hadoop生态系统(二)——zookeeper搭建

一、解压安装包
tar -zxvf zookeeper-3.4.5.tar.gz
二、创建数据文件夹和日志文件夹
cd zookeeper-3.4.5
mkdir data
mkdir log
三、修改配置
cd conf
mv zoo_sample.cfg zoo.cfg
vi 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
四、配置环境变量
vi ~/.bashrc
ZOOKEEPER_HOME=/usr/local/src/zookeeper-3.4.5
export PATH= P A T H : PATH: PATH:ZOOKEEPER_HOME/bin
重新加载环境变量
source ~/.bashrc
五、拷贝安装包到slave1/slave2
scp -r /usr/local/src/zookeeper-3.4.5 root@slave1:/usr/local/src/
scp -r /usr/local/src/zookeeper-3.4.5 root@slave2:/usr/local/src/
六、添加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
七、启动zookeeper服务
#master、slave1、slave2

[root@master conf]# zkServer.sh start
JMX enabled by default
Using config: /usr/local/src/zookeeper-3.4.5/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@master conf]# 

查看运行状态:
#master

[root@master conf]# zkServer.sh status
JMX enabled by default
Using config: /usr/local/src/zookeeper-3.4.5/bin/../conf/zoo.cfg
Mode: leader
[root@master conf]#

#slave1

[root@slave1 ~]# zkServer.sh status
JMX enabled by default
Using config: /usr/local/src/zookeeper-3.4.5/bin/../conf/zoo.cfg
Mode: follower
[root@slave1 ~]#

#slave2

[root@slave2 ~]# zkServer.sh status
JMX enabled by default
Using config: /usr/local/src/zookeeper-3.4.5/bin/../conf/zoo.cfg
Mode: follower
[root@slave2 ~]#

查看进程状态:
存在“QuorumPeerMain”进程

[root@master conf]# jps
1556 NameNode
2391 Jps
2312 QuorumPeerMain
1743 SecondaryNameNode
[root@master conf]#

八、关闭zookeeper服务
#master/slave1/slave2

[root@master conf]# zkServer.sh stop
JMX enabled by default
Using config: /usr/local/src/zookeeper-3.4.5/bin/../conf/zoo.cfg
Stopping zookeeper ... STOPPED
[root@master conf]#

你可能感兴趣的:(hadoop)