- Quick start from official Hbase
HBase (main):003:0> create ' test ', ' CF ' 0 row (s) in 1.2200 secondshbase (main):003:0> list ' test ': 1 row (s) in 0.0550 secondshbase (main):004:0> put ' test ', ' row1 ', ' cf:a ', ' value1 ' 0 row (s) in 0.0560 secondshbase (main): 005:0> put ' test ', ' row2 ', ' cf:b ', ' value2 ' 0 row (s) in 0.0370 secondshbase (main):006:0> put ' test ', ' row3 ', ' cf:c ', ' Value3 ' 0 row (s) in 0.0450 seconds
Another common command is,
HBase (Main):006:0> truncate ' test '
(Note: ' Truncate ' functions like MySQL, emptying the data of the table. Use with caution! )
HBase (main):006:0> describe ' test '
(Note: Query the column family of the test table)
HBase (Main):006:0> count ' test '
(Note: Count the number of records in the ' Test ' table)
HBase (main):006:0> get ' test ', ' row1 '
(Note: Get a record)
HBase (main):006:0> scan ' test '
(Note: Query full table)
HBase (main):006:0> delete ' test ', ' cf:a '
(Note: Delete test table so record a column, you need to be careful!) )
HBase (Main):006:0> deleteall ' test ', ' row1 '
(Note: Delete the entire record of the test table, including any column of the Row1 single record)
The way to convert a relational people table to HBase Columnstore is as follows
People table |
Sex |
Age |
Summary |
Story |
Zhangsan |
M |
19 |
Summary for Zhangsan |
The story of Zhang San |
Wangming |
F |
20 |
Summary for Wangming |
Wang Ming, Song of Ming |
Id |
Column |
Value |
Timestamp |
p| Zhangsan |
Property:sex |
M |
XX (System time) |
p| Zhangsan |
Property:age |
19 |
Xx |
p| Zhangsan |
Detail:summary |
Summary for Zhangsan |
Xx |
p| Zhangsan |
Detail:story |
The story of Zhang San |
Xx |
p| Wangming |
Property:sex |
F |
Xx |
p| Wangming |
Property:age |
20 |
Xx |
p| Wangming |
Detail:summary |
Summary for Wangming |
Xx |
p| Wangming |
Detail:story |
Wang Ming, Song of Ming |
Xx |
Specific conversions such as:
HBase Shell Common Commands