五、zookeeper组建的安装与配置
解压zookeeper
[root@master ~]
把zookeeper-3.4.5安装目录改为zookeeper
[root@master ~]
1、master节点配置
在zookeeper的安装目录下创建data和logs文件夹
[root@master ~]
[root@master zookeeper]
在每个节点中写入给节点的标识编号,每个节点编号不同,master为1,slave1为2,slave2为3
[root@master zookeeper]
修改配置文件zoo.cfg
[root@master zookeeper]
[root@master zookeeper]
修改dataDir参数如下
dataDir=/usr/local/src/zookeeper/data
在zoo.cfg文件末尾添加如下参数配置,表示3个zookeeper节点的访问端口号
server.1=master:2888:3888
server.2=slave1:2888:3888
server.3=slave2:2888:3888
修改zooplankton安装目录的归属用户为hadoop用户
[root@master zookeeper]
2、slave节点配置
从master节点复制zookeeper安装目录到两个slave节点
[root@master zookeeper]
[root@master ~]
[root@master ~]
在slave1节点上修改zookeeper目录的归属用户为hadoop用户
[root@slave1 ~]
在slave1节点上配置该节点的myid为2
echo 2 > /usr/local/src/zookeeper/data/myid
在slave2节点上修改zookeeper目录的归属用户为hadoop用户
[root@slave2 ~]
在slave1节点上配置该节点的myid为2
[root@slave2 ~]
3、系统环境变量配置
在master、slave1、slave2三个节点上增加环境变量配置
[root@master ~]# vim /etc/profile
[root@master ~]# source /etc/profile
export ZOOKEEPER_HOME=/usr/local/src/zookeeper
export PATH=$PATH:$ZOOKEEPER_HOME/bin
4、启动zookeeper
分别启动(都切换到hadoop用户)
master
[hadoop@master ~]$ zkServer.sh start
JMX enabled by default
Using config: /usr/local/src/zookeeper/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
查看zookeeper状态
[hadoop@master ~]$ zkServer.sh status
JMX enabled by default
Using config: /usr/local/src/zookeeper/bin/../conf/zoo.cfg
Mode: follower
slave1
[hadoop@slave1 ~]$ zkServer.sh start
JMX enabled by default
Using config: /usr/local/src/zookeeper/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
查看zookeeper状态
[hadoop@slave1 ~]$ zkServer.sh status
JMX enabled by default
Using config: /usr/local/src/zookeeper/bin/../conf/zoo.cfg
Mode: leader
slave2
[hadoop@slave2 ~]$ zkServer.sh start
JMX enabled by default
Using config: /usr/local/src/zookeeper/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
查看zookeeper状态
[hadoop@slave1 ~]$ zkServer.sh status
JMX enabled by default
Using config: /usr/local/src/zookeeper/bin/../conf/zoo.cfg
Mode: leader
关闭
zkServer.sh stop
|