这篇文章给大家分享的是有关zookeeper3.3.6怎么安装的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。
下载:zookeeper-3.3.6.tar.gz
解压扔到/opt目录下
[~]$ cd /opt/zookeeper-3.3.6/conf
[conf]$ mv zoo_sample.cfg zoo.cfg
[conf]$ vi 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.
dataDir=/opt/zookeeper-3.3.6/tmp/data
#日志位置
dataLogDir=/opt/zookeeper-3.3.6/tmp/logs
# the port at which the clients will connect
clientPort=2181
# 从3.4.0开始,zookeeper提供了自动清理snapshot和事务日志的功能
autopurge.purgeInterval=1 //频率小时,默认为0表示不清理
autopurge.snapRetainCount=1 //保留的文件数目,默认为3
server.1=172-25-3-27:2888:3888
cd /opt/zookeeper-3.3.6/tmp/data
vi myid
1
如果不加这一步,在分布式的情况下,断网会导致zookepper服务异常退出。
QuorumPeerMain
启动
cd ../bin
./zkServer.sh start
停止
./zkServer.sh stop
查看zookeeper状态
./zkServer.sh status
zookeeper客户端操作命令
./zkCli.sh -server 192.168.0.102:2181
[zk: 192.168.0.102:2181(CONNECTED) 0] ls /
create /zk "myData"
get /zk
set /zk "zsl"
delete /zk
create /zk/node1 "node1"
ls /zk
感谢各位的阅读!关于“zookeeper3.3.6怎么安装”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!