Compared with the HA of Hadoop's NameNode and ResourceManager, Hbase's Hmaster configuration HA is relatively simple, and almost no configuration is required:
- <configuration>
- <property>
- <name>hbase.rootdir</name>
- < value > hdfs://ns1/hbase </ value > <!--This must be the same as the configuration in core-site.xml-->
- </property>
- <!-- Enable distributed mode -->
- <property>
- <name>hbase.cluster.distributed</name>
- <value>true</value>
- </property>
- <property>
- <name>hbase.zookeeper.property.clientPort</name>
- <value>2181</value>
- </property>
- <!-- This is right, only configure the port, in order to configure multiple HMaster -->
- <property>
- <name>hbase.master</name>
- <value>60000</value>
- </property>
- <property>
- <name>hbase.tmp.dir</name>
- <value>/ROOT/server/hbase/hbasetmp</value>
- </property>
- <!-- When using the external zk cluster of Hbase, use the following zk port -->
- <property>
- <name>hbase.zookeeper.quorum</name>
- <value>h1,h2,h3</value>
- </property>
- <property>
- <name>hbase.regionserver.lease.period</name>
- <value>120000</value>
- </property>
- </configuration>
<configuration> <property> <name>hbase.rootdir</name> <value>hdfs://ns1/hbase</value><!--This must be the same as the configuration in core-site.xml--> </property> <!-- Enable distributed mode--> <property> <name>hbase.cluster.distributed</name> <value>true</value> </property> <property> <name>hbase.zookeeper.property.clientPort</name> <value>2181</value> </property> <!-- This is right, only configure the port, in order to configure multiple HMaster --> <property> <name>hbase.master</name> <value>60000</value> </property> <property> <name>hbase.tmp.dir</name> <value>/ROOT/server/hbase/hbasetmp</value> </property> <!-- When using the external zk cluster of Hbase, use the following zk port--> <property> <name>hbase.zookeeper.quorum</name> <value>h1,h2,h3</value> </property> <property> <name>hbase.regionserver.lease.period</name> <value>120000</value> </property> </configuration>
After completion, execute start-hbase.sh to start the Hbase cluster, and then
execute . If the startup is successful, you can
see the standby master on the 16010 interface. After everything is normal, you can Kill the master master and test automatic fault tolerance.
Use the jps command to view the processes of the two masters, as follows:
- [webmaster@Hadoop-0-187 ~]$ jps
- 20449 JobHistoryServer
- 27295 Jps
- 14204 DataNode
- 20209 NameNode
- 17328 ResourceManager
- 3310 QuorumPeerMain
- 19329 HMaster
- 13827 DFSZKFailoverController
- 15474 NodeManager
- 14409 JournalNode
- [webmaster@Hadoop-0-187 ~]$
[webmaster@Hadoop-0-187 ~]$ jps 20449 JobHistoryServer 27295 Jps 14204 DataNode 20209 NameNode 17328 ResourceManager 3310 QuorumPeerMain 19329 HMaster 13827 DFSZKFailoverController 15474 NodeManager 14409 JournalNode [webmaster@Hadoop-0-187 ~]$
- [webmaster@Hadoop-0-186 ~]$ jps
- 30300 JournalNode
- 30789 NodeManager
- 582 HMaster
- 30203 DataNode
- 3683 Jps
- 30127 NameNode
- 31256 ResourceManager
- 2396 QuorumPeerMain
- 29987 DFSZKFailoverController
- 32745 HRegionServer
- [webmaster@Hadoop-0-186 ~]$
[webmaster@Hadoop-0-186 ~]$ jps 30300 JournalNode 30789 NodeManager 582 HMaster 30203 DataNode 3683 Jps 30127 NameNode 31256 ResourceManager 2396 QuorumPeerMain 29987 DFSZKFailoverController 32745 HRegionServer [webmaster@Hadoop-0-186 ~]$
It means the configuration is successful!