部署zookeeper集群

zookeeper和jdk下载地址

jdk

链接:https://pan.baidu.com/s/13GpNaAiHM5HSDJ66ebBtEg

提取码:90se

zookeeper

链接:https://pan.baidu.com/s/1nSFKEhSGNiwgSPZWdb7hkw

提取码:u5l2

在所有的机器上面执行下面步骤:

1.上传zookeeper和jdk, /opt/soft/

2.解压jdk和zookeeper

tar xf xxxx

3.配置jdk环境变量:

vi /etc/profile

export JAVA_HOME=/opt/soft/jdk/jdk1.8.0_181

export PATH=JAVA_HOME/bin/:PATH

然后source /etc/profile

java -version看能否打印正确信息

4.配置zookeeper, /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=/opt/soft/zookeeper-3.4.13/data
dataLogDir=/opt/soft/zookeeper-3.4.13/datalog

the port at which the clients will connect

clientPort=2181

the maximum number of client connections.

increase this if you need to handle more clients

#maxClientCnxns=60

Be sure to read the maintenance section of the

administrator guide before turning on autopurge.

http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance

The number of snapshots to retain in dataDir

#autopurge.snapRetainCount=3

Purge task interval in hours

Set to "0" to disable auto purge feature

#autopurge.purgeInterval=1
server.1=10.192.126.144:2888:3888
server.2=10.192.126.145:2888:3888
server.3=10.192.126.146:2888:3888
server.4=10.192.126.147:2888:3888
server.5=10.192.126.148:2888:3888

5.创建目录

mkdir -p /opt/soft/zookeeper-3.4.13/data

mkdir -p /opt/soft/zookeeper-3.4.13/datalog

执行下面步骤 数字是和上面标红配置一致。

例如10.192.126.144机器执行 echo 1 > /opt/soft/zookeeper-3.4.13/data/myid

例如10.192.126.145机器执行 echo 2 > /opt/soft/zookeeper-3.4.13/data/myid

后边类似。

echo 3 > /opt/soft/zookeeper-3.4.13/data/myid

echo 4 > /opt/soft/zookeeper-3.4.13/data/myid

echo 5 > /opt/soft/zookeeper-3.4.13/data/myid

综上,整体配置已经完成,直接到 bin/zkServer.sh start 就行了。

bin/zkServer.sh status查看状态。

如果zookeeper用systemctl管理,查看另一篇文章:

systemctl管理kafka和zookeeper_早退的程序员的博客-CSDN博客

相关推荐
luck_me511 分钟前
基于 Kubernetes 部署容器平台kubesphere
云原生·容器·kubernetes
后端码匠1 小时前
【Hadoop】伪分布式安装
大数据·hadoop·分布式
掘金-我是哪吒2 小时前
分布式微服务系统架构第134集:笔记1运维服务器经验,高并发,大数据量系统
运维·笔记·分布式·微服务·系统架构
AquaPluto2 小时前
kubernetes的Service与服务发现
云原生·kubernetes·服务发现·ingress
onkel in blog3 小时前
【Docker】Docker Compose方式搭建分布式协调服务(Zookeeper)集群
分布式·docker·zookeeper
小小工匠4 小时前
架构思维:构建高并发扣减服务_分布式无主架构
分布式·架构·分布式无主架构
菠萝崽.6 小时前
Elasticsearch进阶篇-DSL
大数据·分布式·elasticsearch·搜索引擎·全文检索·jenkins·springboot
hong_zc7 小时前
服务端高并发分布式结构演进之路
分布式
461K.8 小时前
写spark程序数据计算( 数据库的计算,求和,汇总之类的)连接mysql数据库,写入计算结果
大数据·分布式·spark
Dovis(誓平步青云)11 小时前
“Cloud Native English“云原生时代下的微服务架构设计:从理论到实战全解析
经验分享·微服务·云原生·架构