HBase实验环境:
172.16.110.133 laodeng3.localdomain
172.16.110.132 laodeng2.localdomain
172.16.110.134 laodeng4.localdomain
用户:hbase password:hbase
Node Name Master Zookeeper RegionServer
172.16.110.133 Y Y N
172.16.110.134 backup Y Y
172.16.110.132 N Y Y
下载hbase的安装包
http://mirror.bit.edu.cn/apache/hbase/hbase-0.98.8/hbase-0.98.8-hadoop2-bin.tar.gz
步骤
一、Password-Less SSH Access
1、配置133 到134、132 的 hbase用户Password-Less SSH Access
2、134为backup master
配置在134-〉133的hbase用户Password-Less SSH Access
二、133上的配置
安装jdk 1.6 (其他两个节点也要安装,并配置JAVA_HOME)
安装hbase :tar xzvf hbase-0.98.8-hadoop2-bin.tar.gz 到/opt/hbase
1、配置RegionServer
vi conf/regionservers
laodeng2.localdomain
laodeng4.localdomain
2、配置a backup master
Create a new file in conf/ called backup-masters
vi conf/backup-masters
增加laodeng4.localdomain
3、配置Zookeeper (更多配置参考:http://hbase.apache.org/book/zookeeper.html)
vi conf/hbase-site.xml
hbase.rootdir
hdfs://172.16.110.133:9000/hbase
hbase.cluster.distributed
true
hbase.zookeeper.quorum
laodeng2.localdomain,laodeng3.localdomain,laodeng4.localdomain
hbase.zookeeper.property.dataDir
/usr/local/zookeeper
注意:hbase用户在/usr/local上要有写权限
注意:zookeeper跑在三个节点上,故还需要在133上打通自身的Password-Less SSH Access
4、配置JAVA_HOME
vi conf/hbase-env.sh
export JAVA_HOME=/usr/java/jdk1.6.0_45
5、远程发布hbase到132、134上
[hbase@laodeng3 opt]$ scp -r hbase [email protected]:/opt
[hbase@laodeng3 opt]$ scp -r hbase [email protected]:/opt
三、启动和测试Hbase Cluster
[hbase@laodeng3 hbase]$ ./bin/start-hbase.sh
laodeng3.localdomain: starting zookeeper, logging to /opt/hbase/bin/../logs/hbase-hbase-zookeeper-laodeng3.localdomain.out
laodeng2.localdomain: starting zookeeper, logging to /opt/hbase/bin/../logs/hbase-hbase-zookeeper-laodeng2.localdomain.out
laodeng4.localdomain: starting zookeeper, logging to /opt/hbase/bin/../logs/hbase-hbase-zookeeper-laodeng4.localdomain.out
starting master, logging to /opt/hbase/bin/../logs/hbase-hbase-master-laodeng3.localdomain.out
laodeng2.localdomain: starting regionserver, logging to /opt/hbase/bin/../logs/hbase-hbase-regionserver-laodeng2.localdomain.out
laodeng4.localdomain: starting regionserver, logging to /opt/hbase/bin/../logs/hbase-hbase-regionserver-laodeng4.localdomain.out
laodeng4.localdomain: starting master, logging to /opt/hbase/bin/../logs/hbase-hbase-master-laodeng4.localdomain.out
结果:
[hbase@laodeng3 hbase]$ jps
9893 Jps
9649 HMaster
9584 HQuorumPeer
[hbase@laodeng4 ~]$ jps
12183 HMaster
11948 HQuorumPeer
12398 Jps
12067 HRegionServer
[hbase@laodeng2 ~]$ jps
20800 HRegionServer
20689 HQuorumPeer
21006 Jps
可以查询到我在伪集群实验时建立的表:
[hbase@laodeng3 hbase]$ ./bin/hbase shell
2014-12-16 10:55:32,559 INFO [main] Configuration.deprecation: hadoop.native.lib is deprecated. Instead, use io.native.lib.available
HBase Shell; enter 'help' for list of supported commands.
Type "exit" to leave the HBase Shell
Version 0.98.8-hadoop2, r6cfc8d064754251365e070a10a82eb169956d5fe, Fri Nov 14 18:26:29 PST 2014
hbase(main):001:0> list
TABLE
2014-12-16 10:55:39,772 WARN [main] util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
denglt
denglt2
2 row(s) in 2.4780 seconds
=> ["denglt", "denglt2"]
hbase(main):002:0> scan 'denglt'
ROW COLUMN+CELL
1 column=info:age, timestamp=1418457735162, value=38
1 column=info:name, timestamp=1418457663195, value=dlt
3 column=info:name, timestamp=1418458734676, value=zyy
2 row(s) in 0.2840 seconds
web管理:
http://172.16.110.133:60010/master-status
http://172.16.110.134:60010/
http://172.16.110.132:60030/rs-status
http://172.16.110.134:60030/rs-status
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/195110/viewspace-1370076/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/195110/viewspace-1370076/