hbase-model-versions
程序员文章站
2024-02-20 19:36:28
...
cell定义:
A {row, column, version} tuple exactly specifies a cell
除了rowkey,column family,column quarifities,timestamp,还有就是versions(版本).
versions概念:
It’s possible to have an unbounded number of cells where the row and column are the same but the cell address differs only in its version dimension.
在version dimension 里面,有可能存在一个没有数量边界的cells,在row和column相同但是cell的地址不同,就是value不同的地方。
总结hbase版本就是使用来标识数据版本,同一份数据具有多个版本,这样可以追踪到一条数据的上一个版本的信息,Hbase中的Cell是按照Version倒序排列的,所以第一个读取到的一定是最新版本的数据。
hbase(main):026:0> get 'test','row1',{COLUMN=>'cf:a',VERSIONS=>2}
COLUMN CELL
cf:a timestamp=1516426471309, value=value11
cf:a timestamp=1515136505058, value=value1
version operation
- 建立版本
The maximum number of versions to store for a given column is part of the column schema and is specified at table creation, or via an alter command, via HColumnDescriptor.DEFAULT_VERSIONS. Prior to HBase 0.96, the default number of versions kept was 3, but in 0.96 and newer has been changed to 1.
可以通过table的创建 ,alter命令, HColumnDescriptor类。默认的版本数0.96是3,现在是1。
create 'f3','f2',{NAME=>'LL',VERSIONS=>3}
- 修改版本
alter ‘t1′, NAME => ‘f1′, VERSIONS => 5
- put 数据
Doing a put always creates a new version of a cell
插入数据创建一个新的版本的cell.
4.删除版本
Delete: for a specific version of a column.
Delete column: for all versions of a column.
Delete family: for all columns of a particular ColumnFamily
推荐阅读