ZooKeeper

ZooKeeper是一个分布式的,开放源码的分布式应用程序协调服务

官网地址:https://zookeeper.apache.org/

下载链接:https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/

一、基本环境说明

系统版本

Centos6.8

运行用户root

ZooKeeper版本

3.4.10

二、ZooKeeper文件说明

配置文件:/usr/local/zookeeper/conf/zoo.cfg

启动脚本:/usr/local/zookeeper/bin/zkServer.sh

日志文件:/usr/local/zookeeper/zookeeper.out

三、安装部署

1.准备 Java 运行环境;

2.下载源码包,上传到/usr/local/src目录;

3.解压:tar zxvf zookeeper-3.4.10.tar.gz -C /usr/local/

4. 修改配置文件;

5.在data目录创建 myid 文件, 在文件第一行写上对应的 Server ID;

四、配置文件说明

# 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=/data/zookeeper
# the port at which the clients will connect
clientPort=2188
# the maximum number of client connections.
# increase this if you need to handle more clients
maxClientCnxns=2048
#
# 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=10
# Purge task interval in hours
# Set to "0" to disable auto purge feature
autopurge.purgeInterval=24

server.1=host1:port1:port2
server.2=host2:port1:port2
server.3=host3:port1:port2

 

 

tickTime: 指定了ZooKeeper的基本时间单位(以毫秒为单位);
initLimit: 指定了启动zookeeper时,zookeeper实例中的随从实例同步到领导实例的初始化连接时间限制,超出时间限制则连接失败(以tickTime为时间单位)
syncLimit: 指定了zookeeper正常运行时,主从节点之间同步数据的时间限制,若超过这个时间限制,那么随从实例将会被丢弃
dataDir: zookeeper存放数据的目录
clientPort: 用于连接客户端的端口
maxClientCnxns: 最大连接数
autopurge.snapRetainCount: 指定需要保留的文件数目。默认是保留3个
autopurge.purgeInterval: 指定清理频率,单位是小时

server.1=host1:port1:port2
server.2=host2:port1:port2
server.3=host3:port1:port2

五、其他

1、启动服务

  cd /usr/local/zookeeper && nohup ./bin/zkServer.sh start &

2、停止服务

cd /usr/local/zookeeper && nohup ./bin/zkServer.sh stop

4、查看zookeeper服务状态

cd /usr/local/zookeeper && nohup ./bin/zkServer.sh status

4、进入客户端的命令

cd /usr/local/zookeeper && ./zkCli.sh -server ip:port

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值