报错zookeeper is not a recognized option

[root@localhost bin]# ./kafka-console-consumer.sh --zookeeper localhost:2181 --from-beginning --topic userlog
zookeeper is not a recognized option
Option                                   Description                            
------                                   -----------                            

原因为: 当前使用的 创建消费者命令 与 安装的kafka版本不一致,因为kafka在0.9版本之后,使用创建的kafka 消费者命令已经变了
应该将上面的命令变为下面的命令进行运行
--zookeeper修改为--bootstrap-server

报错[2022-01-20 20:24:10,506] WARN [Consumer clientId=consumer-console-consumer-23606-1, groupId=console-consumer-23606] Bootstrap broker localhost:2181 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient)

[root@localhost bin]# ./kafka-console-consumer.sh --bootstrap-server localhost:2181 --from-beginning --topic userlog
[2022-01-20 20:24:10,415] WARN [Consumer clientId=consumer-console-consumer-23606-1, groupId=console-consumer-23606] Bootstrap broker localhost:2181 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient)
[2022-01-20 20:24:10,506] WARN [Consumer clientId=consumer-console-consumer-23606-1, groupId=console-consumer-23606] Bootstrap broker localhost:2181 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient)

新版本不适用端口2181,而是9092
应该修改为下面的命令

[root@localhost bin]# ./kafka-console-consumer.sh --bootstrap-server localhost:9092 --from-beginning --topic userlog
Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐