1. 程式人生 > >hadoop單機偽分佈安裝HBase-1.4.8詳細步驟(親測成功)

hadoop單機偽分佈安裝HBase-1.4.8詳細步驟(親測成功)

---------前提:安裝hadoop、yarn、jdk

1.下載解壓

1.1使用wget下載

1.2解壓到/usr/local目錄下

1.3.修改hbase資料夾許可權

chown -R hadoop:hadoop /usr/local/hbase-1.4.8

2.設定hbase環境變數--為了使用命令方便(替換成自己的安裝路徑)

vi /etc/profile

#hbase
export HBASE_HOME=/usr/local/hbase-1.4.8
PATH=$HBASE_HOME/bin:$PATH

2.1更新配置--使之生效
source /etc/profile

3.配置 hbase-env.sh檔案(在$HBASE_HOME的conf下--下面配置檔案也是在此目錄下)

JAVA_HOME=新增jdk的安裝路徑
HBASE_MANAGES_ZK=true     #此配置資訊,設定由hbase自己管理zookeeper,不需要單獨的zookeeper

4.配置 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.rootdir</name>
        <value>hdfs://master2:9000/hbase</value>
    </property>
    <property>
        <name>hbase.cluster.distributed</name>
        <value>true</value>
    </property>
    <property>
        <name>hbase.zookeeper.quorum</name>
        <value>master2</value>
    </property>

</configuration>

---開啟叢集順序

hadoop-->yarn--->hbase

5.啟動hadoop與yarn:

start-all.sh

6.啟動hbase
start-hbase.sh

7.檢視程序:紅線框中的三個程序必須都有
jps

8.進入hbase shell:

hbase shell

9.主機IP:16010:---進入hbase的web頁面

10.小總結

hbase:是分散式資料庫,有是非關係型資料庫

hdfs是分散式檔案系統

nosql:非關係型資料庫

不支援SQL語句,儲存在資料庫中的不是二維表格

nosql儲存的型別:

1.key-value------對應的資料庫redis

2.面向文件(例如百度文庫、道客巴巴)--對應的資料庫CouchDB

3.Column-Family 列式儲存--hbase

4.圖(資料結構)

Redis:l類似於map,資料放在記憶體中--讀寫資料非常快(用C\C++編寫而成)

訪問記憶體比磁碟快一千倍,一般資料庫儲存在磁碟中。

主要用於web應用的快取

為什麼使用nosql?

關係型資料庫:1.擴充套件性差,2.大資料處理能力低

nosql補足了這些缺點,但是不能代替傳統的資料庫。

hbase叢集的啟動與單關閉

可以用強勢方式:kill -9 id(id 是jps檢視前面顯示所對應的編碼)

啟動HBase叢集:

bin/start-hbase.sh

單獨啟動一個HMaster程序:

bin/hbase-daemon.sh start master

單獨停止一個HMaster程序:

bin/hbase-daemon.sh stop master

單獨啟動一個HRegionServer程序:

bin/hbase-daemon.sh start regionserver

單獨停止一個HRegionServer程序:

bin/hbase-daemon.sh stop regionserver