1. 程式人生 > >hadoop--搭建hbase叢集

hadoop--搭建hbase叢集

背景

我們已經搭建了HA高可用的hdfs叢集,現在要在hdfs叢集的基礎上搭建hbase叢集。可以看我之前的一篇hdfs叢集搭建,

自行官網下載hbase,我這裡選用1.2.3版本

修改hbase配置檔案

1. hbase-env.sh
//#配置一下JAVA環境
export JAVA_HOME=/usr/local/jdk
//# Tell HBase whether it should manage it's own instance of Zookeeper or not.
export HBASE_MANAGES_ZK=false

2. hbase-site.xml

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
/**
 *
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
-->
<configuration>
<property>
    <name>hbase.cluster.distributed</name>
    <value>true</value>
</property>
<property>
    <name>hbase.rootdir</name>
    <value>hdfs://mycluster/hbase</value>
</property>
<property>
    <name>hbase.zookeeper.quorum</name>
    <value>es02:2181,es03:2181,es04:2181</value>
</property>
<property>
    <name>hbase.zookeeper.property.dataDir</name>
    <value>/home/hadoop/zk/data</value>
</property>
</configuration>
3. 配置regionservers,regionserver的節點
es02
es03
es04

注意事項

由於hdfs配置了HA高可用,我們在hadoop的hdfs-site.xml中配置了"dfs.nameservices"的名稱“mycluster”他下面有兩個名稱節點“nn1,nn2”,我們需要把hadoop中的hdfs-site.xml和core-site.xml放到hbase目錄下的conf資料夾中,不然hbase叢集在啟動的時候會報"unkonwHostException"。

啟動測試

//啟動命令
start-hbase.sh

登入webUI 檢視