HBase集羣配置安裝
hadoop-0.20.2
hbase-0.20.3
zookeeper-3.3.0
1:
tar zxvf hbase-0.20.3.tar.gz
2:
修改 ./hbase-0.20.3/conf/hbase-env.sh
export JAVA_HOME=/usr/local/java/
3:
建立文件./hbase-0.20.3/conf/hbase-site.xml
用戶存放用戶自定義的一些配置信息,相關配置項能夠從 ./hbase-0.20.3/conf/hbase-default.xml中找到.
一個簡單的hbase-site.xml以下:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>hbase.rootdir</name>
<value>hdfs://master:9900/hbase</value>
</property>
<property>
<name>hbase.master.port</name>
<value>60000</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>dfs.replication</name>
<value>3</value>
</property>
</configuration>
注意:
把./hbase-0.20.3/conf/hbase-site.xml中
<name>hbase.rootdir</name>
<value>hdfs://master:9900/hbase</value>
和
./hadoop-0.20.2/conf/core-site.xml中
<name>fs.default.name</name>
<value>hdfs://master:9900/</value>
保持一致就能夠了。
若是不一致的話,會報以下錯誤:
[hadoopuser
@master hbase-0.20.3]$ bin/hbase shell HBase Shell; enter 'help<RETURN>' for list of supported commands. Version: 0.20.3, rUnknown, Fri Apr 9 11:15:50 CST 2010 hbase(main):001:0>create 'test','fs' NativeException: org.apache.hadoop.hbase.MasterNotRunningException: null 4: 建立文件./hbase-0.20.3/conf/regionservers 內容以下: server01 server02 server03 server04 server05 5: 分發hbase-0.20.3到各臺服務器(可能要根據實際狀況更改JAVA_HOME) 6: 啓動hbase 在master節點上啓動: bin/start-hbase.sh localhost: starting zookeeper, logging to ******** starting master, logging to ********* server01: starting regionserver, logging to ********** server02: starting regionserver, logging to ********** server03: starting regionserver, logging to ********** server04: starting regionserver, logging to ********** server05: starting regionserver, logging to ********** 7: 使用hbase shell bin/hbase shell hbase(main):012:0> create 'test','fs' 0 row(s) in 2.4360 seconds hbase(main):013:0> list test 1 row(s) in 0.0060 seconds hbase(main):014:0> disable 'test' 0 row(s) in 2.0460 seconds hbase(main):015:0> drop 'test' 0 row(s) in 0.0050 seconds 0 row(s) in 0.0050 seconds 0 row(s) in 0.0570 seconds 經過web方式能夠查看運行在HBase下的zookeeper : http://master:60010/zk.jsp