HBase shell command

Source: Internet
Author: User

1 , first to open HBase, Use JPS View Process

JPS is the Java Process State tool, which returns the process ID and service name

[Email protected]:~/apache/hbase-0.94.15-security$ JPS
3082 NameNode
6245 Hregionserver
3493 Jobtracker
6064 Hmaster
5999 Hquorumpeer
3638 Tasktracker
3259 DataNode
3413 Secondarynamenode
6320 Jps

2 , run hbase Shell

start Hbase-shell: Enter the bin directory, input./hbase Shell
Status : hbase (main):022:0> status
1 servers, 0 dead, 2.0000 average load

version:hbase (main):023:0> version
0.94.15, r1551829, Wed Dec 19:15:20 UTC 2013

WhoAmI:hbase (main):024:0> WhoAmI
Chen

3 , data definition commands

List : See what tables are currently hbase
HBase (main):002:0> list
TABLE
Employee
1 row (s) in 0.0700 seconds

Create : Create ' table name ', ' column name ', ' column name ' ...
HBase (main):001:0> create ' Employee ', ' lie '
0 row (s) in 3.4890 seconds

describe : View the construction of a table
enable/disable : Disable or start the table, disable the table before changing the table
Drop: Delete Table


4 , data manipulation, and retrieval commands
put : Add a row of data: Put ' table name ', ' named row name ', ' named Column name: ', ' value ';
Add a column to the column family of a row: Put ' table name ', ' named row name
', ' named Column name ', ' value ' (that is, a column continues to be subdivided into multiple columns, such as the score column can be divided into math scores, English scores, etc.)
HBase (main):004:0> put ' Employee ', ' Record1 ', ' lie:empid ', ' 1001 '
0 row (s) in 0.0240 seconds

Get : View data for a row in a table get ' table name ', ' Row name '
HBase (main):007:0> get ' Employee ', ' Record1 '
COLUMN CELL
Lie:address timestamp=1463665484970, Value=bangalore
Lie:empid timestamp=1463665379589, value=1001
Lie:empname timestamp=1463665461795, Value=henry
3 row (s) in 0.1030 seconds

Scan : View all data in a table, scan ' table name ', view data for a column in the scores table ' table name ',{columns=> ' course '}
HBase (main):008:0> scan ' Employee '
ROW Column+cell
Record1 column=lie:address, timestamp=1463665484970, Value=bangalo
Re
Record1 column=lie:empid, timestamp=1463665379589, value=1001
Record1 Column=lie:empname, timestamp=1463665461795, Value=henry
1 row (s) in 0.0870 seconds
Note: The scan command can specify startrow,stoprow to scan multiple row, for example: Scan ' user_test ',{columns=> ' info:username ', LIMIT =>10, StartRow = ' test ',stoprow=> ' test2 '} "

HBase shell command

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.