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..
Looking at the next 947 process, it is found that it is a Linux system process and should not conflict. I also checked several port numbers that zookeeper will use, and none of them is occupied.
Then open bin/ zkServer.sh Start the 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 $zoopidfile, you think that the process ID file already exists, causing it to fail to start.
Go to dataDir and have a look. Sure enough, there is a zookeeper_ server.pid The last revision was a few days ago. Because the machine was shut down due to abnormal power failure last time, it probably caused the residue of this PID file.
Delete, restart, OK.