zookeeper 服务器已启动,但没有输出 [英] zookeeper server STARTED but ruok no output
问题描述
我在zoo.cfg中设置:clientPort=2181
cloudera@cloudera-vm:/$ sudo/usr/lib/zookeeper/bin/zkServer.sh start
我收到以下回复:
默认启用JMX使用配置:/usr/lib/zookeeper/bin/../conf/zoo.cfg启动zookeeper ... STARTED
<块引用>
cloudera@cloudera-vm:/$ sudo/usr/lib/zookeeper/bin/zkServer.sh 状态
默认启用JMX使用配置:/usr/lib/zookeeper/bin/../conf/zoo.cfg模式:独立
但是
$ echo ruok |本地主机 2181$
没有给出任何输出.问题出在哪里?
日志文件:
2014-10-03 08:40:10,912 - INFO [main:QuorumPeerConfig@90] - 从以下位置读取配置:/usr/lib/zookeeper/bin/../conf/zoo.cfg2014-10-03 08:40:10,916 - 错误 [main:QuorumPeerConfig@259] - 配置无效,仅指定了一台服务器(忽略)2014-10-03 08:40:10,916 - 警告 [main:QuorumPeerMain@105] - 没有配置或没有在配置中定义仲裁,在独立模式下运行2014-10-03 08:40:10,927 - INFO [main:QuorumPeerConfig@90] - 从以下位置读取配置:/usr/lib/zookeeper/bin/../conf/zoo.cfg2014-10-03 08:40:10,928 - 错误 [main:QuorumPeerConfig@259] - 配置无效,仅指定了一台服务器(忽略)2014-10-03 08:40:10,928 - 信息 [main:ZooKeeperServerMain@94] - 启动服务器2014-10-03 08:40:10,933 - INFO [main:Environment@97] - 服务器环境:zookeeper.version=3.3.5-cdh3u6--1,建立于 03/20/2013 20:16 GMT2014-10-03 08:40:10,933 - 信息 [main:Environment@97] - 服务器环境:host.name=cloudera-vm2014-10-03 08:40:10,933 - 信息 [main:Environment@97] - 服务器环境:java.version=1.6.0_242014-10-03 08:40:10,934 - 信息 [main:Environment@97] - 服务器环境:java.vendor=Sun Microsystems Inc.2014-10-03 08:40:10,934 - 信息 [main:Environment@97] - 服务器环境:java.home=/usr/lib/jvm/java-6-sun-1.6.0.24/jre2014-10-03 08:40:10,934 - 信息 [main:Environment@97] - 服务器环境:java.class.path=/usr/lib/zookeeper/bin/../build/classes:/usr/lib/zookeeper/bin/../build/lib/*.jar:/usr/lib/zookeeper/bin/../zookeeper-3.3.5-cdh3u6.jar:/usr/lib/zookeeper/bin/../lib/log4j-1.2.15.jar:/usr/lib/zookeeper/bin/../lib/jline-0.9.94.jar:/usr/lib/zookeeper/bin/../src/java/lib/*.jar:/usr/lib/zookeeper/bin/../conf:2014-10-03 08:40:10,934 - 信息 [main:Environment@97] - 服务器环境:java.library.path=/usr/lib/jvm/java-6-sun-1.6.0.24/jre/lib/i386/client:/usr/lib/jvm/java-6-sun-1.6.0.24/jre/lib/i386:/usr/lib/jvm/java-6-sun-1.6.0.24/jre/../lib/i386:/usr/java/packages/lib/i386:/lib:/usr/lib2014-10-03 08:40:10,934 - 信息 [main:Environment@97] - 服务器环境:java.io.tmpdir=/tmp2014-10-03 08:40:10,934 - 信息 [main:Environment@97] - 服务器环境:java.compiler=<NA>2014-10-03 08:40:10,934 - 信息 [main:Environment@97] - 服务器环境:os.name=Linux2014-10-03 08:40:10,934 - 信息 [main:Environment@97] - 服务器环境:os.arch=i3862014-10-03 08:40:10,935 - 信息 [main:Environment@97] - 服务器环境:os.version=2.6.35-28-generic2014-10-03 08:40:10,935 - 信息 [main:Environment@97] - 服务器环境:user.name=root2014-10-03 08:40:10,935 - 信息 [main:Environment@97] - 服务器环境:user.home=/root2014-10-03 08:40:10,935 - 信息 [main:Environment@97] - 服务器环境:user.dir=/2014-10-03 08:40:10,940-信息 [main:ZooKeeperServer@673]-tickTime 设置为 20002014-10-03 08:40:10,940 - 信息 [main:ZooKeeperServer@682] - minSessionTimeout 设置为 -12014-10-03 08:40:10,941 - 信息 [main:ZooKeeperServer@691] - maxSessionTimeout 设置为 -12014-10-03 08:40:10,953 - 信息 [main:NIOServerCnxn$Factory@143] - 绑定到端口 0.0.0.0/0.0.0.0:21812014-10-03 08:40:10,963 - 信息 [main:FileSnap@82] - 读取快照/var/zookeeper/version-2/snapshot.02014-10-03 08:40:10,972 - 信息 [main:FileTxnSnapLog@256] - 快照:02014-10-03 08:45:42,225 - 信息 [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn$Factory@251] - 接受来自/127.0.0.1:39879 的套接字连接2014-10-03 08:45:42,231 - 信息 [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@1237] - 处理来自/127.0.0.1:39879 的 srvr 命令2014-10-03 08:45:42,239 - INFO [Thread-1:NIOServerCnxn@1435] - 关闭客户端/127.0.0.1:39879 的套接字连接(没有为客户端建立会话)
要记住的一件事是 echo hello |nc localhost 2181
只是向 host:port 写入 hello ,不必等待接收任何响应.如果您必须等待响应,请通过提供 -q
选项让 netcat 等待它.例如,您可能想尝试 echo hello |nc -q 3 本地主机 2181
I have set in zoo.cfg : clientPort=2181
cloudera@cloudera-vm:/$ sudo /usr/lib/zookeeper/bin/zkServer.sh start
I get the following response:
JMX enabled by default
Using config: /usr/lib/zookeeper/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
cloudera@cloudera-vm:/$ sudo /usr/lib/zookeeper/bin/zkServer.sh status
JMX enabled by default
Using config: /usr/lib/zookeeper/bin/../conf/zoo.cfg
Mode: standalone
But
$ echo ruok | nc localhost 2181
$
is not giving any output. where is the problem?
Log file:
2014-10-03 08:40:10,912 - INFO [main:QuorumPeerConfig@90] - Reading configuration from: /usr/lib/zookeeper/bin/../conf/zoo.cfg
2014-10-03 08:40:10,916 - ERROR [main:QuorumPeerConfig@259] - Invalid configuration, only one server specified (ignoring)
2014-10-03 08:40:10,916 - WARN [main:QuorumPeerMain@105] - Either no config or no quorum defined in config, running in standalone mode
2014-10-03 08:40:10,927 - INFO [main:QuorumPeerConfig@90] - Reading configuration from: /usr/lib/zookeeper/bin/../conf/zoo.cfg
2014-10-03 08:40:10,928 - ERROR [main:QuorumPeerConfig@259] - Invalid configuration, only one server specified (ignoring)
2014-10-03 08:40:10,928 - INFO [main:ZooKeeperServerMain@94] - Starting server
2014-10-03 08:40:10,933 - INFO [main:Environment@97] - Server environment:zookeeper.version=3.3.5-cdh3u6--1, built on 03/20/2013 20:16 GMT
2014-10-03 08:40:10,933 - INFO [main:Environment@97] - Server environment:host.name=cloudera-vm
2014-10-03 08:40:10,933 - INFO [main:Environment@97] - Server environment:java.version=1.6.0_24
2014-10-03 08:40:10,934 - INFO [main:Environment@97] - Server environment:java.vendor=Sun Microsystems Inc.
2014-10-03 08:40:10,934 - INFO [main:Environment@97] - Server environment:java.home=/usr/lib/jvm/java-6-sun-1.6.0.24/jre
2014-10-03 08:40:10,934 - INFO [main:Environment@97] - Server environment:java.class.path=/usr/lib/zookeeper/bin/../build/classes:/usr/lib/zookeeper/bin/../build/lib/*.jar:/usr/lib/zookeeper/bin/../zookeeper-3.3.5-cdh3u6.jar:/usr/lib/zookeeper/bin/../lib/log4j-1.2.15.jar:/usr/lib/zookeeper/bin/../lib/jline-0.9.94.jar:/usr/lib/zookeeper/bin/../src/java/lib/*.jar:/usr/lib/zookeeper/bin/../conf:
2014-10-03 08:40:10,934 - INFO [main:Environment@97] - Server environment:java.library.path=/usr/lib/jvm/java-6-sun-1.6.0.24/jre/lib/i386/client:/usr/lib/jvm/java-6-sun-1.6.0.24/jre/lib/i386:/usr/lib/jvm/java-6-sun-1.6.0.24/jre/../lib/i386:/usr/java/packages/lib/i386:/lib:/usr/lib
2014-10-03 08:40:10,934 - INFO [main:Environment@97] - Server environment:java.io.tmpdir=/tmp
2014-10-03 08:40:10,934 - INFO [main:Environment@97] - Server environment:java.compiler=<NA>
2014-10-03 08:40:10,934 - INFO [main:Environment@97] - Server environment:os.name=Linux
2014-10-03 08:40:10,934 - INFO [main:Environment@97] - Server environment:os.arch=i386
2014-10-03 08:40:10,935 - INFO [main:Environment@97] - Server environment:os.version=2.6.35-28-generic
2014-10-03 08:40:10,935 - INFO [main:Environment@97] - Server environment:user.name=root
2014-10-03 08:40:10,935 - INFO [main:Environment@97] - Server environment:user.home=/root
2014-10-03 08:40:10,935 - INFO [main:Environment@97] - Server environment:user.dir=/
2014-10-03 08:40:10,940 - INFO [main:ZooKeeperServer@673] - tickTime set to 2000
2014-10-03 08:40:10,940 - INFO [main:ZooKeeperServer@682] - minSessionTimeout set to -1
2014-10-03 08:40:10,941 - INFO [main:ZooKeeperServer@691] - maxSessionTimeout set to -1
2014-10-03 08:40:10,953 - INFO [main:NIOServerCnxn$Factory@143] - binding to port 0.0.0.0/0.0.0.0:2181
2014-10-03 08:40:10,963 - INFO [main:FileSnap@82] - Reading snapshot /var/zookeeper/version-2/snapshot.0
2014-10-03 08:40:10,972 - INFO [main:FileTxnSnapLog@256] - Snapshotting: 0
2014-10-03 08:45:42,225 - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn$Factory@251] - Accepted socket connection from /127.0.0.1:39879
2014-10-03 08:45:42,231 - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@1237] - Processing srvr command from /127.0.0.1:39879
2014-10-03 08:45:42,239 - INFO [Thread-1:NIOServerCnxn@1435] - Closed socket connection for client /127.0.0.1:39879 (no session established for client)
One thing to keep in mind is that echo hello | nc localhost 2181
just writes hello to the host:port and doesn't necessarily wait to receive any response. If you must wait for a response, make netcat wait for it by providing it a -q
option. For instance, you might want to try echo hello | nc -q 3 localhost 2181
这篇关于zookeeper 服务器已启动,但没有输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!