bin/zookeeper-server-start.sh -daemon config/zookeeper.properties
shell
bin/kafka-server-start.sh -daemon config/server.properties
日誌
bin/zookeeper-server-stop.sh
code
bin/kafka-server-stop.sh
server
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
blog
bin/kafka-topics.sh --delete --topic test --zookeeper localhost:2181
kafka
bin/kafka-topics.sh --list --zookeeper localhost:2181
同步
bin/kafka-topics.sh --describe --zookeeper localhost:2181 --topic test
it
說明:io
「Leader」: 是負責給定分區的全部讀取和寫入的節點。 每一個節點將成爲分區隨機選擇部分的領導者。如上面表示節點0爲test的leaderconsole
「Replicas」: 是複製此分區日誌的節點列表,不管它們是不是領導者,或者即便他們當前處於活動狀態。如上面表示當前總共只有一個節點0
「Isr」: 是一組「同步」副本。這是複製品列表的子集,當前活着並被引導到領導者。
指明當前數據要流向哪一個broker,以及哪一個topic
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test`
--from-beginning表示從頭開始讀取全部數據
bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic test --from-beginning`
bin/zookeeper-shell.sh localhost:2181
ls /brokers/ids