Deploy zookeeper distributed nodes
Deploy 3 zookeeper distributed nodes with 2 servers and low resources:
1. Prepare the environment
The system has been configured with the JAVA environment
Download a version of the zookeeper package
Download link: http://apache.claz.org/zookeeper/zookeeper-3.5.3-beta/zookeeper-3.5.3-beta.tar.gz
2. Planning
Server A, deploy 1 instance
Server B, deploy 2 instances
3. We configure three services, and a distributed cluster requires at least three instance services. The configuration information is as follows:
Create a new data directory for each service log
Server A:
/ opt/local/zookeeper/zk, create data and logs, create a new myid in data, and write 3 in it
Server B:
/ opt/local/zookeeper/zk1, create data and logs, create a new myid in data, and write 2 in it
/ opt/local/zookeeper/zk2, create a new data and logs, create a new myid in data, and write 1 in it
4. Configuration file directory / opt/local/zookeeper-3.4.10/conf
Create 3 new profiles for
Server A: zoo.cfg
Server B: zoo1.cfg, zoo2.cfg
The ports are 2181 2182 2183 respectively
TickTime=2000initLimit=10syncLimit=5dataDir=/opt/local/zookeeper/zk/dataclientPort=2181dataLogDir=/opt/local/zookeeper/zk/logsserver.1=IP1:2287:3387server.2=IP2:2288:3388server.3=IP2:2289:3389
First explain the meaning of server.x=A:B:C:
X: represents the contents of the myid under the dataDir used by each service instance
A: the IP address of the machine where the peer service resides
B: leader election port (all ports should not be the same in pseudo-distributed environment)
C: the port of communication between zk servers and the synchronization information between servers
5 、
Start three services:
Bin/zkServer.sh start conf/zoo.cfg bin/zkServer.sh start conf/zoo1.cfg bin/zkServer.sh start conf/zoo2.cfg
View service status:
# Mode: followerbin/zkServer.sh status conf/zoo.cfg # Mode: leaderbin/zkServer.sh status conf/zoo1.cfg # Mode: followerbin/zkServer.sh status conf/zoo2.cfg