HBase access Mode HBase shell

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.