sgroschupf / zkclient

a zookeeper client, that makes life a little easier.
www.datameer.com
Apache License 2.0
1.08k stars 491 forks source link

Unable to connect to zookeeper server #81

Closed GavinAlison closed 5 years ago

GavinAlison commented 5 years ago

Unable to connect to zookeeper server , Env:

      centos 7
      zookeeper 3.5.5
      windows 10

operation:

     zookeeper 3.5.5 is running on centos 7

code

ZkClient zkClient = new ZkClient("192.168.56.101:2181", 10000);
        System.out.println("ZooKeeper session established.");
        System.out.println(zkClient);

Error:

Exception in thread "main" org.I0Itec.zkclient.exception.ZkTimeoutException: Unable to connect to zookeeper server within timeout: 15000
    at org.I0Itec.zkclient.ZkClient.connect(ZkClient.java:876)
    at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:98)
    at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:92)
    at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:76)
    at com.alison.zkjavaapi.zkClient.Create_Session.main(Create_Session.java:15)