報(bào)錯(cuò)內(nèi)容
╭─root@esxi-kali /usr/share/zookeeper/bin
╰─? ./zkCli.sh
Connecting to localhost:2181
Welcome to ZooKeeper!
JLine support is enabled
[zk: localhost:2181(CONNECTING) 0] ls /
Exception in thread "main" org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /
at org.apache.zookeeper.KeeperException.create(KeeperException.java:102)
at org.apache.zookeeper.KeeperException.create(KeeperException.java:54)
at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1541)
at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1569)
at org.apache.zookeeper.ZooKeeperMain.processZKCmd(ZooKeeperMain.java:732)
at org.apache.zookeeper.ZooKeeperMain.processCmd(ZooKeeperMain.java:600)
at org.apache.zookeeper.ZooKeeperMain.executeLine(ZooKeeperMain.java:372)
at org.apache.zookeeper.ZooKeeperMain.run(ZooKeeperMain.java:332)
at org.apache.zookeeper.ZooKeeperMain.main(ZooKeeperMain.java:291)
此時(shí)使用的JAVA版本
╭─root@esxi-kali /usr/share/zookeeper/bin
╰─? java -version 1 ?
java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)
解決方法
修改zkEnv.sh文件中JAVA路徑液兽,使用openjdk
JAVA=/usr/lib/jvm/java-11-openjdk-amd64/bin/java
openjdk的JAVA版本
╭─root@esxi-kali /usr/share/zookeeper/bin
╰─? /usr/lib/jvm/java-11-openjdk-amd64/bin/java -version
openjdk version "11.0.3" 2019-04-16
OpenJDK Runtime Environment (build 11.0.3+1-Debian-1)
OpenJDK 64-Bit Server VM (build 11.0.3+1-Debian-1, mixed mode, sharing)
修改后不再報(bào)錯(cuò)
╭─root@esxi-kali /usr/share/zookeeper/bin
╰─? ./zkCli.sh -server 192.168.137.200 ls / 130 ?
Connecting to 192.168.137.200
WATCHER::
WatchedEvent state:SyncConnected type:None path:null
[zookeeper]