在執行以下動作之前,請先確定已啟動hadoop叢集。可用瀏覽器連到 50030 與 50070 port
啟動 hbase
於第一台電腦 ( vpro )電腦啟動hbase 叢集
$/opt/hbase/bin/start-hbase.sh
若沒有出現錯誤訊息,則代表成功,完整的程序可用 jps 來看。在第一台電腦上執行 jps 可以看到
$ jps
8790 HQuorumPeer
9078 HRegionServer
6598 NameNode
8868 HMaster
6897 JobTracker
6785 DataNode
7075 TaskTracker
21658 Jps
在第二台電腦上面執行jps可以看到
29186 Jps
17358 DataNode
17501 SecondaryNameNode
18617 HQuorumPeer
18772 HRegionServer
17644 TaskTracker
確定完整啟動 hbase 叢集,可以用瀏覽器連到 60010 port來檢視叢集環境,
Master: vpro:60000
Local logs, Thread Dump, Log Level
Master Attributes
| Attribute Name | Value | Description |
| HBase Version | 0.20.2, r834515 | HBase version and svn revision |
| HBase Compiled | Tue Nov 10 10:23:36 PST 2009, jdcryans | When HBase version was compiled and by whom |
| Hadoop Version | Unknown, rUnknown | Hadoop version and svn revision |
| Hadoop Compiled | Unknown, Unknown | When Hadoop version was compiled and by whom |
| HBase Root Directory | hdfs://secuse.nchc.org.tw:9000/hbase | Location of HBase home directory |
| Load average | 1.0 | Average number of regions per regionserver. Naive computation. |
| Regions On FS | 2 | Number of regions on FileSystem. Rough count. |
| Zookeeper Quorum | dx7200:2222,vpro:2222 | Addresses of all registered ZK servers. For more, see zk dump. |
Catalog Tables
| Table | Description |
| -ROOT- | The -ROOT- table holds references to all .META. regions. |
| .META. | The .META. table holds references to all User Table regions |
User Tables
Region Servers
| Address | Start Code | Load |
| dx7200:60030 | 1260783379077 | requests=0, regions=1, usedHeap=28, maxHeap=996 |
| vpro:60030 | 1260783377613 | requests=0, regions=1, usedHeap=28, maxHeap=993 |
| Total: | servers: 2 | | requests=0, regions=2 |
Load is requests per second and count of regions loaded
|
執行 hbase
任一台電腦皆可執行以下指令,來測試hbase功能
$/opt/hbase/bin/hbase shell
hbase> # Type "help" to see shell help screen
hbase> help
hbase> # To create a table named "mylittletable" with a column family of "mylittlecolumnfamily", type
hbase> create "mylittletable", "mylittlecolumnfamily"
hbase> # To see the schema for you just created "mylittletable" table and its single "mylittlecolumnfamily", type
hbase> describe "mylittletable"
hbase> # To add a row whose id is "x", to the column "mylittlecolumnfamily:x" with a value of 'x', do
hbase> put "mylittletable", "x"
hbase> # To get the cell just added, do
hbase> get "mylittletable", "x"
hbase> # To scan you new table, do
hbase> scan "mylittletable"
停止 hbase
$/opt/hbase/bin/stop-hbase.sh
注意
- 使用hbase自帶的 Zookeeper 已經整合了一些調整,因此省了不少麻煩,如自動設定 myid ,自動將叢集內電腦啟動Zookeeper ,並且將 原本 Zookeeper 要設定於 zoo.cfg 的設定值整合到 hbase-site.conf 內
- /opt/hbase/conf/hbase-site.xml 內 hbase.zookeeper.quorum 的值需要與 hostname, hosts 內的 名稱一模一樣,否則會有錯
- 有遇到錯誤訊息,可以參考 官方的錯誤排除網頁 http://wiki.apache.org/hadoop/Hbase/Troubleshooting
- 遇到錯誤要重來,請確實注意幾點
- 停掉 hbase 的服務,但不需停止hadoop
- 刪除hdfs上得hbase工作目錄 bin/hadoop fs -rmr /hbase