kafka指令

后台形式启动kafka

  ./bin/kafka-server-start.sh -daemon /usr/local/kafka/config/server.properties

查询当前所有 topic 

   ./bin/kafka-topics.sh --list --zookeeper localhost:2181

转载:

https://www.orchome.com/454

问题汇总:

1.

在做kafka测试的时候,使用命令bin/kafka-console-consumer.sh --zookeeper 192.168.0.140:2181,192.168.0.141:2181 --topic test --from-beginning启动消费者,发现一只报错consumer zookeeper is not a recognized option,搜索了半天,一只没有解决,最后,换了一个低版本的kakfa,发现在启动的时候说使用 --zookeeper是一个过时的方法,此时,才知道原来在最新的版本中,这种启动方式已经被删除了,
最后附上0.90版本之后启动消费者的方法: bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning
2.
 WARN [Consumer clientId=consumer-1, groupId=console-consumer-77498] Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
说明broker挂掉了,在zookeeper上可以查看当前运行的broker数量
在zkCli.sh打开命令行后,ls /brokers/ids查看当前运行的broker数量
为什么会发生这个问题,因为meta.properties(在tmp或者logs目录下)跟service.properties(在config目录下)中的brokerid不一致造成的。
扫描二维码关注公众号,回复: 8087073 查看本文章

猜你喜欢

转载自www.cnblogs.com/decq/p/11992751.html