Modify schema in HBase using Programs

0 votes
Is there a way to design or modify schema in HBase programmatically?
Aug 9, 2018 in Database by Ashish
• 2,630 points
17 views

1 answer to this question.

0 votes
HBase schemas can be created or updated using the Apache HBase Shell or by using Admin in the Java API.
Creating table schema:

Configuration config = HBaseConfiguration.create();

HBaseAdmin admin = new HBaseAdmin(conf); // execute command through admin</span></pre>

// Instantiating table descriptor class

HTableDescriptor t1 = new HTableDescriptor(TableName.valueOf("employee"));

// Adding column families to t1

t1.addFamily(new HColumnDescriptor("professional"));

t1.addFamily(new HColumnDescriptor("personal"));

// Create the table through admin

admin.createTable(t1);

For modification:

String table = “myTable”;

admin.disableTable(table);

admin.modifyColumn(table, cf2); // modifying existing ColumnFamily

admin.enableTable(table);

Hope this helps
answered Aug 9, 2018 by kurt_cobain
• 9,240 points

Related Questions In Database

0 votes
1 answer

Connection in Hbase

Following code is used to open a ...READ MORE

answered Jul 11, 2018 in Database by Data_Nerd
• 2,360 points
35 views
0 votes
1 answer

HLog and WAL in Hbase.

All edits in the HStore are stored ...READ MORE

answered Jul 16, 2018 in Database by Data_Nerd
• 2,360 points
374 views
0 votes
1 answer

Data model operations in Hbase

1. Get(returns attributes for a specified row, Gets ...READ MORE

answered Jul 16, 2018 in Database by Data_Nerd
• 2,360 points
25 views
0 votes
1 answer

Filters in HBase

ColumnPrefixFilter: takes a single argument, a column ...READ MORE

answered Jul 31, 2018 in Database by kurt_cobain
• 9,240 points
367 views
0 votes
1 answer
0 votes
1 answer

Hadoop Mapreduce word count Program

Firstly you need to understand the concept ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,030 points
2,032 views
0 votes
10 answers

hadoop fs -put command?

copy command can be used to copy files ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Sujay
10,287 views
0 votes
1 answer

Hadoop dfs -ls command?

In your case there is no difference ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by kurt_cobain
• 9,240 points
753 views
0 votes
1 answer

Standalone Mode in Hbase

It is a default mode of HBase. ...READ MORE

answered Jul 11, 2018 in Database by kurt_cobain
• 9,240 points
37 views
0 votes
1 answer

Delete row in HBase

In Hbase, whatever you write will be ...READ MORE

answered Jul 23, 2018 in Database by kurt_cobain
• 9,240 points
149 views