赞
踩
原文地址: http://blog.csdn.net/nsrainbow/article/details/42836479 最新课程请关注原作者博客,获得更好的显示体验
服务端,在每一台需要监控的机器上安装
yum install zookeeper-server
yum install zookeeper-client
maxClientCnxns=50
# 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=/var/lib/zookeeper
# the port at which the clients will connect
clientPort=2181
server.1=host1:2888:3888
server.2=host2:2888:3888
service zookeeper-server start
[zk: localhost:2181(CONNECTED) 0]
[zk: localhost:2181(CONNECTED) 0] help
ZooKeeper -server host:port cmd args
connect host:port
get path [watch]
ls path [watch]
set path data [version]
rmr path
delquota [-n|-b] path
quit
printwatches on|off
create [-s] [-e] path data acl
stat path [watch]
close
ls2 path [watch]
history
listquota path
setAcl path acl
getAcl path
sync path
redo cmdno
addauth scheme auth
delete path [version]
setquota -n|-b val path
[zk: localhost:2181(CONNECTED) 1] ls /
[hadoop-ha, hbase, zookeeper]
[zk: localhost:2181(CONNECTED) 2] ls /hadoop-ha
[mycluster]
[zk: localhost:2181(CONNECTED) 3] create /zk_test my_data
Created /zk_test
[zk: localhost:2181(CONNECTED) 4] ls /
[hadoop-ha, hbase, zookeeper, zk_test]
[zk: localhost:2181(CONNECTED) 5] get /zk_test
my_data
cZxid = 0x2200000019
ctime = Sun Jan 18 02:30:56 PST 2015
mZxid = 0x2200000019
mtime = Sun Jan 18 02:30:56 PST 2015
pZxid = 0x2200000019
cversion = 0
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 7
numChildren = 0
[zk: localhost:2181(CONNECTED) 6] set /zk_test junk
cZxid = 0x2200000019
ctime = Sun Jan 18 02:30:56 PST 2015
mZxid = 0x220000001a
mtime = Sun Jan 18 02:55:35 PST 2015
pZxid = 0x2200000019
cversion = 0
dataVersion = 1
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 4
numChildren = 0
[zk: localhost:2181(CONNECTED) 7] get /zk_test
junk
cZxid = 0x2200000019
ctime = Sun Jan 18 02:30:56 PST 2015
mZxid = 0x220000001a
mtime = Sun Jan 18 02:55:35 PST 2015
pZxid = 0x2200000019
cversion = 0
dataVersion = 1
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 4
numChildren = 0
[zk: localhost:2181(CONNECTED) 8] delete /zk_test
[zk: localhost:2181(CONNECTED) 9] ls /
[hadoop-ha, hbase, zookeeper]
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。