Zookeeper connection error

后端 未结 23 968
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-24 05:41

We have a standalone zookeeper setup on a dev machine. It works fine for every other dev machine except this one testdev machine.

We get this error over and over aga

相关标签:
23条回答
  • 2020-12-24 06:35

    I was able to start with zookeeper and kafka having 2 nodes each. I got the error because i had started zookeeper with ./zkServer.sh instead of the kafka wrapper bin/zookeeper-server-start.sh config/zookeeper.properties

    0 讨论(0)
  • 2020-12-24 06:39

    Also check the local firewall, service firewalld status

    If it's running, just stop it service firewalld stop

    And then give it a try.

    0 讨论(0)
  • 2020-12-24 06:40

    I start standalone instance in my machine, and encounter the same problem. Finally, I change from ip "127.0.0.1" to "localhost" and the problem is gone.

    0 讨论(0)
  • 2020-12-24 06:41

    In my case, I config zoo.cfg like this:

    server.1=host-1:2888:3888
    server.2=host-2:2888:3888
    server.3=host-3:2888:3888
    

    But, in host-1, I config host-1 resolve to 127.0.0.1 in /etc/hosts:

    127.0.0.1   localhost host-1
    

    which may results other hosts can't communicate with it. Resolve host-1 to its real ip solved this problem.

    Hope this can help.

    0 讨论(0)
  • 2020-12-24 06:41

    This is a common issue if the Zookeeper server is not running or no longer running (i.e. it crashed after you started it).

    So first, check that you have the Zookeeper server running. A simple way to check is grep the running processes:

    # ps -ef | grep zookeeper
    

    (run this a couple of times to see if the same process ID is still there. its possible it keep restarting with a new process ID. Alternatively you can use 'systemctl status zookeeper' if your Linux distro support systemd)

    You should see the process running as a java process:

    # ps -ef | grep zookeeper
    root       492     0  0 00:01 pts/1    00:00:00 java -Dzookeeper.log.dir=. -Dzookeeper.root.logger=INFO,CONSOLE -cp /root/zookeeper-3.5.0-alpha/bin/../build/classes:/root/zookeeper-3.5.0-alpha/bin/../build/lib/*.jar:/root/zookeeper-3.5.0-alpha/bin/../lib/slf4j-log4j12-1.7.5.jar:/root/zookeeper-3.5.0-alpha/bin/../lib/slf4j-api-1.7.5.jar:/root/zookeeper-3.5.0-alpha/bin/../lib/servlet-api-2.5-20081211.jar:/root/zookeeper-3.5.0-alpha/bin/../lib/netty-3.7.0.Final.jar:/root/zookeeper-3.5.0-alpha/bin/../lib/log4j-1.2.16.jar:/root/zookeeper-3.5.0-alpha/bin/../lib/jline-2.11.jar:/root/zookeeper-3.5.0-alpha/bin/../lib/jetty-util-6.1.26.jar:/root/zookeeper-3.5.0-alpha/bin/../lib/jetty-6.1.26.jar:/root/zookeeper-3.5.0-alpha/bin/../lib/javacc.jar:/root/zookeeper-3.5.0-alpha/bin/../lib/jackson-mapper-asl-1.9.11.jar:/root/zookeeper-3.5.0-alpha/bin/../lib/jackson-core-asl-1.9.11.jar:/root/zookeeper-3.5.0-alpha/bin/../lib/commons-cli-1.2.jar:/root/zookeeper-3.5.0-alpha/bin/../zookeeper-3.5.0-alpha.jar:/root/zookeeper-3.5.0-alpha/bin/../src/java/lib/*.jar:/root/zookeeper-3.5.0-alpha/bin/../conf: -Xmx1000m -Xmx1000m -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=false org.apache.zookeeper.server.quorum.QuorumPeerMain /root/zookeeper-3.5.0-alpha/bin/../conf/zoo.cfg
    

    If its not there, then there's likely something in the zookeeper log file indicating the issue.

    To find the zookeeper log file, you should first figure out where its configured for logging. In my case I have zookeeper installed under my root directory (not suggesting you install it there):

    [root@centos6_zookeeper conf]# pwd
    /root/zookeeper-3.5.0-alpha/conf
    

    And you can find the log setting in this file:

    [root@centos6_zookeeper conf]# grep "zookeeper.log" log4j.properties 
    zookeeper.log.dir=/var/log
    zookeeper.log.file=zookeeper.log
    zookeeper.log.threshold=INFO
    zookeeper.log.maxfilesize=256MB
    zookeeper.log.maxbackupindex=20
    

    So Zookeeper is configured to log under /var/log.

    Then there's usually a zookeeper.log and/or zookeeper.out file which should indicate your startup error.

    0 讨论(0)
提交回复
热议问题