hbase(main):004:0> create 'htable','cf'
0 row(s) in 0.4790 seconds

=> Hbase::Table - htable
hbase(main):005:0> alter 'htable', NAME => 'id', VERSIONS => 100
Updating all regions with the new schema...
0/1 regions updated.
1/1 regions updated.
Done.
0 row(s) in 2.2790 seconds

hbase(main):006:0> put 'htable','row1','cf:id',2
0 row(s) in 0.1560 seconds

hbase(main):007:0> put 'htable','row1','cf:id',4
0 row(s) in 0.0080 seconds

hbase(main):008:0> get 'htable', 'row1', {COLUMN => 'cf:id', VERSIONS => 4}
COLUMN                CELL
 cf:id                timestamp=1428041368763, value=4
1 row(s) in 0.0200 seconds

我通过设置VERSIONS => 100来更改了表,但是
每次都会提供最新记录。如何获得旧的值(value)?是否有任何其他命令或设置需求?

最佳答案

在hbase shell中尝试一下:
disable 'htable'drop 'htable'create 'htable',NAME=>'cf',VERSIONS=>100put 'htable','row1','cf:id',1scan 'htable'put 'htable','row1','cf:id',2scan 'htable'put 'htable','row1','cf:id',3scan 'htable'put 'htable','row1','cf:id',4scan 'htable'get 'htable', 'row1', {COLUMN => 'cf:id', VERSIONS => 4}Scan命令用于验证和匹配时间戳。

关于hadoop - 如何在HBase Shell中获取旧值,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/29416492/

10-13 04:32