Zookeeper Cluster Setup
Herein Zookeeper number of nodes (odd) is . 3 th. Zookeeper default to provide services outside the port number 2181 . Zookeeper internal cluster 3 the communication between nodes using the default 2888: 3888
192.168.129.101 192.168.129.102 192.168.129.103
Download zookeeper corresponding tar package
They were uploaded tar package to 192.168.0.217 192.168.0.218 192.168.0.219
In 101 , 102 , 103 three zookeeper performed separately on the downlink instruction node, and the file name unpacked zookeeper-3.4.10 modify zookeeper .
tar -zxvf zookeeper-3.4.10.tar.gz -C /usr/local/
In three zookeeper configuration environment variable node
vim /etc/profile
添加export ZOOKEEPER_HOME=/usr/local/zookeeper
In the path to add the $ ZOOKEEPER_HOME / bin
Implementation of source / etc / profile environment variables to take effect immediately
Modify zookeeper in the conf directory zoo_sample.cfg is zoo.cfg
Modify three zookeeper node zoo.cfg file, modify dataDir , add server.0 , server.1 , server.2
In zookeeper directory, create data directory. In . 3 th zookeeper node data are created directory myid file, and the contents were added 0 , 1 , 2
Start zookeeper
每台节点都需要启动
zkServer.sh start
zkServer.sh status
在zookeeper中任意一个节点,执行指令zkCli.sh
执行指令zkCli.sh help ,查看帮助信息(到这,就说明搭建成功)
ls / 查找根目录
create /test abc 创建节点并赋值
get /test 获取指定节点的值
set /test cb 设置已存在节点的值
rmr /test 递归删除节点
delete /test/test01 删除不存在子节点的节点