ZooKeeper安装与配置(Windows环境)

(1)在机器上安装JDK环境(略)


(2)从ZooKeeper官网下载ZooKeeper( http://zookeeper.apache.org/releases.html#download )

这里我下载的是zookeeper-3.3.6.tar.gz。

下载完成后解压缩,这里我本地放的路径是D:\zookeeper-3.3.6。


(3)D:\zookeeper-3.3.6\conf下的zoo_sample.cfg重新命名为zoo.cfg。

默认加载zoo.cfg这个文件。


(4)执行D:\zookeeper-3.3.6\bin下的zkServer.cmd

ZooKeeper安装与配置(Windows环境)_第1张图片



(5)启动D:\zookeeper-3.3.6\bin下的zkCli.cmd或在cmd下进入D:\zookeeper-3.3.6\bin执行命令zkCli.cmd -server 127.0.0.1:2181

启动zkCli.cmd

ZooKeeper安装与配置(Windows环境)_第2张图片



在cmd下进入D:\zookeeper-3.3.6\bin使用命令zkCli.cmd -server 127.0.0.1:2181

ZooKeeper安装与配置(Windows环境)_第3张图片




(6)一些简单的测试命令

ls命令:

[zk: 127.0.0.1:2181(CONNECTED) 0] ls /
[javaer, root-ktv, zookeeper]


create命令:

[zk: 127.0.0.1:2181(CONNECTED) 4] create /javaer www.javaer.com.cn
Created /javaer


get命令:

[zk: 127.0.0.1:2181(CONNECTED) 6] get /javaer
www.javaer.com.cn
cZxid = 0x2
ctime = Mon Apr 11 15:27:10 CST 2016
mZxid = 0x2
mtime = Mon Apr 11 15:27:10 CST 2016
pZxid = 0x2
cversion = 0
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 17
numChildren = 0


set命令:

[zk: 127.0.0.1:2182(CONNECTED) 5] set /javaer sunwenqi
cZxid = 0x100000011
ctime = Wed Apr 13 15:57:23 CST 2016
mZxid = 0x10000001d
mtime = Wed Apr 13 16:08:39 CST 2016
pZxid = 0x100000011
cversion = 0
dataVersion = 1
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 8
numChildren = 0




你可能感兴趣的:(ZooKeeper安装与配置(Windows环境))