ZooKeeper Cluster Installation Configuration Start

One. Preparation

1. Install three virtual machines in VMware;

2. Three machines/etc/hosts They are luxiangzhou1(192.168.200.101), luxiangzhou2(192.168.200.102, luxiangzhou3(192.168.200.103);

3, SSH can be accessed without login;

4, install jdk (jdk_1.6.0_45);

5, decompress zookeeper to /user/java directory (zookeeper-3.3.6);

p>

6. Rename the /usr/java/zookeeper-3.3.6/conf/zoo_sample.cfg file under the three machines to zoo.cfg;

7. Change dataDir in zoo.cfg file to /usr/java/zookeeper/data;

Add server.1=luxiangzhou1:2888:3888
server.2=luxiangzhou2:2888:3888
server.3=luxiangzhou3:2888:3888

6. Create a /usr/java/zookeeper folder to store zookeeper data;

Create data and log folders under the /usr/java/zookeeper folder;

Create a myid file under the /usr/java/zookeeper/data folder, pay attention to the myid content and zoo.cfg configuration The id of server.id=host:port:port in the file is the same;

Second, start zookeeper

Start zookeeper: /usr/java/zookeeper-3.3.6/bin/zkServer.sh start

Close zookeeper: /usr/java/zookeeper-3.3.6/bin/zkServer.sh stop

Check if the role of zookeeper is leader or follower: /usr/java/zookeeper-3.3.6/bin/zkServer.sh status

Check whether zookeeper has started successfully: jps, see if Contains QuorumPeerMain process

View zookeeper startup log: /usr/java/zookeeper-3.3.6/bin/zookeeper.out

3. Zookeeper startup error

zookeeper startup error 1: Create /usr/java/zookeeper/daya/myid file [root@luxiangzhou1 bin]# more zookeeper.out 2017- 10-10 14:00:59,143-INFO [main:QuorumPeerConfig@90]-Reading configuration from: /usr/java/zookeeper-3.3.6/bin/../conf/zoo.cfg 2017-10-10 14: 00:59,148-INFO [main:QuorumPeerConfig@310]-Defaulting to majority quorums 2017-10-10 14:00:59,149-FATAL [main:QuorumPeerMain@83]-Invalid config, exiting abnormally org.apache.zookeeper.server.quorum.QuorumPeerConfig$ConfigException: Error processing /usr/java/zookeeper- 3.3.6/bin/../conf/zoo.cfg at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:110) at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun( QuorumPeerMain.java:99) at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:76) Caused by: java.lang.IllegalArgumentException: /usr/java/zookeeper/data/myid file is missing at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parseProperties(QuorumPeerConfig.java:320) at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:106) … 2 more Invalid config, exiting abnormally zookeeper startup error 2: modify the content in /usr/java/zookeeper/daya/myid to 1, note that the content of myid in the cluster is consistent with the id of server.id=host:port:port in the zoo.cfg configuration file [root@luxiangzhou1 bin]# more zookeeper.out 2017-10-10 14:1 7:59,146-INFO [main:QuorumPeerConfig@90]-Reading configuration from: /usr/java/zookeeper-3.3.6/bin/../conf/zoo.cfg 2017-10-10 14:17:59,150-INFO [main:QuorumPeerConfig@310]-Defaulting to majority quorums 2017-10-10 14:17:59,151-FATAL [main:QuorumPeerMain@83]-Invalid config, exiting abnormally org.apache.zookeeper.server.quorum.QuorumPeerConfig$ConfigException : Error processing /usr/java/zookeeper-3.3.6/bin/../conf/zoo.cfg at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:110) at org.apache. zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:99) at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:76) Caused by: java.lang.IllegalArgumentException: serverid null is not a number at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parseProperties(QuorumPeerConfig.java:333) at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:106) … 2 more Invalid config, exiting abnormally zookeeper startup error 3: each machine in the cluster needs to sense which machines the entire cluster is composed of. In the configuration file, you can write one machine configuration per line in this format: server.id=host: port:port. About this id, we call it Server ID, which identifies the machine serial number of the host machine in the cluster. On each ZK machine, we need to create it in the data directory (the data directory is the directory specified by the dataDir parameter) A myid file, the server ID number in myid. 2017-10-10 22:30:29,410-WARN [Thread-34:QuorumCnxManager$SendWorker@642]-Send worker leaving thread 2017-10-10 22:30:56,106-WARN [Thread-37:QuorumCnxManager$RecvWorker@727 ]-Connection broken for id 1, my id = 1, error = java.io.IOException: Channel eof 2017-10-10 22:30:56,107-WARN [Thread-37:QuorumCnxManager$RecvWorker@730]-Interrupting SendWorker 2017 -10-10 22:30:56,108-WARN [Thread-36:QuorumCnxManager$SendWorker@633]-Interrupted while waiting for message on queue java.lang.InterruptedException at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait( AbstractQueuedSynchronizer.java:1961) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2038) at java.util.concurrent.ArrayBlockingQueue.poll(ArrayBlockingQueue.java:347) at org.apache.zookeeper .server.quorum.QuorumCnxManager$SendWorker.run(QuorumCnxManager.java:622)

Leave a Comment

Your email address will not be published.