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