Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the hbase shell operation statements?

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail what the hbase shell operation sentences are, and the editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

Hbase shell operation statement

Basic shell command

Enter the hbase command line

. / hbase shell

Show tables in hbase

List

Create a user table that contains two column families, info and data

Create 'user',' info1', 'data1'

Create 'user', {NAME = >' info', VERSIONS = >'3'}

Insert information into the user table with row key as rk0001 and column family info with name column identifier with a value of zhangsan

Put 'user',' rk0001', 'info:name',' zhangsan'

Insert information into the user table with row key as rk0001 and column family info with gender column identifier with a value of female

Put 'user',' rk0001', 'info:gender',' female'

Insert information into the user table with row key as rk0001 and add an age column identifier with a value of 20 to the column family info

Put 'user',' rk0001', 'info:age', 20

Insert information into the user table with row key as rk0001 and column family data with pic column identifier with a value of picture

Put 'user',' rk0001', 'data:pic',' picture'

Get all the information in the user table where row key is rk0001

Get 'user',' rk0001'

Get all the information that row key is the rk0001,info column family in the user table

Get 'user',' rk0001', 'info'

Get the information of the name and age column identifiers in the user table where row key is the rk0001,info column family

Get 'user',' rk0001', 'info:name',' info:age'

Get the information that row key is rk0001,info and data column family in user table

Get 'user',' rk0001', 'info',' data'

Get 'user',' rk0001', {COLUMN = > ['info',' data']}

Get 'user',' rk0001', {COLUMN = > ['info:name',' data:pic']}

Get the information that the row key is rk0001, the column family is info and the version number is the latest 5 in the user table

Get 'user',' rk0001', {COLUMN = > 'info', VERSIONS = > 2}

Get 'user',' rk0001', {COLUMN = > 'info:name', VERSIONS = > 5}

Get 'user',' rk0001', {COLUMN = > 'info:name', VERSIONS = > 5, TIMERANGE = > [1392368783980,1392380169184]}

Get the information in the user table whose row key is rk0001,cell and the value is zhangsan

Get 'people',' rk0001', {FILTER = > "ValueFilter (=, 'binary: picture')"}

Get the information that row key is rk0001 and column identifier contains an in the user table

Get 'people',' rk0001', {FILTER = > "(QualifierFilter (=, 'substring:a'))"}

Put 'user',' rk0002', 'info:name',' fanbingbing'

Put 'user',' rk0002', 'info:gender',' female'

Put 'user',' rk0002', 'info:nationality',' China'

Get 'user',' rk0002', {FILTER = > "ValueFilter (=, 'binary: China')"}

Query all the information in the user table

Scan 'user'

Query the information of the column family info in the user table

Scan 'user', {COLUMNS = >' info'}

Scan 'user', {COLUMNS = >' info', RAW = > true, VERSIONS = > 5}

Scan 'persion', {COLUMNS = >' info', RAW = > true, VERSIONS = > 3}

Query the information that the column families in the user table are info and data

Scan 'user', {COLUMNS = > [' info', 'data']}

Scan 'user', {COLUMNS = > [' info:name', 'data:pic']}

Query the information in the user table where the column family is info and the column identifier is name

Scan 'user', {COLUMNS = >' info:name'}

Query the information in the user table with the column family of info, the column identifier of name, and the latest version of 5

Scan 'user', {COLUMNS = >' info:name', VERSIONS = > 5}

Query the information in the user table where the column families are info and data and the column identifier contains the a character

Scan 'user', {COLUMNS = > [' info', 'data'], FILTER = > "(QualifierFilter (=,' substring:a'))"}

Query the data in the user table whose column family is info,rk and the range is [rk0001, rk0003)

Scan 'people', {COLUMNS = >' info', STARTROW = > 'rk0001', ENDROW = >' rk0003'}

Query the row key that begins with the rk character in the user table

Scan 'user', {FILTER= > "PrefixFilter (' rk')"}

Query the specified range of data in the user table

Scan 'user', {TIMERANGE = > [1392368783980,1392380169184]}

Delete data

Delete the data whose row key is rk0001 and column identifier is info:name in the user table

Delete 'people',' rk0001', 'info:name'

Delete the data whose row key is rk0001 and column identifier is 1392383705316 in user table

Delete 'user',' rk0001', 'info:name', 1392383705316

Clear the data in the user table

Truncate 'people'

Modify table structure

First deactivate the user table (not in the new version)

Disable 'user'

Add two column families F1 and f2

Alter 'people', NAME = >' F1'

Alter 'user', NAME = >' f2'

Enable tabl

Enable 'user'

# disable 'user' (not needed in the new version)

Delete a column family:

Alter 'user', NAME = >' F1', METHOD = > 'delete' or alter' user', 'delete' = >' F1'

Add column family F1 and delete column family f2

Alter 'user', {NAME = >' f1'}, {NAME = >'f2', METHOD = > 'delete'}

Change the F1 column family version number of user to 5

Alter 'people', NAME = >' info', VERSIONS = > 5

Enable tabl

Enable 'user'

Delete tabl

Disable 'user'

Drop 'user'

Get 'person',' rk0001', {FILTER = > "ValueFilter (=, 'binary: China')"}

Get 'person',' rk0001', {FILTER = > "(QualifierFilter (=, 'substring:a'))"}

Scan 'person', {COLUMNS = >' info:name'}

Scan 'person', {COLUMNS = > [' info', 'data'], FILTER = > "(QualifierFilter (=,' substring:a'))"}

Scan 'person', {COLUMNS = >' info', STARTROW = > 'rk0001', ENDROW = >' rk0003'}

Scan 'person', {COLUMNS = >' info', STARTROW = > '201402011', ENDROW = >' 20140301'}

Scan 'person', {COLUMNS = >' info:name', TIMERANGE = > [1395978233636

1395987769587]}

Delete 'person',' rk0001', 'info:name'

Alter 'person', NAME = >' ffff'

Alter 'person', NAME = >' info', VERSIONS = > 10

Get 'user',' rk0002', {COLUMN = > ['info:name',' data:pic']}

1. Manual split

Syntax: split 'regionName',' splitKey'

2. Trigger major compaction manually

# syntax: # Compact all regions in a table:#hbase > major_compact 't1'#Compact an entire region:#hbase > major_compact' r1'#Compact a single column family within a region:#hbase > major_compact 'r1statements, 'c1'#Compact a single column family within a table:#hbase > major_compact' T1 statements, 'c1' about "what are the hbase shell operation statements?" this article ends here. I hope the above content can be of some help to you. So that you can learn more knowledge, if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report