安装 zookeeper

cd zookeeper-3.4.8

cp -r * /zookeeper/server1/

cp -r * /zookeeper/server2/

cp -r * /zookeeper/server3/

 

在之前设置的dataDir中新建myid文件, 写入一个数字, 该数字表示这是第几号server. 该数字必须和zoo.cfg文件中的server.X中的X一一对应.


/zookeeper/server1/data/myid文件中写入1, 

/zookeeper/server2/data/myid文件中写2, 

/zookeeper/server3/data/myid文件中写入3.


redis01:/zookeeper/server1/data# cd /zookeeper/
redis01:/zookeeper# ls -ltr
total 12
drwxr-xr-x 4 root root 4096 Apr  5 09:46 server1
drwxr-xr-x 3 root root 4096 Apr  5 09:54 server2
drwxr-xr-x 3 root root 4096 Apr  5 09:54 server3




redis01:/zookeeper/server3/conf# cat /zookeeper/server1/conf/zoo.cfg 
# 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=/zookeeper/server1/data
dataLogDir=/zookeeper/server1/logs
# the port at which the clients will connect
clientPort=2181
server.1=127.0.0.1:2888:3888


redis01:/zookeeper/server3/conf# cat /zookeeper/server2/conf/zoo.cfg 
# 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=/zookeeper/server2/data
dataLogDir=/zookeeper/server2/logs
# the port at which the clients will connect
clientPort=2182
server.2=127.0.0.1:2889:3889


redis01:/zookeeper/server3/conf# cat /zookeeper/server3/conf/zoo.cfg 
# 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=/zookeeper/server3/data
dataLogDir=/zookeeper/server3/logs
# the port at which the clients will connect
clientPort=2183
server.3=127.0.0.1:2890:3890

你可能感兴趣的:(安装 zookeeper)