hbase安装(hbase-0.90.5+hadoop0.20.2)
所有操作均使用grid账户
1、下载 hbase
*** 用什么版本的hadoop,就用什么版本的hbase (下载解压后得到 hadoop-core-0.20-append-r1056497.jar, 然后查看MANIFEST.MF,可得到hadoop版本的支持信息)***
下载地址:mirror.bjtu.edu.cn/apache/hbase
使用版本:hbase-0.90.5.tar.gz(从群的空间下载的)
hadoop版本:0.20.2
2、拷贝、解压
[grid@h1 ~]$ cp /mnt/hgfs/share_files/hbase-0.90.5.tar.gz ~
[grid@h1 ~]$ tar -zxvf hbase-0.90.5.tar.gz
3、修改hbase-env.sh
位置:/home/grid/hbase-0.90.5/conf/hbase-env.sh
export JAVA_HOME=/usr/java/jdk1.6.0_29/
export HBASE_CLASSPATH=/home/gird/hadoop-0.20.2/conf
配置说明:使用独立的ZooKeeper时需要修改HBASE_MANAGES_ZK值为false,为不使用默认ZooKeeper实例(默认为true)
4、配置hbase-site.xml
位置:/home/grid/hbase-0.90.5/conf/hbase-site.xml
[grid@h1 ~]$ mkdir hbase-0.90.5_zookeeper
[grid@h1 ~]$ mkdir hbase-0.90.5_tmp
<configuration>
<property>
<name>hbase.rootdir</name>
<value>hdfs://h1:9000/hbase</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>h1,h2,h3</value>
</property>
<property>
<name>hbase.tmp.dir</name>
<value>/home/grid/hbase-0.90.5_tmp</value>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/home/grid/hbase-0.90.5_zookeeper</value>
</property>
<configuration>
5、覆盖hadoop核心jar包(原因:防止因为hbase和hadoop版本不同出现兼容问题,造成bmaster启动异常)
Hadoop覆盖Hbase
先备份一下
[grid@h1 ~]$ cd hbase-0.90.5/lib
[grid@h1 lib]$ cp hadoop-core-0.20-append-r1056497.jar hadoop-core-0.20-append-r1056497.sav
[grid@h1 lib]$ rm hadoop-core-0.20-append-r1056497.jar
[grid@h1 lib]$ cp /home/grid/hadoop-0.20.2/hadoop-0.20.2-core.jar .
6、拷贝到其他机器
[grid@h1 ~]$ scp -r ./hbase-0.90.5 h2:/home/grid
[grid@h1 ~]$ scp -r ./hbase-0.90.5 h3:/home/grid
[grid@h1 ~]$ scp -r ./hbase-0.90.5_tmp h2:/home/grid
[grid@h1 ~]$ scp -r ./hbase-0.90.5_tmp h3:/home/grid
[grid@h1 ~]$ scp -r ./hbase-0.90.5_zookeeper h2:/home/grid
[grid@h1 ~]$ scp -r ./hbase-0.90.5_zookeeper h3:/home/grid
7、启动Hbase及验证
[grid@h1 ~]$ hbase-0.90.5/bin/start-hbase.sh
[grid@h1 ~]$ /usr/java/jdk1.6.0_29/bin/jps
验证:http://192.168.1.104:60010/master.jsp
报:You are currently running the HMaster without HDFS append support enabled. This may result in data loss. Please see the HBase wiki for details.
见图:
<ignore_js_op style="word-wrap: break-word; font-family: 微软雅黑, 宋体; background-color: rgb(223, 223, 223);">
<ignore_js_op style="word-wrap: break-word; font-family: 微软雅黑, 宋体; background-color: rgb(223, 223, 223);">
8、关闭
[grid@h1 ~]$ hbase-0.90.5/bin/stop-hbase.sh
[grid@h1 ~]$ hadoop-0.20.2/bin/stop-all.sh
9、用hbase的jar包覆盖hadoop的jar包
先备份
[grid@h1 hadoop-0.20.2]$ cp hadoop-0.20.2-core.jar hadoop-0.20.2-core.sav
[grid@h1 hadoop-0.20.2]$ cd ../hbase-0.90.5/lib
[grid@h1 lib]$ cp adoop-core-0.20-append-r1056497.sav hadoop-0.20.2-core.jar
[grid@h1 lib]$ cp hadoop-0.20.2-core.jar /home/grid/hadoop-0.20.2/hadoop-0.20.2-core.jar
同步到其他节点
[grid@h1 lib]$ scp -r hadoop-0.20.2-core.jar h2:/home/grid/hbase-0.90.5/lib/
[grid@h1 lib]$ scp -r hadoop-0.20.2-core.jar h3:/home/grid/hbase-0.90.5/lib/
[grid@h1 lib]$ scp -r hadoop-0.20.2-core.jar h2:/home/grid/hadoop-0.20.2/
[grid@h1 lib]$ scp -r hadoop-0.20.2-core.jar h3:/home/grid/hadoop-0.20.2/
10、再次重新启动
hadoop-0.20.2/bin/start-all.sh //过20多秒再起hbase,有一段时间的安全模式
hbase-0.90.5/bin/start-hbase.sh
/usr/java/jdk1.6.0_29/bin/jps
<ignore_js_op style="word-wrap: break-word; font-family: 微软雅黑, 宋体; background-color: rgb(223, 223, 223);">
<ignore_js_op style="word-wrap: break-word; font-family: 微软雅黑, 宋体; background-color: rgb(223, 223, 223);">
测试:
[grid@h1 ~]$ hbase-0.90.5/bin/hbase shell
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 0.90.5, r1212209, Fri Dec 9 05:40:36 UTC 2011
hbase(main):001:0> status
1 servers, 0 dead, 2.0000 average load
注意点:
启动顺序:先启动Hadoop——>再启动Hbase,关闭顺序:先关闭Hbase——>再关闭Hadoop
hbase.zookeeper.quorum 的个数必须是奇数。(没验证)
web管理界面
localhost:60010/master.jsp