HBASE-3218 Shell help cleanup/cosmetics/edit
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1033754 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
65979de1fb
commit
63c6827376
|
@ -1144,6 +1144,7 @@ Release 0.90.0 - Unreleased
|
|||
HBASE-3090 Don't include hbase-default in conf/ assembly
|
||||
HBASE-3161 Provide option for Stargate to only serve GET requests
|
||||
(Bennett Neale via Stack)
|
||||
HBASE-3218 Shell help cleanup/cosmetics/edit
|
||||
|
||||
|
||||
NEW FEATURES
|
||||
|
|
|
@ -114,6 +114,7 @@ public class RetriesExhaustedWithDetailsException extends RetriesExhaustedExcept
|
|||
public static Map<String, Integer> classifyExs(List<Throwable> ths) {
|
||||
Map<String, Integer> cls = new HashMap<String, Integer>();
|
||||
for (Throwable t : ths) {
|
||||
if (t == null) continue;
|
||||
String name = t.getClass().getSimpleName();
|
||||
Integer i = cls.get(name);
|
||||
if (i == null) {
|
||||
|
|
|
@ -109,22 +109,26 @@ module Shell
|
|||
def print_banner
|
||||
puts "HBase Shell; enter 'help<RETURN>' for list of supported commands."
|
||||
puts 'Type "exit<RETURN>" to leave the HBase Shell'
|
||||
print 'Version '
|
||||
command('version')
|
||||
puts
|
||||
end
|
||||
|
||||
def help_command(command)
|
||||
puts "COMMAND: #{command}"
|
||||
def help_multi_command(command)
|
||||
puts "Command: #{command}"
|
||||
puts command_instance(command).help
|
||||
puts
|
||||
return nil
|
||||
end
|
||||
|
||||
def help_command(command)
|
||||
puts command_instance(command).help
|
||||
return nil
|
||||
end
|
||||
|
||||
def help_group(group_name)
|
||||
group = ::Shell.command_groups[group_name.to_s]
|
||||
puts group[:full_name]
|
||||
puts '-' * 80
|
||||
group[:commands].sort.each { |cmd| help_command(cmd) }
|
||||
group[:commands].sort.each { |cmd| help_multi_command(cmd) }
|
||||
if group[:comment]
|
||||
puts '-' * 80
|
||||
puts
|
||||
|
@ -135,7 +139,6 @@ module Shell
|
|||
end
|
||||
|
||||
def help(command = nil)
|
||||
puts
|
||||
if command
|
||||
return help_command(command) if ::Shell.commands[command.to_s]
|
||||
return help_group(command) if ::Shell.command_groups[command.to_s]
|
||||
|
@ -145,32 +148,30 @@ module Shell
|
|||
|
||||
puts help_header
|
||||
puts
|
||||
puts '-' * 80
|
||||
puts
|
||||
puts 'COMMAND GROUPS:'
|
||||
::Shell.command_groups.each do |name, group|
|
||||
puts " " + group[:full_name] + ": "
|
||||
puts " group name: " + name
|
||||
puts " commands: " + group[:command_names].sort.join(', ')
|
||||
puts " Group name: " + name
|
||||
puts " Commands: " + group[:command_names].sort.join(', ')
|
||||
puts
|
||||
end
|
||||
puts
|
||||
unless command
|
||||
puts '-' * 80
|
||||
puts
|
||||
puts 'SHELL USAGE:'
|
||||
help_footer
|
||||
puts
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
def help_header
|
||||
return "Enter, help 'COMMAND_GROUP', (e.g. help 'general') to get help on all commands in a group\n" +
|
||||
"Enter, help 'COMMAND', (e.g. help 'get') to get help on a specific command"
|
||||
return "HBase Shell, version #{org.apache.hadoop.hbase.util.VersionInfo.getVersion()}, " +
|
||||
"r#{org.apache.hadoop.hbase.util.VersionInfo.getRevision()}, " +
|
||||
"#{org.apache.hadoop.hbase.util.VersionInfo.getDate()}" + "\n" +
|
||||
"Type 'help \"COMMAND\"', (e.g. 'help \"get\"' -- the quotes are necessary) for help on a specific command.\n" +
|
||||
"Commands are grouped. Type 'help \"COMMAND_GROUP\"', (e.g. 'help \"general\"') for help on a command group."
|
||||
end
|
||||
|
||||
def help_footer
|
||||
puts <<-HERE
|
||||
Quote all names in HBase shell such as table and column names. Commas delimit
|
||||
Quote all names in HBase Shell such as table and column names. Commas delimit
|
||||
command parameters. Type <RETURN> after entering a command to run it.
|
||||
Dictionaries of configuration used in the creation and alteration of tables are
|
||||
Ruby Hashes. They look like this:
|
||||
|
@ -190,7 +191,7 @@ double-quote'd hexadecimal representation. For example:
|
|||
hbase> put 't1', "test\\xef\\xff", 'f1:', "\\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://wiki.apache.org/hadoop/Hbase/Shell
|
||||
For more on the HBase Shell, see http://hbase.apache.org/docs/current/book.html
|
||||
HERE
|
||||
end
|
||||
end
|
||||
|
|
|
@ -23,15 +23,15 @@ module Shell
|
|||
class AddPeer< Command
|
||||
def help
|
||||
return <<-EOF
|
||||
Add a peer cluster to replicate to, the id must be a short and
|
||||
the cluster key is composed like this:
|
||||
hbase.zookeeper.quorum:hbase.zookeeper.property.clientPort:zookeeper.znode.parent
|
||||
This gives a full path for HBase to connect to another cluster.
|
||||
Examples:
|
||||
Add a peer cluster to replicate to, the id must be a short and
|
||||
the cluster key is composed like this:
|
||||
hbase.zookeeper.quorum:hbase.zookeeper.property.clientPort:zookeeper.znode.parent
|
||||
This gives a full path for HBase to connect to another cluster.
|
||||
Examples:
|
||||
|
||||
hbase> add_peer '1', "server1.cie.com:2181:/hbase"
|
||||
hbase> add_peer '2', "zk1,zk2,zk3:2182:/hbase-prod"
|
||||
EOF
|
||||
hbase> add_peer '1', "server1.cie.com:2181:/hbase"
|
||||
hbase> add_peer '2', "zk1,zk2,zk3:2182:/hbase-prod"
|
||||
EOF
|
||||
end
|
||||
|
||||
def command(id, cluster_key)
|
||||
|
|
|
@ -23,29 +23,35 @@ module Shell
|
|||
class Alter < Command
|
||||
def help
|
||||
return <<-EOF
|
||||
Alter column family schema; pass table name and a dictionary
|
||||
specifying new column family schema. Dictionaries are described
|
||||
on the main help command output. Dictionary must include name
|
||||
of column family to alter. For example,
|
||||
Alter column family schema; pass table name and a dictionary
|
||||
specifying new column family schema. Dictionaries are described
|
||||
on the main help command output. Dictionary must include name
|
||||
of column family to alter. For example,
|
||||
|
||||
To change or add the 'f1' column family in table 't1' from defaults
|
||||
to instead keep a maximum of 5 cell VERSIONS, do:
|
||||
hbase> alter 't1', NAME => 'f1', VERSIONS => 5
|
||||
To change or add the 'f1' column family in table 't1' from defaults
|
||||
to instead keep a maximum of 5 cell VERSIONS, do:
|
||||
|
||||
To delete the 'f1' column family in table 't1', do:
|
||||
hbase> alter 't1', NAME => 'f1', METHOD => 'delete'
|
||||
or a shorter version:
|
||||
hbase> alter 't1', 'delete' => 'f1'
|
||||
hbase> alter 't1', NAME => 'f1', VERSIONS => 5
|
||||
|
||||
You can also change table-scope attributes like MAX_FILESIZE
|
||||
MEMSTORE_FLUSHSIZE, READONLY, and DEFERRED_LOG_FLUSH.
|
||||
To delete the 'f1' column family in table 't1', do:
|
||||
|
||||
For example, to change the max size of a family to 128MB, do:
|
||||
hbase> alter 't1', METHOD => 'table_att', MAX_FILESIZE => '134217728'
|
||||
hbase> alter 't1', NAME => 'f1', METHOD => 'delete'
|
||||
|
||||
There could be more than one alteration in one command:
|
||||
hbase> alter 't1', {NAME => 'f1'}, {NAME => 'f2', METHOD => 'delete'}
|
||||
EOF
|
||||
or a shorter version:
|
||||
|
||||
hbase> alter 't1', 'delete' => 'f1'
|
||||
|
||||
You can also change table-scope attributes like MAX_FILESIZE
|
||||
MEMSTORE_FLUSHSIZE, READONLY, and DEFERRED_LOG_FLUSH.
|
||||
|
||||
For example, to change the max size of a family to 128MB, do:
|
||||
|
||||
hbase> alter 't1', METHOD => 'table_att', MAX_FILESIZE => '134217728'
|
||||
|
||||
There could be more than one alteration in one command:
|
||||
|
||||
hbase> alter 't1', {NAME => 'f1'}, {NAME => 'f2', METHOD => 'delete'}
|
||||
EOF
|
||||
end
|
||||
|
||||
def command(table, *args)
|
||||
|
|
|
@ -23,11 +23,12 @@ module Shell
|
|||
class CloseRegion < Command
|
||||
def help
|
||||
return <<-EOF
|
||||
Close a single region. Optionally specify regionserver.
|
||||
Examples:
|
||||
hbase> close_region 'REGIONNAME'
|
||||
hbase> close_region 'REGIONNAME', 'REGIONSERVER_IP:PORT'
|
||||
EOF
|
||||
Close a single region. Optionally specify regionserver.
|
||||
Examples:
|
||||
|
||||
hbase> close_region 'REGIONNAME'
|
||||
hbase> close_region 'REGIONNAME', 'REGIONSERVER_IP:PORT'
|
||||
EOF
|
||||
end
|
||||
|
||||
def command(region_name, server = nil)
|
||||
|
|
|
@ -23,9 +23,9 @@ module Shell
|
|||
class Compact < Command
|
||||
def help
|
||||
return <<-EOF
|
||||
Compact all regions in passed table or pass a region row
|
||||
to compact an individual region
|
||||
EOF
|
||||
Compact all regions in passed table or pass a region row
|
||||
to compact an individual region
|
||||
EOF
|
||||
end
|
||||
|
||||
def command(table_or_region_name)
|
||||
|
|
|
@ -23,19 +23,19 @@ module Shell
|
|||
class Count < Command
|
||||
def help
|
||||
return <<-EOF
|
||||
Count the number of rows in a table. This operation may take a LONG
|
||||
time (Run '$HADOOP_HOME/bin/hadoop jar hbase.jar rowcount' to run a
|
||||
counting mapreduce job). Current count is shown every 1000 rows by
|
||||
default. Count interval may be optionally specified. Scan caching
|
||||
is enabled on count scans by default. Default cache size is 10 rows.
|
||||
If your rows are small in size, you may want to increase this
|
||||
parameter. Examples:
|
||||
Count the number of rows in a table. This operation may take a LONG
|
||||
time (Run '$HADOOP_HOME/bin/hadoop jar hbase.jar rowcount' to run a
|
||||
counting mapreduce job). Current count is shown every 1000 rows by
|
||||
default. Count interval may be optionally specified. Scan caching
|
||||
is enabled on count scans by default. Default cache size is 10 rows.
|
||||
If your rows are small in size, you may want to increase this
|
||||
parameter. Examples:
|
||||
|
||||
hbase> count 't1'
|
||||
hbase> count 't1', INTERVAL => 100000
|
||||
hbase> count 't1', CACHE => 1000
|
||||
hbase> count 't1', INTERVAL => 10, CACHE => 1000
|
||||
EOF
|
||||
hbase> count 't1'
|
||||
hbase> count 't1', INTERVAL => 100000
|
||||
hbase> count 't1', CACHE => 1000
|
||||
hbase> count 't1', INTERVAL => 10, CACHE => 1000
|
||||
EOF
|
||||
end
|
||||
|
||||
def command(table, params = {})
|
||||
|
|
|
@ -23,18 +23,17 @@ module Shell
|
|||
class Create < Command
|
||||
def help
|
||||
return <<-EOF
|
||||
Create table; pass table name, a dictionary of specifications per
|
||||
column family, and optionally a dictionary of table configuration.
|
||||
Dictionaries are described below in the GENERAL NOTES section.
|
||||
Examples:
|
||||
Create table; pass table name, a dictionary of specifications per
|
||||
column family, and optionally a dictionary of table configuration.
|
||||
Dictionaries are described below in the GENERAL NOTES section.
|
||||
Examples:
|
||||
|
||||
hbase> create 't1', {NAME => 'f1', VERSIONS => 5}
|
||||
hbase> create 't1', {NAME => 'f1'}, {NAME => 'f2'}, {NAME => 'f3'}
|
||||
hbase> # The above in shorthand would be the following:
|
||||
hbase> create 't1', 'f1', 'f2', 'f3'
|
||||
hbase> create 't1', {NAME => 'f1', VERSIONS => 1, TTL => 2592000,
|
||||
BLOCKCACHE => true}
|
||||
EOF
|
||||
hbase> create 't1', {NAME => 'f1', VERSIONS => 5}
|
||||
hbase> create 't1', {NAME => 'f1'}, {NAME => 'f2'}, {NAME => 'f3'}
|
||||
hbase> # The above in shorthand would be the following:
|
||||
hbase> create 't1', 'f1', 'f2', 'f3'
|
||||
hbase> create 't1', {NAME => 'f1', VERSIONS => 1, TTL => 2592000, BLOCKCACHE => true}
|
||||
EOF
|
||||
end
|
||||
|
||||
def command(table, *args)
|
||||
|
|
|
@ -23,14 +23,14 @@ module Shell
|
|||
class Delete < Command
|
||||
def help
|
||||
return <<-EOF
|
||||
Put a delete cell value at specified table/row/column and optionally
|
||||
timestamp coordinates. Deletes must match the deleted cell's
|
||||
coordinates exactly. When scanning, a delete cell suppresses older
|
||||
versions. To delete a cell from 't1' at row 'r1' under column 'c1'
|
||||
marked with the time 'ts1', do:
|
||||
Put a delete cell value at specified table/row/column and optionally
|
||||
timestamp coordinates. Deletes must match the deleted cell's
|
||||
coordinates exactly. When scanning, a delete cell suppresses older
|
||||
versions. To delete a cell from 't1' at row 'r1' under column 'c1'
|
||||
marked with the time 'ts1', do:
|
||||
|
||||
hbase> delete 't1', 'r1', 'c1', ts1
|
||||
EOF
|
||||
hbase> delete 't1', 'r1', 'c1', ts1
|
||||
EOF
|
||||
end
|
||||
|
||||
def command(table, row, column, timestamp = org.apache.hadoop.hbase.HConstants::LATEST_TIMESTAMP)
|
||||
|
|
|
@ -23,13 +23,13 @@ module Shell
|
|||
class Deleteall < Command
|
||||
def help
|
||||
return <<-EOF
|
||||
Delete all cells in a given row; pass a table name, row, and optionally
|
||||
a column and timestamp. Examples:
|
||||
Delete all cells in a given row; pass a table name, row, and optionally
|
||||
a column and timestamp. Examples:
|
||||
|
||||
hbase> deleteall 't1', 'r1'
|
||||
hbase> deleteall 't1', 'r1', 'c1'
|
||||
hbase> deleteall 't1', 'r1', 'c1', ts1
|
||||
EOF
|
||||
hbase> deleteall 't1', 'r1'
|
||||
hbase> deleteall 't1', 'r1', 'c1'
|
||||
hbase> deleteall 't1', 'r1', 'c1', ts1
|
||||
EOF
|
||||
end
|
||||
|
||||
def command(table, row, column = nil, timestamp = org.apache.hadoop.hbase.HConstants::LATEST_TIMESTAMP)
|
||||
|
|
|
@ -23,9 +23,9 @@ module Shell
|
|||
class Describe < Command
|
||||
def help
|
||||
return <<-EOF
|
||||
Describe the named table. For example:
|
||||
hbase> describe 't1'
|
||||
EOF
|
||||
Describe the named table. For example:
|
||||
hbase> describe 't1'
|
||||
EOF
|
||||
end
|
||||
|
||||
def command(table)
|
||||
|
|
|
@ -23,8 +23,8 @@ module Shell
|
|||
class Disable < Command
|
||||
def help
|
||||
return <<-EOF
|
||||
Start disable of named table: e.g. "hbase> disable 't1'"
|
||||
EOF
|
||||
Start disable of named table: e.g. "hbase> disable 't1'"
|
||||
EOF
|
||||
end
|
||||
|
||||
def command(table)
|
||||
|
|
|
@ -23,15 +23,15 @@ module Shell
|
|||
class DisablePeer< Command
|
||||
def help
|
||||
return <<-EOF
|
||||
Stops the replication stream to the specified cluster, but still
|
||||
keeps track of new edits to replicate.
|
||||
Stops the replication stream to the specified cluster, but still
|
||||
keeps track of new edits to replicate.
|
||||
|
||||
CURRENTLY UNSUPPORTED
|
||||
CURRENTLY UNSUPPORTED
|
||||
|
||||
Examples:
|
||||
Examples:
|
||||
|
||||
hbase> disable_peer '1'
|
||||
EOF
|
||||
hbase> disable_peer '1'
|
||||
EOF
|
||||
end
|
||||
|
||||
def command(id)
|
||||
|
|
|
@ -23,10 +23,10 @@ module Shell
|
|||
class DisableRegion < Command
|
||||
def help
|
||||
return <<-EOF
|
||||
Disable a single region. For example:
|
||||
Disable a single region. For example:
|
||||
|
||||
hbase> disable_region 'REGIONNAME'
|
||||
EOF
|
||||
hbase> disable_region 'REGIONNAME'
|
||||
EOF
|
||||
end
|
||||
|
||||
def command(region_name)
|
||||
|
|
|
@ -23,11 +23,11 @@ module Shell
|
|||
class Drop < Command
|
||||
def help
|
||||
return <<-EOF
|
||||
Drop the named table. Table must first be disabled. If table has
|
||||
more than one region, run a major compaction on .META.:
|
||||
Drop the named table. Table must first be disabled. If table has
|
||||
more than one region, run a major compaction on .META.:
|
||||
|
||||
hbase> major_compact ".META."
|
||||
EOF
|
||||
hbase> major_compact ".META."
|
||||
EOF
|
||||
end
|
||||
|
||||
def command(table)
|
||||
|
|
|
@ -23,8 +23,8 @@ module Shell
|
|||
class Enable < Command
|
||||
def help
|
||||
return <<-EOF
|
||||
Start enable of named table: e.g. "hbase> enable 't1'"
|
||||
EOF
|
||||
Start enable of named table: e.g. "hbase> enable 't1'"
|
||||
EOF
|
||||
end
|
||||
|
||||
def command(table)
|
||||
|
|
|
@ -23,15 +23,15 @@ module Shell
|
|||
class EnablePeer< Command
|
||||
def help
|
||||
return <<-EOF
|
||||
Restarts the replication to the specified peer cluster,
|
||||
continuing from where it was disabled.
|
||||
Restarts the replication to the specified peer cluster,
|
||||
continuing from where it was disabled.
|
||||
|
||||
CURRENTLY UNSUPPORTED
|
||||
CURRENTLY UNSUPPORTED
|
||||
|
||||
Examples:
|
||||
Examples:
|
||||
|
||||
hbase> enable_peer '1'
|
||||
EOF
|
||||
hbase> enable_peer '1'
|
||||
EOF
|
||||
end
|
||||
|
||||
def command(id)
|
||||
|
|
|
@ -23,10 +23,10 @@ module Shell
|
|||
class EnableRegion < Command
|
||||
def help
|
||||
return <<-EOF
|
||||
Enable a single region. For example:
|
||||
Enable a single region. For example:
|
||||
|
||||
hbase> enable_region 'REGIONNAME'
|
||||
EOF
|
||||
hbase> enable_region 'REGIONNAME'
|
||||
EOF
|
||||
end
|
||||
|
||||
def command(region_name)
|
||||
|
|
|
@ -23,8 +23,8 @@ module Shell
|
|||
class Exists < Command
|
||||
def help
|
||||
return <<-EOF
|
||||
Does the named table exist? e.g. "hbase> exists 't1'"
|
||||
EOF
|
||||
Does the named table exist? e.g. "hbase> exists 't1'"
|
||||
EOF
|
||||
end
|
||||
|
||||
def command(table)
|
||||
|
|
|
@ -23,12 +23,12 @@ module Shell
|
|||
class Flush < Command
|
||||
def help
|
||||
return <<-EOF
|
||||
Flush all regions in passed table or pass a region row to
|
||||
flush an individual region. For example:
|
||||
Flush all regions in passed table or pass a region row to
|
||||
flush an individual region. For example:
|
||||
|
||||
hbase> flush 'TABLENAME'
|
||||
hbase> flush 'REGIONNAME'
|
||||
EOF
|
||||
hbase> flush 'TABLENAME'
|
||||
hbase> flush 'REGIONNAME'
|
||||
EOF
|
||||
end
|
||||
|
||||
def command(table_or_region_name)
|
||||
|
|
|
@ -23,18 +23,18 @@ module Shell
|
|||
class Get < Command
|
||||
def help
|
||||
return <<-EOF
|
||||
Get row or cell contents; pass table name, row, and optionally
|
||||
a dictionary of column(s), timestamp and versions. Examples:
|
||||
Get row or cell contents; pass table name, row, and optionally
|
||||
a dictionary of column(s), timestamp and versions. Examples:
|
||||
|
||||
hbase> get 't1', 'r1'
|
||||
hbase> get 't1', 'r1', {COLUMN => 'c1'}
|
||||
hbase> get 't1', 'r1', {COLUMN => ['c1', 'c2', 'c3']}
|
||||
hbase> get 't1', 'r1', {COLUMN => 'c1', TIMESTAMP => ts1}
|
||||
hbase> get 't1', 'r1', {COLUMN => 'c1', TIMESTAMP => ts1, VERSIONS => 4}
|
||||
hbase> get 't1', 'r1', 'c1'
|
||||
hbase> get 't1', 'r1', 'c1', 'c2'
|
||||
hbase> get 't1', 'r1', ['c1', 'c2']
|
||||
EOF
|
||||
hbase> get 't1', 'r1'
|
||||
hbase> get 't1', 'r1', {COLUMN => 'c1'}
|
||||
hbase> get 't1', 'r1', {COLUMN => ['c1', 'c2', 'c3']}
|
||||
hbase> get 't1', 'r1', {COLUMN => 'c1', TIMESTAMP => ts1}
|
||||
hbase> get 't1', 'r1', {COLUMN => 'c1', TIMESTAMP => ts1, VERSIONS => 4}
|
||||
hbase> get 't1', 'r1', 'c1'
|
||||
hbase> get 't1', 'r1', 'c1', 'c2'
|
||||
hbase> get 't1', 'r1', ['c1', 'c2']
|
||||
EOF
|
||||
end
|
||||
|
||||
def command(table, row, *args)
|
||||
|
|
|
@ -23,12 +23,12 @@ module Shell
|
|||
class GetCounter < Command
|
||||
def help
|
||||
return <<-EOF
|
||||
Return a counter cell value at specified table/row/column coordinates.
|
||||
A cell cell should be managed with atomic increment function oh HBase
|
||||
and the data should be binary encoded. Example:
|
||||
Return a counter cell value at specified table/row/column coordinates.
|
||||
A cell cell should be managed with atomic increment function oh HBase
|
||||
and the data should be binary encoded. Example:
|
||||
|
||||
hbase> get_counter 't1', 'r1', 'c1'
|
||||
EOF
|
||||
hbase> get_counter 't1', 'r1', 'c1'
|
||||
EOF
|
||||
end
|
||||
|
||||
def command(table, row, column, value = nil)
|
||||
|
|
|
@ -23,14 +23,14 @@ module Shell
|
|||
class Incr < Command
|
||||
def help
|
||||
return <<-EOF
|
||||
Increments a cell 'value' at specified table/row/column coordinates.
|
||||
To increment a cell value in table 't1' at row 'r1' under column
|
||||
'c1' by 1 (can be omitted) or 10 do:
|
||||
Increments a cell 'value' at specified table/row/column coordinates.
|
||||
To increment a cell value in table 't1' at row 'r1' under column
|
||||
'c1' by 1 (can be omitted) or 10 do:
|
||||
|
||||
hbase> incr 't1', 'r1', 'c1'
|
||||
hbase> incr 't1', 'r1', 'c1', 1
|
||||
hbase> incr 't1', 'r1', 'c1', 10
|
||||
EOF
|
||||
hbase> incr 't1', 'r1', 'c1'
|
||||
hbase> incr 't1', 'r1', 'c1', 1
|
||||
hbase> incr 't1', 'r1', 'c1', 10
|
||||
EOF
|
||||
end
|
||||
|
||||
def command(table, row, column, value = nil)
|
||||
|
|
|
@ -23,8 +23,8 @@ module Shell
|
|||
class IsDisabled < Command
|
||||
def help
|
||||
return <<-EOF
|
||||
Is named table disabled?: e.g. "hbase> is_disabled 't1'"
|
||||
EOF
|
||||
Is named table disabled?: e.g. "hbase> is_disabled 't1'"
|
||||
EOF
|
||||
end
|
||||
|
||||
def command(table)
|
||||
|
@ -37,42 +37,3 @@ module Shell
|
|||
end
|
||||
end
|
||||
end
|
||||
#
|
||||
# Copyright 2010 The Apache Software Foundation
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
module Shell
|
||||
module Commands
|
||||
class IsDisabled < Command
|
||||
def help
|
||||
return <<-EOF
|
||||
Is table disabled: e.g. "hbase> is_disabled 't1'"
|
||||
EOF
|
||||
end
|
||||
|
||||
def command(table)
|
||||
format_simple_command do
|
||||
formatter.row([
|
||||
admin.disabled?(table) ? "true" : "false"
|
||||
])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -23,8 +23,8 @@ module Shell
|
|||
class IsEnabled < Command
|
||||
def help
|
||||
return <<-EOF
|
||||
Is named table enabled?: e.g. "hbase> is_enabled 't1'"
|
||||
EOF
|
||||
Is named table enabled?: e.g. "hbase> is_enabled 't1'"
|
||||
EOF
|
||||
end
|
||||
|
||||
def command(table)
|
||||
|
@ -37,42 +37,3 @@ module Shell
|
|||
end
|
||||
end
|
||||
end
|
||||
#
|
||||
# Copyright 2010 The Apache Software Foundation
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
module Shell
|
||||
module Commands
|
||||
class IsEnabled < Command
|
||||
def help
|
||||
return <<-EOF
|
||||
Is table enabled: e.g. "hbase> enable 't1'"
|
||||
EOF
|
||||
end
|
||||
|
||||
def command(table)
|
||||
format_simple_command do
|
||||
formatter.row([
|
||||
admin.enabled?(table) ? "true" : "false"
|
||||
])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -23,12 +23,12 @@ module Shell
|
|||
class List < Command
|
||||
def help
|
||||
return <<-EOF
|
||||
List all tables in hbase. Optional regular expression parameter could
|
||||
be used to filter the output. Examples:
|
||||
List all tables in hbase. Optional regular expression parameter could
|
||||
be used to filter the output. Examples:
|
||||
|
||||
hbase> list
|
||||
hbase> list 'abc.*'
|
||||
EOF
|
||||
hbase> list
|
||||
hbase> list 'abc.*'
|
||||
EOF
|
||||
end
|
||||
|
||||
def command(regex = ".*")
|
||||
|
|
|
@ -23,9 +23,9 @@ module Shell
|
|||
class MajorCompact < Command
|
||||
def help
|
||||
return <<-EOF
|
||||
Run major compaction on passed table or pass a region row
|
||||
to major compact an individual region
|
||||
EOF
|
||||
Run major compaction on passed table or pass a region row
|
||||
to major compact an individual region
|
||||
EOF
|
||||
end
|
||||
|
||||
def command(table_or_region_name)
|
||||
|
|
|
@ -23,12 +23,12 @@ module Shell
|
|||
class Put < Command
|
||||
def help
|
||||
return <<-EOF
|
||||
Put a cell 'value' at specified table/row/column and optionally
|
||||
timestamp coordinates. To put a cell value into table 't1' at
|
||||
row 'r1' under column 'c1' marked with the time 'ts1', do:
|
||||
Put a cell 'value' at specified table/row/column and optionally
|
||||
timestamp coordinates. To put a cell value into table 't1' at
|
||||
row 'r1' under column 'c1' marked with the time 'ts1', do:
|
||||
|
||||
hbase> put 't1', 'r1', 'c1', 'value', ts1
|
||||
EOF
|
||||
hbase> put 't1', 'r1', 'c1', 'value', ts1
|
||||
EOF
|
||||
end
|
||||
|
||||
def command(table, row, column, value, timestamp = nil)
|
||||
|
|
|
@ -23,12 +23,11 @@ module Shell
|
|||
class RemovePeer< Command
|
||||
def help
|
||||
return <<-EOF
|
||||
Stops the specified replication stream and deletes all the meta
|
||||
information kept about it.
|
||||
Examples:
|
||||
Stops the specified replication stream and deletes all the meta
|
||||
information kept about it. Examples:
|
||||
|
||||
hbase> remove_peer '1'
|
||||
EOF
|
||||
hbase> remove_peer '1'
|
||||
EOF
|
||||
end
|
||||
|
||||
def command(id)
|
||||
|
|
|
@ -23,23 +23,23 @@ module Shell
|
|||
class Scan < Command
|
||||
def help
|
||||
return <<-EOF
|
||||
Scan a table; pass table name and optionally a dictionary of scanner
|
||||
specifications. Scanner specifications may include one or more of
|
||||
the following: LIMIT, STARTROW, STOPROW, TIMESTAMP, or COLUMNS. If
|
||||
no columns are specified, all columns will be scanned. To scan all
|
||||
members of a column family, leave the qualifier empty as in
|
||||
'col_family:'. Examples:
|
||||
Scan a table; pass table name and optionally a dictionary of scanner
|
||||
specifications. Scanner specifications may include one or more of
|
||||
the following: LIMIT, STARTROW, STOPROW, TIMESTAMP, or COLUMNS. If
|
||||
no columns are specified, all columns will be scanned. To scan all
|
||||
members of a column family, leave the qualifier empty as in
|
||||
'col_family:'. Examples:
|
||||
|
||||
hbase> scan '.META.'
|
||||
hbase> scan '.META.', {COLUMNS => 'info:regioninfo'}
|
||||
hbase> scan 't1', {COLUMNS => ['c1', 'c2'], LIMIT => 10, STARTROW => 'xyz'}
|
||||
hbase> scan '.META.'
|
||||
hbase> scan '.META.', {COLUMNS => 'info:regioninfo'}
|
||||
hbase> scan 't1', {COLUMNS => ['c1', 'c2'], LIMIT => 10, STARTROW => 'xyz'}
|
||||
|
||||
For experts, there is an additional option -- CACHE_BLOCKS -- which
|
||||
switches block caching for the scanner on (true) or off (false). By
|
||||
default it is enabled. Examples:
|
||||
For experts, there is an additional option -- CACHE_BLOCKS -- which
|
||||
switches block caching for the scanner on (true) or off (false). By
|
||||
default it is enabled. Examples:
|
||||
|
||||
hbase> scan 't1', {COLUMNS => ['c1', 'c2'], CACHE_BLOCKS => false}
|
||||
EOF
|
||||
hbase> scan 't1', {COLUMNS => ['c1', 'c2'], CACHE_BLOCKS => false}
|
||||
EOF
|
||||
end
|
||||
|
||||
def command(table, args = {})
|
||||
|
|
|
@ -23,8 +23,8 @@ module Shell
|
|||
class Shutdown < Command
|
||||
def help
|
||||
return <<-EOF
|
||||
Shut down the cluster.
|
||||
EOF
|
||||
Shut down the cluster.
|
||||
EOF
|
||||
end
|
||||
|
||||
def command
|
||||
|
|
|
@ -23,8 +23,8 @@ module Shell
|
|||
class Split < Command
|
||||
def help
|
||||
return <<-EOF
|
||||
Split table or pass a region row to split individual region
|
||||
EOF
|
||||
Split table or pass a region row to split individual region
|
||||
EOF
|
||||
end
|
||||
|
||||
def command(table_or_region_name)
|
||||
|
|
|
@ -23,14 +23,14 @@ module Shell
|
|||
class StartReplication < Command
|
||||
def help
|
||||
return <<-EOF
|
||||
Restarts all the replication features. The state in which each
|
||||
stream starts in is undetermined.
|
||||
WARNING:
|
||||
start/stop replication is only meant to be used in critical load situations.
|
||||
Examples:
|
||||
Restarts all the replication features. The state in which each
|
||||
stream starts in is undetermined.
|
||||
WARNING:
|
||||
start/stop replication is only meant to be used in critical load situations.
|
||||
Examples:
|
||||
|
||||
hbase> start_replication
|
||||
EOF
|
||||
hbase> start_replication
|
||||
EOF
|
||||
end
|
||||
|
||||
def command
|
||||
|
|
|
@ -23,14 +23,14 @@ module Shell
|
|||
class Status < Command
|
||||
def help
|
||||
return <<-EOF
|
||||
Show cluster status. Can be 'summary', 'simple', or 'detailed'. The
|
||||
default is 'summary'. Examples:
|
||||
Show cluster status. Can be 'summary', 'simple', or 'detailed'. The
|
||||
default is 'summary'. Examples:
|
||||
|
||||
hbase> status
|
||||
hbase> status 'simple'
|
||||
hbase> status 'summary'
|
||||
hbase> status 'detailed'
|
||||
EOF
|
||||
hbase> status
|
||||
hbase> status 'simple'
|
||||
hbase> status 'summary'
|
||||
hbase> status 'detailed'
|
||||
EOF
|
||||
end
|
||||
|
||||
def command(format = 'summary')
|
||||
|
|
|
@ -23,14 +23,14 @@ module Shell
|
|||
class StopReplication < Command
|
||||
def help
|
||||
return <<-EOF
|
||||
Stops all the replication features. The state in which each
|
||||
stream stops in is undetermined.
|
||||
WARNING:
|
||||
start/stop replication is only meant to be used in critical load situations.
|
||||
Examples:
|
||||
Stops all the replication features. The state in which each
|
||||
stream stops in is undetermined.
|
||||
WARNING:
|
||||
start/stop replication is only meant to be used in critical load situations.
|
||||
Examples:
|
||||
|
||||
hbase> stop_replication
|
||||
EOF
|
||||
hbase> stop_replication
|
||||
EOF
|
||||
end
|
||||
|
||||
def command
|
||||
|
|
|
@ -23,8 +23,8 @@ module Shell
|
|||
class Truncate < Command
|
||||
def help
|
||||
return <<-EOF
|
||||
Disables, drops and recreates the specified table.
|
||||
EOF
|
||||
Disables, drops and recreates the specified table.
|
||||
EOF
|
||||
end
|
||||
|
||||
def command(table)
|
||||
|
|
|
@ -23,13 +23,13 @@ module Shell
|
|||
class Version < Command
|
||||
def help
|
||||
return <<-EOF
|
||||
Output this HBase version
|
||||
EOF
|
||||
Output this HBase version
|
||||
EOF
|
||||
end
|
||||
|
||||
def command
|
||||
# Output version.
|
||||
puts "Version: #{org.apache.hadoop.hbase.util.VersionInfo.getVersion()}, " +
|
||||
puts "#{org.apache.hadoop.hbase.util.VersionInfo.getVersion()}, " +
|
||||
"r#{org.apache.hadoop.hbase.util.VersionInfo.getRevision()}, " +
|
||||
"#{org.apache.hadoop.hbase.util.VersionInfo.getDate()}"
|
||||
end
|
||||
|
|
|
@ -23,9 +23,9 @@ module Shell
|
|||
class Zk < Command
|
||||
def help
|
||||
return <<-EOF
|
||||
Low level ZooKeeper surgery tools. Type "zk 'help'" for more
|
||||
information (Yes, you must quote 'help').
|
||||
EOF
|
||||
Low level ZooKeeper surgery tools. Type "zk 'help'" for more
|
||||
information (Yes, you must quote 'help').
|
||||
EOF
|
||||
end
|
||||
|
||||
def command(*args)
|
||||
|
|
|
@ -23,8 +23,8 @@ module Shell
|
|||
class ZkDump < Command
|
||||
def help
|
||||
return <<-EOF
|
||||
Dump status of HBase cluster as seen by ZooKeeper.
|
||||
EOF
|
||||
Dump status of HBase cluster as seen by ZooKeeper.
|
||||
EOF
|
||||
end
|
||||
|
||||
def command
|
||||
|
|
Loading…
Reference in New Issue