HBase Common shell command _hadoop

Source: Internet
Author: User
Enter HBase Shell Console
$HBASE _home/bin/hbase Shell
If you have Kerberos authentication, you need to use the appropriate keytab for authentication (using the Kinit command), and then use the HBase shell after the authentication is successful. You can use the WhoAmI command to view the current user hbase (main) > WhoAmI The management of the table
1 See what Tables HBase (main) > list

2 Creating Table # Syntax: Create <table>, {NAME => <family>, versions => <versions>} # For example: Create a table T1, there are two family name:f1 , F2, with version number 2 hbase (main) > create ' t1 ', {NAME => ' F1 ', versions => 2},{name => ' F2 ', versions => 2}

3) Delete Table
Two steps: First disable, then drop
For example: Delete table T1 hbase (main) > Disable ' T1 ' hbase (Main) > drop ' t1 '

4 View the structure of the table # syntax: Describe <table> # For example: View the structure of the table T1 HBase (main) > describe ' t1 '

5) Modify Table structure
Modify table structure must first disable # syntax: Alter ' t1 ', {name => ' F1 '}, {name => ' F2 ', method => ' delete '} # For example: the TTL of CF that modifies table test1 is 180-day HBA SE (main) > Disable ' test1 ' hbase (main) > Alter ' test1 ',{name=> ' body ',ttl=> ' 15552000 '},{name=> ' meta ', T Tl=> ' 15552000 '} hbase (main) > Enable ' Test1 ' Rights management
1 Assigning Permissions # Syntax: Grant <user> <permissions> <table> <column family> <column qualifier> parameters followed by a comma Partition # permission is represented by five letters: "RWXCA". # READ (' R '), write (' W '), EXEC (' X '), CREATE (' C '), ADMIN (' A ') # For example, give user ' test ' assign read/write permission to table T1, HBase (Main) > Grant ' Test ', ' RW ', ' T1 '

2 View Permissions # syntax: User_permission <table> # For example, view table T1 permissions List hbase (main) > user_permission ' t1 '

3 Reclaim permissions # similar to assigning permissions, syntax: Revoke <user> <table> <column family> <column qualifier> # for example, Retract test user permissions on table T1 hbase (main) > Revoke ' Test ', ' T1 ' table data additions and deletions to check
1 Add Data # syntax: Put <table>,<rowkey>,<family:column>,<value>,<timestamp> # For example: Add a row to the table T1: Rowkey is rowkey001,family name:f1,column name:col1,value:value01,timestamp: System default HBase (Main) > put ' T1 ', ' rowkey001 ', ' f1:col1 ', ' value01 ' usage is more unitary.

2) query data
A) query for a line of records # syntax: Get <table>,<rowkey>,[<family:column>,....] # For example: Query table t1,rowkey001 in the F1 under the Col1 value HBase ( Main) > Get ' T1 ', ' rowkey001 ', ' f1:col1 ' # or: HBase (main) > Get ' T1 ', ' rowkey001 ', {column=> ' f1:col1 '} # query table All column values under F1 in t1,rowke002 hbase (main) > Get ' T1 ', ' rowkey001 '

b Scan Table # Syntax: Scan <table>, {COLUMNS => [<family:column>,....], LIMIT => num} # In addition, you can add StartRow, Timerang E and Fitler advanced features such as: Scan table T1 the first 5 data hbase (main) > scan ' t1 ', {limit=>5}

c) Number of rows in the query table # Syntax: Count <table>, {INTERVAL => intervalnum, CACHE => cachenum} # INTERVAL set how many rows to display once and corresponding Rowkey, default 1000;cache the buffer size per fetch, default is 10, adjust this parameter to increase query speed # For example, the number of rows in the query table T1, each 100 display, the buffer is hbase (main) > count ' T1 ', {INTERVAL => MB, CACHE => 500}

3) Delete data
A to delete a column value in a row

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.