5、如果在zoo*.cfg中配置了
#the location of the log file dataLogDir=/usr/local/zookeeper-3.4.3/[color=red]logs[/color]如果$ZK_INSTALL下不存在logs目录,也会报错。所以需要手动创建logs文件夹。
报错异常信息如下:
2012-02-26 00:06:47,364 [myid:] - INFO [main:QuorumPeerConfig@101] - Reading configuration from: ../conf/zoo3.cfg 2012-02-26 00:06:47,372 [myid:] - ERROR [main:QuorumPeerMain@85] - Invalid config, exiting abnormally org.apache.zookeeper.server.quorum.QuorumPeerConfig$ConfigException: Error processing ../conf/zoo3.cfg at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:121) at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:101) at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:78) Caused by: [color=red]java.lang.IllegalArgumentException: dataLogDir /usr/local/zookeeper-3.4.3/logs is missing.[/color] at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parseProperties(QuorumPeerConfig.java:247) at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:117) ... 2 more Invalid config, exiting abnormally6、现在就可以启动zookeeper了:
zkServer.sh start zoo1.cfg
zkServer.sh start zoo2.cfg
zkServer.sh start zoo3.cfg
然后输入jps,查看进程:
[root@Hadoopname snapshot]# jps
4208 SecondaryNameNode
4587 QuorumPeerMain
4498 QuorumPeerMain
4273 JobTracker
4014 NameNode
4106 DataNode
4617 Jps
4547 QuorumPeerMain
4424 TaskTracker
有3个QuorumPeerMain进程启动了,zookeeper启动成功。还可以使用zookeeper自带的四字命令进行启动成功的测试:
[root@hadoopname snapshot]# echo ruok | nc hadoopName 2181
imok
返回了imok,证明启动成功。如果什么都没有返回,证明启动失败。