当前位置:   article > 正文

linux 安装zookeeper

linux 安装zo

自行下载安装包 zookeeper-3.4.6.tar.gz

wget http://apache.fayea.com/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz

安装步骤:

1.解压 zookeeper-3.4.6.tar.gz /root 目录下

2.在目录 /root/zookeeper-3.4.6.tar.gz/conf 中新增文件 zoo.cfg

3.创建目录 /root/zookeeper-3.4.6/data

4.创建目录 /root/zookeeper-3.4.6/logs

5.执行启动命令 sh zkServer.sh start

 

ZooKeeper服务命令:

     在准备好相应的配置之后,可以直接通过zkServer.sh 这个脚本进行服务的相关操作

  • 1. 启动ZK服务:       sh bin/zkServer.sh start
  • 2. 查看ZK服务状态: sh bin/zkServer.sh status
  • 3. 停止ZK服务:       sh bin/zkServer.sh stop
  • 4. 重启ZK服务:       sh bin/zkServer.sh restart

 

设置开机启动

编辑文件: vi /etc/rc.local

追加内容: /root/zookeeper-3.4.6/bin/zkServer.sh start

提升权限:chmod +x /etc/rc.local

保存文件结束

 

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=/root/zookeeper-3.4.6/data
dataLogDir=/root/zookeeper-3.4.6/logs
# 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=2
# Purge task interval in hours
# Set to "0" to disable auto purge feature
autopurge.purgeInterval=1
#2888,3888 are election port
#server.1=192.168.0.101:2888:3888
#server.2=192.168.0.102:2888:3888
#server.3=192.168.0.103:2888:3888

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/喵喵爱编程/article/detail/968257
推荐阅读
相关标签
  

闽ICP备14008679号