报错背景:
单机安装了kafka,创建完成主题,启动生产者的时候产生报错现象。报错时持续不断打印日志信息。
报错现象:
[2019-05-21 09:43:52,790] WARN [Producer clientId=console-producer] Error while fetching metadata with correlation id 59 : {alarmHis=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient) [2019-05-21 09:43:52,894] WARN [Producer clientId=console-producer] Error while fetching metadata with correlation id 60 : {alarmHis=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient) [2019-05-21 09:43:52,998] WARN [Producer clientId=console-producer] Error while fetching metadata with correlation id 61 : {alarmHis=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient) [2019-05-21 09:43:53,101] WARN [Producer clientId=console-producer] Error while fetching metadata with correlation id 62 : {alarmHis=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient) [2019-05-21 09:43:53,205] WARN [Producer clientId=console-producer] Error while fetching metadata with correlation id 63 : {alarmHis=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient) [2019-05-21 09:43:53,310] WARN [Producer clientId=console-producer] Error while fetching metadata with correlation id 64 : {alarmHis=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient) [2019-05-21 09:43:53,414] WARN [Producer clientId=console-producer] Error while fetching metadata with correlation id 65 : {alarmHis=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient) [2019-05-21 09:43:53,519] WARN [Producer clientId=console-producer] Error while fetching metadata with correlation id 66 : {alarmHis=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient) [2019-05-21 09:43:53,623] WARN [Producer clientId=console-producer] Error while fetching metadata with correlation id 67 : {alarmHis=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
报错原因:
获取相关ID为xx的元数据时出错。
报错解决:
1.进入到kafka的安装目录下的配置文件目录
cd /opt/kafka/config
2.打开server.properties配置文件
vim server.properties
3.修改文件内容
4.重启kafka服务,启动生产者验证。