HBase API for Administration Flashcards
What language does the HBase Shell use?
JRuby
What is the HBase Shell?
- 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 do you start the hbase shell?
hbase shell
What is the command to see help?
help
What is the command to see the status of Hbase?
status
What is reported in the status command?
The number of servers, the number of dead servers and the average load
What is the command to get the version?
version
What is the hash rocket symbol?
=>
What is the syntax for creating a table using the shell command?
create ‘t1’, {NAME => ‘cf1’}
create ‘t1’, {NAME => ‘cf1’, VERSION => 5}
create ‘t1’, {NAME => ‘cf1’}, {NAME => ‘cf2’}
or short hand
create ‘t1’,’cf1’,’cf2’
What modes are supported by Hbase shell?
interactive and batch
When creating a table, what needs to be defined?
The table name and the column family.
Does HBase have a concept of multiple database?
No
True or False, Every table must have at least one column family when creating the table?
True
When using the JAVA API you need to convert all everything to what?
A byte array
What class contains methods for converting primitives and Strings to byte arrays?
A utility class called Bytes
Using the Java API what is the first line of any class that reads the connection information for HBase?
Configuration configuration = new Configuration()
When you want to use the Administration API what class do you instantiate?
HBaseAdmin admin = new HBaseAdmin(configuration);
If you wanted to create a new table using the Java API what would the code look like to do that
HTableDescriptor descriptor = new HTableDescriptor(Bytes.toBytes(“t1”));
HColumnDescriptor column = new HColumnDescriptor(Bytes.toBytes(“cf1”));
descriptor.addFamily(column);
admin.createTable(descriptor);
admin.close();
What does the Java Configuration object do?
Reads in the Hadoop and HBase configuration files
In the HBase shell, how do you get a list of the tables
list
In the HBase Java API, how do you get a list of the tables?
HTableDescriptor[] tables = admin.listTables();
In HBase shell, waht is the syntax for getting the details about a table?
describe ‘tablename’
In HBase Java API, what is the syntax for getting the details about a table
HTableDescriptor[] description = admin.getTableDescriptor(Bytes.toBytes(“tablename”));
In HBase shell, how do you disable a table?
disable ‘tablename’