2015-05-09 84 views
0

我幾天前已經安裝Hadoop 2.5上的Hbase 1.0.1我的問題是Get命令不能返回任何行。 我嘗試了不同的表格,通過外殼或API ...沒有任何東西Hbase GET命令不斷返回0行

如果您對此有任何想法,請與我分享。

hbase(main):020:0> get 'teste', 'camp:name' 
COLUMN     CELL                
0 row(s) in 0.0930 seconds 

hbase(main):021:0> scan 'teste' 
ROW      COLUMN+CELL               
1      column=camp:nume, timestamp=1431128619811, value=David    
1 row(s) in 0.1720 seconds 
+0

是一個錯字 - 名字和數字嗎? –

+0

nume(是專欄名稱)應該是(取而代之的名字......但在凌晨3點....不高亮:) –

回答

1

這是因爲你錯過了行鍵,它認爲你得到'camp:nume'行不存在。

使用此功能可以從第1行獲得所有列:從第1行列:

hbase(main):020:0> get 'teste', '1' 

使用該工具來獲取 'nume陣營':

hbase(main):020:0> get 'teste', '1', 'camp:nume' 

僅供參考,在HBase的殼你可以運行一個沒有參數的簡單命令來查看幫助:

hbase(main):005:0> get 

ERROR: wrong number of arguments (0 for 2) 

Here is some help for this command: 
Get row or cell contents; pass table name, row, and optionally 
a dictionary of column(s), timestamp, timerange and versions. Examples: 

    hbase> get 't1', 'r1' 
    hbase> get 't1', 'r1', {TIMERANGE => [ts1, ts2]} 
    hbase> get 't1', 'r1', {COLUMN => 'c1'} 
    hbase> get 't1', 'r1', {COLUMN => ['c1', 'c2', 'c3']} 
    hbase> get 't1', 'r1', {COLUMN => 'c1', TIMESTAMP => ts1} 
    hbase> get 't1', 'r1', {COLUMN => 'c1', TIMERANGE => [ts1, ts2], VERSIONS => 4} 
    hbase> get 't1', 'r1', {COLUMN => 'c1', TIMESTAMP => ts1, VERSIONS => 4} 
    hbase> get 't1', 'r1', 'c1' 
    hbase> get 't1', 'r1', 'c1', 'c2' 
    hbase> get 't1', 'r1', ['c1', 'c2'] 

The same commands also can be run on a reference to a table (obtained via get_table or 
create_table). Suppose you had a reference t to table 't1', the corresponding commands would be: 

    hbase> t.get 'r1' 
    hbase> t.get 'r1', {TIMERANGE => [ts1, ts2]} 
    hbase> t.get 'r1', {COLUMN => 'c1'} 
    hbase> t.get 'r1', {COLUMN => ['c1', 'c2', 'c3']} 
    hbase> t.get 'r1', {COLUMN => 'c1', TIMESTAMP => ts1} 
    hbase> t.get 'r1', {COLUMN => 'c1', TIMERANGE => [ts1, ts2], VERSIONS => 4} 
    hbase> t.get 'r1', {COLUMN => 'c1', TIMESTAMP => ts1, VERSIONS => 4} 
    hbase> t.get 'r1', 'c1' 
    hbase> t.get 'r1', 'c1', 'c2' 
    hbase> t.get 'r1', ['c1', 'c2']