配置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
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
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
master
slave1
slave2
如下目录赋予hadoop用户
/opt/data/hbase
/opt/data/hbase/pid
/opt/data/hbase/tmp
./bin/start-hbase.sh
启动之后,会发现只有主节点有regionserver进程,其余都没有,查看log,发现
java.net.UnknownHostException: cluster
HBase没有识别cluster这个集群,解决这个问题的方法是把Hadoop的2个配置文件(core-site.xml和hdfs-site.xml),放到HBase的conf目录下,让HBase能找到Hadoop的配置
./bin/hbase-daemon.sh start master
[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]
访问http://172.16.30.101:16010 和 http://172.16.30.100:16010
其中一个是Backup Master,另一个是Master
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对时间偏差要求很高,一定要做好时间同步