Hi, I use java code to create a table. Following sample I create table with one family. Don't forget to put your zookeeper configure(zoo.cfg) with your java class. Hope it is useful for you.
Fleming
---------------------------------------------------------------------------------------------------
CreatHBaseTable("test","COLUMNS");
public static void CreatHBaseTable(String TableName,String ColumnFamily){
config = new HBaseConfiguration();
HBaseAdmin hbaseAdmin;
try {
hbaseAdmin = new HBaseAdmin(config);
HColumnDescriptor column = new
HColumnDescriptor(ColumnFamily);
//table descriptor
HTableDescriptor table = new HTableDescriptor(TableName);
//add column into table
table.addFamily(column);
hbaseAdmin.createTable(table);
} catch (MasterNotRunningException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("create "+TableName +" ok");
}
Muhammad Mudassar
<mudassa...@gmail To:
[email protected]
.com> cc: (bcc: Y_823910/TSMC)
Subject: how to add table
2009/07/08 01:35
PM
Please respond to
hbase-user
Hi,
I have just started to work with hbase can any body here tell me how to add
a table to the hbase.
thanks
Muhammad Mudassar
---------------------------------------------------------------------------
TSMC PROPERTY
This email communication (and any attachments) is proprietary information
for the sole use of its
intended recipient. Any unauthorized review, use or distribution by anyone
other than the intended
recipient is strictly prohibited. If you are not the intended recipient,
please notify the sender by
replying to this email, and then delete this email and any copies of it
immediately. Thank you.
---------------------------------------------------------------------------
