ZooKeeper installation

The JDK must be configured before zookeeper installation

JDK version: 1.8

zookeeper version: 3.4

zookeeper has the function of supervising the working status of the cluster, It does not have to be installed with the node you are monitoring. It is lightweight. It is often used to monitor the status of multiple machines in big data environments such as hadoop, hbase, and hive.

1. Download the zookeeper installation package , Unzip

2. Copy /conf/zoosample.cfg to zoo.cfg file, configuration file content

dataDir=/data/local/zookeeper/zkdata //data data storage dataLogDir=/data/local/zookeeper/zkdataLog //log data storage server.1=192.168.4.187:2888:3888 //three zookeepers Server server.2=192.168.4.188:2888:3888server.3=192.168.4.193:2888:3888

3. Create data and log data storage folders

< p>4. Create a file myid under the data folder —>only one data is stored in myid, corresponding to the server 1,2,3 of the above configuration file

  Take mine as an example: 192.168. The myid file of 4.187 is 1

         192.168.4.188 is 2 in the myid file of 192.168.4.188

         and so on

   Send to each machine keeper

   p>

5. Open port 2181. Zookeeper’s default connection port is 2181. In order to ensure zookeeper communication, this port must be open.

6. Configure environment variables

  export ZOOKEEPER_HOME= /data/local/zookeeper

  export PATH=$PATH:${ZOOKEEPER_HOME}/bin

  source /etc/profile //Enable environment variables to take effect

7. If the environment variable is generated If the environment variable is not configured or not effective, enter the zookeeper/bin file to execute

  zkServer.sh start Start your zookeeper machines separately

  zkServer.sh status Check the startup status– >Under normal circumstances there is one leader and multiple followers

  zkSever.sh stop shutting down zookeeper

8. The status error after startup is that zookeeper may not be running

  1 .Check the configuration file myid

  2. Check your open ports

dataDir=/data/ local/zookeeper/zkdata //data data storage dataLogDir=/data/local/zookeeper/zkdataLog //log data storage server.1=192.168.4.187:2888:3888 //three zookeeper servers server.2=192.168.4.188: 2888:3888server.3=192.168.4.193:2888:3888

Leave a Comment

Your email address will not be published.