Zookeeper failed to start resolution
Today, in order to free up space, kill used the zookeeper process, but unexpectedly, it couldn't be started after kill.
Indicates that it has started normally
[root@lnx-a-11 bin] #. / zkServer.sh start
JMX enabled by default
Using config: / home/tester/zookeeper/bin/../conf/zoo.cfg
Starting zookeeper... STARTED
[root@lnx-air-9-27 bin] # ps aux | grep zook
But look at the background process.
Check the zookeeper.out log and have the following prompts:
2015-12-31 17 main:QuorumPeerMain@85 32V 04090 [myid:]-ERROR [main:QuorumPeerMain@85]-Invalid config, exiting abnormally
Org.apache.zookeeper.server.quorum.QuorumPeerConfig$ConfigException: Error processing / home/tester/zookeeper/bin/../conf/zoo.cfg
At org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse (QuorumPeerConfig.java:123)
At org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun (QuorumPeerMain.java:101)
At org.apache.zookeeper.server.quorum.QuorumPeerMain.main (QuorumPeerMain.java:78)
Caused by: java.lang.IllegalArgumentException: / tmp/zookeeper/data/myid file is missing
At org.apache.zookeeper.server.quorum.QuorumPeerConfig.parseProperties (QuorumPeerConfig.java:350)
At org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse (QuorumPeerConfig.java:119)
The hint is obvious / tmp/zookeeper/data/myid file is missing
It is found that there is no myid file in this directory. You know that the / tmp folder is a temporary directory, and the files in it are likely to be deleted after a period of time.
View the / etc/cron.daily/tmpwatch file and display the following
#! / bin/sh
Flags=-umc
/ usr/sbin/tmpwatch "$flags"-x / tmp/.X11-unix-x / tmp/.XIM-unix\
-x / tmp/.font-unix-x / tmp/.ICE-unix-x / tmp/.Test-unix\
-X'/ tmp/hsperfdata_*' 10d / tmp
/ usr/sbin/tmpwatch "$flags" 30d / var/tmp
For d in / var/ {cache/man,catman} / {cat?,X11R6/cat?,local/cat?}; do
If [- d "$d"]; then
/ usr/sbin/tmpwatch "$flags"-f 30d "$d"
Fi
Done
You can know that the contents of the / tmp file will be cleared once every 10 days except for the set file.
So we should not put myid under / tmp or exclude this file from the cleanup file.
Add the myid file, modify the data directory in zoo.cfg, and start it again. The startup is successful.
[root@lnx-a-11 bin] # ps aux | grep zook
Root 21869 24.7 0.8 2584892 35100 pts/2 Sl 17:54 0:01 java-Dzookeeper.log.dir=/home/tester/zookeeper/bin/../logs-Dzookeeper.root.logger=INFO CONSOLE-cp / home/tester/zookeeper/bin/../build/classes:/home/tester/zookeeper/bin/../build/lib/*.jar:/home/tester/zookeeper/bin/../lib/slf4j-log4j12-1.6.1.jar:/home/tester/zookeeper/bin/../lib/slf4j-api-1.6.1.jar:/home/tester/zookeeper/bin/../lib/netty-3.7.0.Final.jar:/home/ Tester/zookeeper/bin/../lib/log4j-1.2.16.jar:/home/tester/zookeeper/bin/../lib/jline-0.9.94.jar:/home/tester/zookeeper/bin/../zookeeper-3.4.6.jar:/home/tester/zookeeper/bin/../src/java/lib/*.jar:/home/tester/zookeeper/bin/../conf:-Dcom.sun.management.jmxremote-Dcom.sun.management.jmxremote .local.only = false org.apache.zookeeper.server.quorum.QuorumPeerMain / home/tester/zookeeper/bin/../conf/zoo.cfg
Root 21948 0.0 103252 808 pts/2 D + 17:55 0:00 grep zook