无法启动zookeeper

时间:2015-06-29 10:49:49

标签: apache-zookeeper

我正在尝试手动启动zookeeper。我跑

# source zkServer.sh start

输出:

JMX enabled by default
Using config: /opt/zookeeper-3.4.6/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED

当我运行#jps时,它会输出

15360 QuorumPeerMain
15412 Jps

从我在线阅读的内容来看,Zookeeper与上面列出的QuorumPeerMain处理过程相同。但是当我使用

检查其状态时
source zkServer.sh status

它挂在:

JMX enabled by default
Using config: /opt/zookeeper-3.4.6/bin/../conf/zoo.cfg

所以我跑

#source zkServer.sh status > templogs.txt

在上面运行会使终端闪烁到下面一会儿(我必须多次运行此命令才能读取终端关闭前实际输出的内容)并关闭终端

JMX enabled by default
Using config:
grep: No such file or directory
grep: No such file or directory

之后写templogs.txt
Error contacting service. It is probably not running.

当我打开zookeeper.out时,我可以看到此输出:

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/zookeeper-3.4.6/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/hive-0.12.0-cdh5.0.3/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/hbase-0.96.1.1-cdh5.0.3/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/spark-0.9.0-cdh/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/splicemachine/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
2015-06-29 15:49:40,831 [myid:] - INFO  [main:QuorumPeerConfig@103] - Reading configuration from: /opt/zookeeper-3.4.6/bin/../conf/zoo.cfg
2015-06-29 15:49:40,836 [myid:] - INFO  [main:DatadirCleanupManager@78] - autopurge.snapRetainCount set to 3
2015-06-29 15:49:40,836 [myid:] - INFO  [main:DatadirCleanupManager@79] - autopurge.purgeInterval set to 0
2015-06-29 15:49:40,836 [myid:] - INFO  [main:DatadirCleanupManager@101] - Purge task is not scheduled.
2015-06-29 15:49:40,837 [myid:] - WARN  [main:QuorumPeerMain@113] - Either no config or no quorum defined in config, running  in standalone mode
2015-06-29 15:49:40,847 [myid:] - INFO  [main:QuorumPeerConfig@103] - Reading configuration from: /opt/zookeeper-3.4.6/bin/../conf/zoo.cfg
2015-06-29 15:49:40,847 [myid:] - INFO  [main:ZooKeeperServerMain@95] - Starting server
2015-06-29 15:49:40,896 [myid:] - INFO  [main:Environment@100] - Server environment:zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 GMT
2015-06-29 15:49:40,896 [myid:] - INFO  [main:Environment@100] - Server environment:host.name=ingester
2015-06-29 15:49:40,896 [myid:] - INFO  [main:Environment@100] - Server environment:java.version=1.8.0_25
2015-06-29 15:49:40,896 [myid:] - INFO  [main:Environment@100] - Server environment:java.vendor=Oracle Corporation
2015-06-29 15:49:40,900 [myid:] - INFO  [main:Environment@100] - Server environment:java.home=/usr/java/jdk1.8.0_25/jre
2015-06-29 15:49:40,901 [myid:] - INFO  [main:Environment@100] - Server environment:java.class.path=/opt/zookeeper-3.4.6/bin/../build/classes:/opt

我省略了后面的巨大路径字符串,并在剩下的日志下面给出:

2015-06-29 15:49:40,902 [myid:] - INFO  [main:Environment@100] - Server environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
2015-06-29 15:49:40,902 [myid:] - INFO  [main:Environment@100] - Server environment:java.io.tmpdir=/tmp
2015-06-29 15:49:40,902 [myid:] - INFO  [main:Environment@100] - Server environment:java.compiler=<NA>
2015-06-29 15:49:40,903 [myid:] - INFO  [main:Environment@100] - Server environment:os.name=Linux
2015-06-29 15:49:40,903 [myid:] - INFO  [main:Environment@100] - Server environment:os.arch=amd64
2015-06-29 15:49:40,903 [myid:] - INFO  [main:Environment@100] - Server environment:os.version=3.17.8-200.fc20.x86_64
2015-06-29 15:49:40,903 [myid:] - INFO  [main:Environment@100] - Server environment:user.name=root
2015-06-29 15:49:40,904 [myid:] - INFO  [main:Environment@100] - Server environment:user.home=/root
2015-06-29 15:49:40,904 [myid:] - INFO  [main:Environment@100] - Server environment:user.dir=/root
2015-06-29 15:49:40,909 [myid:] - INFO  [main:ZooKeeperServer@755] - tickTime set to 2000
2015-06-29 15:49:40,909 [myid:] - INFO  [main:ZooKeeperServer@764] - minSessionTimeout set to -1
2015-06-29 15:49:40,909 [myid:] - INFO  [main:ZooKeeperServer@773] - maxSessionTimeout set to -1
2015-06-29 15:49:40,918 [myid:] - INFO  [main:NIOServerCnxnFactory@94] - binding to port 0.0.0.0/0.0.0.0:2181

是不是像动物园管理员一样难以获得到2181端口的绑定?

但是当我运行lsof -i:2181 -s时,它会输出:

COMMAND   PID USER   FD   TYPE   DEVICE SIZE NODE NAME
java    15360 root  467u  IPv6 18340028       TCP *:eforward (LISTEN)

pid是QuorumPeerMain

的pid

在另一台PC上运行source zkServer.sh status,正确提供

Mode: standalone

但是在这台电脑上,我几乎搞砸了。任何人都可以帮助我。

3 个答案:

答案 0 :(得分:1)

PORT绑定似乎有些问题

“绑定到端口0.0.0.0/0.0.0.0:2181

并且应该通过在主机文件下面添加主机文件来解决问题

127.0.0.1 localhost

答案 1 :(得分:0)

您是否确认配置文件正常?

尝试使用配置文件完整路径运行Zookeeper

示例:zkServer.sh start /etc/zookeeper/conf/zoo.cfg

答案 2 :(得分:0)

就我而言,我不安装 JAVA

所以它没有启动

请下载JDKinstall 然后再试一次