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
阳光总在风雨后!