dubbo系列-Linux下zookeeper的安装

         zookeeper作为dubbo服务的注册中心,zookeeper是一个分布式的服务框架,是树形的目录服务的数据存储,能做到集群管理数据,能更好的作为dubbo服务的注册中心;当提供者出现断电等异常情况停机时,zookeeper注册中心会自动删除提供者的信息,当提供者重启时,zookeeper能够自动恢复注册数据,以及订阅请求;今天小编就带领大家在Linux上安装单节点的zookeeper;

☸  前期准备

     IP 地址:192.168.255.132

    软件:zookeeper-3.4.8.tar.gz

☸ 实施步骤

  修改 /etc/hosts 文件,添加主机名和IP地址的映射

         # zookeeper cluster servers

        192.168.1.81    edu-zk-01

上传或者下载zookeeper的软件到某一个目录(本篇使用/root为路径):

        本次使用版本为:zookeeper-3.4.8.tar.gz

✎  解压 zookeeper 安装包, 并按节点号对 zookeeper 目录重命名: 

          $ tar -zxvf zookeeper-3.4.8.tar.gz 

              服务器 为:

          $ mv zookeeper-3.4.8 node-01

✎ 在zookeeper的节点目录下创建以下目录:

           $ cd   /root/zookeeper-3.4.8

          $  mkdir data

         $ mkdir logs

 将zookeeper/conf目录下的zoo_sample.cfg文件拷贝一份,并重命名为 zoo.cfg

         $  cp zoo_sample.cfg zoo.cfg

  修改 zoo.cfg 配置文件:

         路径为:/root/zookeeper-3.4.8/conf/zoocfg

         修改内容:

# 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.8/data
dataLogDir=/root/zookeeper-3.4.8/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=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1
server.1=edu-provider-01:2888:3888
 在dataDir=/root/zookeeper-3.4.8/data 目录下创建myid 文件

$vi /root/zookeeper-3.4.8/data/myid## 值为1

  由于版本问题,centos需要将防火墙关闭:

#systemctl stop firewalld.service

 启动并测试zookeeper服务,在/root/zookeeper-3.4.8/bin目录中执行

           $ ./zkServer.sh start

           输入jps命令查看当前进程:

           如果出现1456 QuorumPeerMain  则说明 启动正常

        到这里,在Linux环境中安装zookeeper服务的步骤就完成了,如果有需要大家可以根据上述的步骤做一下,但要注意路径的统一;

       最后送大家一句话共勉:生命不息,奔跑不止





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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值