centos7上查看kafka-常见命令

启动和关闭zookeeper

bin/zookeeper-server-start.sh -daemon config/zookeeper.properties
bin/zookeeper-server-stop.sh 
  • 启动和关闭kafka
bin/kafka-server-start.sh -daemon config/server.properties
bin/kafka-server-stop.sh
  • centos7上查看kafka是否成功启动的命令(显示的有进程号代表成功)
输入:jps

  • 查看kafka topic列表,使用–list参数
bin/kafka-topics.sh --list --zookeeper localhost:2181
bin/kafka-topics.sh --zookeeper 127.0.0.1:2181 --list

  • 查看kafka特定topic的详情,使用–topic与–describe参数
bin/kafka-topics.sh --zookeeper 127.0.0.1:2181 --topic test --describe

  • 创建一个测试的Topic
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
  • 开启生产者
kafka-console-producer.sh --broker-list localhost:9092 --topic test
  • 开启消费者
kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning
  • 删除topic
 ./kafka-topics.sh  --delete --zookeeper localhost:2181 --topic test

 

posted @ 2022-01-18 10:12  南北12345678  阅读(318)  评论(0编辑  收藏  举报