Zookeeper Clustered (Multi-Server) Deployment

Environmental convention:

system os: centos 6
java version: "1.8.0_191"
zookeeper version: 3.4.13
zookeeper1 ip: 192.168.10.101
zookeeper2 ip: 192.168.10.102
zookeeper3 ip: 192.168.10.103
zookeeper_prefix: /data/opt/zookeeper-3.4.13
zookeeper_data_dir: /data/zookeeper
zookeeper_conf_dir: $zookeeper_prefix /conf

Preparation:

1. Unzip the downloaded zookeeper-3.4.13.tar.gz to the /data/opt directory

tar zxf zookeeper -3.4.13.tar.gz -C /data/opt/

2. Create a java environment variable file
vim $zookeeper_prefix/conf/java.env

JAVA_HOME= "/DATA/opt/jdk1.8.0_191"

3. Create a configuration file
vim $zookeeper_prefix/conf/zoo.cfg

tickTime=2000
initLimit =5
syncLimit=2
dataDir=/data/zookeeper
dataLogDir=/data/logs/zookeeper
clientPort=2181
server.1=192.168.10.101: 2888:3888
server.2=192.168.10.102:2888:3888
server.3=192.168.10.103:2888:3888

4. Create zookeeper data and log directory

p>

mkdir /data/zookeeper
mkdir /data/logs/zookeeper

! Perform the same operations on both hosts to ensure the configuration is consistent

5. Create a myid file
The myid file type is a text file, and the content is a unique id in the cluster, and the value is between 1 and 255.
The myid of the server.1 host is ‘1’, the myid of the server.2 host is ‘2’ and the rest can be deduced by analogy.
vim /data/zookeeper/myid

1

6. Start service instance

/data/opt/zookeeper-3.4.13/bin/ zkServer.sh start
  1. Execute commands on the three hosts to verify the status
    /data/opt/zookeeper-3.4.13/bin/zkServer.sh status< /pre> 

    Similar to the following output

    ZooKeeper JMX enabled by default
    Using config: /data/opt/zookeeper-3.4.13/bin/../conf/zoo.cfg< br />Mode: follower

Cluster considerations

To create a deployment that can tolerate F host failures, calculate the number of cluster hosts The method is 2×F+1. Therefore, a cluster composed of three hosts can tolerate one host failure, while five hosts can handle two host failures.
The zookeeper cluster usually consists of an odd number of hosts.

Reference materials

https://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_zkMulitServerSetup

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 4760 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.