標籤:localhost radmin 絕對路徑 zookeeper incr window local str ISE
第一次嘗試自己在Windows上搭建zk的叢集,是在搭建單機zk的基礎上操作的。
單機時的zoo.cfg檔案如下所示,可正常啟動
# The number of milliseconds of each ticktickTime=2000# The number of ticks that the initial # synchronization phase can takeinitLimit=10# The number of ticks that can pass between # sending a request and getting an acknowledgementsyncLimit=5# the directory where the snapshot is stored.# do not use /tmp for storage, /tmp here is just # example sakes.dataDir=D:\Software\zookeeper\zk_data\server1# the port at which the clients will connectclientPort=2181# the maximum number of client connections.# increase this if you need to handle more clients#maxClientCnxns=60## Be sure to read the maintenance section of the # administrator guide before turning on autopurge.## http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance## The number of snapshots to retain in dataDir#autopurge.snapRetainCount=3# Purge task interval in hours# Set to "0" to disable auto purge feature#autopurge.purgeInterval=1
View Code
複製三個節點,增加對應的叢集配置
server.1=localhost:2887:3887server.2=localhost:2888:3888server.3=localhost:2889:3889
啟動
果然報錯了……
去掉server1=local...server2...server3...又可以正常啟動,仔細檢查了那三行配置也沒有多餘的空格……為此還在sublime中配置了
"draw_white_space": "all"
百思不得其解,突然想起來log檔案裡應該會有額外的資訊吧……
果不其然
2018-03-30 21:38:13,591 [myid:] - ERROR [main:[email protected]] - Invalid config, exiting abnormallyorg.apache.zookeeper.server.quorum.QuorumPeerConfig$ConfigException: Error processing D:\Software\zookeeper\zookeeper-3.4.10-1\bin\..\conf\zoo.cfg at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:154) 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: D:Softwarezookeeperzk_dataserver1\myid file is missing at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parseProperties(QuorumPeerConfig.java:406) at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:150) ... 2 more
快照日誌、交易記錄根據以下路徑是可以正常儲存的
dataDir=D:\Software\zookeeper\zk_data\server1
叢集尋找myid檔案就gg了……會把"\"當做是轉義符處理,所以路徑錯誤,找不到myid檔案從而啟動失敗,修改該路徑後重新啟動一切正常 // todo 明天看源碼查一查兩者處理方式
dataDir=D:\\Software\\zookeeper\\zk_data\\server12018-03-30 21:59:15,784 [myid:1] - INFO [main:[email protected]] - currentEpoch not found! Creating with a reasonable default of 0. This should only happen when you are upgrading your installation2018-03-30 21:59:15,799 [myid:1] - INFO [main:[email protected]] - acceptedEpoch not found! Creating with a reasonable default of 0. This should only happen when you are upgrading your installation2018-03-30 21:59:15,810 [myid:1] - INFO [ListenerThread:QuorumCnxManager$Listener@739] - My election bind port: localhost/127.0.0.1:38872018-03-30 21:59:15,817 [myid:1] - INFO [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:[email protected]] - LOOKING2018-03-30 21:59:15,819 [myid:1] - INFO [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:[email protected]] - New election. My id = 1, proposed zxid=0x0
Ps:zookeeper日誌修改需改動log4j.properties的zookeeper.root.logger和zkEnv.cmd中的ZOO_LOG4J_PROP,預設是CONSOLE,我都改成了ROLLINGFILE了
log路徑需要修改zkEnv.cmd中的ZOO_LOG_DIR。
log4j.properties中的zookeeper.log.dir=. 表示命令所在的路徑 // todo 初步估計zkEnv.cmd中不修改,此處改為絕對路徑應該也是可以的,明天驗證
明天正常上班~goodnight
剛剛發郵件給部落格園登出了一個不用的帳號,後台提供支援服務的tx也是蠻辛苦的~
加油!
windows搭建zookeeper叢集報錯之Invalid config, exiting abnormally