Zookeeper 报错:Unable to connect to zookeeper server within timeout:6000

Posted by Yancy on 2017-05-04

Zookeeper 报错:Unable to connect to zookeeper server within timeout : 6000

问题:

Exception in thread “main” org.I0Itec.zkclient.exception.ZkTimeoutException: Unable to connect to zookeeper server within timeout: 6000

解决:

I had the same problem and here is how I fixed it:
1) Stop all Kafka and Zookeeper processes

1
2
ps -aux | grep zoo
ps -aux | grep kafka

(then proceed to kill all process ids from above jobs)
2) Run zookeeper

1
<kafka_dir>/bin/zookeeper-server-start.sh ../config/zookeeper.properties

3) Run kafka server

1
<kafka_dir>/bin/kafka-server-start.sh ../config/server.properties

✨✨查看zk配置然后重启服务。

1
2
3
./zookeeper-3.4.6/bin/zkServer.sh start
./zookeeper-3.4.6/bin/zkServer.sh status
./bin/kafka-server-start.sh config/server.properties &

先重启zk后重启kafka 因为kafka基于zk运行的,Zk运行超时。说明连接有问题。查看启动日志。