11:57:24 [org.springframework.kafka.KafkaListenerEndpointContainer#0-0-C-1] WARN o.apache.kafka.clients.NetworkClient - [Consumer clientId=consumer-2, groupId=jiatian_api] 3 partitions have leader……
错误如下:
11:57:24 [org.springframework.kafka.KafkaListenerEndpointContainer#0-0-C-1] WARN o.apache.kafka.clients.NetworkClient - [Consumer clientId=consumer-2, groupId=test_api] 3 partitions have leader brokers without a matching listener, including [test_topic_order-0, test_topic_goods-0, test_topic_refund-0]
11:57:24 [org.springframework.kafka.KafkaListenerEndpointContainer#0-0-C-1] WARN o.apache.kafka.clients.NetworkClient - [Consumer clientId=consumer-2, groupId=test_api] 3 partitions have leader brokers without a matching listener, including [test_topic_order-0, test_topic_goods-0, test_topic_refund-0]
11:57:25 [org.springframework.kafka.KafkaListenerEndpointContainer#0-0-C-1] WARN o.apache.kafka.clients.NetworkClient - [Consumer clientId=consumer-2, groupId=test_api] 3 partitions have leader brokers without a matching listener, including [test_topic_order-0, test_topic_goods-0, test_topic_refund-0]
用tail命令查看会发现日志在不停的刷上面内容,开始排查问题,最后定位在配置文件server.properties里面,通过网上一些文章,尝试了一下
第一个:
把192.168.2.9改成localhost
试了之后,依然报错:
11:57:00 [org.springframework.kafka.KafkaListenerEndpointContainer#0-0-C-1] WARN o.apache.kafka.clients.NetworkClient - [Consumer clientId=consumer-2, groupId=test_api] Connection to node 0 could not be established. Broker may not be available.
11:57:01 [org.springframework.kafka.KafkaListenerEndpointContainer#0-0-C-1] WARN o.apache.kafka.clients.NetworkClient - [Consumer clientId=consumer-2, groupId=test_api] Connection to node 0 could not be established. Broker may not be available.
11:57:02 [org.springframework.kafka.KafkaListenerEndpointContainer#0-0-C-1] WARN o.apache.kafka.clients.NetworkClient - [Consumer clientId=consumer-2, groupId=test_api] Connection to node 0 could not be established. Broker may not be available.
11:57:04 [org.springframework.kafka.KafkaListenerEndpointContainer#0-0-C-1] WARN o.apache.kafka.clients.NetworkClient - [Consumer clientId=consumer-2, groupId=test_api] Connection to node 0 could not be established. Broker may not be available.
11:57:05 [org.springframework.kafka.KafkaListenerEndpointContainer#0-0-C-1] WARN o.apache.kafka.clients.NetworkClient - [Consumer clientId=consumer-2, groupId=test_api] Connection to node 0 could not be established. Broker may not be available.
会发现报错改变了,看来这么改不对,回头想了下,首先排除ip和端口问题,然后想到会不会是参数哪里有问题,于是
参数 |
默认值 |
描述 |
broker.id |
-1 |
每一个boker都有一个唯一的id作为它们的名字。当该服务器的IP地址发生改变时,broker.id没有变化,则不会影响consumers的消息情况 |
num.network.threads |
3 |
broker处理消息的最大线程数,一般情况下数量为cpu核数 |
num.io.threads |
8 |
处理IO的线程数 |
num.partitions |
1 |
默认分区数 |
发现参数也没什么问题,接着往下看配置文件,看了下zookeeper连接,通过ps和netstat命令查到本机上有一个单台和一个由三台组成的zookeeper集群
更改了一下zookeeper,发现日志刷新错误变了,发现需要重启服务,然后重新启动后日志恢复正常