hbase簡介
HBase是一個分佈式的、面向列的開源數據庫,該技術來源於 Fay Chang 所撰寫的Google論文“Bigtable:一個結構化數據的分佈式存儲系統”。就像Bigtable利用了Google文件系統(File System)所提供的分佈式數據存儲一樣,HBase在Hadoop之上提供了類似於Bigtable的能力。HBase是Apache的Hadoop項目的子項目。HBase不同於一般的關係數據庫,它是一個適合於非結構化數據存儲的數據庫。另一個不同的是HBase基於列的而不是基於行的模式。
—百度百科
hbase安裝流程介紹
1.下載hbase
hbase下載地址:hbase下載地址
將hbase壓縮包解壓到/opt目錄中,顯示信息如下:
hadoop@hzwy23:/opt/hbase-1.3.0$ pwd
/opt/hbase-1.3.0
hadoop@hzwy23:/opt/hbase-1.3.0$ ls
bin CHANGES.txt conf docs hbase-webapps LEGAL lib LICENSE.txt logs NOTICE.txt README.txt zookeeper.out
2.下載zookeeper
下載地址:zookeeper官方下載地址
將下載下來的壓縮包解壓到/opt目錄中。
hadoop@hzwy23:/opt/zookeeper-3.4.9$ ls
bin conf docs lib README_packaging.txt src zookeeper-3.4.9.jar.md5
build.xml contrib ivysettings.xml LICENSE.txt README.txt zookeeper-3.4.9.jar zookeeper-3.4.9.jar.sha1
CHANGES.txt dist-maven ivy.xml NOTICE.txt recipes zookeeper-3.4.9.jar.asc
hadoop@hzwy23:/opt/zookeeper-3.4.9$ pwd
/opt/zookeeper-3.4.9
hadoop@hzwy23:/opt/zookeeper-3.4.9$ cp conf/zoo_sample.cfg conf/zoo.cfg
修改用戶環境變量~/.profile文件,在文件末尾添加下邊信息:
export ZOOKEEPER_HOME=/opt/zookeeper-3.4.9
export PATH=$PATH:$ZOOKEEPER_HOME/bin
export HBASE_HOME=/opt/hbase-1.3.0
export PATH=$PATH:$HBASE_HOME/bin
接着source一下配置文件,讓環境變量生效:
source ~/.profile
3.修改hbase配置文件
修改$HBASE_HOME/conf/hbase-site.xml,將configuration中內容修改爲下邊所示:
<configuration>
<property>
<name>hbase.rootdir</name>
<value>hdfs://localhost:9000/hbase</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
</configuration>
4.啓動zookeeper與hbase服務
首先啓動zookeeper,
cd $ZOOKEEPER_HOME/bin
./zkServer.sh start
jps
如果在jvm進程中找到QuorumPeerMain進程,表示zookeeper啓動成功。
5.啓動hbase服務
cd $HBASE_HOME/bin
./start-hbase.sh
jps
如果在jvm中存在HMaster,HRegionServer進程,表示hbase啓動成功。
5.驗證hbase
通過shell進入hbase交互界面。
hbase shell
創建people表,字段是name,age,gender。
hbase(main):001:0> create 'people','name','age','gender';
向表中添加數據
hbase(main):028:0> put 'people','huang','age','gender:man'
查詢people表中數據
hbase(main):029:0> get 'people','huang','age'
COLUMN CELL
age: timestamp=1487258719121, value=gender:man
age:24 timestamp=1487258624676, value=man
1 row(s) in 0.0140 seconds
詳細hbase操作手冊,請參考官方文檔。