一、官网下载安装包,我的安装版本zookeeper-3.4.11.tar.gz
https://zookeeper.apache.org/releases.html#download
二、拷贝至/software目录下并解压
software是我自定义的文件夹
rz
tar
-zxvf zookeeper
-3.4.11.tar
.gz
三、新建自定义zookeeper目录,将解压zookeeper内容拷贝/myzookeeper目录内
mkdir 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
# 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
=/tmp
/zookeeper
# 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
六、开启服务+客户端连接(CentOS7.0系统)
开启服务
注意启动zookeeper服务之前需要安装好java环境!
echo $JAVA_HOME
cd
/usr
/local
/myzookeeper
/zookeeper
-3.4.11/bin
./zkServer
.sh start
ps
-ef
|grep zookeeper
netstat
-anp
|grep
2181
echo ruok
|nc
127.0.0.1 2181
如果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/ 欢迎转载,一起技术交流吧!