bho*_*ass 10 java hadoop jline cloudera apache-zookeeper
我刚刚起床CDH 5.4并安装了zookeeper.之前我曾多次成功使用过zkCli.这次命令行启动在到达提示符之前停止
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
Run Code Online (Sandbox Code Playgroud)
我知道通常的打印输出是启用了JLine支持
是什么让它陷入困境?我没有看到任何方法来改变这个Cloudera管理器配置页面.
短
Cloudera zookeeper 3.4.5-cdh5.4.0在几个地方都破了.服务正在运行,但CLI已经死了.除了回滚之外没有其他解决方法.
长
在此分配奖金;-).我也踩到了这个矿井,并且很生气地找到了原因:
Zookeeper检查JLine期间ZooKeeperMain.run().有try-catch块可以加载多个类.类加载期间的任何异常都会导致整个块失败,并且报告JLine支持被禁用.
但这就是为什么会发生这种情况CDH 5.4.0:
当前的开源是Zookeeper-3.4.6有效的jline-0.9.94.没有这样的问题.
在CDH 5.4Cloudera中应用了以下补丁:
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 jline-2.11.jar用于ZooKeeper,它没有jline.ConsoleReader类(来自2.11它jline.console.ConsoleReader).
Jline 0.9.94反过来没有jline.console.completer.Completer.
因此,与任何现有的JLine都不兼容.任何Cloudera CDH 5.4用户都可以zookeeper-client在他/她的群集上运行并发现它不起作用.
开源zookeeper-3.4.6取决于jline-0.9.94哪个没有patches.不知道为什么Cloudera工程师做了这样的矿井.
我认为没有干净的方法来修复它3.4.5-cdh5.4.0.我3.4.5-cdh5.3.3依赖于我需要CLI并拥有生产集群.
jline-0.9.94.jar并jline.2.11.jar在类路径中的动物园管理员将解决这个问题.但是刚刚发现Cloudera在ZK为CDH 5.4.0做了另一个'修复',他们已经将org.apache.zookeeper.JLineZNodeCompletor类重命名为org.apache.zookeeper.JLineZNodeCompleter.但这里是代码 ZooKeeperMain.java
Class<?> completorC = Class.forName("org.apache.zookeeper.JLineZNodeCompletor");
Run Code Online (Sandbox Code Playgroud)
当然,它实际上是不可能以CDH 5.4.0正确的方式启动ZK CLI.糟糕的工作.:-(