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

BigData--hadoop集群搭建之zookeer安装

时间:2018-08-27 15:28:56      阅读:171      评论:0      收藏:0      [点我收藏+]

标签:节点   export   集群   添加   root   pat   default   文件   str   

Zookeeper安装
 cd /opt/
 tar -zxvf zookeeper-3.4.10.tar.gz
mv zookeeper-3.4.10  /opt/zookeeper
修改配置文件
cd /opt zookeeper-3.4.10/conf/
cp zoo_sample.cfg zoo.cfg
vim zoo.cfg
tickTime=2000
dataDir=/optzookeeper-3.4.10/data
clientPort=2181
initLimit=10
syncLimit=5
server.1=hadoop-1:2888:3888
server.2=hadoop-2:2888:3888
server.3=hadoop-3:2888:3888
所有节点修改环境变量量
vim /etc/profile.d/zookeeper.sh
# zookeeper
export ZOOKEEPER_HOME=/optzookeeper-3.4.10
export PATH=$ZOOKEEPER_HOME/bin:$PATH
 source /etc/profile
将zookeeper?目录复制到其他节点上
scp -r /opt/zookeeper-3.4.10/  root@hadoop-2:/opt/zookeeper-3.4.10
scp -r /opt/zookeeper-3.4.10/  root@hadoop-3:/opt/zookeeper-3.4.10
添加myid?文件(每节点都需要)
cd /opt/zookeeper-3.4.10
mkdir data
echo "1" > data/myid
注意,每个节点myid?文件要不不?一致
启动并测试
# 在三台机器?上分别执行行
zkServer.sh start
# 查看状态
[root@hadoop-1 zookeeper-3.4.10]# zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /opt/zookeeper-3.4.10/bin/../conf/zoo.cfg
Mode: follower
[root@hadoop-2 zookeeper-3.4.10]# zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /opt/zookeeper-3.4.10/bin/../conf/zoo.cfg
Mode: leader
[root@hadoop-3 zookeeper-3.4.10]# zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /optzookeeper-3.4.10/bin/../conf/zoo.cfg
Mode: follower

注:3个节点允许一个节点当掉,5个节点允许2个节点同时当掉(选举机制过半数就是leader)

BigData--hadoop集群搭建之zookeer安装

标签:节点   export   集群   添加   root   pat   default   文件   str   

原文地址:https://www.cnblogs.com/aronyao/p/zookeeper.html

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