The zookeeper client does not provide the CLI with a “jline support is disabled” message
I just started CDH 5.4
and installed zookeeper. I have successfully used zkCli many times before. This time the command line start stops before entering the prompt
Welcome to ZooKeeper!
JLine support is disabled
2015-05-04 18:18:33,936 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@975] - Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
2015-05-04 18:18:33,952 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@852] - Socket connection established to localhost/127.0.0.1:2181, initiating session
2015-05-04 18:18:33,985 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@1235] - Session establishment complete on server localhost/127.0.0.1:2181, sessionid = 0x34d12349d0a15cf, negotiated timeout = 30000
WATCHER::
WatchedEvent state:SyncConnected type:None path:null
I know the usual printout is
Enable JLine support
Is this the reason for the stuck? I don’t see any way to change this Cloudera Manager configuration page.
Solution
Disclaimer: Please note that the answer is from 2015. It may no longer be relevant, but it may serve historical purposes and shed light on similar “modern” cases.
Brief
Cloudera corrupted zookeeper 3.4.5-cdh5.4.0
in multiple places. The service is running, but the CLI is dead. There is no workaround other than rolling back.
Long
Allocate a bounty for this ;-). I have also stepped on this mine and am so angry that I find the reason:
Zookeeper checks JLine
during ZooKeeperMain.run().
There are try-catch blocks to load the number of classes. Any exception during class loading causes the entire block to fail and reports that JLine support has been disabled.
But that’s why this happened with CDH 5.4.0
:
The current open source
Zookeeper-3.4.6
works withjline-0.9.94.
There is no such problem.The following patch was applied in
CDH 5.4
Cloudera:
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 nojline. ConsoleReader
class (from2.11
it isjline.console.ConsoleReader
).Jline 0.9.94
in turn has nojline.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.
- It seemed to me both
jline-0.9.94.jar
andjline.2.11.jar
in classpath for zookeeper will fix the problem. But just have found Cloudera made another ‘fix’ in ZK for CDH 5.4.0, they have renamedorg.apache.zookeeper.JLineZNodeCompletor
class toorg.apache.zookeeper.JLineZNodeCompleter
.
But here is the code from ZooKeeperMain.java
Class<?> completorC = Class.forName("org.apache.zookeeper.JLineZNodeCompletor");
Of course, this means that it is practically impossible to start the ZK CLI in CDH 5.4.0 the right way. Bad job. 🙁