首先要打开zookeeper,其次打开kafka,关闭时要先关闭kafka再关闭zookeeper
启动zookeeper
zookeeper-server-start.sh config/zookeeper.properties
启动kafka
kafka-server-start.sh config/server.properties
停止kafka
kafka-server-stop.sh
停止zookeeper
zookeeper-server-stop.sh
创建topic
kafka-topics.sh --create --zookeeper 192.168.228.13:2181 --replication-factor 1 --partitions 1 --topic test
展示topic
kafka-topics.sh --list --zookeeper 192.168.228.13:2181
描述topic
kafka-topics.sh --describe --zookeeper 192.168.228.13:2181 --topic test
生产者:
kafka-console-producer.sh --broker-list 192.168.228.13:9092 --topic test
消费者:
kafka-console-consumer.sh --zookeeper 192.168.228.13:2181 --topic test --from-beginning
192.168.228.13:2181:表示我节点ip
test:创建的topic名称
分别在不同的