1、檢視topic列表
##需要--zookeeper引數列出zk集群
./kafka-topics.sh --list --zookeeper 192.168.1.100:2181,192.168.1.100:2182,192.168.1.100:2183
2、檢視topic詳情
##--topic引數指定topic
./kafka-topics.sh --describe --zookeeper 192.168.1.100:2181,192.168.1.100:2182,192.168.1.100:2183 --topic kafka-test
3、新建topic
##--replication-factor指定副本數,--partition指定分割槽數
./kafka-topics.sh --create --zookeeper 192.168.1.100:2181,192.168.1.100:2182,192.168.1.100:2183 --replication-factor 2 --partition 4 --topic kafka-test
##--replica-assignment直接在broker指定分割槽、副本,1714543等是brokerid,此配置表示新建3分割槽、2副本,並且前面的副本為leader
./kafka-topics.sh --create --zookeeper 192.168.1.100:2181,192.168.1.100:2182,192.168.1.100:2183 --replica-assignment 1714543:1714544,1714544:1714543,1714543:1714544 --topic kafka-test
kafka常用命令
kafka常用操作命令 l檢視當前伺服器中的所有topic bin kafka topics.sh list zookeeper hadoop02 2181 l建立topic kafka topics.sh create zookeeper hadoop02 2181 replication fac...
kafka常用命令
啟動集群 nohup bin kafka server start.sh config server.properties 建立topic kafka topics topictt replication factor3 partitions3 create zookeeper hadoop1 21...
Kafka 常用命令
kafka console producer broker list 127.0.0.1 9092 topic mytopic kafka console consumer bootstrap server 127.0.0.1 9092 topic mytopic 建立主題,replication ...