zk启动正常但zkServer.sh status报错Error contacting service
Posted general
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了zk启动正常但zkServer.sh status报错Error contacting service相关的知识,希望对你有一定的参考价值。
参考文章
zkServer.sh start启动正常 zkServer.sh status启动异常 解决办法
- 呃...2181端口被占用还能启动成功?
【已解决】zookeeper显示Error contacting service. It is probably not running等问题
- 扯,
server.X
中的X
可以是从0开始的(虽然好像网上所有文章都是从1开始, 连官网也是).
- 扯,
- 人工智能 安装zookeeper时候,可以查看进程启动,但是状态显示报错 Error contacting service. It is probably not running
CentOS下ZooKeeper的安装教程(单机模式)
- 同参考文章2
- bin/zkServer.sh status fails when jmx_prometheus_javaagent added as agent #392
zk: 3.4.9 (3节点)
kubernetes: 1.17.2
容器镜像使用 CentOS7 + zk安装包自行封装.
问题描述
zk的3个节点全部启动, 集群也建起来了, 正常对外提供服务. 但是执行zkServer.sh status
查询节点状态异常, 如下
$ ./bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/zookeeper-3.4.9/bin/../conf/zoo.cfg
Error contacting service. It is probably not running
使用jps
可以看到zk进程
$ jps
26 QuorumPeerMain
120300 Jps
排查过程
按照参考文章1中所说, 修改bin/zkServer.sh
, 查看status
子命令的详细过程.
STAT=`"$JAVA" "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}" \\ -cp "$CLASSPATH" $JVMFLAGS org.apache.zookeeper.client.FourLetterWordMain \\ $clientPortAddress $clientPort srvr 2> /dev/null \\ | $GREP Mode`
将上述语句的2> /dev/null
以及后面的管道过滤语句移除, 查看srvr
指令的输出, 得到如下
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:386)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:401)
Caused by: java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at sun.net.httpserver.ServerImpl.<init>(ServerImpl.java:100)
at sun.net.httpserver.HttpServerImpl.<init>(HttpServerImpl.java:50)
at sun.net.httpserver.DefaultHttpServerProvider.createHttpServer(DefaultHttpServerProvider.java:35)
at com.sun.net.httpserver.HttpServer.create(HttpServer.java:130)
at io.prometheus.jmx.shaded.io.prometheus.client.exporter.HTTPServer.<init>(HTTPServer.java:179)
at io.prometheus.jmx.shaded.io.prometheus.jmx.JavaAgent.premain(JavaAgent.java:31) ... 6 more
FATAL ERROR in native method: processing of -javaagent failed
和参考文章1中说的一样, 都是Address already in use
, 但是ta没说是哪个端口啊...
以上是关于zk启动正常但zkServer.sh status报错Error contacting service的主要内容,如果未能解决你的问题,请参考以下文章