The installation process and testing of Zookeeper under Windows and the problems encountered

The installation process and test of Zookeeper under Windows

  1. install jdk
  2. Install Zookeeper. Download zookeeper from the official website http://zookeeper.apache.org/ . I downloaded the zookeeper-3.4.6 version.
  3. Unzip zookeeper-3.4.6 to D:\machine\zookeeper-3.4.6.
  4. Create new data and log directories in D:\machine.
  5. There are three installation modes of ZooKeeper: stand-alone mode, cluster mode and cluster pseudo-distribution mode. The installation of ZooKeeper stand-alone mode is relatively simple. If you are new to ZooKeeper, it is recommended to install ZooKeeper stand-alone mode or cluster pseudo-distributed mode.
  6. Install click mode. Copy zoo_sample.cfg to D:\machine\zookeeper-3.4.6\conf and paste it into the current directory, name it zoo.cfg.
  7. Edit zoo.cfg. Modify the following configuration
    write picture description here
  8. Enter the D:\machine\zookeeper-3.4.6\bin directory under the cmd command to run zkserver.cmd. As shown in the following figure:
    write picture description here
  9. After the startup is completed, under the cmd command, netstat-ano checks the port monitoring service.
  10. Enter D:\machine\zookeeper-3.4.6\bin under cmd and run zkcli.cmd. As shown in the following figure:
    write picture description here
  11. Install cluster pseudo-distributed mode.
  12. Modify the zoo.cfg file. As shown in the following figure:
    write picture description here
    Save as zoo-1.cmd.
    write picture description here
    Save as zoo-2.cmd.
    write picture description here
    Save as zoo-3.cmd.
  13. Modify the zkserver.cmd file. As shown in the following figure:
    write picture description here
    Save as zkserver-1.cmd and
    write picture description here
    save as zkserver-2.cmd and
    write picture description here
    save as zkserver-3.cmd.
  14. Run zkserver-1.cmd, zkserver-2.cmd, zkserver-3.cmd respectively under cmd.
  15. Run netstar-ano under cmd to view the port listening status.
  16. cmd下运行zkcli.cmd -server:localhost:2181;zkcli.cmd ;-server:localhost:2182;zkcli.cmd -server:localhost:2183.
  17. The connection between zookeeper and java
    write picture description here
    Single machine connection:
    write picture description here
    cluster connection:
    write picture description here

 

 

 

Problems encountered during deployment, zookeeper cannot be started normally

Today, in order to free up space, I killed the zookeeper process, but I didn't expect it to start after killing.

Prompt to start normally

[root@lnx-a-11 bin]# ./zkServer.sh start
JMX enabled by default
Using config: /home/tester/zookeeper/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@lnx-air-9-27 bin]# ps aux |grep zook

But look at the background process no

Check the zookeeper.out log, there are the following tips:

2015-12-31 17:32:04,090 [myid:] - ERROR [main:QuorumPeerMain@85] - Invalid config, exiting abnormally
org.apache.zookeeper.server.quorum.QuorumPeerConfig$ConfigException: Error processing /home/tester/zookeeper/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: /tmp/zookeeper/data/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)

 

The prompt is obvious /tmp/zookeeper/data/myid file is missing

I found that there is no myid file in this directory. Everyone knows that the /tmp folder is a temporary directory, and the files in it are likely to be deleted after a period of time.

Check the /etc/cron.daily/tmpwatch file and display the following

#! /bin/sh
flags=-umc
/usr/sbin/tmpwatch "$flags" -x /tmp/.X11-unix -x /tmp/.XIM-unix \
    -x /tmp/.font-unix -x /tmp/.ICE-unix -x /tmp/.Test-unix \
    -X '/tmp/hsperfdata_*' 10d /tmp
/usr/sbin/tmpwatch "$flags" 30d /var/tmp
for d in /var/{cache/man,catman}/{cat?,X11R6/cat?,local/cat?}; do
    if [ -d "$d" ]; then
    /usr/sbin/tmpwatch "$flags" -f 30d "$d"
    fi
done

 

It can be known that the contents of the /tmp file will be cleared once every 10 days except for the set file.

So we shouldn't put myid under /tmp or exclude this file from cleanup

 

Add the myid file, modify the data directory in zoo.cfg, start again, and start successfully

[root@lnx-a-11 bin]# ps aux |grep zook
root     21869 24.7  0.8 2584892 35100 pts/2   Sl   17:54   0:01 java -Dzookeeper.log.dir=/home/tester/zookeeper/bin/../logs -Dzookeeper.root.logger=INFO,CONSOLE -cp /home/tester/zookeeper/bin/../build/classes:/home/tester/zookeeper/bin/../build/lib/*.jar:/home/tester/zookeeper/bin/../lib/slf4j-log4j12-1.6.1.jar:/home/tester/zookeeper/bin/../lib/slf4j-api-1.6.1.jar:/home/tester/zookeeper/bin/../lib/netty-3.7.0.Final.jar:/home/tester/zookeeper/bin/../lib/log4j-1.2.16.jar:/home/tester/zookeeper/bin/../lib/jline-0.9.94.jar:/home/tester/zookeeper/bin/../zookeeper-3.4.6.jar:/home/tester/zookeeper/bin/../src/java/lib/*.jar:/home/tester/zookeeper/bin/../conf: -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=false org.apache.zookeeper.server.quorum.QuorumPeerMain /home/tester/zookeeper/bin/../conf/zoo.cfg
root     21948  0.0  0.0 103252   808 pts/2    D+   17:55   0:00 grep zook

 

 

 

 

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324937957&siteId=291194637