java - zookeeper 客户端不向 CLI 提供 "jline support is disabled"消息

标签 java hadoop cloudera apache-zookeeper jline

我刚刚启动了 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

我知道通常的打印输出是 启用 JLine 支持

这就是卡住的原因吗?我看不出有什么方法可以更改这个 Cloudera 管理器配置页面。

最佳答案

免责声明:请注意答案来自 2015 年。它可能不再相关,但可能有助于历史目的,并对类似的“现代”案例有所启发。

简短

Cloudera 在多个地方损坏了 zookeeper 3.4.5-cdh5.4.0。服务正在运行,但 CLI 已死。除了回滚之外没有解决方法。

为此分配赏金 ;-)。我也踩过这个地雷,气得找原因:

Zookeeper 在 ZooKeeperMain.run() 期间检查 JLine。有 try-catch block 加载类的数量。类加载期间的任何异常都会导致整个 block 失败,并且报告 JLine 支持已被禁用。

但这就是 CDH 5.4.0 发生这种情况的原因:

  1. 当前的开源 Zookeeper-3.4.6 适用于 jline-0.9.94。没有这样的问题。

  2. 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"));

  1. 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).

  2. 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.

  1. It seemed to me both jline-0.9.94.jar and jline.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 renamed org.apache.zookeeper.JLineZNodeCompletor class to org.apache.zookeeper.JLineZNodeCompleter.

But here is the code from ZooKeeperMain.java

Class<?> completorC =                    Class.forName("org.apache.zookeeper.JLineZNodeCompletor");

当然这意味着实际上不可能以正确的方式在 CDH 5.4.0 中启动 ZK CLI。糟糕的工作。 :-(

关于java - zookeeper 客户端不向 CLI 提供 "jline support is disabled"消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30043897/

相关文章:

java - 通过将值添加到spark dataframe列来生成新列

hadoop - 在 Pig Latin 中获取 xml 值

hadoop - Apache Pig 存储分隔符

java - 为什么java泛型允许在HashMap<Integer,String>的get中传递 boolean 值

java - 如何获取lucene index中每个term的postings列表

java - 将图像置于 LinearLayout 底部和我的应用程序底部之间

hadoop - 如何检查是否已完成向HDFS的文件传输

java - JOOQ 中带有列表的 IN 谓词仅返回第一个值

hadoop - cloudera navigator Multi-Tenancy 能力

hadoop - Cloudera Hive,Horton Works Hive和MapR Hive之间的区别?