HBase Tutorial (ii) HBase database Shell command

Source: Internet
Author: User
Tags hbase tutorial

HBase Tutorial (ii) HBase database Shell command



1 Hbase-shell Command

HBase is a distributed, column-oriented open source database, HBase also provides the shell command of the database to add, delete, change, check the basic operations, such as database creation, modification, delete, modify the operation, data insertion, deletion, modification and so on.

Execute command: HBase shell, enter HBase database


1.1 hbase help command

Execute on the command line: Help [' Command '], view the assistance command:


1.2 General Operation

1,Status: Query Server Status:

Usage: status


2,whoami: Query the current User:

Usage: WhoAmI


3,version: The current hbase to use the edition number:

Usage: Version


1.3 DDL Operations

1,create: Creating database tables, creating commands to see Help ' create '

Syntax: Create <table>, {NAME =><family>, versions => <versions>}

Example: Create ' product ', {name => ' computer ', versions => 5},{name => ' food ', versions => 3}

Description: Create a table named ' Product ' database, and create two column families, respectively: ' Computer ', ' food '

2.List: View existing tables

Usage: List


3.describe: View table structure description

Usage: Describe ' product '


4.Alter: Modify the table

Usage: Modify table structure must first disable, then modify the table, after the modification, then the Enable table.

Disable ' product '

Alter ' product ', {NAME => ' food ',versions=> 3}

Enable ' product '


5.Drop: Delete table

Usage: First disable, then drop.

Disable ' product '

Drop ' product '


1.4 DML Operations

1.put: Insert data

Grammar: Put <table>,<rowkey>,<family:column>,<value>,<timestamp>

Example: Put ' product ', ' rowkey001 ', ' computer:name ', ' ThinkPad E550 '

Insert data again: Put ' product ', ' rowkey001 ', ' Computer:price ', 4199

Description: Adds a row to the table ' product ': Rowkey is ' rowkey001 ', family name: ' Computer ', column name: ' Name ', Value: ' ThinkPad E550 ', Timestamp: system default

Insert two data, actually add two columns, return or a piece of data



2,scan: Scan table

Syntax: Scan <table>,{columns => [<family:column>,....], LIMIT => num}

HBase storage data is stored in binary form, reading is not a problem

Example: Scan ' product '

3,get: Query data

Grammar:get<table>,<rowkey>,[<family:column>,....]

Query the value of a cell under computer in the table product,rowkey001

Example: Get ' product ', ' rowkey001 '


Example: Get ' product ', ' rowkey001 ',{column=> ' computer:name '}


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.