标签:
[lizhiwei@localhost ZooKeeper]$ tar -zxvf zookeeper-3.4.6
......
[lizhiwei@localhost ZooKeeper]$ ll
total 17292
drwxr-xr-x. 10 lizhiwei lizhiwei 4096 Feb 20 2014 zookeeper-3.4.6
-rwxrwxr-x. 1 lizhiwei lizhiwei 17699306 Sep 13 23:25 zookeeper-3.4.6.tar.gz
[lizhiwei@localhost ZooKeeper]$ cd zookeeper-3.4.6
[lizhiwei@localhost zookeeper-3.4.6]$ ll
total 1552
drwxr-xr-x. 2 lizhiwei lizhiwei 4096 Oct 19 00:56 bin
-rw-rw-r--. 1 lizhiwei lizhiwei 82446 Feb 20 2014 build.xml
-rw-rw-r--. 1 lizhiwei lizhiwei 80776 Feb 20 2014 CHANGES.txt
drwxr-xr-x. 2 lizhiwei lizhiwei 4096 Oct 19 00:52 conf
drwxr-xr-x. 10 lizhiwei lizhiwei 4096 Feb 20 2014 contrib
drwxr-xr-x. 2 lizhiwei lizhiwei 4096 Feb 20 2014 dist-maven
drwxr-xr-x. 6 lizhiwei lizhiwei 4096 Feb 20 2014 docs
-rw-rw-r--. 1 lizhiwei lizhiwei 1953 Feb 20 2014 ivysettings.xml
-rw-rw-r--. 1 lizhiwei lizhiwei 3375 Feb 20 2014 ivy.xml
drwxr-xr-x. 4 lizhiwei lizhiwei 4096 Feb 20 2014 lib
-rw-rw-r--. 1 lizhiwei lizhiwei 11358 Feb 20 2014 LICENSE.txt
-rw-rw-r--. 1 lizhiwei lizhiwei 170 Feb 20 2014 NOTICE.txt
-rw-rw-r--. 1 lizhiwei lizhiwei 1770 Feb 20 2014 README_packaging.txt
-rw-rw-r--. 1 lizhiwei lizhiwei 1585 Feb 20 2014 README.txt
drwxr-xr-x. 5 lizhiwei lizhiwei 4096 Feb 20 2014 recipes
drwxr-xr-x. 8 lizhiwei lizhiwei 4096 Feb 20 2014 src
-rw-rw-r--. 1 lizhiwei lizhiwei 1340305 Feb 20 2014 zookeeper-3.4.6.jar
-rw-rw-r--. 1 lizhiwei lizhiwei 836 Feb 20 2014 zookeeper-3.4.6.jar.asc
-rw-rw-r--. 1 lizhiwei lizhiwei 33 Feb 20 2014 zookeeper-3.4.6.jar.md5
-rw-rw-r--. 1 lizhiwei lizhiwei 41 Feb 20 2014 zookeeper-3.4.6.jar.sha12
[lizhiwei@localhost zookeeper-3.4.6]$ cd conf/
[lizhiwei@localhost conf]$ ll
total 16
-rw-rw-r--. 1 lizhiwei lizhiwei 535 Feb 20 2014 configuration.xsl
-rw-rw-r--. 1 lizhiwei lizhiwei 2161 Feb 20 2014 log4j.properties
-rw-rw-r--. 1 lizhiwei lizhiwei 922 Oct 19 00:52 zoo.cfg
-rw-rw-r--. 1 lizhiwei lizhiwei 922 Feb 20 2014 zoo_sample.cfg
#这个时间是作为 Zookeeper 服务器之间或客户端与服务器之间维持心跳的时间间隔,也就是每个 tickTime 时间就会发送一个心跳。
tickTime=2000
#顾名思义就是 Zookeeper 保存数据的目录,默认情况下,Zookeeper 将写数据的日志文件也保存在这个目录里。
dataDir=/tmp/zookeeper
#这个端口就是客户端连接 Zookeeper 服务器的端口,Zookeeper 会监听这个端口,接受客户端的访问请求。
clientPort=2181
#这个配置项是用来配置 Zookeeper 接受客户端(这里所说的客户端不是用户连接 Zookeeper 服务器的客户端,
#而是 Zookeeper 服务器集群中连接到 Leader 的 Follower 服务器)初始化连接时最长能忍受多少个心跳时间间隔数。
#当已经超过 10 个心跳的时间(也就是 tickTime)长度后 Zookeeper 服务器还没有收到客户端的返回信息,
#那么表明这个客户端连接失败。总的时间长度就是 10*2000=20 秒
initLimit=10
#这个配置项标识 Leader 与 Follower 之间发送消息,请求和应答时间长度,最长不能超过多少个 tickTime 的时间长度,总的时间长度就是 5*2000=10 秒
syncLimit=5
#这个操作将限制连接到 ZooKeeper 的客户端的数量,限制并发连接的数量,它通过 IP 来区分不同的客户端。此配置选项可以用来阻止某些类别的 Dos 攻击。将它设置为 0 或者忽略而不进行设置将会取消对并发连接的限制。
maxClientCnxns=60
#这个参数指定了需要保留事务日志和快照文件的数目。默认是保留3个。
autopurge.snapRetainCount=3
#ZK提供了自动清理事务日志和快照文件的功能,这个参数指定了清理频率,单位是小时,
#需要配置一个1或更大的整数,默认是0,表示不开启自动清理功能,但可以运行bin/zkCleanup.sh来手动清理zk日志
autopurge.purgeInterval=1
#单机配置:
tickTime=2000
dataDir=D:/devtools/zookeeper-3.2.2/build
clientPort=2181
#集群配置:
initLimit=5
syncLimit=2
server.1=192.168.211.1:2888:3888
server.2=192.168.211.2:2888:3888
[lizhiwei@localhost zookeeper-3.4.6]$ cd bin/
[lizhiwei@localhost bin]$ ll
total 44
-rwxr-xr-x. 1 lizhiwei lizhiwei 238 Feb 20 2014 README.txt
-rwxr-xr-x. 1 lizhiwei lizhiwei 1937 Feb 20 2014 zkCleanup.sh
-rwxr-xr-x. 1 lizhiwei lizhiwei 1049 Feb 20 2014 zkCli.cmd
-rwxr-xr-x. 1 lizhiwei lizhiwei 1534 Feb 20 2014 zkCli.sh
-rwxr-xr-x. 1 lizhiwei lizhiwei 1333 Feb 20 2014 zkEnv.cmd
-rwxr-xr-x. 1 lizhiwei lizhiwei 2696 Feb 20 2014 zkEnv.sh
-rwxr-xr-x. 1 lizhiwei lizhiwei 1084 Feb 20 2014 zkServer.cmd
-rwxr-xr-x. 1 lizhiwei lizhiwei 5742 Feb 20 2014 zkServer.sh
[lizhiwei@localhost bin]$ ./zkServer.sh
JMX enabled by default
Using config: /home/lizhiwei/SoftWare/ZooKeeper/zookeeper-3.4.6/bin/../conf/zoo.cfg
Usage: ./zkServer.sh {start|start-foreground|stop|restart|status|upgrade|print-cmd}
[lizhiwei@localhost bin]$ ./zkServer.sh start
JMX enabled by default
Using config: /home/lizhiwei/SoftWare/ZooKeeper/zookeeper-3.4.6/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[lizhiwei@localhost bin]$ ./zkCli.sh -server 127.0.0.1:2181
Connecting to 127.0.0.1:2181 ......
[zk: 127.0.0.1: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: 127.0.0.1:2181(CONNECTED) 1] ls /
[testRootPath, zookeeper]
[zk: 127.0.0.1:2181(CONNECTED) 2] get /zookeeper
cZxid = 0x0
ctime = Wed Dec 31 16:00:00 PST 1969
mZxid = 0x0
mtime = Wed Dec 31 16:00:00 PST 1969
pZxid = 0x0
cversion = -1
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 0
numChildren = 1
[zk: 127.0.0.1:2181(CONNECTED) 3]
标签:
原文地址:http://www.cnblogs.com/LiZhiW/p/4893386.html