部署zookeeper
资源列表
node01 | node02 | node03 |
---|
192.168.1.1 | 192.168.1.2 | 192.168.1.3 |
下载zookeeper
zookeeper下载地址
上传到服务器并解压(3节点)
tar -xvf apache-zookeeper-3.8.1-bin.tar.gz
mv apache-zookeeper-3.8.1-bin zookeeper
修改节点配置文件(3节点)
cd conf
cp zoo_sample.cfg zoo.cfg
mkdir /usr/local/zookeeper/data
vim zoo.cfg
dataDir=/opt/iot/zookeeper/data
server.1=node01:2888:3888
server.2=node02:2888:3888
server.3=node03:2888:3888
为每个zookeeper节点设置myid
echo '1' > /opt/iot/zookeeper/data/myid
echo '2' > /opt/iot/zookeeper/data/myid
echo '3' > /opt/iot/zookeeper/data/myid
添加zk工具到全局(3节点)
sudo vim /etc/profile
export ZK_HOME=/usr/local/apache-zookeeper-3.8.1-bin
export PATH=$PATH:$ZK_HOME/bin
source /etc/profile
常用命令
zkServer.sh start
zkServer.sh stop
zkServer.sh status