今天搭建zookeeper observer,一直报以下错误
2017-09-01 09:37:04,103 [myid:6] - INFO [QuorumPeer[myid=6]/0.0.0.0:2181:ObserverZooKeeperServer@64] - syncEnabled =true
2017-09-01 09:37:04,103 [myid:6] - INFO [QuorumPeer[myid=6]/0.0.0.0:2181:Observer@67] - Observing /192.168.122.26:2888
2017-09-01 09:37:04,106 [myid:6] - INFO [QuorumPeer[myid=6]/0.0.0.0:2181:FileSnap@83] - Reading snapshot /data/bf/5.0-zookeeper/1/version-2/snapshot.500000000
2017-09-01 09:37:04,113 [myid:6] - WARN [QuorumPeer[myid=6]/0.0.0.0:2181:Learner@338] - Truncating log to get in sync with the leader 0x400000005
2017-09-01 09:37:04,113 [myid:6] - WARN [QuorumPeer[myid=6]/0.0.0.0:2181:QuorumPeer@775] - Unexpected exception
java.lang.NullPointerException
at org.apache.zookeeper.server.persistence.FileTxnLog.truncate(FileTxnLog.java:367)
at org.apache.zookeeper.server.persistence.FileTxnSnapLog.truncateLog(FileTxnSnapLog.java:259)
at org.apache.zookeeper.server.ZKDatabase.truncateLog(ZKDatabase.java:438)
at org.apache.zookeeper.server.quorum.Learner.syncWithLeader(Learner.java:340)
at org.apache.zookeeper.server.quorum.Observer.observeLeader(Observer.java:72)
at org.apache.zookeeper.server.quorum.QuorumPeer.run(QuorumPeer.java:773)
2017-09-01 09:37:04,113 [myid:6] - INFO [QuorumPeer[myid=6]/0.0.0.0:2181:Observer@137] - shutdown called
java.lang.Exception: shutdown Observer
at org.apache.zookeeper.server.quorum.Observer.shutdown(Observer.java:137)
at org.apache.zookeeper.server.quorum.QuorumPeer.run(QuorumPeer.java:777)
2017-09-01 09:37:04,113 [myid:6] - INFO [QuorumPeer[myid=6]/0.0.0.0:2181:ZooKeeperServer@441] - shutting down
2017-09-01 09:37:04,113 [myid:6] - INFO [QuorumPeer[myid=6]/0.0.0.0:2181:QuorumPeer@714] - LOOKING
2017-09-01 09:37:04,114 [myid:6] - INFO [QuorumPeer[myid=6]/0.0.0.0:2181:FastLeaderElection@815] - New election. My id = 6, proposed zxid=0x8000000000000000
删除就好了
rm -rf /data/bf/zookeeper/version-2/
补充
server.1=xxx:2888:3888
server.2=xxx:2888:3888
顺序不得乱。
你的答案