报错信息
在终端执行kafka发送、消费消息遇到如下错误
Error while fetching metadata with correlation id 2 : {abc123=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient
处理步骤
1 修改server.properties
/usr/local/etc/kafka/server.properties
2 ps -ef | grep kafka
kill -9 kafka的pid
3 ps -ef | grep zookeeper
kill -9 zookeeper的pid
4 启动 zookeeper
进入kafka安装目录( /usr/local/Cellar/kafka/2.4.1)
./bin/zookeeper-server-start /usr/local/etc/kafka/zookeeper.properties
5 启动kafka
进入kafka安装目录( /usr/local/Cellar/kafka/2.4.1)
./bin/kafka-server-start /usr/local/etc/kafka/server.properties
6、验证
- 发送消息
./bin/kafka-console-producer --broker-list localhost:9092 --topic abc123
结果
>hehe
>haha
>gan
>
- 消费消息
./bin/kafka-console-consumer --bootstrap-server localhost:9092 --topic abc123 --from-beginning
结果:
hehe
haha
gan