zookeeper启动报错:already running as process

通过脚本启动zookeeper集群,发现主节点zookeeper进程并未起来,其余节点zookeeper进程都起来了

zookeeper启动报错:already running as processzookeeper启动报错:already running as process

查看zookeeper·的启动脚本可以发现Zookeeper的进程名叫QuorumPeerMain

zookeeper启动报错:already running as process

zookeeper启动报错:already running as process

 

于是手动启动了一下主节点的zookeeper,发现报错:

JMX enabled by default
Using config: /export/servers/zookeeper-3.4.5-cdh5.14.0/bin/../conf/zoo.cfg
Starting zookeeper ... already running as process 3041.

查看zookeeper·的启动脚本可以发现:

zookeeper启动报错:already running as process

zookeeper启动报错:already running as process

判断$ZOOPIDFILE这个文件是否存在
kill -0 表示不发送任何信号给PID对应的进程,但是仍会对变量值PID对应的
/dev/null 2>&1; 表示不输出错误信息
进程是否存在进行检查,如果$pid对应的进程存在,则返回0,不存在返回1

分析启动脚本我们可以知道错误的原因是:

    机器异常关闭缓存目录中残留PID文件。 那肯定是之前服务器异常断电过。

查看zookeeper的日志目录可以发现:

zookeeper启动报错:already running as process

我们把这个文件输出就行!!!!   

rm -rf zookeeper_server.pid 

zookeeper启动报错:already running as process

让后再起启动,会发现我们的zookeeper起来了,一切正常!!

zookeeper启动报错:already running as process

上一篇:C# 反射简单介绍


下一篇:Navicat注册机报错No all pattern found! file already patched