BigData--hadoop集群搭建之zookeer安装
Posted aronyao
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了BigData--hadoop集群搭建之zookeer安装相关的知识,希望对你有一定的参考价值。
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/ [email protected]:/opt/zookeeper-3.4.10
scp -r /opt/zookeeper-3.4.10/ [email protected]:/opt/zookeeper-3.4.10
添加myid?文件(每节点都需要)
cd /opt/zookeeper-3.4.10
mkdir data
echo "1" > data/myid
注意,每个节点myid?文件要不不?一致
启动并测试
# 在三台机器?上分别执行行
zkServer.sh start
# 查看状态
[[email protected] 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
[[email protected] 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
[[email protected] 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安装的主要内容,如果未能解决你的问题,请参考以下文章