Hbase-HA搭建(两个HMaster)

1.配置

1.1.环境配置

配置HBASE_HOME(部分参数路径基于此配置,比方说log)
vi ~/.bash_profile

PATH=$PATH:$HOME/bin
export JAVA_HOME=/home/hadoop/env/jdk1.7.0_80
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export HADOOP_HOME=/opt/modules/hadoop
export HBASE_HOME=/opt/modules/hbase-1.2.6
export PATH=$JAVA_HOME/bin:$HADOOP_HOME/bin:$HBASE_HOME/bin:$PATH

1.2.文件配置

1.2.1.hbase-env.sh

export JAVA_HOME=/home/hadoop/env/jdk1.7.0_80
export HBASE_CLASSPATH=/opt/modules/hbase-1.2.6/conf
# 根据内存情况,可以适当调大
export HBASE_HEAPSIZE=1G
export HBASE_PID_DIR=/opt/data/hbase/pid
# 使用独立的zookeeper
export HBASE_MANAGES_ZK=false

1.2.2.hbase-site.xml


	
		
		hbase.rootdir
		hdfs://cluster/hbase
	
	
		
		hbase.cluster.distributed
		true
	
	
		hbase.zookeeper.quorum
		master,slave1,slave2
	
	
		hbase.zookeeper.property.clientPort
		2181
	
	
		
		hbase.master.maxclockskew
		180000
	
	
		
		hbase.regionserver.handler.count
		12
	
	
		
		hbase.master
		60000
	
	
		hbase.tmp.dir
		/opt/data/hbase/tmp
	

1.2.3.regionservers

master
slave1
slave2

1.3.创建相关文件

如下目录赋予hadoop用户

/opt/data/hbase
/opt/data/hbase/pid
/opt/data/hbase/tmp

2.启动集群

./bin/start-hbase.sh
启动之后,会发现只有主节点有regionserver进程,其余都没有,查看log,发现
java.net.UnknownHostException: cluster
HBase没有识别cluster这个集群,解决这个问题的方法是把Hadoop的2个配置文件(core-site.xml和hdfs-site.xml),放到HBase的conf目录下,让HBase能找到Hadoop的配置

3.启动从节点的HMaster

./bin/hbase-daemon.sh start master

4.查看zookeeper

[zk: localhost:2181(CONNECTED) 0] ls /
[hbase, yarn-leader-election, hadoop-ha, zookeeper]
[zk: localhost:2181(CONNECTED) 1] ls /hbase
[meta-region-server, backup-masters, table, draining, region-in-transition, running, table-lock, master, namespace, hbaseid, online-snapshot, replication, splitWAL, recovering-regions, rs, flush-table-proc]

5.确定ha是否成功

访问http://172.16.30.101:16010 和 http://172.16.30.100:16010
其中一个是Backup Master,另一个是Master

6.进程情况

master进程

[hadoop@master hbase-1.2.6]$ jps
42237 ZooKeeperMain
38296 NodeManager
42561 Jps
37230 NameNode
36329 JournalNode
36151 DataNode
42497 HMaster
36479 DFSZKFailoverController
41912 HRegionServer
34688 QuorumPeerMain

slave1进程

[hadoop@slave1 hbase-1.2.6]$ jps                                                                             
56760 DFSZKFailoverController
59847 HMaster
56572 DataNode
56667 JournalNode
60158 Jps
57922 ResourceManager
57769 NodeManager
17361 QuorumPeerMain
57211 NameNode

slave2进程

[hadoop@slave2 hbase-1.2.6]$ jps
105523 QuorumPeerMain
109093 Jps
109004 HRegionServer
107074 NodeManager
106772 JournalNode
106595 DataNode
107229 ResourceManager

注意事项:
hbase对时间偏差要求很高,一定要做好时间同步

你可能感兴趣的:(大数据)