Free Online Certification Courses – Learn Today. Lead Tomorrow. › Forums › Apache Hadoop › Ways to create a table in HBase
- This topic has 1 reply, 1 voice, and was last updated 5 years, 7 months ago by DataFlair Team.
-
AuthorPosts
-
-
September 20, 2018 at 12:44 pm #4915DataFlair TeamSpectator
In HBase, tables can be created by two ways :
# Using HBase shell
# Using Java API
-
September 20, 2018 at 12:44 pm #4917DataFlair TeamSpectator
In HBase, it is possible to create a Table in two ways:
i. HBase Create Table
ii. Creating a Table Using Java APISo, let’s learn both in brief:
i. HBase Create Table
With the help of Create command, we can create a table in HBase. But as a condition, we need to specify the table name and the Column Family name to create one.Syntax
create ‘<table name>’,’<column family>’
ii. Creating a Table Using Java API
Else we can use createTable() method of HBaseAdmin class for creating a table. To do so, steps are:Step1: Instantiate HBaseAdmin
Do instantiate the Configuration class. Then also pass this instance to HBaseAdmin, since the class needs the Configuration object as a parameter:
Configuration conf = HBaseConfiguration.create();
HBaseAdmin admin = new HBaseAdmin(conf);
Step2: Create TableDescriptor
Step 3: Execute through Admin
with the help of createTable() method of HBaseAdmin class, it is possible to execute the created table in Admin mode.
admin.createTable(table);
However, to learn all Table Management Commands in HBase, follow the link: Table Management Commands in HBase
-
-
AuthorPosts
- You must be logged in to reply to this topic.