【第1章】Linux下Zookeeper3.4.11步骤安装与配置文件解读

一、官网下载安装包,我的安装版本zookeeper-3.4.11.tar.gz

https://zookeeper.apache.org/releases.html#download

在这里插入图片描述

二、拷贝至/software目录下并解压

software是我自定义的文件夹

rz     //上传本地磁盘上文件 压缩的zookeeper文件
tar -zxvf zookeeper-3.4.11.tar.gz  //解压文件

在这里插入图片描述

三、新建自定义zookeeper目录,将解压zookeeper内容拷贝/myzookeeper目录内
mkdir myzookeeper; //新建文件夹myzookeeper

在这里插入图片描述

cp -r zookeeper-3.4.11 /usr/local/myzookeeper/  //递归【拷贝】解压文件至新的目录中

在这里插入图片描述

验证自定义myzookeeper目录下文件
在这里插入图片描述

四、进入conf文件夹,拷贝zoo_sample.cfg改为zoo.cfg

在这里插入图片描述

五、zoo.cfg配置文件解读
# The number of milliseconds of each tick
tickTime=2000   //zookeeper服务器心跳时间,单位毫秒(2s)
    
# The number of ticks that the initial 
# synchronization phase can take
initLimit=10  //Leader允许初始化连接是最长能忍受多少个心跳的时间间隔数 总时间长度10*2000=20s

    
# The number of ticks that can pass between 
# sending a request and getting an acknowledgement
//响应超过syncLimit * tickTime=5*2000=10s,Leader认为Follwer死掉,从服务器列表中删除Follwer

syncLimit=5 //同步通信时限(集群中Leader与Follower之间的最大响应时间单位) 
    
# 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 //客户端访问端口号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

六、开启服务+客户端连接(CentOS7.0系统)

开启服务

注意启动zookeeper服务之前需要安装好java环境!

echo $JAVA_HOME //检验JAVA环境
cd /usr/local/myzookeeper/zookeeper-3.4.11/bin //切换到bin目录
./zkServer.sh start //启动zookeeper
ps -ef|grep zookeeper //方式一:检验zookeeper服务是否启动

在这里插入图片描述

netstat -anp|grep 2181 //方式二:检验zookeeper服务是否启动

在这里插入图片描述

echo ruok|nc 127.0.0.1 2181//方式三:检验zookeeper服务是否启动 【ruok-四字命令!!!!】

在这里插入图片描述

如果nc命令没有安装,则需要安装!

(1)CentOS6.8下面nc命令的安装

/media/CentOS_6.8_Final/Packages // 路径  

rpm -ivh nc-1.84-24.el6.x86_64.rpm // 命令

(2)CentOS7下面nc命令的安装

/run/media/root/CentOS 7 x86_64/Packages  //路径
 
rpm -ivh nmap-ncat-6.40-7.el7.x86_64//命令

关闭服务

在这里插入图片描述

启动客户端

在这里插入图片描述


 ☝上述分享来源个人总结,如果分享对您有帮忙,希望您积极转载;如果您有不同的见解,希望您积极留言,让我们一起探讨,您的鼓励将是我前进道路上一份助力,非常感谢!我会不定时更新相关技术动态,同时我也会不断完善自己,提升技术,希望与君同成长同进步!

☞本人博客:https://coding0110lin.blog.csdn.net/  欢迎转载,一起技术交流吧!

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值