您好,登錄后才能下訂單哦!
1. 關于HBase的介紹,http://www.searchtb.com/2011/01/understanding-hbase.html很不錯。
HBase – Hadoop Database,是一個高可靠性、高性能、面向列、可伸縮的分布式存儲系統,利用HBase技術可在廉價PC Server上搭建起大規模結構化存儲集群。
HBase是Google Bigtable的開源實現,類似Google Bigtable利用GFS作為其文件存儲系統,HBase利用Hadoop HDFS作為其文件存儲系統;Google運行MapReduce來處理Bigtable中的海量數據,HBase同樣利用Hadoop MapReduce來處理HBase中的海量數據;Google Bigtable利用 Chubby作為協同服務,HBase利用Zookeeper作為對應。
(HBase感覺更像是一個上學時學的分布式數據庫)
2. HBase安裝的版本要和Hadoop的版本對應起來,剛開始下了最新的hbase-0.94.0,但是Hadoop的版本是hadoop-0.20.203.0,在啟動HBase的時候,總是有問題。重新下載了hbase-0.90.6之后,一次就啟動成功了。
[ate: /local/nomad2 ]
>> /local/nomad2/hbase/hbase-0.94.0/bin/start-hbase.sh
starting master, logging to /local/nomad2/hbase/hbase-0.94.0/bin/../logs/hbase-nomad2-master-ate.out
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/local/nomad2/hbase/hbase-0.94.0/lib/slf4j-log4j12-1.5.8.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/local/nomad2/hadoop/hadoop-0.20.203.0/lib/slf4j-log4j12-1.4.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
[ate: /local/nomad2 ] >> /local/nomad2/hbase/hbase-0.94.0/bin/start-hbase.sh starting master, logging to /local/nomad2/hbase/hbase-0.94.0/bin/../logs/hbase-nomad2-master-ate.out SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/local/nomad2/hbase/hbase-0.94.0/lib/slf4j-log4j12-1.5.8.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/local/nomad2/hadoop/hadoop-0.20.203.0/lib/slf4j-log4j12-1.4.3.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
>> hbase classpath | tr ":" "\n" | grep -i slf4j
>> hbase classpath | tr ":" "\n" | grep -i slf4j
3. 設置環境變量
export HBASE_INSTALL=/local/nomad2/hbase/hbase-0.90.6
export PATH=$PATH:$HBASE_INSTALL/bin
export HBASE_INSTALL=/local/nomad2/hbase/hbase-0.90.6 export PATH=$PATH:$HBASE_INSTALL/bin
[ate: /local/nomad2/hbase/hbase-0.90.6/bin ]
>> start-hbase.sh
starting master, logging to /local/nomad2/hbase/hbase-0.90.6/bin/../logs/hbase-nomad2-master-ate.out
[ate: /local/nomad2/hbase/hbase-0.90.6/bin ]
>> hbase shell
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 0.90.6, r1295128, Wed Feb 29 14:29:21 UTC 2012
hbase(main):001:0> create 'test', 'data'
0 row(s) in 1.4430 seconds
hbase(main):002:0> list
TABLE
test
1 row(s) in 0.0420 seconds
hbase(main):003:0> put 'test', 'row1', 'data:1', 'value1'
0 row(s) in 0.1500 seconds
hbase(main):005:0> put 'test', 'row2', 'data:2', 'value2'
0 row(s) in 0.0230 seconds
hbase(main):006:0> put 'test', 'row3', 'data:3', 'value3'
0 row(s) in 0.0220 seconds
hbase(main):007:0> scan 'test'
ROW COLUMN+CELL
row1 column=data:1, timestamp=1341662081734, value=value1
row2 column=data:2, timestamp=1341662107606, value=value2
row3 column=data:3, timestamp=1341662122336, value=value3
3 row(s) in 0.0640 seconds
hbase(main):008:0> disable 'test'
0 row(s) in 2.0590 seconds
hbase(main):011:0> drop 'test'
0 row(s) in 1.1650 seconds
hbase(main):012:0> list
TABLE
0 row(s) in 0.0190 seconds
[ate: /local/nomad2/hbase/hbase-0.90.6/bin ] >> start-hbase.sh starting master, logging to /local/nomad2/hbase/hbase-0.90.6/bin/../logs/hbase-nomad2-master-ate.out [ate: /local/nomad2/hbase/hbase-0.90.6/bin ] >> hbase shell HBase Shell; enter 'help<RETURN>' for list of supported commands. Type "exit<RETURN>" to leave the HBase Shell Version 0.90.6, r1295128, Wed Feb 29 14:29:21 UTC 2012 hbase(main):001:0> create 'test', 'data' 0 row(s) in 1.4430 seconds hbase(main):002:0> list TABLE test 1 row(s) in 0.0420 seconds hbase(main):003:0> put 'test', 'row1', 'data:1', 'value1' 0 row(s) in 0.1500 seconds hbase(main):005:0> put 'test', 'row2', 'data:2', 'value2' 0 row(s) in 0.0230 seconds hbase(main):006:0> put 'test', 'row3', 'data:3', 'value3' 0 row(s) in 0.0220 seconds hbase(main):007:0> scan 'test' ROW COLUMN+CELL row1 column=data:1, timestamp=1341662081734, value=value1 row2 column=data:2, timestamp=1341662107606, value=value2 row3 column=data:3, timestamp=1341662122336, value=value3 3 row(s) in 0.0640 seconds hbase(main):008:0> disable 'test' 0 row(s) in 2.0590 seconds hbase(main):011:0> drop 'test' 0 row(s) in 1.1650 seconds hbase(main):012:0> list TABLE 0 row(s) in 0.0190 seconds
hbase(main):013:0> create 'stations', {NAME => 'info', VERSIONS => 1}
0 row(s) in 1.1100 seconds
hbase(main):014:0> create 'observations', {NAME => 'data', VERSIONS => 1}
0 row(s) in 1.1060 seconds
hbase(main):015:0> list
TABLE
observations
stations
2 row(s) in 0.0210 seconds
hbase(main):013:0> create 'stations', {NAME => 'info', VERSIONS => 1} 0 row(s) in 1.1100 seconds hbase(main):014:0> create 'observations', {NAME => 'data', VERSIONS => 1} 0 row(s) in 1.1060 seconds hbase(main):015:0> list TABLE observations stations 2 row(s) in 0.0210 seconds
>> export HBASE_CLASSPATH=$HBASE_CLASSPATH:ch23.jar
>> hbase HBaseTemperatureImporter input/ncdc/all
>> export HBASE_CLASSPATH=$HBASE_CLASSPATH:ch23.jar >> hbase HBaseTemperatureImporter input/ncdc/all
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。