HBase集群安装-2 Zookeeper安装

创建 zookeeper 数据目录 和 myid文件

[hadoop@master hadoop]$ mkdir -p /usr/local/hadoop/zk/data
[hadoop@master hadoop]$ echo 1 >> /usr/local/hadoop/zk/data/myid

[hadoop@slave1 hadoop]$ mkdir -p /usr/local/hadoop/zk/data
[hadoop@slave1 hadoop]$ echo 2 >> /usr/local/hadoop/zk/data/myid

[hadoop@slave2 hadoop]$ mkdir -p /usr/local/hadoop/zk/data
[hadoop@slave2 hadoop]$ echo 3 >> /usr/local/hadoop/zk/data/myid

编辑 zookeeper 配置

cd /usr/local/hadoop/zookeeper-3.4.6/conf/
cp zoo_sample.cfg zoo.cfg
vim zoo.cfg


dataDir=/usr/local/hadoop/zk/data
server.1=master:2888:3888
server.2=slave1:2888:3888
server.3=slave2:2888:3888

同步

同步master中的zookeeper到2个slave结点
[hadoop@master conf] rsyncr/usr/local/hadoop/zookeeper3.4.6slave1:/usr/local/hadoop/[hadoop@masterconf] rsync -r /usr/local/hadoop/zookeeper-3.4.6 slave2:/usr/local/hadoop/

分别启动zookeeper

[hadoop@master hadoop]$ cd /usr/local/hadoop/zookeeper-3.4.6/bin/
[hadoop@master bin]$ ./zkServer.sh start

检查安装是否成功

./zkCli.sh -server master:2181
ls /
quit

或者查看状态,一个Mode:leader,2个Mode:follower

./zkServer.sh status

其他

停止ZooKeeper

./zkServer.sh stop

防火墙坑

chkconfig iptables off
service iptables stop

你可能感兴趣的:(HBase集群安装-2 Zookeeper安装)