Zookeeper的安装

来源:互联网 发布:coc地狱塔数据 编辑:程序博客网 时间:2024/06/01 07:31

1. 解压缩 zookeeper压缩包

 tar –zxvf  zookeeper-3.4.9.tar.gz

2. 移动到 conf 路径下, 将zoo_sample.cfg 文件 更名zoo.cfg复制到coof 路径下

[root@yufan hbase]# cd zookeeper-3.4.9/conf/[root@yufan conf]# cp zoo_sample.cfg zoo.cfg[root@yufan conf]# lsconfiguration.xsl  log4j.properties  zoo.cfg  zoo_sample.cfg


3. 

修改zoo.cfg 文件的配置信息

tickTime=2000initLimit=10syncLimit=5dataDir=/home/bigdata/hbase/zkdata/clientPort=2181server.1=yufan:2888:3888server.2=yufan1:2888:3888server.3=yufan2:2888:3888Server.n = YYY:A:B


其中N表示服务器编号,YYY表示服务器的IP地址(或主机名)。

ALF通信端口,表示该服务器与集群中的leader交换的信息的端口

B为选择端口,表示选择新的leader时服务器间相互通信的端口

4.

 [root@yufan conf]# mdir /home/bigdata/hbase/zkdata[root@yufan conf]# cd /home/bigdata/hbase/zkdata


在该目录下创建名为myid的文件,内容为1(这个值随server而改变)

[root@yufan conf]# cd /home/bigdata/hbase/zkdata[root@yufan zkdata]# vim myid[root@yufan zkdata]# cat myid1[root@yufan zkdata]#


 

5. 复制到其他结点

复制内容:

yufan上已经配置好的zookeeper-3.4.9拷贝到另外两台服务器yufan1yufan2(使用scp命令)然后将其上的.myid 的内容修改成23

6. 启动Zookeeper (每个结点都需要启动)

yufan:

[root@yufan bin]# ./zkServer.sh startZooKeeper JMX enabled by defaultUsing config: /home/bigdata/hbase/zookeeper-3.4.9/bin/../conf/zoo.cfgStarting zookeeper ... STARTED[root@yufan bin]# ./zkServer.sh statusZooKeeper JMX enabled by defaultUsing config: /home/bigdata/hbase/zookeeper-3.4.9/bin/../conf/zoo.cfgMode: follower


 

yufan1

[root@yufan1 ~]# cd /home/bigdata/hbase/zookeeper-3.4.9/bin/[root@yufan1 bin]# ./zkServer.sh startZooKeeper JMX enabled by defaultUsing config: /home/bigdata/hbase/zookeeper-3.4.9/bin/../conf/zoo.cfgStarting zookeeper ... STARTED[root@yufan1 bin]# ./zkServer.sh statusZooKeeper JMX enabled by defaultUsing config: /home/bigdata/hbase/zookeeper-3.4.9/bin/../conf/zoo.cfgMode: leader


yufan2:

[root@yufan2 ~]# source /etc/profile[root@yufan2 ~]# cd /home/bigdata/hbase/zookeeper-3.4.9/bin/[root@yufan2 bin]# ./zkServer.sh startZooKeeper JMX enabled by defaultUsing config: /home/bigdata/hbase/zookeeper-3.4.9/bin/../conf/zoo.cfgStarting zookeeper ... STARTED[root@yufan2 bin]# ./zkServer.sh statusZooKeeper JMX enabled by defaultUsing config: /home/bigdata/hbase/zookeeper-3.4.9/bin/../conf/zoo.cfgMode: follower