HBase: specify VERSIONS when creating a table using the Java API

I know that we can do this from the hbase shell as follows:

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

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

+4
source share
2 answers

Maximum versions and other parameters of type ttl are specified for each column family. So the maximum versions are on HColumnDescriptor .

+2
source

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

 HTableDescriptor descriptor = new HTableDescriptor("t1"); HColumnDescriptor cd = new HColumnDescriptor("f1"); cd.setMaxVersions(5); descriptor.addFamily(cd); 
+4
source

Source: https://habr.com/ru/post/1447678/


All Articles