Created 05-17-2018 05:13 AM
hi all
any suggestion why we cant get the prompt ?
/usr/hdp/2.6.0.3-8/kafka/bin/zookeeper-shell.sh localhost:2181 Connecting to localhost:2181 Welcome to ZooKeeper! JLine support is disabled WATCHER:: WatchedEvent state:SyncConnected type:None path:null
Created 05-17-2018 05:27 AM
I tried like this and it worked:
# /usr/hdp/current/kafka-broker/bin/zookeeper-shell.sh localhost:2181 get / Connecting to localhost:2181 WATCHER:: WatchedEvent state:SyncConnected type:None path:null cZxid = 0x0 ctime = Thu Jan 01 00:00:00 UTC 1970 mZxid = 0x0 mtime = Thu Jan 01 00:00:00 UTC 1970 pZxid = 0x80009e5f1 cversion = 37 dataVersion = 0 aclVersion = 0 ephemeralOwner = 0x0 dataLength = 0 numChildren = 19
.
Created 05-17-2018 05:29 AM
I see the error in your command:
WatchedEvent state:SyncConnected type:None path:null
.
This is because you have not defined the "cmd" (like get , set) and "args" (like Path)
Created 05-21-2018 08:01 AM
dear Jay
actually I was asking about how to get the zookeeper session as the following,
/usr/hdp/2.6.0.3-8/zookeeper/bin/zkCli.sh -server master02:2181
remark zookeeper client installed on the master machine
and that give me the session
WATCHER:: WatchedEvent state:SyncConnected type:None path:null [zk: master02:2181(CONNECTED) 0]
Created 01-21-2020 11:50 PM
Try this command "zookeeper-client"
[hdfs@servername ~]$ zookeeper-client
Connecting to localhost:2181
log4j:WARN No appenders could be found for logger (org.apache.zookeeper.ZooKeeper).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Welcome to ZooKeeper!
JLine support is enabled
WATCHER::
WatchedEvent state:SyncConnected type:None path:null
[zk: localhost:2181(CONNECTED) 0]
Created 01-22-2020 12:21 AM
Created 01-22-2020 06:06 AM
SHORT
Cloudera has broken zookeeper 3.4.5-cdh5.4.0 in several places. Service is working but CLI is dead. No workaround other than rollback.
LONG
Assign a bounty on this ;-). I have stepped on this mine too and was angry enough to find the reason:
Zookeeper checks JLine during ZooKeeperMain.run(). There is a try-catch block that loads a number of classes. Any exception during class loading fails the whole block and JLine support is reported to be disabled.
But here is why this happens with CDH 5.4.0:
Current opensource Zookeeper-3.4.6 works against jline-0.9.94. Has no such issue.
In CDH 5.4 Cloudera has applied the following patch:
roman@node4:$ diff zookeeper-3.4.5-cdh5.3.3/src/java/main/org/apache/zookeeper/ZooKeeperMain.java zookeeper-3.4.5-cdh5.4.0/src/java/main/org/apache/zookeeper/ZooKeeperMain.java 305,306c305,306 < Class consoleC = Class.forName("jline.ConsoleReader"); < Class completorC = --- > Class consoleC = Class.forName("jline.ConsoleReader"); > Class completorC = 316,317c316,317 < Method addCompletor = consoleC.getMethod("addCompletor", < Class.forName("jline.Completor")); --- > Method addCompletor = consoleC.getMethod("addCompleter", > Class.forName("jline.console.completer.Completer"));
CDH 5.4 uses jline-2.11.jar for ZooKeeper and it has no jline.ConsoleReader class (from 2.11 it is jline.console.ConsoleReader).
Jline 0.9.94 in turn has no jline.console.completer.Completer.
So there is incompatibility with any existing JLine. Any Cloudera CDH 5.4 user can run zookeeper-client on his/her cluster and find it does not work.
Open-source zookeeper-3.4.6 depends on jline-0.9.94 which has no such patches. Don't know why Cloudera engineers have done such a mine.
I see no clean way to fix it with 3.4.5-cdh5.4.0. I stayed with 3.4.5-cdh5.3.3 dependency where I need CLI and have production clusters.
But here is the code from ZooKeeperMain.java
Class<?> completorC = Class.forName("org.apache.zookeeper.JLineZNodeCompletor");
And of course, it means practically it is not possible to start ZK CLI in CDH 5.4.0 proper way. Awful work. 😞