当生产数据的时候,报错如下:提示没有可用的kafka 主节点
root@ubuntu-130:/opt/kafka_2.11-0.11.0.2/bin# ./kafka-console-producer.sh --broker-list 192.168.13.130:9092 --topic testtopic
>hello
[2019-07-14 23:42:47,318] WARN Error while fetching metadata with correlation id 1 : {testtopic=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
[2019-07-14 23:42:47,512] WARN Error while fetching metadata with correlation id 3 : {testtopic=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
[2019-07-14 23:42:47,631] WARN Error while fetching metadata with correlation id 4 : {testtopic=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
[2019-07-14 23:42:47,790] WARN Error while fetching metadata with correlation id 5 : {testtopic=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
[2019-07-14 23:42:48,228] WARN Error while fetching metadata with correlation id 6 : {testtopic=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
[2019-07-14 23:42:48,365] WARN Error while fetching metadata with correlation id 7 : {testtopic=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
[2019-07-14 23:42:48,496] WARN Error while fetching metadata with correlation id 8 : {testtopic=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
[2019-07-14 23:42:48,635] WARN Error while fetching metadata with correlation id 9 : {testtopic=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
[2019-07-14 23:42:48,777] WARN Error while fetching metadata with correlation id 10 : {testtopic=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
[2019-07-14 23:42:48,916] WARN Error while fetching metadata with correlation id 11 : {testtopic=LEADER_NOT
临时解决思路:
重新创建kafka节点id,重启kafka
修改server.properties文件,修改节点
root@ubuntu-130:/opt/zookeeper/zookeeper-3.4.8/bin# cd /opt/kafka_2.11-0.11.0.2/config/
root@ubuntu-130:/opt/kafka_2.11-0.11.0.2/config# vim server.properties
root@ubuntu-130:/opt/kafka_2.11-0.11.0.2/config#
# The id of the broker. This must be set to a unique integer for each broker.
broker.id=1000
并删除logs下的所有文件解决
重启后解决
./kafka-server-start.sh ../config/server.properties