kafka无法消费

自己动手写了一个kafka消费实例,但是执行时总是报错:

2018-06-19 15:40:24.146 INFO  AbstractCoordinator - [Consumer clientId=consumer-1, groupId=dfp] Marking the coordinator localhost:9092 (id: 2147483647 rack: null) dead
2018-06-19 15:40:25.153 WARN  NetworkClient - [Consumer clientId=consumer-1, groupId=dfp] Connection to node 0 could not be established. Broker may not be available.
2018-06-19 15:40:26.206 WARN  NetworkClient - [Consumer clientId=consumer-1, groupId=dfp] Connection to node 0 could not be established. Broker may not be available.
2018-06-19 15:40:27.311 WARN  NetworkClient - [Consumer clientId=consumer-1, groupId=dfp] Connection to node 0 could not be established. Broker may not be available.
2018-06-19 15:40:28.514 WARN  NetworkClient - [Consumer clientId=consumer-1, groupId=dfp] Connection to node 0 could not be established. Broker may not be available.

在kafka的配置文件server.properties中添加设置如下:

listeners=PLAINTEXT://10.100.1.200:9092

即可解决问题。

推荐阅读更多精彩内容