zookeeper
bin目录下执行
启动:./zkServer.sh start
停止:./zkServer.sh stop
重启:./zkServer.sh restart
状态:./zkServer.sh status
kafka
bin目录下执行
启动:./kafka-server-start.sh -daemon …/config/server.properties &
停止:./kafka-server-stop.sh
创建topic:./kafka-topics.sh --create --topic topicname --replication-factor 1 --partitions 1 --bootstrap-server localhost:9092
删除opic: ./kafka-topics.sh --delete --topic topicname --bootstrap-server localhost:9092
查看topic:./kafka-topics.sh --list --bootstrap-server localhost:9092
踩坑:查看topic时报错 ERROR org.apache.kafka.common.errors.TimeoutException: Timed out waiting for a node assignment. Call: listTopics
(kafka.admin.TopicCommand$)
解决办法:命令的ip地址换成localhost