你是在正確的軌道上!
row:column_family:column_qualifier:timestamp:value
注:
HBase
datamodel可以被看作是一個「多維地圖」和每個單元值與時間戳(默認insertion_time)相關聯的時間戳與每個單個值相關聯,並且而不是整行(這使得幾個很好的功能)!
在閱讀時,默認情況下您將獲得最新版本,除非您另行指定。默認情況下應該存儲3 versions。 Hbase進行「合併讀取」,它將返回每一行的最新單元格值。
請從您的HBase的殼試試這個(未發佈之前真正的考驗):
put ‘table_name’, ‘1’, ‘f:name’, ‘Ritesh’
put ‘table_name’, ‘1’, ‘f:surname’, ‘Rai’
put ‘table_name’, ‘1’, ‘f:name’, ‘RiteshKumar’
put ‘table_name’, ‘1’, ‘f:surname’, ‘Rai’
put ‘table_name’, ‘1’, ‘f:other’, ‘Some other stuff’
// Data on 'disk' (that might just be the memstore for now) will look like this:
// 1:f:name:1234567890:‘Ritesh’
// 1:f:surname:1234567891:‘Rai’
// 1:f:name:1234567892:‘RiteshKumar’
// 1:f:surname:1234567893:‘Rai’
// 1:f:other:1234567894:‘Some other stuff’
// Now try... And you will get ‘RiteshKumar’, ‘Rai’, ‘Some other stuff’
get ‘table_name’, ‘1’
// To get the previous versions of the data use the following:
get ‘table_name’, ‘1’, {COLUMN => ‘f’, VERSIONS => 2}
不要忘了看一看的schema design
的最佳實踐是有可能得到以前在這種情況下的價值? –