zookeeper似乎可以正常启动,但是没有响应端口查询

时间:2018-10-05 18:14:07

标签: ubuntu-16.04 apache-zookeeper

在单个节点[我的笔记本电脑]上安装zookeeper并修改配置文件后,我开始执行该过程:

idf@DESKTOP-QVGBOPK:~$ sudo service zookeeper restart
 * Restarting centralized coordination service zookeeper                                                                                                                                                   [ OK ]

我问是否还可以:

idf@DESKTOP-QVGBOPK:~$ echo ruok | nc 127.0.0.1 2181
imok

我希望查看日志文件中是否有任何错误。看起来还可以:

idf@DESKTOP-QVGBOPKmore /var/log/zookeeper/zookeeper.log
2018-10-05 18:09:27,238 - INFO  [main:QuorumPeerConfig@103] - Reading configuration from: /etc/zookeeper/conf/zoo.cfg
2018-10-05 18:09:27,247 - INFO  [main:DatadirCleanupManager@78] - autopurge.snapRetainCount set to 3
2018-10-05 18:09:27,248 - INFO  [main:DatadirCleanupManager@79] - autopurge.purgeInterval set to 0
2018-10-05 18:09:27,248 - INFO  [main:DatadirCleanupManager@101] - Purge task is not scheduled.
2018-10-05 18:09:27,250 - WARN  [main:QuorumPeerMain@113] - Either no config or no quorum defined in config, running  in standalone mode
2018-10-05 18:09:27,357 - INFO  [main:QuorumPeerConfig@103] - Reading configuration from: /etc/zookeeper/conf/zoo.cfg
2018-10-05 18:09:27,358 - INFO  [main:ZooKeeperServerMain@95] - Starting server
2018-10-05 18:09:27,373 - INFO  [main:Environment@100] - Server environment:zookeeper.version=3.4.8-1--1, built on Fri, 26 Feb 2016 14:51:43 +0100
2018-10-05 18:09:27,374 - INFO  [main:Environment@100] - Server environment:host.name=DESKTOP-QVGBOPK.localdomain
2018-10-05 18:09:27,374 - INFO  [main:Environment@100] - Server environment:java.version=1.8.0_181
2018-10-05 18:09:27,374 - INFO  [main:Environment@100] - Server environment:java.vendor=Oracle Corporation
2018-10-05 18:09:27,374 - INFO  [main:Environment@100] - Server environment:java.home=/usr/lib/jvm/java-8-oracle/jre
2018-10-05 18:09:27,374 - INFO  [main:Environment@100] - Server environment:java.class.path=/etc/zookeeper/conf:/usr/share/java/jline.jar:/usr/share/java/log4j-1.2.jar:/usr/share/java/xercesImpl.jar:/usr/share/
java/xmlParserAPIs.jar:/usr/share/java/netty.jar:/usr/share/java/slf4j-api.jar:/usr/share/java/slf4j-log4j12.jar:/usr/share/java/zookeeper.jar
2018-10-05 18:09:27,374 - INFO  [main:Environment@100] - Server environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
2018-10-05 18:09:27,374 - INFO  [main:Environment@100] - Server environment:java.io.tmpdir=/tmp
2018-10-05 18:09:27,375 - INFO  [main:Environment@100] - Server environment:java.compiler=<NA>
2018-10-05 18:09:27,376 - INFO  [main:Environment@100] - Server environment:os.name=Linux
2018-10-05 18:09:27,376 - INFO  [main:Environment@100] - Server environment:os.arch=amd64
2018-10-05 18:09:27,376 - INFO  [main:Environment@100] - Server environment:os.version=4.4.0-17134-Microsoft
2018-10-05 18:09:27,376 - INFO  [main:Environment@100] - Server environment:user.name=zookeeper
2018-10-05 18:09:27,377 - INFO  [main:Environment@100] - Server environment:user.home=/var/lib/zookeeper
2018-10-05 18:09:27,377 - INFO  [main:Environment@100] - Server environment:user.dir=/
2018-10-05 18:09:27,384 - INFO  [main:ZooKeeperServer@787] - tickTime set to 2000
2018-10-05 18:09:27,385 - INFO  [main:ZooKeeperServer@796] - minSessionTimeout set to -1
2018-10-05 18:09:27,385 - INFO  [main:ZooKeeperServer@805] - maxSessionTimeout set to -1
2018-10-05 18:09:27,401 - INFO  [main:NIOServerCnxnFactory@89] - binding to port 0.0.0.0/0.0.0.0:2181
2018-10-05 18:09:34,766 - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@192] - Accepted socket connection from /127.0.0.1:51610
2018-10-05 18:09:34,847 - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@827] - Processing ruok command from /127.0.0.1:51610
2018-10-05 18:09:34,850 - INFO  [Thread-1:NIOServerCnxn@1008] - Closed socket connection for client /127.0.0.1:51610 (no session established for client)
idf@DESKTOP-QVGBOPK:~$

我查看进程是否正在运行:

idf@DESKTOP-QVGBOPK:~$ ps -ef | grep zookeeper
zookeep+  4817     1  0 13:09 ?        00:00:01 /usr/bin/java -cp /etc/zookeeper/conf:/usr/share/java/jline.jar:/usr/share/java/log4j-1.2.jar:/usr/share/java/xercesImpl.jar:/usr/share/java/xmlParserAPIs.jar:/usr/share/java/netty.jar:/usr/share/java/slf4j-api.jar:/usr/share/java/slf4j-log4j12.jar:/usr/share/java/zookeeper.jar -Dzookeeper.log.dir=/var/log/zookeeper -Dzookeeper.root.logger=INFO,ROLLINGFILE org.apache.zookeeper.server.quorum.QuorumPeerMain /etc/zookeeper/conf/zoo.cfg
idf       4850     4  0 13:21 tty1     00:00:00 grep --color=auto zookeeper
idf@DESKTOP-QVGBOPK:~$

我尝试使用telnet:

idf@DESKTOP-QVGBOPK:$ telnet localhost 2181
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
ruok
imokConnection closed by foreign host.
idf@DESKTOP-QVGBOPK:~/Downloads$

但是,当我查询它是否在端口2181上运行时

idf@DESKTOP-QVGBOPK:~$ sudo netstat -antp | grep 2181
idf@DESKTOP-QVGBOPK:~$

什么都没回来?

0 个答案:

没有答案