One of the Dubbo distributed environment series: installation and configuration of the distributed registry ZooKeeper

1. Preparation

1. VMware Workstation installs three virtual machines with Centos 6.5, the IP is as follows:

192.168.2.137
192.168.2.138
192.168.2.139

2. Use the sftp of Xshell 5 to upload the following files to the three virtual machines:

jdk-7u80-linux-x64.tar.gz
zookeeper-3.4.6.tar.gz

2. Install and configure JDK on three virtual machines respectively

For the specific installation and configuration process, please refer to the blog ( one of the CI series: JDK installation and configuration )

3. Open firewall ports 2181, 2888 and 3888 on the three virtual machines respectively

For the specific process of opening the port, please refer to the detailed process of opening port 3306 in the blog ( CI Series II: MySQL Installation and Configuration ).

4. Install, configure and test the distributed registry ZooKeeper on three virtual machines respectively

1. Move sonarqube-5.6.6.zip to the installation directory

# mv zookeeper-3.4.6.tar.gz /usr/local

2. Switch to the installation directory

# cd /usr/local 

4. Unzip the tar.gz

# tar -zxvf zookeeper-3.4.6.tar.gz

5. Switch to the ZooKeeper root directory

# cd zookeeper-3.4.6

6. Create folders data (data) and logs (logs) respectively

# mkdir data
# mkdir logs

7. Modify the configuration file:

# cd conf //切换到配置文件目录
# cp zoo_sample.cfg zoo.cfg // 复制配置文件
# vi zoo.cfg //修改配置文件内容如下:
dataDir=/usr/local/zookeeper-3.4.6/data
dataLogDir=/usr/local/zookeeper-3.4.6/logs
server.1=192.168.2.137:2888:3888
server.2=192.168.2.138:2888:3888
server.3=192.168.2.139:2888:3888

8. Configure the corresponding service id for the three hosts

# cd /usr/local/zookeeper-3.4.6/data/
# vi myid
1 // IP为192.168.2.137的虚拟机的配置内容
2 // IP为192.168.2.138的虚拟机的配置内容
3 // IP为192.168.2.139的虚拟机的配置内容

9. Start the ZooKeeper service of the three virtual machines in sequence, the leader will be automatically elected, and the remaining two are followers

# cd /usr/local/zookeeper-3.4.6/bin
# ./zkServer.sh start

10. The display information of successful test is as follows

# ./zkServer.sh status
#192.168.2.137和192.168.2.138均为follower,显示内容一致,如下:
JMX enabled by default
Using config: /usr/local/zookeeper-3.4.6/bin/../conf/zoo.cfg
Mode: follower
#192.168.2.139被推选为leader,显示内容如下:
JMX enabled by default
Using config: /usr/local/zookeeper-3.4.6/bin/../conf/zoo.cfg
Mode: leader

Guess you like

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