linux 安装zookeeper
3.4 linux 安装zookeeper
下载zookeeper安装包
https://downloads.apache.org/zookeeper/zookeeper-3.5.9/
上传zookeeper 的安装包到Linux 服务器上面
# 上传到 /myapp 下
/myapp
解压apache-zookeeper-3.5.9-bin.tar.gz
tar -zxvf apache-zookeeper-3.5.9-bin.tar.gz
把解压后的文件移动到指定位置, 这里统一移动到 /myapp/software 目录下
mv apache-zookeeper-3.5.9-bin /myapp/software/
在 /data 目录下创建一个文件夹 zookeeper 用来存放zookeeper 的数据文件
cd /data
mkdir zookeeper
复制cp zoo_sample.cfg zoo.cfg
#进入 /myapp/software/apache-zookeeper-3.5.9-bin/conf 目录
cd /myapp/software/apache-zookeeper-3.5.9-bin/conf
# 复制 zoo_sample.cfg 文件,并重命名为zoo.cfg 否则zookeeper不会生效
cp zoo_sample.cfg zoo.cfg
编辑 zoo.cfg 文件,
修改 dataDir 属性等于 /tmp/zookeeper
如下第13行所示
# 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=/tmp/zookeeper
# 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
启动/关闭/查看状态 zookeeper 服务
# 1.进入zookeeper安装目录的bin 目录
/myapp/software/apache-zookeeper-3.5.9-bin/bin
# 2. 启动zookeeper
./zkServer.sh start
# 3. 关闭zookeeper
./zkServer.sh stop
# 4. 查看zookeeper的状态
./zkServer.sh status
阳光总在风雨后!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· DeepSeek 开源周回顾「GitHub 热点速览」
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了