轉(zhuǎn):http://www.tech126.com/hadoop-hbase/
基于現(xiàn)有的Hadoop集群,來(lái)搭建Hbase的環(huán)境
整個(gè)過(guò)程還是比較簡(jiǎn)單的
1. 下載Hbase源碼,并解壓
cp hbase-0.20.6.tar.gz /opt/hadoop/
cd /opt/hadoop/
tar zxvf hbase-0.20.6.tar.gz
ln -s hbase-0.20.6 hbase
2.修改hbase-env.sh,加入java環(huán)境,并修改log位置
export JAVA_HOME=/opt/java/jdk
export HBASE_LOG_DIR=/opt/log/hbase
export HBASE_MANAGES_ZK=true
3. 修改hbase-site.xml,配置hbase
<property>
<name>hbase.rootdir</name>
<value>hdfs://zw-hadoop-master:9000/hbase</value>
<description>The directory shared by region servers.</description>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
<description>The mode the cluster will be in. Possible values are
false: standalone and pseudo-distributed setups with managed Zookeeper
true: fully-distributed with unmanaged Zookeeper Quorum (see hbase-env.sh)
</description>
</property>
<property>
<name>hbase.master</name>
<value>hdfs://zw-hadoop-master:60000</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>zw-hadoop-slave225,zw-hadoop-slave226,zw-hadoop-slave227</value>
<description>Comma separated list of servers in the ZooKeeper Quorum. For example, "host1.mydomain.com,host2.mydomain.com,host3.mydomain.com". By default this is set to localhost for local and pseudo-distributed modes of operation. For a fully-distributed setup, this should be set to a full list of ZooKeeper quorum servers. If HBASE_MANAGES_ZK is set in hbase-env.sh this is the list of servers which we will start/stop ZooKeeper on.
</description>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/opt/log/zookeeper</value>
<description>Property from ZooKeeper's config zoo.cfg.
The directory where the snapshot is stored.
</description>
</property>
幾個(gè)配置的說(shuō)明:
- hbase.rootdir設(shè)置hbase在hdfs上的目錄,主機(jī)名為hdfs的namenode節(jié)點(diǎn)所在的主機(jī)
- hbase.cluster.distributed設(shè)置為true,表明是完全分布式的hbase集群
- hbase.master設(shè)置hbase的master主機(jī)名和端口
- hbase.zookeeper.quorum設(shè)置zookeeper的主機(jī),官方推薦設(shè)置為3,5,7比較好
4. 編輯regionservers文件,設(shè)置regionservers的服務(wù)器,和hadoop的slaves一樣即可
5. 啟動(dòng)Hbase
/opt/sohuhadoop/hbase/bin/start-hbase.sh
/opt/sohuhadoop/hbase/bin/stop-hbase.sh
Hbase默認(rèn)只有一個(gè)Master,我們可以也啟動(dòng)多個(gè)Master:
/opt/sohuhadoop/hbase/bin/hbase-daemon.sh start master
不過(guò),其它的Master并不會(huì)工作,只有當(dāng)主Master down掉后
其它的Master才會(huì)選擇接管Master的工作
Hbase也有一個(gè)簡(jiǎn)單的web界面,來(lái)查看其狀態(tài)
http://10.10.71.1:60010/master.jsp
http://10.10.71.1:60030/regionserver.jsphttp://10.10.71.1:60010/zk.jsp