今日為了釋放空間,kill了zookeeper進(jìn)程,沒(méi)想到kill了后就啟動(dòng)不起來(lái)了
成都創(chuàng)新互聯(lián)公司咨詢(xún)電話(huà):18982081108,為您提供成都網(wǎng)站建設(shè)網(wǎng)頁(yè)設(shè)計(jì)及定制高端網(wǎng)站建設(shè)服務(wù),成都創(chuàng)新互聯(lián)公司網(wǎng)頁(yè)制作領(lǐng)域10年,包括宣傳片制作等多個(gè)行業(yè)擁有豐富的網(wǎng)站營(yíng)銷(xiāo)經(jīng)驗(yàn),選擇成都創(chuàng)新互聯(lián)公司,為網(wǎng)站錦上添花!
提示已正常啟動(dòng)
[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
但看后臺(tái)進(jìn)程沒(méi)有
查看zookeeper.out日志,有如下提示:
2015-12-31 17:32:04,090 [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)
提示很明顯/tmp/zookeeper/data/myid file is missing
到該目錄下發(fā)現(xiàn)確實(shí)沒(méi)有myid這個(gè)文件,大家知道/tmp文件夾是一個(gè)臨時(shí)目錄,里面的文件很可能過(guò)一段時(shí)間就會(huì)被刪除
查看/etc/cron.daily/tmpwatch文件,顯示如下內(nèi)容
#! /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
可以知道/tmp文件中的內(nèi)容除了設(shè)定的文件將會(huì)10d清除一次
所以我們不應(yīng)該把myid放在/tmp下或者要把這個(gè)文件從清除文件中排除出去
添加myid文件,修改zoo.cfg中的data目錄后,再次啟動(dòng),啟動(dòng)成功
[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 0.0 103252 808 pts/2 D+ 17:55 0:00 grep zook