Hbase GET命令不断返回0行

时间:2021-09-15 09:18:40

I had instaled few days ago Hbase 1.0.1 on Hadoop 2.5 My issue is that Get command dosen't return any rows. I tried with diferent tables, via shell or API ... and nothing

我几天前在Hadoop 2.5上安装了Hbase 1.0.1我的问题是Get命令不会返回任何行。我尝试使用不同的表,通过shell或API ...而没有

If you have any thoughts about this, please share with me.

如果您对此有任何想法,请与我分享。

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

1 个解决方案

#1


That's because you're missing the row key and it thinks you're getting the 'camp:nume' row which doesn't exists.

那是因为你错过了行键,它认为你正在获得不存在的'camp:nume'行。

Use this to get all columns from row 1:

使用它来获取第1行中的所有列:

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

Use this to get the 'camp:nume' column from row 1:

使用它来获取第1行的'camp:nume'列:

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

Just FYI, in the HBase Shell you can run a simple command with no arguments to see the help:

仅供参考,在HBase Shell中,您可以运行一个没有参数的简单命令来查看帮助:

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']

#1


That's because you're missing the row key and it thinks you're getting the 'camp:nume' row which doesn't exists.

那是因为你错过了行键,它认为你正在获得不存在的'camp:nume'行。

Use this to get all columns from row 1:

使用它来获取第1行中的所有列:

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

Use this to get the 'camp:nume' column from row 1:

使用它来获取第1行的'camp:nume'列:

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

Just FYI, in the HBase Shell you can run a simple command with no arguments to see the help:

仅供参考,在HBase Shell中,您可以运行一个没有参数的简单命令来查看帮助:

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']