zookeeper的安装

前几天学习了eureka的使用,但是eureka已经停止更新了,所以我们用zookeeper来代替eureka做服务注册中心。

首先在Ubuntu下安装zookeeper。下载zookeeper的压缩包并上传到服务器上。使用tar -zxvf 命令解压到/usr/local/zookeeper文件夹下面。

在根目录下创建data以及logs文件夹。进入conf文件夹下面执行cp zoo_sample.cfg zoo_cfg

编辑zoo_cfg文件如下(单机模式):

# The number of milliseconds of each tick
# 心跳间隔,毫秒
tickTime=2000
# The number of ticks that the initial 
# synchronization phase can take
# 配置zookeeper接受客户端初始化连接时最长能忍受多少个时间心跳间隔。
initLimit=10
# The number of ticks that can pass between 
# sending a request and getting an acknowledgement
# 这个配置项标识 Leader 与 Follower 之间发送消息,请求和应答时间长度,最长不能超过多少个 tickTime 的时间长度。
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just 
# example sakes.
# 数据存放的位置
dataDir=/usr/local/zookeeper/zookeeper-3.4.10/data
#日志存放的位置
dataLogDir=/usr/local/zookeeper/zookeeper-3.4.10/logs
# 服务器客户端的接口
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

进入bin目录执行 

./zkService.sh start  启动

./zkService.sh stop  停止

./zkService.sh stop  查看状态

./zkcli.sh   连接客户端

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值