hbase-model-versions

本文介绍了HBase中Cell的概念及其组成元素,并详细解析了版本(versions)在HBase中的作用,包括如何设置版本数量、如何通过操作实现版本的创建与删除等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

  1. 建立版本
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}
  1. 修改版本
alter ‘t1′, NAME => ‘f1′, VERSIONS => 5
  1. 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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值