zk伪集群部署
jdk 配置
# tar xf jdk-8u161-linux-x64.tar.gz -C /usr/local/
# vim /etc/profile.d/jdk.sh
export JAVA_HOME=/usr/local/jdk1.8.0_161
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH
# source /etc/profile.d/jdk.sh
zk伪集群配置
# mkdir /zk/{1,2,3}/{data,logs} -p
# tar xf zookeeper-3.4.10.tar.gz -C /zk/1
# tar xf zookeeper-3.4.10.tar.gz -C /zk/2
# tar xf zookeeper-3.4.10.tar.gz -C /zk/3
# cd /zk/1/zookeeper-3.4.10/conf/
# cp zoo_sample.cfg zoo.cfg
# vim zoo.cfg
tickTime=2000
initLimit=10
syncLimit=5
dataDir=/zk/1/data
dataLogDir=/zk/1/logs
clientPort=2181
server.1=192.168.10.60:2188:3188
server.2=192.168.10.60:2288:3288
server.3=192.168.10.60:2388:3388
#cd /zk/2/zookeeper-3.4.10/conf/
#cp zoo_sample.cfg zoo.cfg
#vim zoo.cfg
tickTime=2000
initLimit=10
syncLimit=5
dataDir=/zk/2/data
dataLogDir=/zk/2/logs
clientPort=2281
server.1=192.168.10.60:2188:3188
server.2=192.168.10.60:2288:3288
server.3=192.168.10.60:2388:3388
#cd /zk/3/zookeeper-3.4.10/conf/
#cp zoo_sample.cfg zoo.cfg
#vim zoo.cfg
tickTime=2000
initLimit=10
syncLimit=5
dataDir=/zk/3/data
dataLogDir=/zk/3/logs
clientPort=2381
server.1=192.168.10.60:2188:3188
server.2=192.168.10.60:2288:3288
server.3=192.168.10.60:2388:3388
#cd /zk/ #echo "1" > 1/data/myid
#echo "2" > 2/data/myid
#echo "3" > 3/data/myid
#cd 1/zookeeper-3.4.10/bin/
#./zkServer.sh start
#cd ../../../2/zookeeper-3.4.10/bin/
#./zkServer.sh start
#cd ../../../3/zookeeper-3.4.10/bin/
#./zkServer.sh start
# ss -lntp | grep java
LISTEN 0 50 ::ffff:192.168.10.60:3388 :::* users:(("java",pid=1484,fd=29))
LISTEN 0 50 :::36444 :::* users:(("java",pid=1439,fd=21))
LISTEN 0 50 :::2181 :::* users:(("java",pid=1404,fd=28))
LISTEN 0 50 :::37001 :::* users:(("java",pid=1484,fd=21))
LISTEN 0 50 :::2281 :::* users:(("java",pid=1439,fd=28))
LISTEN 0 50 :::2381 :::* users:(("java",pid=1484,fd=28))
LISTEN 0 50 ::ffff:192.168.10.60:2288 :::* users:(("java",pid=1439,fd=31))
LISTEN 0 50 :::38225 :::* users:(("java",pid=1404,fd=21))
LISTEN 0 50 ::ffff:192.168.10.60:3188 :::* users:(("java",pid=1404,fd=29))
LISTEN 0 50 ::ffff:192.168.10.60:3288 :::* users:(("java",pid=1439,fd=29))