kafka启动
bin/kafka-server-start.sh config/server.properties
生产者启动
bin/kafka-console-producer.sh --broker-list localhost:20882 --topic test
消费者启动
bin/kafka-console-consumer.sh --zookeeper localhost:48890 --topic test --from-beginning
创建topic
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 3 --partitions 3 --topic test
删除topic
bin/kafka-topics.sh --zookeeper localhost:48889 --delete --topic topic_name
topic列表
bin/kafka-topics.sh --list --zookeeper localhost:48889
topic状态(列出分区、副本、Isr参数)
bin/kafka-topics.sh --zookeeper localhost:48889 --describe --topic topic_name
生产者吞吐量测试
bin/kafka-producer-perf-test.sh --topic test-topic --num-records 500000 --record-size 200 --throughput -1 --producer-props bootstrap.servers=kafka1:9092,kafka2:9093,kafka3:9094 acks=-1
消费者吞吐量测试
bin/kafka-consumer-perf-test.sh --topic test-topic --broker-list kafka1:9092,kafka2:9093,kafka3:9094 --message-size 200 --messages 500000 --topic test-topic