HBase: Specify VERSIONS while creating table using

2019-06-28 04:55发布

I know we can do it from hbase shell in the following way:

create 't1', {NAME => 'f1', VERSIONS => 5}

I could not find any corresponding option in HTableDesctiptor in the Java API. Any idea how to do this?

标签: hbase
2条回答
乱世女痞
2楼-- · 2019-06-28 05:25

I leave here a sample code based on your example as reference.

HTableDescriptor descriptor = new HTableDescriptor("t1");
HColumnDescriptor cd = new HColumnDescriptor("f1");
cd.setMaxVersions(5);
descriptor.addFamily(cd);
查看更多
成全新的幸福
3楼-- · 2019-06-28 05:26

Max versions, and other ttl type settings, is specified per column family. So the max versions is on the HColumnDescriptor.

查看更多
登录 后发表回答