I am using CDH 5.4.2 and trying to create Hbase Table have the following code snippet:
Configuration conf = HBaseConfiguration.create(new Configuration());
HBaseAdmin hba = new <strike>HBaseAdmin</strike>(conf);
if(!hba.tableExists(args[0])){
HTableDescriptor ht = new <strike>HTableDescriptor</strike> (args[0]);
ht.addFamily(new HColumnDescriptor("sample"));
There is a Deprecated
error.
- How to avoid these warnings?
- Do I need to add any specific jars for CDH 5.4.2?
It's just a warning. But you should not use deprecated methods in your code.
In place of :
You should use:
Sample code for your reference. Assuming that you have Hbase running in standalone mode.
If you need to retrieve a table for usage, you can use
Connection.getTable(TableName)
But If you need to create a table instead, use
TableDescriptorBuilder
andAdmin.createTable(TableDescriptor)
For instance: