CentOS7安装Zookeeper伪集群
程序员文章站
2022-03-22 17:34:00
...
准备
1. 服务器上先安装好JDK
安装zookeeper单机版
cd /opt wget https://archive.apache.org/dist/zookeeper/zookeeper-3.4.14/zookeeper-3.4.14.tar.gz tar -xzhf ./zookeeper-3.4.14.tar.gz cp /zookeeper-3.4.14/zoo_sample.cfg .//zookeeper-3.4.14/zoo.cfg
安装zookeeper集群
cd /opt mkdir zookeeper_cluster cd zookeeper_cluster cp -fr /opt/zookeeper-3.4.14 /opt/zookeeper_cluster/1 cp -fr /opt/zookeeper-3.4.14 /opt/zookeeper_cluster/2 cp -fr /opt/zookeeper-3.4.14 /opt/zookeeper_cluster/3 mkdir -p /opt/zookeeper_cluster/1/data mkdir -p /opt/zookeeper_cluster/1/log sed -i 's/dataDir=.*/dataDir=\/opt\/zookeeper_cluster\/1\/data/g' ./1/conf/zoo.cfg echo 'dataLogDir=/opt/zookeeper_cluster/1/log' >> ./1/conf/zoo.cfg sed -i 's/clientPort=2181/clientPort=2181/g' ./1/conf/zoo.cfg echo 'server.1=192.168.0.180:2881:3881' >> ./1/conf/zoo.cfg echo 'server.2=192.168.0.180:2882:3882' >> ./1/conf/zoo.cfg echo 'server.3=192.168.0.180:2883:3883' >> ./1/conf/zoo.cfg echo '4lw.commands.whitelist=*' >> ./1/conf/zoo.cfg echo '1' > ./1/data/myid mkdir -p /opt/zookeeper_cluster/2/data mkdir -p /opt/zookeeper_cluster/2/log sed -i 's/dataDir=.*/dataDir=\/opt\/zookeeper_cluster\/2\/data/g' ./2/conf/zoo.cfg echo 'dataLogDir=/opt/zookeeper_cluster/2/log' >> ./2/conf/zoo.cfg sed -i 's/clientPort=2181/clientPort=2182/g' ./2/conf/zoo.cfg echo 'server.1=192.168.0.180:2881:3881' >> ./2/conf/zoo.cfg echo 'server.2=192.168.0.180:2882:3882' >> ./2/conf/zoo.cfg echo 'server.3=192.168.0.180:2883:3883' >> ./2/conf/zoo.cfg echo '4lw.commands.whitelist=*' >> ./2/conf/zoo.cfg echo '2' > ./2/data/myid mkdir -p /opt/zookeeper_cluster/3/data mkdir -p /opt/zookeeper_cluster/3/log sed -i 's/dataDir=.*/dataDir=\/opt\/zookeeper_cluster\/3\/data/g' ./3/conf/zoo.cfg echo 'dataLogDir=/opt/zookeeper_cluster/3/log' >> ./3/conf/zoo.cfg sed -i 's/clientPort=2181/clientPort=2183/g' ./3/conf/zoo.cfg echo 'server.1=192.168.0.180:2881:3881' >> ./3/conf/zoo.cfg echo 'server.2=192.168.0.180:2882:3882' >> ./3/conf/zoo.cfg echo 'server.3=192.168.0.180:2883:3883' >> ./3/conf/zoo.cfg echo '4lw.commands.whitelist=*' >> ./3/conf/zoo.cfg echo '3' > ./3/data/myid
启动脚本
#!/bin/bash cd /opt/zookeeper_cluster ./1/bin/zkServer.sh start ./2/bin/zkServer.sh start ./3/bin/zkServer.sh start
关闭脚本
#!/bin/bash cd /opt/zookeeper_cluster ./1/bin/zkServer.sh stop ./2/bin/zkServer.sh stop ./3/bin/zkServer.sh stop
上一篇: DateJS - 聪明的日期选择器
下一篇: header组件的使用方法
推荐阅读
-
Spark新手入门——2.Hadoop集群(伪分布模式)安装
-
Springboot 2.0.x 集成基于Centos7的Redis集群安装及配置
-
Zookeeper的安装与集群搭建
-
zookeeper-3.6.1集群环境安装
-
Springboot 1.5.x 集成基于Centos7的RabbitMQ集群安装及配置
-
Centos7安装Hadoop-- 伪分布式配置
-
Centos7下Apache Hadoop 3.2.1伪分布式部署安装
-
CentOS 6.8 minimal版本安装zookeeper集群
-
centos7安装部署clickhouse集群
-
Docker下安装zookeeper(单机和集群)