HBase API for Administration Flashcards

1
Q

What language does the HBase Shell use?

A

JRuby

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the HBase Shell?

A
  • It is a command line interface used to call Hbase. - Wraps Java client calls in Ruby
  • Allows Ruby syntax
  • Makes parameters usage a little different that most shells.
  • Command parameters are single quoted (‘)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do you start the hbase shell?

A

hbase shell

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the command to see help?

A

help

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the command to see the status of Hbase?

A

status

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is reported in the status command?

A

The number of servers, the number of dead servers and the average load

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the command to get the version?

A

version

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the hash rocket symbol?

A

=>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the syntax for creating a table using the shell command?

A

create ‘t1’, {NAME => ‘cf1’}
create ‘t1’, {NAME => ‘cf1’, VERSION => 5}
create ‘t1’, {NAME => ‘cf1’}, {NAME => ‘cf2’}

or short hand
create ‘t1’,’cf1’,’cf2’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What modes are supported by Hbase shell?

A

interactive and batch

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

When creating a table, what needs to be defined?

A

The table name and the column family.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Does HBase have a concept of multiple database?

A

No

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

True or False, Every table must have at least one column family when creating the table?

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

When using the JAVA API you need to convert all everything to what?

A

A byte array

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What class contains methods for converting primitives and Strings to byte arrays?

A

A utility class called Bytes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Using the Java API what is the first line of any class that reads the connection information for HBase?

A

Configuration configuration = new Configuration()

17
Q

When you want to use the Administration API what class do you instantiate?

A

HBaseAdmin admin = new HBaseAdmin(configuration);

18
Q

If you wanted to create a new table using the Java API what would the code look like to do that

A

HTableDescriptor descriptor = new HTableDescriptor(Bytes.toBytes(“t1”));
HColumnDescriptor column = new HColumnDescriptor(Bytes.toBytes(“cf1”));
descriptor.addFamily(column);
admin.createTable(descriptor);
admin.close();

19
Q

What does the Java Configuration object do?

A

Reads in the Hadoop and HBase configuration files

20
Q

In the HBase shell, how do you get a list of the tables

A

list

21
Q

In the HBase Java API, how do you get a list of the tables?

A

HTableDescriptor[] tables = admin.listTables();

22
Q

In HBase shell, waht is the syntax for getting the details about a table?

A

describe ‘tablename’

23
Q

In HBase Java API, what is the syntax for getting the details about a table

A

HTableDescriptor[] description = admin.getTableDescriptor(Bytes.toBytes(“tablename”));

24
Q

In HBase shell, how do you disable a table?

A

disable ‘tablename’

25
Q

What happens when you disable a table

A
  • Allows various maintenance commands to be run
  • Prevents all client access
  • Allows you to alter a table
  • Takes several minutes for a table to be disabled
26
Q

In the Java API, how do you disable a table?

A

admin.disableTable(“tablename”);

27
Q

How do you take a table out of maintenance mode in Hbase shell?

A

enable ‘tablename’

28
Q

Using the Java API, how to you take a table out of maintenance mode?

A

admin.enableTable(“tablename”);

29
Q

Can you alter a table after if has been created?

A

Yes, it needs to be in maintenance mode (or disabled) in order to do that

30
Q

How do you delete a table from Hbase using the shell command?

A

disable ‘tablename’

drop ‘tablename’

31
Q

How do you truncate a table in HBase shell?

A

truncate ‘tablename’

32
Q

Using hbase shell, how do you add a new column family to a table

A

disable ‘tablename’
alter ‘tablename’, NAME => ‘newColFamily’
enable ‘tablename’

33
Q

Using hbase shell, how do you permanently delete an existing column family

A

disable ‘tablename’
alter ‘tablename’, NAME => ‘colFamily’, METHOD => ‘delete’
enable ‘tablename’

34
Q

Using hbase shell, how do you modify an existing column family to have 5 versions

A

disable ‘tablename’
alter ‘tablename’, NAME => ‘colFamily’, VERSIONS => 5
enable ‘tablename’