1. 程式人生 > >基於Hadoop2.6.x叢集安裝Zookeeper

基於Hadoop2.6.x叢集安裝Zookeeper

a.下載軟體包zookeeper-3.4.5.tar.gz

#Master

wget http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.5/zookeeper-3.4.5.tar.gz

tar zxvf zookeeper-3.4.5.tar.gz

 b.修改zookeeper配置

#Master

cd zookeeper-3.4.5

#建立日誌資料夾及資料資料夾

mkdir data

mkdir log

#修改配置

cd conf

mv zoo_sample.cfg zoo.cfg

vim zoo.cfg

dataDir=/usr/local/src/zookeeper-3.4.5/data

dataLogDir=/usr/local/src/zookeeper-3.4.5/log

server.1=master:2888:3888

server.2=slave1:2888:3888

server.3=slave2:2888:3888


c.配置環境變數

#Master、Slave1、Slave2

vim ~/.bashrc

export ZOOKEEPER_HOME=/usr/local/src/zookeeper-3.4.5

export PATH=$PATH:$ZOOKEEPER_HOME/bin

#重新整理環境變數

source ~/.bashrc

 d. 拷貝安裝包

#Master

scp -r /usr/local/src/zookeeper-3.4.5 [email protected]:/usr/local/src/zookeeper-3.4.5

scp -r /usr/local/src/zookeeper-3.4.5 [email protected]:/usr/local/src/zookeeper-3.4.5

 

e.分別新增ID

#Master

echo "1" > /usr/local/src/zookeeper-3.4.5/data/myid 

#Slave1

echo "2" > /usr/local/src/zookeeper-3.4.5/data/myid 

#Slave2

echo "3" >  /usr/local/src/zookeeper-3.4.5/data/myid 

 

f. 啟動Zookeeper服務

#Master、Slave1、Slave2

zkServer.sh start

 g. 檢視執行狀態

zkServer.sh status

#Master

#Slave1

#Slave2

 h.檢視程序狀態

jps

#Master

#Slave1

#Slave2

 i. 關閉叢集

#master、Slave1、Slave2

zkServer.sh stop