Cluster deployment steps of zookeeper

1. Use WinSCP to remotely record three servers

2. Use XShell5 to connect to three servers respectively, and use commands to perform remote operations on them

3. Create zookeeper folders under the three servers respectively

        mkdir zookeeper

4. Download zookeeper-3.4.10 on three servers respectively (or download on one service, and then copy to the other two), and decompress them. The names are zookeeper-3.4.10_1, ookeeper-3.4.10_2, ookeeper -3.4.10_3

       tar -czvf zookeeper-3.4.10.tar.gz ./zookeeper-3.4.10_1

5. Locate the conf path and create the file zoo.cfg

       cd zookeeper-3.4.10_1/conf/ (same for the other two)

       touch zoo.cfg

6. Create a data folder under zookeeper-3.4.10_1, zookeeper-3.4.10_3, zookeeper-3.4.10_3, and create a logs folder under the data folder

       cd ../ (same for the other two)

       mkdir data

       cd data

       mkdir logs

Seven, modify the contents of the three zoo.cfg respectively

# The number of milliseconds of each tick

tickTime =2000
# The number of ticks that the initial
# synchronization phase can take
initLimit = 10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just 
# example sakes.
dataDir=/home/softwares/zookeeper/zookeeper-3.4.10_1/data  
dataLogDir=/home/softwares/zookeeper/zookeeper-3.4.10_1/data/logs
# the port at which the clients will connect
clientPort=2181
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# Be sure to read the maintenance section of the
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
# autopurge.purgeInterval = 1
server.1=0.0.0.0:2888:3888
server.2=180.76.234.29:4888:5888
server.3=180.76.234.29:6888:788

1) Modify the paths of dataDir and dataLogDir to actual paths respectively

2) Since the three servers are deployed on different machines, their port numbers clientPort can be set to the same or different.

3) server.X=A:B:C where

   X: is a number, indicating which server this is

   A: is the IP address where the server is located, write the IP addresses of the three servers respectively

     B: Configure the port used by the server to exchange information with the leader in the cluster. Since the three servers are deployed on different machines, they can be set to the same or different

     C: Configure the port used to elect the leader. Since the three servers are deployed on different machines, they can be set to the same or different

8. Create myid under the paths of /zookeeper-3.4.10_1/data, /zookeeper-3.4.10_2/data, and /zookeeper-3.4.10_3/data, and write 1, 2, and 3 in the file respectively.

     touch myid

9. Enter the /zookeeper-3.4.10_1/bin, /zookeeper-3.4.10_2/bin, and /zookeeper-3.4.10_3/bin directories respectively, and enter the command: ./zkServer.sh start to start the server. Use the ./zkServer.sh status command to view the running status of the three servers. Use the ./zkServer.sh stop command to stop the server from running.

      

Guess you like

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