Hbase 1.2 HA配置

在网上看到很多博客都说要配置backup-masters,实际上是不用配置的。

1、配置Hbase集群使用自带的zookeeper还是另外的zookeeper集群,我使用的是自己单独搭建的zookeeper集群,配置如下

hbase-env.sh
# Tell HBase whether it should manage it's own instance of Zookeeper or not.
export HBASE_MANAGES_ZK=false

2、配置Zookeeper信息

vim ${HBASE_CONF_DIR}/hbase-site.xml

          hbase.zookeeper.quorum
          SZD-L0090345,SZD-L0090346,SZD-L0090343
          
                Comma separated list of servers in the ZooKeeper ensemble (This config. should have been named hbase.zookeeper.ensemble).
          For example, "host1.mydomain.com,host2.mydomain.com,host3.mydomain.com". By default this is set to localhost for local and pseudo-distributed modes 
          of operation. For a fully-distributed setup, this should be set to a full list of ZooKeeper ensemble servers. If HBASE_MANAGES_ZK is set in hbase-env.sh 
          this is the list of servers which hbase will start/stop ZooKeeper on as part of cluster start/stop.  Client-side, we will take this list of
          ensemble members and put it together with the hbase.zookeeper.clientPort config. and pass it into zookeeper constructor as the connectString parameter.
          


         hbase.zookeeper.property.clientPort
         2181
         Property from ZooKeeper's config zoo.cfg. The port at which the clients will connect.

3、在一台master上启动集群 start-hbase.sh,这个过程会启动本机的hmaster和集群的regionserver,并且将集群的状态信息更新到zookeeper目录。

4、在zookeeper Dump页面查看集群信息,地址http://master_ip:60010/zk.jsp,可以看到集群中的active master、backup master、regionserver等信息。

5、测试HA,在另外一台或多台master上启动/停止单个hmaster服务,在http://master_ip:60010/zk.jsp界面观察集群信息变化。

启动单个hmaster服务:hbase-daemon.sh start hmaster

停止单个hmaster服务:hbase-daemon.sh stop hmaster


你可能感兴趣的:(Hbase)