报错背景:
新安装的单机版kafka启动消费者的时候报错!
报错现象:
[2020-05-19 22:08:04,053] WARN [Consumer clientId=consumer-console-consumer-36457-1, groupId=console-consumer-36457] Bootstrap broker basecoalmine:2181 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient) [2020-05-19 22:08:04,990] WARN [Consumer clientId=consumer-console-consumer-36457-1, groupId=console-consumer-36457] Bootstrap broker basecoalmine:2181 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient) [2020-05-19 22:08:06,086] WARN [Consumer clientId=consumer-console-consumer-36457-1, groupId=console-consumer-36457] Bootstrap broker basecoalmine:2181 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient)
报错原因:
端口号的问题,以前启动消费者的时候监听的端口是 2181,但是新版本的kafka对zookeeper的依赖没有那么强烈了,所以改成了自己的 9092。
kafka-console-consumer.sh --bootstrap-server basecoalmine:2181 --topic test --from-beginning
报错解决:
修改端口号
kafka-console-consumer.sh --bootstrap-server basecoalmine:9092 --topic test --from-beginning