The shell command for HBase

Source: Internet
Author: User

1. HBase provides a shell terminal to interact with the user

2. The DDL operation of the HBase shell

(1) Enter HBase shell command line first, that is hbase_home/bin/hbase shell ... >quit

To Create a table:>create'Users','user_id','Address','Info'    //table users, there are three column families User_id,address,info

List all tables:>the list gets a description of the table:>describe'Users'To Create a table:>create'users_tmp','user_id','Address','Info'To Delete a table:>disable'users_tmp'>drop'users_tmp'

(2) Add records, Get records, update records

add record: Put'Users','xiaoming','Info:age',' -'; Put'Users','xiaoming','Info:birthday','1987-06-17'; Put'Users','xiaoming','Info:company','Alibaba'; Put'Users','xiaoming','Address:contry',' China'; Put'Users','xiaoming','address:province','Zhejiang'; Put'Users','xiaoming','address:city','Hangzhou'; Put'Users','Zhangyifei','Info:birthday','1987-4-17'; Put'Users','Zhangyifei','Info:favorite','movie'; Put'Users','Zhangyifei','Info:company','Alibaba'; Put'Users','Zhangyifei','Address:contry',' China'; Put'Users','Zhangyifei','address:province','Guangdong'; Put'Users','Zhangyifei','address:city','Jieyang'; Put'Users','Zhangyifei','Address:town','Xianqiao'; Gets a record:1. Get all the data for an ID:>Get 'Users','xiaoming'2. Gets all the data for an ID, a column family:>Get 'Users','xiaoming','Info'3. Gets an ID for one column in a column family: all dataGet 'Users','xiaoming','Info:age'
Update Record:>put'Users','xiaoming','Info:age',' in'>Get 'Users','xiaoming','Info:age'>put'Users','xiaoming','Info:age',' -'>Get 'Users','xiaoming','Info:age'get version data for cell data:>Get 'Users','xiaoming',{column=>'Info:age',versions=>1}    >Get 'Users','xiaoming',{column=>'Info:age',versions=>2}    >Get 'Users','xiaoming',{column=>'Info:age',versions=>3get a version of the cell data )Get 'Users','xiaoming', {column=>'Info:age',timestamp=>1364874937056} full table scan:>scan'Users'

(3) Delete

Delete the xiaoming value of the'Info:age'fields:>delete'Users','xiaoming','Info:age'>Get 'Users','xiaoming'To delete an entire row:>deleteall'Users','xiaoming'number of rows in the statistics table:>count'Users'Clear the table:>truncate'Users'

The shell command for HBase

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.