第一次测验考试本身在Windows上搭建zk的集群,是在搭建单机zk的根本上操纵的。
单机时的zoo.cfg文件如下所示,可正常启动
# The number of milliseconds of each tick tickTime=2000 # The number of ticks that the initial # synchronization phase can take initLimit=10 # The number of ticks that can pass between # sending a request and getting an acknowledgement syncLimit=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 connect clientPort=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. # # #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:3887 server.2=localhost:2888:3888 server.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 abnormally org.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\\server1 2018-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 installation 2018-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 installation 2018-03-30 21:59:15,810 [myid:1] - INFO [ListenerThread:QuorumCnxManager$Listener@739] - My election bind port: localhost/127.0.0.1:3887 2018-03-30 21:59:15,817 [myid:1] - INFO [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:[email protected]] - LOOKING 2018-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
标签:
原文地点:https://www.cnblogs.com/mkcoding/p/8679244.html