One of hbase Study Notes | hbase shell commands

Source: Internet
Author: User

Recently, some hbase things were introduced during the testing of XX Project, hoping to record the process from the testing perspective and hope to help you quickly understand it. As a person who first came into contact with it, they need to grasp the basic concepts urgently and will not go into detail here.

Hbase shell is a convenient access method provided by hbase. First, you need to build an hbase environment. For more information, see

Http://hbase.apache.org/book/quickstart.html and http://hbase.apache.org/book/notsoquick.html.

1. Go to the hbase shell command line interface

> Hbase Shell

Enter 'help' to quickly view the supported commands.

2. Create a table

> Create 'people', 'blood ', 'feature'

You can run the 'LIST' command to check whether the table has been successfully created.

3. Add Table records

> Put 'people', '1', 'blood: A', 'a is aaa'

> Put 'people', '1', 'blood: B ',' B is bbb'

> Put 'people', '1', 'blood: O', 'O is ooo'

> Put 'people', '1', 'blood: AB ',' AB is abab'

4. query by rowkey

> Get 'people', '1'

5. Update table records

• Query the pre-update Value

> Get 'people', '1', 'blood: AB'

• Update the value of 'AB' to 'a and B'

> Put 'people', '1', 'blood: AB ', 'a and B'

• Query the updated value

> Get 'people', '1', 'blood: AB'

• Query multiple 'AB' values

> Get 'people', '1', {Column => 'blood: AB ', versions => 2}

• To query one of the versions, use Timestamp

> Get 'people', '1', {Column => 'blood: AB ', timestamp => 1406198779063}

6. Delete table records

• Delete can only delete one column

> Delete 'people', '1', 'blood: AB'

• Delete all columns of rowkey with deleteall

> Deleteall 'people', '1'

• Delete a table

> Disable 'others'

> Drop 'others'

You must disable the table before deleting it.

Summary

The above demonstrates how to use hbase shell to add, delete, modify, query, and create and Delete tables for records. You can refer to your own exercises to learn the principles and knowledge points.

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.