In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Enter hbase shell console
[hadoop@mylab2 hbase] $. / bin/hbase shell2016-09-18 15 WARN 01purl 36773 WARN [main] util.NativeCodeLoader: Unable to load native-hadoop library for your platform... Using builtin-java classes where applicableSLF4J: Class path contains multiple SLF4J bindings.SLF4J: Found binding in [jar:file:/usr/local/hbase/lib/slf4j-log4j12-1.7.5.jarbank http://www.slf4j.org/codes. SLF4J] SLF4J: Found binding in [jar:file:/usr/local/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jarbank http://www.slf4j.org/codes.] SLF4J: Html#multiple_bindings for an explanation.SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory] HBase Shell Enter 'help' for list of supported commands.Type "exit" to leave the HBase ShellVersion 1.2.1, r8d8a7107dc4ccbf36a92f64675dc60392f85c015, Wed Mar 30 11:19:21 CDT 2016hbase (main): 001VR 0 >
Query server status
Hbase (main): 007backup masters 0 > status1 active master, 0 backup masters, 2 servers, 0 dead, 1.5000 average load
View hbase version
Hbase (main): 008r8d8a7107dc4ccbf36a92f64675dc60392f85c015 0 > version1.2.1, r8d8a7107dc4ccbf36a92f64675dc60392f85c015, Wed Mar 30 11:19:21 CDT 2016
Command help
Hbase (main): 002 for 0 > help getERROR: wrong number of arguments (0 for 2) Here is some help for this command:Get row or cell contents; pass table name, row, and optionallya dictionary of column (s), timestamp, timerange and versions. Examples: hbase > get 'ns1:t1', 'r1' hbase > get 't1regions,' r1' hbase > get 't1bands, 'r1blocks, {TIMERANGE = > [ts1, ts2]} hbase > get 't1bands,' r1bands, {COLUMN = > 'c1'} hbase > get 't1bands,' r1bands, {COLUMN = > ['c1stocks,' c2rels, 'c3']} hbase > get' t1chains, 'r1bands, {COLUMN = >' c1cards, TIMESTAMP = > ts1 hbase > get 't1' [ts1, ts2], VERSIONS = > 4} hbase > get 't1regions, 'r1miles, {COLUMN = >' c1miles, TIMESTAMP = > ts1, VERSIONS = > 4} hbase > get 't1miles, 'r1miles, {FILTER = > "ValueFilter (=,' binary:abc')"} hbase > get 't1miles, 'r1miles,' c1' hbase > get 't1trades,' r1cards, 'c1bands,' c1odes, 'c2' hbase > get' t1cards, 'r1cards ['c1trees,' c2'] hbase > get 't1miles, 'r1bands, {COLUMN = >' c1miles, ATTRIBUTES = > {'mykey'= >' myvalue'}} hbase > get 't1bands, 'r1bands, {COLUMN = >' c1bands, AUTHORIZATIONS = > ['PRIVATE','SECRET']} hbase > get 't1miles,' r1miles, {CONSISTENCY = > 'TIMELINE'} hbase > get 't1miles,' r1miles, {CONSISTENCY = > 'TIMELINE', REGION_REPLICA_ID = > 1} Besides the default' toStringBinary' format 'get' also supports custom formatting bycolumn. A user can define a FORMATTER by adding it to the column name in the getspecification. The FORMATTER can be stipulated: 1. Either as an org.apache.hadoop.hbase.util.Bytes method name (e.g, toInt, toString) 2. Or as a custom class followed by method name: e.g. C (MyFormatterClass) .format '.Example formatting cf:qualifier1 and cf:qualifier2 both as Integers: hbase > get't 1 COLUMN,' r1' {COLUMN = > ['cf:qualifier1:toInt' 'cf:qualifier2:c (org.apache.hadoop.hbase.util.Bytes) .toInt']} Note that you can specify a FORMATTER by column only (cf:qualifier). You cannot specifya FORMATTER for all columns of a column family. The same commands also can be run on a reference to a table (obtained via get_table orcreate_table). Suppose you had a reference t to table 't1regions, the corresponding commandswould be: hbase > t.get 'r1' hbase > t.get 'r1bands, {TIMERANGE = > [ts1, ts2]} hbase > t.get 'r1bands, {COLUMN = > 'c1'} hbase > t.get 'r1bands, {COLUMN = > [' c1bands, 'c2rels,' c3']} hbase > t.get 'r1bands, {COLUMN = > c1bands, TIMESTAMP = > ts1} hbase > t.get 'r1bands, {COLUMN = > c1' TIMERANGE = > [ts1, ts2], VERSIONS = > 4} hbase > ts1, {COLUMN = >'C1, TIMESTAMP = > ts1, VERSIONS = > 4} hbase > t.get 'r1, {FILTER = > "ValueFilter (=, 'binary:abc')"} hbase > t.get 'r1,' c1' hbase > t.get 'r1,'c1, 'c2' hbase > t.get' r1, ['c1, 'c2'] hbase > t.get 'r1' {CONSISTENCY = > 'TIMELINE'} hbase > t.get 'r1', {CONSISTENCY = > 'TIMELINE', REGION_REPLICA_ID = > 1} HBase Shell, version 1.2.1, r8d8a7107dc4ccbf36a92f64675dc60392f85c015, Wed Mar 30 11:19:21 CDT 2016Type' help "COMMAND", (e.g. 'help "get"'-- the quotes are necessary) for help on a specific command.Commands are grouped. Type 'help "COMMAND_GROUP', (e.g. 'help" general "') for help on a command group.COMMAND GROUPS: Group name: general Commands: status, table_help, version, whoami Group name: ddl Commands: alter, alter_async, alter_status, create, describe, disable, disable_all, drop, drop_all, enable, enable_all, exists, get_table, is_disabled, is_enabled, list, locate_region, show_filters Group name: namespace Commands: alter_namespace, create_namespace, describe_namespace Drop_namespace, list_namespace, list_namespace_tables Group name: dml Commands: append, count, delete, deleteall, get, get_counter, get_splits, incr, put, scan, truncate, truncate_preserve Group name: tools Commands: assign, balance_switch, balancer, balancer_enabled, catalogjanitor_enabled, catalogjanitor_run, catalogjanitor_switch, close_region, compact, compact_rs, flush, major_compact, merge_region, move, normalize, normalizer_enabled, normalizer_switch, split, trace, unassign, wal_roll Zk_dump Group name: replication Commands: add_peer, append_peer_tableCFs, disable_peer, disable_table_replication, enable_peer, enable_table_replication, list_peers, list_replicated_tables, remove_peer, remove_peer_tableCFs, set_peer_tableCFs, show_peer_tableCFs Group name: snapshots Commands: clone_snapshot, delete_all_snapshot, delete_snapshot, list_snapshots, restore_snapshot, snapshot Group name: configuration Commands: update_all_config, update_config Group name: quotas Commands: list_quotas Set_quota Group name: security Commands: grant, list_security_capabilities, revoke, user_permission Group name: procedures Commands: abort_procedure, list_procedures Group name: visibility labels Commands: add_labels, clear_auths, get_auths, list_labels, set_auths, set_visibilitySHELL USAGE:Quote all names in HBase Shell such as table and column names. Commas delimitcommand parameters. Type after entering a command to run it.Dictionaries of configuration used in the creation and alteration of tables areRuby Hashes. They look like this: {'key1' = >' value1', 'key2' = >' value2',...} and are opened and closed with curley-braces. Key/values are delimited by the'= > 'character combination. Usually keys are predefined constants such asNAME, VERSIONS, COMPRESSION, etc. Constants do not need to be quoted. Type'Object.constants' to see a (messy) list of all constants in the environment.If you are using binary keys or values and need to enter them in the shell, usedouble-quote'd hexadecimal representation. For example: hbase > get 't1cards, "key\ x03\ x3f\ xcd" hbase > get 't1cards, "key\ 003\ 023\ 011" hbase > put 't1bands, "test\ xef\ xff",'F1 vehicles ","\ X01\ x33\ x40 "The HBase shell is the (J) Ruby IRB with the above HBase-specific commands added.For more on the HBase Shell, see http://hbase.apache.org/book.html
Management of tables
Create a tabl
Hbase (main): 004VR 0 > create'scores','grade' 'course'0 row (s) in 2.8930 seconds= > Hbase::Table-scores# View the creation table hbase (main): 006 seconds= 0 > listTABLE scores 1 row (s) in 0.0270 seconds= > ["scores"]
View the construction of the table
Hbase (main): 010 0 > describe'scores'Table scores is ENABLED scores COLUMN FAMILIES DESCRIPTION {NAME = > 'course' DATA_BLOCK_ENCODING = > 'NONE', BLOOMFILTER = >' ROW', REPLICATION_SCOPE = > '0mm, VERSIONS = >' 1mm, COMPRESSION = > 'NONE', MIN_VERSIONS = >' 0mm, TTL = > 'FOREVER', KEEP_DELETED_CELLS = >' FALSE', BLOCKSIZE = > '65536', IN_MEMORY = >' false' BLOCKCACHE = > 'true'} {NAME = >' grade', DATA_BLOCK_ENCODING = > 'NONE', BLOOMFILTER = >' ROW', REPLICATION_SCOPE = > '0mm, VERSIONS = >' 1mm, COMPRESSION = > 'NONE', MIN_VERSIONS = >' 0mm, TTL = > 'FOREVER' KEEP_DELETED_CELLS = > 'FALSE', BLOCKSIZE = >' 65536', IN_MEMORY = > 'false', BLOCKCACHE = >' true'} 2 row (s) in 0.2090 secondshbase (main): 011true' 0 >
Add a row of data, the row name is zkb column family grad, the column name is "" value bit 5
Hbase (main): 011row 0 > put'scores','zkb','grade:','5' 0 row (s) in 0.1240 secondshbase (main): 012row 0 >
Add a column to the column family course of the data in this row of zkb
Hbase (main): 012in 0 > put'scores','zkb','course:math','97'0 row (s) in 0.0120 secondshbase (main): 013in 0 >
Add a column to the column family course of the data in this row of zkb
Hbase (main): 013 in 0 > put'scores','zkb','course:art','87'0 row (s) in 0.0140 secondshbase (main): 014 put'scores','zkb','course:art','87'0 row 0 >
Add a row of data with a row name called baoniu column family grad with a column name of "" with a value of 4
Hbase (main): 014 in 0 > put'scores','baoniu','grade:','4'0 row (s) in 0.0170 seconds
Add a column to the column family course of the data in this row of baoniu
Hbase (main): 015 in 0 > put'scores','baoniu','course:math','89'0 row (s) in 0.0120 seconds
Add a column to the column family course of the data in this row of Jerry
Hbase (main): 016 in 0 > put'scores','baoniu','course:art','80'0 row (s) in 0.0150 secondshbase (main): 017 put'scores','baoniu','course:art','80'0 row 0 >
View data related to zkb in the scores table
Hbase (main): 017VR 0 > get'scores','zkb'COLUMN CELL course:art timestamp=1474183749925 Value=87 course:math timestamp=1474183718550, value=97 grade: timestamp=1474183615369 Value=5 3 row (s) in 0.1280 secondshbase (main): 018in 0 >
View all data in the scores table
Hbase (main): 018 scan'scores'ROW COLUMN+CELL baoniu column=course:art 0 > timestamp=1474183803493 Value=80 baoniu column=course:math, timestamp=1474183793034, value=89 baoniu column=grade:, timestamp=1474183782970, value=4 zkb column=course:art Timestamp=1474183749925, value=87 zkb column=course:math, timestamp=1474183718550, value=97 zkb column=grade:, timestamp=1474183615369 Value=5 2 row (s) in 0.0590 secondshbase (main): 019secondshbase 0 >
View all the data in the scores table all the data of the courses column family
Hbase (main): 019 COLUMNS 0 > scan'scores', {COLUMNS = > 'course'} ROW COLUMN+CELL baoniu column=course:art, timestamp=1474183803493 Value=80 baoniu column=course:math, timestamp=1474183793034, value=89 zkb column=course:art, timestamp=1474183749925 Value=87 zkb column=course:math, timestamp=1474183718550, value=97 2 row (s) in 0.0330 secondshbase (main): 020row 0 >
Reference documentation
Http://blog.csdn.net/lifuxiangcaohui/article/details/40042117
Http://blog.csdn.net/smcwwh/article/details/7468672
Http://www.cnblogs.com/nexiyi/p/hbase_shell.html
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.