1.2. Quick Start
Loopback IP
/etc/hosts should look something like this:
vi /etc/hosts
127.0.0.1 localhost
127.0.0.1 ubuntu.ubuntu-domain ubuntu
1.2.1. Download and unpack the latest stable release.(下載下傳和解壓穩定版本)
$ tar xfvz hbase-0.94.3-security.tar.gz
$ cd hbase-0.94.3-security
安裝之前,編輯 conf/hbase-site.xml.其中hbase.rootdir,是Hbase寫資料的目錄
其中hbase.zookeeper.property.dataDir,是ZooKeeper寫資料的目錄
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
hbase.rootdir
/data/hbase
hbase.zookeeper.property.dataDir
/data/zookeeper
1.2.2. Start HBase
[root@ZSDDB8 hbase-0.94.3-security]# ./bin/start-hbase.sh
starting master, logging to /root/hbase-0.94.3-security/bin/../logs/hbase-root-master-ZSDDB8.out
這樣就算開啟了單執行個體的HBase
Is java Installed?可以檢視http://blog.chinaunix.net/space.php?uid=26446098&do=blog&id=3438622 java7安裝方式
1.2.3. Shell Exercises
通過shell連接配接HBASE
[root@ZSDDB8 hbase-0.94.3-security]# ./bin/hbase shell
HBase Shell; enter 'help' for list of supported commands.
Type "exit" to leave the HBase Shell
Version 0.94.3, r1408904, Wed Nov 14 16:41:36 UTC 2012
hbase(main):001:0>
建立一個表為test且一個列集合為cf。通過list 'test'驗證它的建立然後插入一些資料
hbase(main):003:0> create 'test', 'cf'
0 row(s) in 1.2200 seconds
hbase(main):002:0> list 'test'
TABLE
test
1 row(s) in 0.0170 seconds
1 row(s) in 0.0550 seconds
hbase(main):004:0> put 'test', 'row1', 'cf:a', 'value1'
0 row(s) in 0.0560 seconds
hbase(main):005:0> put 'test', 'row2', 'cf:b', 'value2'
0 row(s) in 0.0370 seconds
hbase(main):006:0> put 'test', 'row3', 'cf:c', 'value3'
0 row(s) in 0.0450 seconds
通過執行scan 指令驗證剛插入的資料
hbase(main):006:0> scan 'test'
ROW COLUMN+CELL
row1 column=cf:a, timestamp=1355386368983, value=value1
row2 column=cf:b, timestamp=1355386374028, value=value2
row3 column=cf:c, timestamp=1355386377745, value=value3
3 row(s) in 0.0600 seconds
得到一行的資料
hbase(main):007:0> get 'test', 'row1'
COLUMN CELL
cf:a timestamp=1355386368983, value=value1
1 row(s) in 0.0330 seconds
現在disable然後drop掉你的表,就可以清除上面你做的所有操作
hbase(main):008:0> disable 'test'
0 row(s) in 2.0730 seconds
hbase(main):009:0> drop 'test'
0 row(s) in 0.1100 seconds
退出
hbase(main):013:0> exit
1.2.4. Stopping HBase
執行stop-hbase.sh關閉HBase
$ ./bin/stop-hbase.sh
[root@ZSDDB8 hbase-0.94.3-security]# ./bin/stop-hbase.sh
stopping hbase...........
1.2.5. Where to go next
The above described standalone setup is good for testing and
we'll go into depth on the different HBase run modes, system requirements
running HBase, and critical configurations setting up a distributed HBase deploy.