Hi@akhtar,
You can use the below code to create table in Hbase.
import java.io.IOException;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.client.HBaseAdmin;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.conf.Configuration;
public class CreateTable1 {
public static void main(String[] args) throws IOException {
Configuration con = HBaseConfiguration.create();
HBaseAdmin admin = new HBaseAdmin(con);
HTableDescriptor tableDescriptor = new
HTableDescriptor(TableName.valueOf("table name"));
tableDescriptor.addFamily(new HColumnDescriptor("data1"));
tableDescriptor.addFamily(new HColumnDescriptor("data2"));
admin.createTable(tableDescriptor);
System.out.println(" Table Created");
}
}
write this java code inside one file and run the file.
$ javac filename.java
$ java filename
Thank You