kafka Create topic 報錯

bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic kk_log
報錯如下:
WARN [Consumer clientId=consumer-1, groupId=console-consumer-507] Connection to node -1 could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)

配置server.confg時候設置的
advertised.listeners=PLAINTEXT://10.171.222.26:9092
此時需要用配置的IP而非localhost地址:

nohup bin/zookeeper-server-start.sh config/zookeeper.properties > /dev/null 2>&1 &
nohup bin/kafka-server-start.sh config/server.properties > /dev/null 2>&1 &
netstat -ntpl|egrep "(2181|9092)"
運行起來再試試
bin/kafka-console-consumer.sh --bootstrap-server 10.171.222.26:9092 --topic kk_log
應該就可以了。
做個小筆記。

PS zookeeper 報錯,宕掉;

[2016-06-27 12:07:14,065] INFO Closed socket connection for client /127.0.0.1:58824 (no session established for client) (org.apache.zookeeper.server.NIOServerCnxn) [2016-
[2016-06-27 12:07:17,351] INFO Refusing session request for client /127.0.0.1:58834 as it has seen zxid 0xd820 our last zxid is 0x20 client must try another server (org.apache.zookeeper.server.ZooKeeperServer)
[2016-06-27 12:07:17,351] INFO Closed socket connection for client /127.0.0.1:58834 (no session established for client) (org.apache.zookeeper.server.NIOServerCnxn)
[2016-06-27 12:07:19,048] INFO Accepted socket connection from /127.0.0.1:58840 (org.apache.zookeeper.server.NIOServerCnxnFactory)
[2016-06-27 12:07:19,048] INFO Refusing session request for client /127.0.0.1:58840 as it has seen zxid 0xd820 our last zxid is 0x20 client must try another server (org.apache.zookeeper.server.ZooKeeperServer)

解決方法

報錯原因:服務器上還有應用在不停的向zookeeper發送請求

解決方法:
          用top -u [username]查看該用戶下的所有進程,發現多了一個java進程在運行着;
         1、kill掉與java相關的進程;

          2、關閉zookeeper,刪除zoo.cfg中的dataDir配置的文件夾;

          3、重啓zookeeper。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章