kafka經常使用命令

1.啓動zookeepercode

bin/zookeeper-server-start.sh config/zookeeper.properties

2.啓動kafkaserver

bin/kafka-server-start.sh config/server.properties

3.建立topickafka

bin/kafka-topics.sh \
    --create \
    --zookeeper localhost:2181 \
    --replication-factor 1 \
    --partitions 1 \
    --topic gang_gang_topic

4.查看全部topicit

bin/kafka-topics.sh \
    --list \
    --zookeeper localhost:2181

5.啓動生產者io

bin/kafka-console-producer.sh \
    --broker-list localhost:9092 \
    --topic gang_gang_topic

6.啓動消費者console

bin/kafka-console-consumer.sh \
    --zookeeper localhost:2181 \
    --topic gang_gang_topic

7.partitiontest

bin/kafka-topics.sh \
    --zookeeper localhost:2181 \
    --alter \
    --topic gang_gang_topic \
    --partitions 3

8.testzookeeper

bin/kafka-producer-perf-test.sh \
    --producer.config config/producer-test.properties \
    --topic gnus-test \
    --throughput 2000000 \
    --num-records 6000000 \
    --payload-file message.txt

bin/kafka-producer-perf-test.sh 
    --producer.config config/producer-test2.properties \
    --topic gnus-test \
    --throughput 2000000 \
    --num-records 6000000 \
    --payload-file message.txt
相關文章
相關標籤/搜索