码迷,mamicode.com
首页 > 其他好文 > 详细

zookeeper分布式集群

时间:2018-10-13 22:51:56      阅读:193      评论:0      收藏:0      [点我收藏+]

标签:3.1   tmp   java   最新版   code   led   下载   节点   lan   

简介

zookeeper:分布式协调应用程序
官方网站:http://zookeeper.apache.org/

最新版本:3.4.13
下载地址:https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3.4.13/zookeeper-3.4.13.tar.gz

安装部署

vim /etc/hosts
192.168.33.14 node4
192.168.33.15 node5
192.168.33.16 node6

下载安装

yum -y install java
yum -y install wget 
wget https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3.4.13/zookeeper-3.4.13.tar.gz
tar xf zookeeper-3.4.13.tar.gz 
mv zookeeper-3.4.13 /usr/local/zookeeper

配置

mv /usr/local/zookeeper/conf/zoo{_sample,}.cfg
cat >> /usr/local/zookeeper/conf/zoo.cfg<<EOF
server.1 = node4:2888:3888
server.2 = node5:2888:3888
server.3 = node6:2888:3888
EOF

node4:
echo 1 > /tmp/zookeeper/myid
node5:
echo 2 > /tmp/zookeeper/myid
node6:
echo 3 > /tmp/zookeeper/myid

启动集群

cd /usr/local/zookeeper/bin && ./zkServer.sh start

查看集群节点状态

查看下面的信息说明集群配置正常,如果不正常,查看日志文件/usr/local/zookeeper/bin/zookeeper.out

./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg
Mode: leader

zookeeper分布式集群

标签:3.1   tmp   java   最新版   code   led   下载   节点   lan   

原文地址:http://blog.51cto.com/hzde0128/2299600

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!