PrepAway - Latest Free Exam Questions & Answers

Which of the following method(s) would you use next?

From within an HBase application, you would like to create a new table named weblogs. You have
started with the following Java code:
HBaseAdmin admin = new HBaseAdmin (conf);
HTableDescriptor t = new HTableDescriptor(“weblogs”);
Which of the following method(s) would you use next?

PrepAway - Latest Free Exam Questions & Answers

A.
admin.createTable(t);admin.enable.Table(t);

B.
admin.createTable(t);

C.
HTable.createTable(t);HTable.enableTable(t);

D.
HTable.createTable(t);

Explanation:
See line 10 below.
Creating a table in HBase
01
public void createTable (String tablename, String familyname) throws IOException {
02
03
Configuration conf = HBaseConfiguration.create();
04
HBaseAdmin admin = new HBaseAdmin(conf);
05
06
HTableDescriptor tabledescriptor = new HTableDescriptor(Bytes.toBytes(tablename));
07
08
tabledescriptor.addFamily(new HColumnDescriptor (familyname));
09
10
admin.createTable(tabledescriptor);
11
12
}
Reference:HBASE ADMINISTRATION USING THE JAVA API, USING CODE EXAMPLES
http://linuxjunkies.wordpress.com/2011/12/03/hbase-administration-using-the-java-api-using-codeexamples/(creating a table in Hbase, see the code)

One Comment on “Which of the following method(s) would you use next?


Leave a Reply to mr_tienvu Cancel reply

Your email address will not be published. Required fields are marked *