|
|
Table can be created using create command by specifying the table name and the Column Family name. Syntax for creating a table in HBase shell is shown below.
Below is a sample schema of a table named emp which has two column families: “personal data” and “professional data”.
Row key |
personal data |
professional data |
This table can be created in HBase shell as shown below.
This will give you below output.
User can verify if the table is created using the list command as shown below. Here you can observe the created emp table.
A table in HBase can be created using createTable() method of HBaseAdmin class. This class belongs to org.apache.hadoop.hbase.client package. Below are the steps for creating a table in HBase using java API.
This class requires the Configuration object as a parameter, therefore initially instantiate the Configuration class and pass this instance to HBaseAdmin.
HTableDescriptor is a class which belongs to the org.apache.hadoop.hbase class. This c
Created table can be executed in Admin mode Using createTable() method of HBaseAdmin class.
Below is the complete program for creating a table via admin.
Compile and execute the above program as shown below.
|
|
All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.