1、当kafka接收数据时会出现如下警告:
2020-04-27 12:27:39,258 (kafka-coordinator-heartbeat-thread | flume) [WARN - org.apache.kafka.clients.NetworkClient$DefaultMetadataUpdater.handleCompletedMetadataResponse(NetworkClient.java:961)] [Consumer clientId=consumer-1, groupId=flume] 7 partitions have leader brokers without a matching listener, including [history_topic_20200420-0, history_topic_20200420-5, history_topic_20200420-8, history_topic_20200420-2, history_topic_20200420-9, history_topic_20200420-6, history_topic_20200420-3]
2020-04-27 12:27:39,420 (PollableSourceRunner-KafkaSource-s1) [WARN - org.apache.kafka.clients.NetworkClient$DefaultMetadataUpdater.handleCompletedMetadataResponse(NetworkClient.java:961)] [Consumer clientId=consumer-1, groupId=flume] 7 partitions have leader brokers without a matching listener, including [history_topic_20200420-0, history_topic_20200420-5, history_topic_20200420-8, history_topic_20200420-2, history_topic_20200420-9, history_topic_20200420-6, history_topic_20200420-3]
2020-04-27 12:27:39,922 (PollableSourceRunner-KafkaSource-s1) [WARN - org.apache.kafka.clients.NetworkClient$DefaultMetadataUpdater.handleCompletedMetadataResponse(NetworkClient.java:961)] [Consumer clientId=consumer-1, groupId=flume] 7 partitions have leader brokers without a matching listener, including [history_topic_20200420-0, history_topic_20200420-5, history_topic_20200420-8, history_topic_20200420-2, history_topic_20200420-9, history_topic_20200420-6, history_topic_20200420-3]
2020-04-27 12:27:40,623 (kafka-coordinator-heartbeat-thread | flume) [WARN - org.apache.kafka.clients.NetworkClient$DefaultMetadataUpdater.handleCompletedMetadataResponse(NetworkClient.java:961)] [Consumer clientId=consumer-1, groupId=flume] 7 partitions have leader brokers without a matching listener, including [history_topic_20200420-0, history_topic_20200420-5, history_topic_20200420-8, history_topic_20200420-2, history_topic_20200420-9, history_topic_20200420-6, history_topic_20200420-3]
2020-04-27 12:27:40,825 (kafka-coordinator-heartbeat-thread | flume) [WARN - org.apache.kafka.clients.NetworkClient$DefaultMetadataUpdater.handleCompletedMetadataResponse(NetworkClient.java:961)] [Consumer clientId=consumer-1, groupId=flume] 7 partitions have leader brokers without a matching listener, including [history_topic_20200420-0, history_topic_20200420-5, history_topic_20200420-8, history_topic_20200420-2, history_topic_20200420-9, history_topic_20200420-6, history_topic_20200420-3]
2020-04-27 12:27:41,026 (kafka-coordinator-heartbeat-thread | flume) [WARN - org.apache.kafka.clients.NetworkClient$DefaultMetadataUpdater.handleCompletedMetadataResponse(NetworkClient.java:961)] [Consumer clientId=consumer-1, groupId=flume] 7 partitions have leader brokers without a matching listener, including [history_topic_20200420-0, history_topic_20200420-5, history_topic_20200420-8, history_topic_20200420-2, history_topic_20200420-9, history_topic_20200420-6, history_topic_20200420-3]
2020-04-27 12:27:41,228 (kafka-coordinator-heartbeat-thread | flume) [WARN - org.apache.kafka.clients.NetworkClient$DefaultMetadataUpdater.handleCompletedMetadataResponse(NetworkClient.java:961)] [Consumer clientId=consumer-1, groupId=flume] 7 partitions have leader brokers without a matching listener, including [history_topic_20200420-0, history_topic_20200420-5, history_topic_20200420-8, history_topic_20200420-2, history_topic_20200420-9, history_topic_20200420-6, history_topic_20200420-3]
2020-04-27 12:27:41,429 (kafka-coordinator-heartbeat-thread | flume) [WARN - org.apache.kafka.clients.NetworkClient$DefaultMetadataUpdater.handleCompletedMetadataResponse(NetworkClient.java:961)] [Consumer clientId=consumer-1, groupId=flume] 7 partitions have leader brokers without a matching listener, including [history_topic_20200420-0, history_topic_20200420-5, history_topic_20200420-8, history_topic_20200420-2, history_topic_20200420-9, history_topic_20200420-6, history_topic_20200420-3]
2020-04-27 12:27:41,631 (kafka-coordinator-heartbeat-thread | flume) [WARN - org.apache.kafka.clients.NetworkClient$DefaultMetadataUpdater.handleCompletedMetadataResponse(NetworkClient.java:961)] [Consumer clientId=consumer-1, groupId=flume] 7 partitions have leader brokers without a matching listener, including [history_topic_20200420-0, history_topic_20200420-5, history_topic_20200420-8, history_topic_20200420-2, history_topic_20200420-9, history_topic_20200420-6, history_topic_20200420-3]
2020-04-27 12:27:41,833 (kafka-coordinator-heartbeat-thread | flume) [WARN - org.apache.kafka.clients.NetworkClient$DefaultMetadataUpdater.handleCompletedMetadataResponse(NetworkClient.java:961)] [Consumer clientId=consumer-1, groupId=flume] 7 partitions have leader brokers without a matching listener, including [history_topic_20200420-0, history_topic_20200420-5, history_topic_20200420-8, history_topic_20200420-2, history_topic_20200420-9, history_topic_20200420-6, history_topic_20200420-3]
2020-04-27 12:27:42,034 (kafka-coordinator-heartbeat-thread | flume) [WARN - org.apache.kafka.clients.NetworkClient$DefaultMetadataUpdater.handleCompletedMetadataResponse(NetworkClient.java:961)] [Consumer clientId=consumer-1, groupId=flume] 7 partitions have leader brokers without a matching listener, including [history_topic_20200420-0, history_topic_20200420-5, history_topic_20200420-8, history_topic_20200420-2, history_topic_20200420-9, history_topic_20200420-6, history_topic_20200420-3]
2020-04-27 12:27:42,235 (kafka-coordinator-heartbeat-thread | flume) [WARN - org.apache.kafka.clients.NetworkClient$DefaultMetadataUpdater.handleCompletedMetadataResponse(NetworkClient.java:961)] [Consumer clientId=consumer-1, groupId=flume] 7 partitions have leader brokers without a matching listener, including [history_topic_20200420-0, history_topic_20200420-5, history_topic_20200420-8, history_topic_20200420-2, history_topic_20200420-9, history_topic_20200420-6, history_topic_20200420-3]
2020-04-27 12:27:42,437 (kafka-coordinator-heartbeat-thread | flume) [WARN - org.apache.kafka.clients.NetworkClient$DefaultMetadataUpdater.handleCompletedMetadataResponse(NetworkClient.java:961)] [Consumer clientId=consumer-1, groupId=flume] 7 partitions have leader brokers without a matching listener, including [history_topic_20200420-0, history_topic_20200420-5, history_topic_20200420-8, history_topic_20200420-2, history_topic_20200420-9, history_topic_20200420-6, history_topic_20200420-3]
如下图所示:
2、出现此问题是kafka的server.properties没有配置listeners = PLAINTEXT://your.host.name:9092。在配置集群的时候,必须设置,不然以后的操作会报找不到leader的错误 ,集群中的每个节点都必须配置,如下图所示:
3、然后重启kafka即可。