运行环境
1.6.0_21
ubuntu 11.04
1.先从官网上下载最新版本的zookeeper
2.解压后进入conf目录,拷贝zoo_sample.cfg,重命名为zoo.cfg,这个是zookeeper运行时默认找的配置文件
Standalone,单机模式
3.运行zookeeper
bin/zkServer.sh start
4.连接到zookeeper
bin/zkCli.sh -server 127.0.0.1:2181
输入完后看到
[zk: 127.0.0.1:2181(CONNECTED) 0]
说明运行正常,服务器正常启动
输入 help 可以查看常用命令的帮助:
ZooKeeper host:port cmd args
get path [watch]
ls path [watch]
set path data [version]
delquota [-n|-b] path
quit
printwatches on|off
createpath data acl
stat path [watch]
listquota path
history
setAcl path acl
getAcl path
sync path
redo cmdno
addauth scheme auth
delete path [version]
setquota -n|-b val path
输入一些常用命令,例如
ls /
create /eryk mynode
get /eryk
delete /eryk