Error already running as process when starting zookeeper

An error was reported when starting zookeeper today:

[ root@hadoop -one zookeeper-3.4.5]# bin/zkServer.sh start
JMX enabled by default
Using config: /root/zookeeper/zookeeper-3.4.5/bin/../conf/zoo.cfg
Starting zookeeper … already running as process 947..

After looking at the 947 process, it is found that it is a Linux system process and should not conflict. Check several port numbers that zookeeper will use, and they are not occupied

Later, open the bin/zkserver.sh startup script and search the place where the above sentence will be thrown:

    echo  -n "Starting zookeeper ... "
    if [ -f $ZOOPIDFILE ]; then
      if kill -0 `cat $ZOOPIDFILE` > /dev/null 2>&1; then
         echo $command already running as process `cat $ZOOPIDFILE`.
         exit 0
      fi
    fi

When you see $zoomidfile, you think that the process ID file already exists, which makes it impossible to start

Go to dataDir and see if there is a zookeeper_Server.pid, last modified a few days ago. The last time the machine was shut down abnormally due to power failure, which probably caused the residual PID file

Delete, restart, OK

Similar Posts: