how hbase is accessed
1. Native Java API: The most conventional and efficient way to access;
2, hbase shell:hbase command line tool, the simplest interface, suitable for hbase management use;
3, Thrift Gateway: The use of Thrift serialization technology, support C++,php,python and other languages, suitable for other heterogeneous systems online access hbase table data;
4, rest Gateway: Support the rest-style HTTP API to access HBase, lifting the language restrictions;
5. MapReduce: Processing hbase data directly using mapreduce operations;
6. Use pig/hive to process hbase data.
basic usage of common hbase shell:
HBase Shell Common operation commands are create,describe,disable,drop,list,scan,put,get,delete,deleteall,count,status, etc., You can see the detailed usage through Help.
1. Open HBase Shell
hadoop@ubuntu:/usr$ HBase Shell
2. Inquiry Form List
HBase (main):001:0> list
3. Build table (Create)
HBase (main):008:0> create ' scores ', ' Grad ', ' course '
4, add data (table Scores,rowkey is zkb column family grad, column named "" Value is 5)
HBase (main):013:0> put ' scores ', ' ZKD ', ' Grade: ', ' 5 '
5, to zkb this row of data column Family course add a column <math,97> (put)
HBase (main):016:0> put ' scores ', ' zkd ', ' Course:math ', ' 97 '
6, query a piece of data (get), according to Rowkey find
HBase (main):024:0> get ' scores ', ' ZKD '
7. Querying multiple data (scan)
Format: Scan command can specify startrow,stoprow to scan multiple row, for example: Scan ' User_test ', {COLUMNS = ' info:username ', LIMIT =>10, StartRow = > ' Test ',stoprow=> ' test2 '}, {} Inside is optional
HBase (main):003:0> scan ' scores ',{columns=> ' Course:art ',limit=>1,startrow=> ' a ',stoprow=> ' Z '}
8. Delete record (only one column)
Delete ' scores ', ' 1 ', ' Course:art '
9. Delete all column Rowkey
DeleteAll ' scores ', ' 1 '
10. Delete scores table
HBase (Main):004:0> disable ' scores '
HBase (Main):005:0> drop ' scores '
Reference:
http://www.taobaotest.com/blogs/qa?bid=13871