In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you how to use the HBase Shell command, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
HBase Shell
Part I: Hbase basic View
1. View the Hbase version
Hbase (main): 008 CSTTook 0 > version2.2.3, r6a830d87542b766bd3dc4cfdee28655f62de3974, Friday, January 10, 2020 18:27:51 CSTTook 0.0002 seconds
2. Hbase status View Command shell
Hbase (main): 009 servers 0 > status1 active master, 0 backup masters, 1 servers, 0 dead, 3.0000 average loadTook 0.0387 seconds part II: DDL (Data Defination Language) operation, addition, deletion, modification and query of Hbase table
1. Create a new table test to set the two column families to cf1,cf2
Hbase (main): 010 test','cf1','cf2'Created table testTook 0 > create 'test','cf1','cf2'Created table testTook 1.3418 seconds = > Hbase::Table-test
two。 Get the description of the table
Hbase (main): 011test'Table test is ENABLED test COLUMN FAMILIES DESCRIPTION 0 > describe 'test'Table test is ENABLED test COLUMN FAMILIES DESCRIPTION {NAME = >' cf1', VERSIONS = >'1' EVICT_BLOCKS_ON_CLOSE = > 'false', NEW_VERSION_BEHAVIOR = >' false', KEEP_DELETED_CELLS = > 'FALSE', CACHE_DATA_ON_WRITE = >' false', DATA_BLOCK_ENCODING = > 'NONE', TTL = >' FOREVER', MIN_VERSIONS = > '0mm, REPLICATION_SCOPE = >' 01mm, BLOOMFILTER = > 'ROW', CACHE_INDEX_ON_WRITE = >' false', IN_MEMORY = > 'false', CACHE_BLOOMS_ON_WRITE = >' false', PREFETCH_BLOCKS_ON_OPEN = > 'false', COMPRESSION = >' NONE' BLOCKCACHE = > 'true', BLOCKSIZE = >' 65536'} {NAME = > 'cf2', VERSIONS = >' 1century, EVICT_BLOCKS_ON_CLOSE = > 'false', NEW_VERSION_BEHAVIOR = >' false', KEEP_DELETED_CELLS = > 'FALSE', CACHE_DATA_ON_WRITE = >' false', DATA_BLOCK_ENCODING = > 'NONE', TTL = >' FOREVER', MIN_VERSIONS = > '0mm, REPLICATION_SCOPE = >' 0mm, BLOOMFILTER = > 'ROW', CACHE_INDEX_ON_WRITE = >' false', IN_MEMORY = > 'false' CACHE_BLOOMS_ON_WRITE = > 'false', PREFETCH_BLOCKS_ON_OPEN = >' false', COMPRESSION = > 'NONE', BLOCKCACHE = >' true', BLOCKSIZE = > '65536'} 2 row (s) QUOTAS 0 row (s) Took 16.3063 seconds
3. Delete a column family cf2
Hbase (main): 012test', 0 > alter 'test', {NAME= >' cf2',METHOD= > 'delete'} Updating all regions with the new schema...1/1 regions updated.Done.Took 2.0665 seconds
4. List all the tables in Hbase
Hbase (main): 013pur0 > listTABLE table test 2 row (s) Took 0.0044 seconds = > ["table" "test"]
5. Query whether the table exists
Hbase (main): 014 test'Table test does exist Took 0 > exists' test'Table test does exist Took 0.0224 seconds = > true
6. Query whether the table is available
Hbase (main): 015test'true Took 0 > is_enabled 'test'true Took 0.0053 seconds = > true
7. Delete a table
Hbase (main): 017seconds hbase 0 > disable 'test'Took 0.4657 seconds hbase (main): 018seconds hbase 0 > drop' test'Took 0.2485 seconds part 3: HBase's DML (data manipulation language) manipulates table data to add, modify, obtain, delete and query.
1. Insert data
Insert two columns into the row1 row of Hbase's test table.
Hbase (main): 034seconds hbase 0 > put 'test','row1','cf1:name','tom'Took 0.0080 seconds hbase (main): 035 seconds hbase 0 > put' test','row1','cf1:age','18'Took 0.0043 seconds
The column family cf1 defines two columns, name and age
two。 Read data
Read all the data in the row1 row of the test table
Hbase (main): 036 hbase 0 > get 'test','row1'COLUMN CELL cf1:age timestamp=1581128757386, value=18 cf1:name timestamp=1581128743387, value=tom 1 row (s) Took 0.0264 seconds
Read all data of test row1 row and column family cf1
Hbase (main): 037get 0 > get 'test','row1','cf1'COLUMN CELL cf1:age timestamp=1581128757386, value=18 cf1:name timestamp=1581128743387, value=tom 1 row (s) Took 0.0083 seconds
3. Update a record
The update syntax for Hbase is the same as the syntax for inserting new data
Hbase (main): 038 test','row1','cf1:age','19'Took 0 > put 'test','row1','cf1:age','19'Took 0.0059 seconds
View update results
Hbase (main): 039 value=19 0 > get 'test','row1','cf1:age'COLUMN CELL cf1:age timestamp=1581130589721, value=19 1 row (s) Took 0.0133 seconds
4. Read two versions of data by timestamp
Hbase (main): 005test','row1', 0 > get 'test','row1', {COLUMN= >' cf1:age',TIMESTAMP= > 1581130589721} COLUMN CELL cf1:age timestamp=1581130589721, value=19 1 row (s) Took 0.0082 seconds hbase (main): 008test','row1', 0 > get 'test','row1', {COLUMN= >' cf1:age' TIMESTAMP= > 1581128757386} COLUMN CELL cf1:age timestamp=1581128757386, value=18 1 row (s) Took 0.0135 seconds
5. Full table scan
Hbase (main): 009 test'ROW COLUMN+CELL row1 column=cf1:age 0 > scan 'test'ROW COLUMN+CELL row1 column=cf1:age, timestamp=1581130589721, value=19 row1 column=cf1:name, timestamp=1581128743387, value=tom 1 row (s) Took 0.0107 seconds
6. Number of rows in statistical table
Hbase (main): 017test'1 row 0 > count 'test'1 row (s) Took 0.0635 seconds = > 1
7. Delete a column
Hbase (main): 011 test','row1','cf1:age'Took 0 > delete 'test','row1','cf1:age'Took 0.0269 seconds
Check the deletion results, the age is back to 18, delete the 19
Hbase (main): 012test','row1'COLUMN CELL cf1:age timestamp=1581128757386 0 > get 'test','row1'COLUMN CELL cf1:age timestamp=1581128757386, value=18 cf1:name timestamp=1581128743387, value=tom 1 row (s) Took 0.0114 seconds
Delete again
Hbase (main): 015 test','row1','cf1:age'Took 0 > delete 'test','row1','cf1:age'Took 0.0030 seconds hbase (main): 014 test','row1','cf1:age'Took 0 > get' test','row1'COLUMN CELL cf1:name timestamp=1581128743387, value=tom 1 row (s) Took 0.0134 seconds
8. Delete all cells
Hbase (main): 020 test','row1'Took 0 > deleteall 'test','row1'Took 0.0041 seconds
9. Clear all data in the table
Hbase (main): 022test'Truncating 0 > truncate 'test'Truncating' test' table (it may take a while): Disabling table...Truncating table...Took 1.5547 seconds is all the content of this article "how to use the HBase Shell Command". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.