14. zookeeper部署

1.配置java

cd /opt/src/ && wget http://file.zhidianjh.com/k8s/day3/jdk-8u221-linux-x64.tar.gz
mkdir /usr/java && tar xf jdk-8u221-linux-x64.tar.gz -C /usr/java/
ln -s /usr/java/jdk1.8.0_221/ /usr/java/jdk

 vim /etc/profile
export JAVA_HOME=/usr/java/jdk
export PATH=$JAVA_HOME/bin:$JAVA_HOME/bin:$PATH
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar

source /etc/profile
java -version

2.部署zk集群

wget http://file.zhidianjh.com/k8s/day3/zookeeper-3.4.14.tar.gz
mkdir -pv /data/zookeeper/data /data/zookeeper/logs
 tar xf zookeeper-3.4.14.tar.gz -C /opt/
ln -s /opt/zookeeper-3.4.14/ /opt/zookeeper
cd /opt/zookeeper/conf
mv zoo_sample.cfg zoo_sample.cfg_bak

vim zoo.cfg
tickTime=2000
initLimit=10
syncLimit=5
dataDir=/data/zookeeper/data
dataLogDir=/data/zookeeper/logs
clientPort=2181
server.1=zk1.od.com:2888:3888
server.2=zk2.od.com:2888:3888
server.3=zk3.od.com:2888:3888

cat /data/zookeeper/data/myid 
1

3.启动集群,查看集群配置

./zkServer.sh start
./zkServer.sh status
上一篇:分布式Zookeeper-基础


下一篇:Zookeeper技术:分布式架构详解、分布式技术详解、分布式事务