且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在HBase的选定群集中创建列族

更新时间:2023-11-30 22:34:04

There is no such concept of cluster namespace in HBase. You can simple create a table in HBase using methods of HBaseAdmin class.

HBaseConfiguration conf = HBaseConfiguration.create();
HBaseAdmin admin = new HBaseAdmin(conf);
HTableDescriptor tableDescriptor = new HTableDescriptor(tableName);// maps to keyspace name of cassandra.
HColumnDescriptor hColumnDescriptor = new HColumnDescriptor(columnFamilyName);// maps to column family name of cassandra.
tableDescriptor.addFamily(hColumnDescriptor);

admin.createTable(hTableDescriptor);