cd /usr/local/kafka ./bin/kafka-topics.sh --list --zookeeper 10.1.44.186:2181,10.1.44.187:2181,10.1.44.188:2181 186 187 188 ------------------ ------------------ ------------------ __consumer_offsets __consumer_offsets __consumer_offsets connect-test connect-test connect-test test0320 test0320 test0320
2.创建topic
cd /usr/local/kafka ./bin/kafka-topics.sh --create --zookeeper 10.1.44.186:2181,10.1.44.187:2181,10.1.44.188:2181 --partitions 3 --replication-factor 2 --topic test0326 # 创建后各broker上的物理目录 186 187 188 ---------- ---------- ---------- test0326-1 test0326-1 test0326-1 test0326-2 test0326-2 test0326-2
3.查看指定topic中Leader的信息
cd /usr/local/kafka ./bin/kafka-topics.sh --describe --zookeeper 10.1.44.186:2181,10.1.44.187:2181,10.1.44.188:2181 --topic test0326 Topic: test0326 PartitionCount:3 ReplicationFactor:2 Configs: Topic: test0326 Partition: 0 Leader: 0 Replicas: 0,2 Isr: 0,2 Topic: test0326 Partition: 1 Leader: 1 Replicas: 1,0 Isr: 1,0 Topic: test0326 Partition: 2 Leader: 2 Replicas: 2,1 Isr: 2,1
原文地址:http://blog.51cto.com/13634837/2091072