前几段的时候,Zookeeper的安装是成功的,也启动成功,但是今天不知道就怎么了,另外一台装突然就一直启动不起来。在‘#’后面的是注释:

 

# 目前所在的位置:

[scidb@localhost bin]$ pwd

/home/scidb/zookeeper/zookeeper-3.4.8/bin

 

# 在bin的文件下有这些文件:

[scidb@localhost bin]$ ls 

README.txt    zkCli.cmd  zkEnv.cmd  zkServer.cmd  zookeeper.out

zkCleanup.sh  zkCli.sh   zkEnv.sh   zkServer.sh

 

# 接下来启动 zkServer.sh

[scidb@localhost bin]$ sudo sh zkServer.sh start

ZooKeeper JMX enabled by default

Using config: /home/scidb/zookeeper/zookeeper-3.4.8/bin/../conf/zoo.cfg

Starting zookeeper ... STARTED

 

# 看起来是启动成功了哦,然后我们再来看看是否真的启动成功了。

[scidb@localhost bin]$ sh zkServer.sh status

ZooKeeper JMX enabled by default

Using config: /home/scidb/zookeeper/zookeeper-3.4.8/bin/../conf/zoo.cfg

Error contacting service. It is probably not running.

 

# 呵呵,居然没有启动起来。然后我用zkCli.sh 尝试启动客户端,结果。。

 
  1. [root@iZuf6j2g9ep36k1nmcesowZ /alex/data/zoookeeper/zookeeper-3.4.12/bin]$ ./zkCli.sh

  2. Connecting to localhost:2181

  3. 2018-06-30 18:38:54,977 [myid:] - INFO [main:Environment@100] - Client environment:zookeeper.version=3.4.12-e5259e437540f349646870ea94dc2658c4e44b3b, built on 03/27/2018 03:55 GMT

  4. 2018-06-30 18:38:54,985 [myid:] - INFO [main:Environment@100] - Client environment:host.name=iZuf6j2g9ep36k1nmcesowZ

  5. 2018-06-30 18:38:54,985 [myid:] - INFO [main:Environment@100] - Client environment:java.version=1.8.0_172

  6. 2018-06-30 18:38:54,986 [myid:] - INFO [main:Environment@100] - Client environment:java.vendor=Oracle Corporation

  7. 2018-06-30 18:38:54,986 [myid:] - INFO [main:Environment@100] - Client environment:java.home=/alex/data/java/jdk8/jdk1.8.0_172/jre

  8. 2018-06-30 18:38:54,987 [myid:] - INFO [main:Environment@100] - Client environment:java.class.path=/alex/data/zoookeeper/zookeeper-3.4.12/bin/../build/classes:/alex/data/zoookeeper/zookeeper-3.4.12/bin/../build/lib/*.jar:/alex/data/zoookeeper/zookeeper-3.4.12/bin/../lib/slf4j-log4j12-1.7.25.jar:/alex/data/zoookeeper/zookeeper-3.4.12/bin/../lib/slf4j-api-1.7.25.jar:/alex/data/zoookeeper/zookeeper-3.4.12/bin/../lib/netty-3.10.6.Final.jar:/alex/data/zoookeeper/zookeeper-3.4.12/bin/../lib/log4j-1.2.17.jar:/alex/data/zoookeeper/zookeeper-3.4.12/bin/../lib/jline-0.9.94.jar:/alex/data/zoookeeper/zookeeper-3.4.12/bin/../lib/audience-annotations-0.5.0.jar:/alex/data/zoookeeper/zookeeper-3.4.12/bin/../zookeeper-3.4.12.jar:/alex/data/zoookeeper/zookeeper-3.4.12/bin/../src/java/lib/*.jar:/alex/data/zoookeeper/zookeeper-3.4.12/bin/../conf:.:/alex/data/java/jdk8/jdk1.8.0_172/jre/lib/rt.jar:/alex/data/java/jdk8/jdk1.8.0_172/lib/dt.jar:/alex/data/java/jdk8/jdk1.8.0_172/lib/tools.jar

  9. 2018-06-30 18:38:54,987 [myid:] - INFO [main:Environment@100] - Client environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib

  10. 2018-06-30 18:38:54,987 [myid:] - INFO [main:Environment@100] - Client environment:java.io.tmpdir=/tmp

  11. 2018-06-30 18:38:54,987 [myid:] - INFO [main:Environment@100] - Client environment:java.compiler=<NA>

  12. 2018-06-30 18:38:54,987 [myid:] - INFO [main:Environment@100] - Client environment:os.name=Linux

  13. 2018-06-30 18:38:54,987 [myid:] - INFO [main:Environment@100] - Client environment:os.arch=amd64

  14. 2018-06-30 18:38:54,987 [myid:] - INFO [main:Environment@100] - Client environment:os.version=3.10.0-693.2.2.el7.x86_64

  15. 2018-06-30 18:38:54,987 [myid:] - INFO [main:Environment@100] - Client environment:user.name=root

  16. 2018-06-30 18:38:54,987 [myid:] - INFO [main:Environment@100] - Client environment:user.home=/root

  17. 2018-06-30 18:38:54,987 [myid:] - INFO [main:Environment@100] - Client environment:user.dir=/alex/data/zoookeeper/zookeeper-3.4.12/bin

  18. 2018-06-30 18:38:54,988 [myid:] - INFO [main:ZooKeeper@441] - Initiating client connection, connectString=localhost:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@5c29bfd

  19. 2018-06-30 18:38:55,012 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@1028] - Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)

  20. Welcome to ZooKeeper!

  21. JLine support is enabled

  22. 2018-06-30 18:38:55,123 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@1165] - Socket error occurred: localhost/127.0.0.1:2181: Connection refused

  23. [zk: localhost:2181(CONNECTING) 0] 2018-06-30 18:38:56,225 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@1028] - Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)

  24. 2018-06-30 18:38:56,226 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@1165] - Socket error occurred: localhost/127.0.0.1:2181: Connection refused

  25. 2018-06-30 18:38:57,327 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@1028] - Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)

  26. 2018-06-30 18:38:57,327 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@1165] - Socket error occurred: localhost/127.0.0.1:2181: Connection refused

  27. 2018-06-30 18:38:58,428 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@1028] - Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)

  28. 2018-06-30 18:38:58,429 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@1165] - Socket error occurred: localhost/127.0.0.1:2181: Connection refused

  29. 2018-06-30 18:38:59,536 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@1028] - Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)

  30. 2018-06-30 18:38:59,537 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@1165] - Socket error occurred: localhost/127.0.0.1:2181: Connection refused

  31. 2018-06-30 18:39:00,637 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@1028] - Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)

  32. 2018-06-30 18:39:00,638 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@1165] - Socket error occurred: localhost/127.0.0.1:2181: Connection refused

  33. [root@iZuf6j2g9ep36k1nmcesowZ /alex/data/zoookeeper/zookeeper-3.4.12/bin]$ sh zkServer.sh status

  34. ZooKeeper JMX enabled by default

  35. Using config: /alex/data/zoookeeper/zookeeper-3.4.12/bin/../conf/zoo.cfg

  36. Error contacting service. It is probably not running.

  37. [root@iZuf6j2g9ep36k1nmcesowZ /alex/data/zoookeeper/zookeeper-3.4.12/bin]$ sudo netstat -anp | grep 2181

  38. [root@iZuf6j2g9ep36k1nmcesowZ /alex/data/zoookeeper/zookeeper-3.4.12/bin]$ netstat -ntlp

  39. Active Internet connections (only servers)

  40. Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name

  41. tcp 0 0 0.0.0.0:6379 0.0.0.0:* LISTEN 6136/./redis-server

  42. tcp 0 0 127.0.0.1:9100 0.0.0.0:* LISTEN 31614/node_exporter

  43. tcp 0 0 127.0.0.1:9229 0.0.0.0:* LISTEN 31593/gitlab-workho

  44. tcp 0 0 127.0.0.1:9168 0.0.0.0:* LISTEN 31582/ruby

  45. tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 1321/java

  46. tcp 0 0 127.0.0.1:8082 0.0.0.0:* LISTEN 4440/sidekiq 5.1.3

  47. tcp 0 0 127.0.0.1:9236 0.0.0.0:* LISTEN 31570/gitaly

  48. tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 15241/sshd

  49. tcp 0 0 0.0.0.0:8060 0.0.0.0:* LISTEN 31608/nginx: master

  50. tcp 0 0 0.0.0.0:6783 0.0.0.0:* LISTEN 31562/alertmanager

  51. tcp 0 0 0.0.0.0:8800 0.0.0.0:* LISTEN 31608/nginx: master

  52. tcp 0 0 127.0.0.1:32000 0.0.0.0:* LISTEN 1095/java

  53. tcp 0 0 127.0.0.1:8801 0.0.0.0:* LISTEN 31275/unicorn worke

  54. tcp 0 0 127.0.0.1:9121 0.0.0.0:* LISTEN 31752/redis_exporte

  55. tcp 0 0 127.0.0.1:9090 0.0.0.0:* LISTEN 31704/prometheus

  56. tcp 0 0 127.0.0.1:9187 0.0.0.0:* LISTEN 31618/postgres_expo

  57. tcp 0 0 127.0.0.1:9093 0.0.0.0:* LISTEN 31562/alertmanager

  58. tcp 0 0 127.0.0.1:8005 0.0.0.0:* LISTEN 1321/java

  59. tcp 0 0 0.0.0.0:8009 0.0.0.0:* LISTEN 1321/java

  60. tcp6 0 0 :::6379 :::* LISTEN 6136/./redis-server

  61.  
  62.  

 

# 乍一看配置没错啊,我想看看到底2181端口是否被占用。

[scidb@localhost bin]$ sudo netstat -anp | grep 2181

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐