Database Reference
In-Depth Information
7 row(s) in 0.0390 seconds
hbase(main):003:0>
As you can see, I have a number of kiji tables as well as regular ones that
I have created. Kiji is a popular open source framework to jump-start your
HBase modeling and development, and it is supported by a company,
WibiData . We will talk about them in due time.
The best way to deal with the values in HBase is by creating the tables,
adding values, and reading them. In the following section, we will show
you how to do this.
create : The create command creates a table as follows:
create 'table_name', 'fam1'
This command creates a table called table_name , with one column family
named fam1 .
You can add some values in HBase in the following format:
put<table name><row key><column_family : column><value>
Consider the following example:
hbase(main):016:0> put 'table_name', 'row1', 'fam1:col1', 'val1'
hbase(main):017:0> put 'table_name', 'row1', 'fam1:col2', 'val2'
hbase(main):017:0> put 'table_name', 'row2', 'fam:col1', 'val3'
scan : The scan command is used to scan tables as follows:
hbase(main):019:0> scan 'table_name'
Observe the output, which might look similar to the following:
ROW COLUMN+CELL
r1 column=fam1:col1,
timestamp=1365320206055, value=val1
r1 column=fam1:col2,
timestamp=1365320238460, valueval2
r2 column=fam1:col1,
timestamp=1365320505407, value=val3 2 row(s) in 0.0420 seconds
Now is the time to write some simple Java code to read/write (but don't
despair if you do not know Java; there is also SQL coming up).
 
Search WWH ::




Custom Search