您好,登錄后才能下訂單哦!
今天就跟大家聊聊有關啟動zookeeper報錯該怎么辦,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結了以下內容,希望大家根據這篇文章可以有所收獲。
啟動zookeeper報錯:ERROR [main:QuorumPeerMain@85] - Invalid config, exiting abnormally
場景:
1.給三臺機器安裝zookeeper集群報錯:ERROR [main:QuorumPeerMain@85] - Invalid config, exiting abnormally
2.環境描述
系統: CentOS 7.6
zookeeper版本: 3.4.6
安裝目錄: /opt/zookeeper-3.4.6
安裝的用戶: hadoop
zookeeper data目錄: /opt/zookeeper-3.4.6/zookeepertmp --需要手動創建
zookeeper tmp目錄: /opt/zookeeper-3.4.6/zookeepertmp/log --需要手動創建
三臺機器主機名: note01、note02、note03
解決:
報錯信息如下:
$ vi zookeeper.out 2019-03-31 22:48:53,422 [myid:] - INFO [main:QuorumPeerConfig@103] - Reading configuration from: /opt/zookeeper-3.4.6/bin/../conf/zoo.cfg 2019-03-31 22:48:53,447 [myid:] - INFO [main:QuorumPeerConfig@340] - Defaulting to majority quorums 2019-03-31 22:48:53,449 [myid:] - ERROR [main:QuorumPeerMain@85] - Invalid config, exiting abnormally org.apache.zookeeper.server.quorum.QuorumPeerConfig$ConfigException: Error processing /opt/zookeeper-3.4.6/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: /opt/zookeeper-3.4.6/zookeepertmp/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) ... 2 more Invalid config, exiting abnormally
1.網上反饋很多的是因為沒有創建myid文件以及配置文件配錯(尷尬,畢竟是新手);
2.從myid文件先入手,這個第一次啟動的時候確實沒有創建myid文件,分別在三臺機器創建myid文件并寫入機器id號
在note01創建myid
$ cd /opt/zookeeper-3.4.6/zookeepertmp
$ echo "1" > myid
在note02創建myid
$ cd /opt/zookeeper-3.4.6/zookeepertmp
$ echo "2" > myid
在note03創建myid
$ cd /opt/zookeeper-3.4.6/zookeepertmp
$ echo "3" > myid
3.把zookeeper data目錄下除了log文件夾和myid外其他的文件和文件夾刪除
$ rm zookeeper_server.pid -rf
$ rm zookeeper.out -rf
$ rm version-2 -rf
4.再檢查zoo.cfg文件是否配置正確
最后發現最后的
server.1=note2:2888:3888
server.2=note3:2888:3888
server.3=note4:2888:3888
前面的主機名錯誤,正確的應該是
server.1=note02:2888:3888
server.2=note03:2888:3888
server.3=note04:2888:3888
5.再次嘗試啟動zookeeper
分別在三臺機器執行啟動命令
$ zkServer.sh start
分別在三臺機器執行查看狀態命令
$ zkServer.sh status
6.居然還報錯,不應該啊!!!死馬當活馬醫,重啟一下機器
$ exit
# reboot
7.再次嘗試啟動zookeeper
分別在三臺機器執行啟動命令
$ zkServer.sh start
分別在三臺機器執行查看狀態命令
[hadoop@note03 zookeepertmp]$ zkServer.sh status
JMX enabled by default
Using config: /opt/zookeeper-3.4.6/bin/../conf/zoo.cfg
Mode: leader
[hadoop@note04 zookeepertmp]$ zkServer.sh status
JMX enabled by default
Using config: /opt/zookeeper-3.4.6/bin/../conf/zoo.cfg
Mode: follower
[hadoop@note02 zookeepertmp]$ zkServer.sh status
JMX enabled by default
Using config: /opt/zookeeper-3.4.6/bin/../conf/zoo.cfg
Mode: follower
看到這里證明zookeeper啟動正常,搞定!!!
看完上述內容,你們對啟動zookeeper報錯該怎么辦有進一步的了解嗎?如果還想了解更多知識或者相關內容,請關注億速云行業資訊頻道,感謝大家的支持。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。