博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
zookeeper
阅读量:7210 次
发布时间:2019-06-29

本文共 2543 字,大约阅读时间需要 8 分钟。

下载安装

wget http://mirrors.hust.edu.cn/apache/zookeeper/zookeeper-3.4.13/zookeeper-3.4.13.tar.gz

解压:

tar -zxvf zookeeper-3.4.13.tar.gz

把名字改短一些

mv zookeeper-3.4.13 /usr/local/apps/zookeeper

配置环境变量:

vi /etc/profile
在配置文件中添加:export ZOOKEEPER_HOME=/usr/local/apps/zookeeperexport PATH=$PATH:$ZOOKEEPER_HOME/bin

复制一份zoo_sample.cfg并改名为zoo.cfg  

cp zoo_sample.cfg zoo.cfg

 vi zoo.cfg 查看配置

修改dataDir

# The number of milliseconds of each ticktickTime=2000# The number of ticks that the initial # synchronization phase can takeinitLimit=10# The number of ticks that can pass between # sending a request and getting an acknowledgementsyncLimit=5# the directory where the snapshot is stored.# do not use /tmp for storage, /tmp here is just # example sakes.dataDir=/usr/local/apps/tmp/zkData# the port at which the clients will connectclientPort=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

启动zookeeper

zkServer.sh start

运行客户端

zkCli.sh

help查看命令

stat path [watch]	set path data [version]	ls path [watch]	delquota [-n|-b] path	ls2 path [watch]	setAcl path acl	setquota -n|-b val path	history 	redo cmdno	printwatches on|off	delete path [version]	sync path	listquota path	rmr path	get path [watch]	create [-s] [-e] path data acl	addauth scheme auth	quit 	getAcl path	close 	connect host:port

查看节点:ls / 

[zk: localhost:2181(CONNECTED) 0] ls /

[cluster, brokers, zookeeper, dubbo, admin,config]

创建节点:create /test

[zk: localhost:2181(CONNECTED) 3] create /test "aaa"     [zk: localhost:2181(CONNECTED) 4] ls /[cluster, brokers, zookeeper, dubbo, admin,config,test][zk: localhost:2181(CONNECTED) 5]

删除节点:delete /test 

[zk: localhost:2181(CONNECTED) 8] delete /test[zk: localhost:2181(CONNECTED) 9] ls /[cluster, brokers, zookeeper, dubbo, admin,config][zk: localhost:2181(CONNECTED) 10]

获取节点数据 get /dubbo

[zk: localhost:2181(CONNECTED) 10] get /dubbo192.168.23.1cZxid = 0xactime = Tue Sep 25 20:42:48 CST 2018mZxid = 0xamtime = Tue Sep 25 20:42:48 CST 2018pZxid = 0x15cversion = 2dataVersion = 0aclVersion = 0ephemeralOwner = 0x0dataLength = 12numChildren = 2[zk: localhost:2181(CONNECTED) 11]

  

 

转载于:https://www.cnblogs.com/lysongbo/p/9709248.html

你可能感兴趣的文章
wemall app商城源码Android之支付宝通知处理类
查看>>
利用已有的大数据技术,如何构建机器学习平台
查看>>
Stream从Python切换到Go的原因
查看>>
Python将迁移到GitHub
查看>>
Linux系统安装MySql步骤及截屏
查看>>
如何理解阿里月饼事件中各方的表现
查看>>
浅谈line-height
查看>>
php二维数组指定其键名对其排序的方法
查看>>
用什么PHP框架最好?框架?还不如用开源系统吧
查看>>
JS 设计模式 一(接口)
查看>>
ios category 笔记整理(一)
查看>>
神经网络很萌的
查看>>
关系数据库SQL之可编程性存储过程
查看>>
Yii2 日期和时间组件
查看>>
[实战] 用数人云,部署弹性 ELK 集群就五步
查看>>
h5端呼起摄像头扫描二维码并解析
查看>>
用babel cli编译用ES6写的JSX
查看>>
程序是生活的抽象
查看>>
koa源码分析-generator和yield分析
查看>>
如何在内部 Stash 服务器上添加 hook
查看>>