超简单zookeeper配置(最新)
一.zookeeper安装部署1.集群规划hadoop1hadoop2hadoop3ZookeeperZookeeperZookeeper2.解压安装(1)解压Zookeeper安装包到/opt/module/目录下[yl@hadoop1 software]$ tar -zxvf zookeeper-3.5.7.tar.gz -C /opt/module/(2)修改/opt/module/apac
一.zookeeper安装部署
1.集群规划
hadoop1 | hadoop2 | hadoop3 |
---|---|---|
Zookeeper | Zookeeper | Zookeeper |
2.解压安装
(1)解压Zookeeper安装包到/opt/module/目录下
[yl@hadoop1 software]$ tar -zxvf zookeeper-3.5.7.tar.gz -C /opt/module/
(2)修改/opt/module/apache-zookeeper-3.5.7-bin名称为zookeeper-3.5.7
[yl@hadoop1 module]$ mv apache-zookeeper-3.5.7-bin/ zookeeper-3.5.7
(3)同步/opt/module/zookeeper-3.5.7目录内容到hadoop2、hadoop3
3.配置服务器编号
(1)在/opt/module/zookeeper-3.5.7/这个目录下创建zkData
[yl@hadoop1 zookeeper-3.5.7]$ mkdir zkData
(2)在/opt/module/zookeeper-3.5.7/zkData目录下创建一个myid的文件
[yl@hadoop1 zkData]$ vim myid
在文件中添加与server对应的编号:1
(3)拷贝配置好的zookeeper到其他机器上,并分别在hadoop2、hadoop3上修改myid文件中内容为2、3
4.配置zoo.cfg文件
(1)重命名/opt/module/zookeeper-3.5.7/conf这个目录下的zoo_sample.cfg为zoo.cfg
[yl@hadoop1 conf]$ mv zoo_sample.cfg zoo.cfg
(2)打开zoo.cfg文件
[yl@hadoop1 conf]$ vim zoo.cfg
修改数据存储路径配置(一般存储路径在/tmp目录下,系统会30天自动删除)
dataDir=/opt/module/zookeeper-3.5.7/zkData
增加如下配置
#######################cluster##########################
server.1=hadoop1:2888:3888
server.2=hadoop2:2888:3888
server.3=hadoop3:2888:3888
(3)同步zoo.cfg配置文件到其他机器
5.集群操作
(1)分别启动Zookeeper
[yl@hadoop1 zookeeper-3.5.7]$ bin/zkServer.sh start
[yl@hadoop2 zookeeper-3.5.7]$ bin/zkServer.sh start
[yl@hadoop3 zookeeper-3.5.7]$ bin/zkServer.sh start
(2)分别查看状态
[yl@hadoop1 zookeeper-3.5.7]# bin/zkServer.sh status
JMX enabled by default
Using config: /opt/module/zookeeper-3.5.7/bin/../conf/zoo.cfg
Mode: follower
[yl@hadoop2 zookeeper-3.5.7]# bin/zkServer.sh status
JMX enabled by default
Using config: /opt/module/zookeeper-3.5.7/bin/../conf/zoo.cfg
Mode: leader
[yl@hadoop3 zookeeper-3.4.5]# bin/zkServer.sh status
JMX enabled by default
Using config: /opt/module/zookeeper-3.5.7/bin/../conf/zoo.cfg
Mode: follower
6.启动客户端
[yl@hadoop2 zookeeper-3.5.7]$ bin/zkCli.sh
更多推荐
所有评论(0)