Install zookeeper cluster in CentOS 6.8 minimal version

Zookeeper I simply say here as

the first in zk first, close the firewall first! In the middle of the process, there is no permission, please execute the command to modify the permission.

First of all, the environment is still CentOS6.8 minimal, and I am going to build three zk machines. Why is it an odd number? Please Baidu by yourself. Because it is a minimal system

, 1. You need to install jdk first. The steps to install jdk are in my article on installing maven private service ( http://287746074.iteye.com/blog/2341697 ).

2. Next, download the zookeeper package, which is the mirror image of Tsinghua University on the zookeeper official website: ( https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3.4.9/zookeeper-3.4.9 .tar.gz ), after downloading, I extracted it to the opt folder, and now my zk directory is /opt/zookeeper-3.4.9.
After unzipping.

3. Enter the /opt/zookeeper-3.4.9/conf directory, execute "cp zoo_sample.cfg zoo.cfg", that is, copy the file, zk will load the zoo.cfg file.

4. Edit vi to enter the zoo.cfg file, and modify the following content:
dataDir=/opt/zookeeper-data
dataLogDir=/opt/zookeeper-log
clientPort=2181
server.1=192.168.10.232:2888:3888
server.2=192.168.10.233:2888:3888
server.3=192.168.10.234:2888:3888 For
the detailed configuration of cluster commands, I also refer to this article http://blog.csdn.net/zhll3377/article/ details/45041691

5. Take a look at the configuration path of dataDir in step 4. Under this configuration path, create a file whose full name is "myid", and only write a number in it, which is what you configured in the fourth step The 1 of server.1 should be consistent. For example, if I configure zk on the machine 192.168.10.232, then 1 should be written in the myid file of this machine, which should correspond to the configuration above in step 4.

6. Enter the bin directory /opt/zookeeper-3.4.9/bin, execute the startup command "./zkServer.sh start", and start them on the three machines respectively. You will be surprised to find that there are displays such as "leader, Follower", this is zk's Master election.

7. If there is a problem, still look at the log, OK, end.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326863221&siteId=291194637