1. 程式人生 > >BigData--hadoop集群搭建之zookeer安裝

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

其他 ron fault ntp time pro art 變量 tick

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安裝