Error contacting service. It is probably not running && java.lang.IllegalArgumentException: serverid

关于ZooKeeper的配置部署问题总结。

问题1:

执行:  zkServer.sh start       之后,执行:zkServer.sh status

出现:

JMX enabled by default

Using config: /opt/zk/bin/../conf/zoo.cfg

Error contacting service. It is probably not running.

 

解决问题1:

执行: zkServer.sh start-foreground  

进行调试,找具体原因。

 

问题2:

调试过程中出现如下错误,

Caused by: java.lang.IllegalArgumentException: serverid #server1 is not a number

原因:

myid文件中内容有错,需要修改。

解决问题2:

如果配置文件如下:

     1 # The number of milliseconds of each tick
      2 tickTime=2000
      3 # The number of ticks that the initial
      4 # synchronization phase can take
      5 initLimit=10
      6 # The number of ticks that can pass between
      7 # sending a request and getting an acknowledgement
      8 syncLimit=5
      9 # the directory where the snapshot is stored.
     10 # do not use /tmp for storage, /tmp here is just
     11 # example sakes.
     12 #dataDir=/tmp/zookeeper/
     13 dataDir=/opt/zookeeper/zkdata
     14 dataLogDir=/opt/zookeeper/zkdatalog
     15 # the port at which the clients will connect
     16 clientPort=2181
     17 #add 3 servers
     18 server.1=172.16.18.105:2888:3888
     19 server.2=172.16.18.106:2888:3888
     20 server.3=172.16.18.107:2888:3888

     21 
     22 # the maximum number of client connections.
     23 # increase this if you need to handle more clients
     24 #maxClientCnxns=60
     25 #
     26 # Be sure to read the maintenance section of the
     27 # administrator guide before turning on autopurge.
     28 #
     29 # http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
     30 #
     31 # The number of snapshots to retain in dataDir
     32 #autopurge.snapRetainCount=3
     33 # Purge task interval in hours
     34 # Set to "0" to disable auto purge feature
     35 #autopurge.purgeInterval=1

那么第一个server 的myid文件只有 纯数字  “1”(注意,没有双引号,没有空格,只有一个1就可以)

其他两个server myid  文件  分别是 “2” 和  “3”

参考:

https://stackoverflow.com/questions/29909191/zookeeper-it-is-probably-not-running/29950279#29950279

https://stackoverflow.com/questions/43114814/zkserver-sh-status-error-contacting-service-it-is-probably-not-running

https://stackoverflow.com/questions/11498507/zookeeper-three-nodes-and-nothing-but-errors

 

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值