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:
Michael Stack 2010-11-10 22:06:40 +00:00
parent 65979de1fb
commit 63c6827376
40 changed files with 227 additions and 297 deletions

View File

@ -1144,6 +1144,7 @@ Release 0.90.0 - Unreleased
HBASE-3090 Don't include hbase-default in conf/ assembly HBASE-3090 Don't include hbase-default in conf/ assembly
HBASE-3161 Provide option for Stargate to only serve GET requests HBASE-3161 Provide option for Stargate to only serve GET requests
(Bennett Neale via Stack) (Bennett Neale via Stack)
HBASE-3218 Shell help cleanup/cosmetics/edit
NEW FEATURES NEW FEATURES

View File

@ -114,6 +114,7 @@ public class RetriesExhaustedWithDetailsException extends RetriesExhaustedExcept
public static Map<String, Integer> classifyExs(List<Throwable> ths) { public static Map<String, Integer> classifyExs(List<Throwable> ths) {
Map<String, Integer> cls = new HashMap<String, Integer>(); Map<String, Integer> cls = new HashMap<String, Integer>();
for (Throwable t : ths) { for (Throwable t : ths) {
if (t == null) continue;
String name = t.getClass().getSimpleName(); String name = t.getClass().getSimpleName();
Integer i = cls.get(name); Integer i = cls.get(name);
if (i == null) { if (i == null) {

View File

@ -109,22 +109,26 @@ module Shell
def print_banner def print_banner
puts "HBase Shell; enter 'help<RETURN>' for list of supported commands." puts "HBase Shell; enter 'help<RETURN>' for list of supported commands."
puts 'Type "exit<RETURN>" to leave the HBase Shell' puts 'Type "exit<RETURN>" to leave the HBase Shell'
print 'Version '
command('version') command('version')
puts puts
end end
def help_command(command) def help_multi_command(command)
puts "COMMAND: #{command}" puts "Command: #{command}"
puts command_instance(command).help puts command_instance(command).help
puts puts
return nil return nil
end end
def help_command(command)
puts command_instance(command).help
return nil
end
def help_group(group_name) def help_group(group_name)
group = ::Shell.command_groups[group_name.to_s] group = ::Shell.command_groups[group_name.to_s]
puts group[:full_name] group[:commands].sort.each { |cmd| help_multi_command(cmd) }
puts '-' * 80
group[:commands].sort.each { |cmd| help_command(cmd) }
if group[:comment] if group[:comment]
puts '-' * 80 puts '-' * 80
puts puts
@ -135,7 +139,6 @@ module Shell
end end
def help(command = nil) def help(command = nil)
puts
if command if command
return help_command(command) if ::Shell.commands[command.to_s] return help_command(command) if ::Shell.commands[command.to_s]
return help_group(command) if ::Shell.command_groups[command.to_s] return help_group(command) if ::Shell.command_groups[command.to_s]
@ -145,32 +148,30 @@ module Shell
puts help_header puts help_header
puts puts
puts '-' * 80 puts 'COMMAND GROUPS:'
puts
::Shell.command_groups.each do |name, group| ::Shell.command_groups.each do |name, group|
puts " " + group[:full_name] + ": " puts " Group name: " + name
puts " group name: " + name puts " Commands: " + group[:command_names].sort.join(', ')
puts " commands: " + group[:command_names].sort.join(', ')
puts puts
end end
puts
unless command unless command
puts '-' * 80 puts 'SHELL USAGE:'
puts
help_footer help_footer
puts
end end
return nil return nil
end end
def help_header def help_header
return "Enter, help 'COMMAND_GROUP', (e.g. help 'general') to get help on all commands in a group\n" + return "HBase Shell, version #{org.apache.hadoop.hbase.util.VersionInfo.getVersion()}, " +
"Enter, help 'COMMAND', (e.g. help 'get') to get help on a specific command" "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 end
def help_footer def help_footer
puts <<-HERE 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. command parameters. Type <RETURN> after entering a command to run it.
Dictionaries of configuration used in the creation and alteration of tables are Dictionaries of configuration used in the creation and alteration of tables are
Ruby Hashes. They look like this: 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" 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. 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 HERE
end end
end end

View File

@ -23,15 +23,15 @@ module Shell
class AddPeer< Command class AddPeer< Command
def help def help
return <<-EOF return <<-EOF
Add a peer cluster to replicate to, the id must be a short and Add a peer cluster to replicate to, the id must be a short and
the cluster key is composed like this: the cluster key is composed like this:
hbase.zookeeper.quorum:hbase.zookeeper.property.clientPort:zookeeper.znode.parent hbase.zookeeper.quorum:hbase.zookeeper.property.clientPort:zookeeper.znode.parent
This gives a full path for HBase to connect to another cluster. This gives a full path for HBase to connect to another cluster.
Examples: Examples:
hbase> add_peer '1', "server1.cie.com:2181:/hbase" hbase> add_peer '1', "server1.cie.com:2181:/hbase"
hbase> add_peer '2', "zk1,zk2,zk3:2182:/hbase-prod" hbase> add_peer '2', "zk1,zk2,zk3:2182:/hbase-prod"
EOF EOF
end end
def command(id, cluster_key) def command(id, cluster_key)

View File

@ -23,29 +23,35 @@ module Shell
class Alter < Command class Alter < Command
def help def help
return <<-EOF return <<-EOF
Alter column family schema; pass table name and a dictionary Alter column family schema; pass table name and a dictionary
specifying new column family schema. Dictionaries are described specifying new column family schema. Dictionaries are described
on the main help command output. Dictionary must include name on the main help command output. Dictionary must include name
of column family to alter. For example, of column family to alter. For example,
To change or add the 'f1' column family in table 't1' from defaults To change or add the 'f1' column family in table 't1' from defaults
to instead keep a maximum of 5 cell VERSIONS, do: to instead keep a maximum of 5 cell VERSIONS, do:
hbase> alter 't1', NAME => 'f1', VERSIONS => 5
To delete the 'f1' column family in table 't1', do: hbase> alter 't1', NAME => 'f1', VERSIONS => 5
hbase> alter 't1', NAME => 'f1', METHOD => 'delete'
or a shorter version:
hbase> alter 't1', 'delete' => 'f1'
You can also change table-scope attributes like MAX_FILESIZE To delete the 'f1' column family in table 't1', do:
MEMSTORE_FLUSHSIZE, READONLY, and DEFERRED_LOG_FLUSH.
For example, to change the max size of a family to 128MB, do: hbase> alter 't1', NAME => 'f1', METHOD => 'delete'
hbase> alter 't1', METHOD => 'table_att', MAX_FILESIZE => '134217728'
There could be more than one alteration in one command: or a shorter version:
hbase> alter 't1', {NAME => 'f1'}, {NAME => 'f2', METHOD => 'delete'}
EOF 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 end
def command(table, *args) def command(table, *args)

View File

@ -23,11 +23,12 @@ module Shell
class CloseRegion < Command class CloseRegion < Command
def help def help
return <<-EOF return <<-EOF
Close a single region. Optionally specify regionserver. Close a single region. Optionally specify regionserver.
Examples: Examples:
hbase> close_region 'REGIONNAME'
hbase> close_region 'REGIONNAME', 'REGIONSERVER_IP:PORT' hbase> close_region 'REGIONNAME'
EOF hbase> close_region 'REGIONNAME', 'REGIONSERVER_IP:PORT'
EOF
end end
def command(region_name, server = nil) def command(region_name, server = nil)

View File

@ -23,9 +23,9 @@ module Shell
class Compact < Command class Compact < Command
def help def help
return <<-EOF return <<-EOF
Compact all regions in passed table or pass a region row Compact all regions in passed table or pass a region row
to compact an individual region to compact an individual region
EOF EOF
end end
def command(table_or_region_name) def command(table_or_region_name)

View File

@ -23,19 +23,19 @@ module Shell
class Count < Command class Count < Command
def help def help
return <<-EOF return <<-EOF
Count the number of rows in a table. This operation may take a LONG 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 time (Run '$HADOOP_HOME/bin/hadoop jar hbase.jar rowcount' to run a
counting mapreduce job). Current count is shown every 1000 rows by counting mapreduce job). Current count is shown every 1000 rows by
default. Count interval may be optionally specified. Scan caching default. Count interval may be optionally specified. Scan caching
is enabled on count scans by default. Default cache size is 10 rows. 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 If your rows are small in size, you may want to increase this
parameter. Examples: parameter. Examples:
hbase> count 't1' hbase> count 't1'
hbase> count 't1', INTERVAL => 100000 hbase> count 't1', INTERVAL => 100000
hbase> count 't1', CACHE => 1000 hbase> count 't1', CACHE => 1000
hbase> count 't1', INTERVAL => 10, CACHE => 1000 hbase> count 't1', INTERVAL => 10, CACHE => 1000
EOF EOF
end end
def command(table, params = {}) def command(table, params = {})

View File

@ -23,18 +23,17 @@ module Shell
class Create < Command class Create < Command
def help def help
return <<-EOF return <<-EOF
Create table; pass table name, a dictionary of specifications per Create table; pass table name, a dictionary of specifications per
column family, and optionally a dictionary of table configuration. column family, and optionally a dictionary of table configuration.
Dictionaries are described below in the GENERAL NOTES section. Dictionaries are described below in the GENERAL NOTES section.
Examples: Examples:
hbase> create 't1', {NAME => 'f1', VERSIONS => 5} hbase> create 't1', {NAME => 'f1', VERSIONS => 5}
hbase> create 't1', {NAME => 'f1'}, {NAME => 'f2'}, {NAME => 'f3'} hbase> create 't1', {NAME => 'f1'}, {NAME => 'f2'}, {NAME => 'f3'}
hbase> # The above in shorthand would be the following: hbase> # The above in shorthand would be the following:
hbase> create 't1', 'f1', 'f2', 'f3' hbase> create 't1', 'f1', 'f2', 'f3'
hbase> create 't1', {NAME => 'f1', VERSIONS => 1, TTL => 2592000, hbase> create 't1', {NAME => 'f1', VERSIONS => 1, TTL => 2592000, BLOCKCACHE => true}
BLOCKCACHE => true} EOF
EOF
end end
def command(table, *args) def command(table, *args)

View File

@ -23,14 +23,14 @@ module Shell
class Delete < Command class Delete < Command
def help def help
return <<-EOF return <<-EOF
Put a delete cell value at specified table/row/column and optionally Put a delete cell value at specified table/row/column and optionally
timestamp coordinates. Deletes must match the deleted cell's timestamp coordinates. Deletes must match the deleted cell's
coordinates exactly. When scanning, a delete cell suppresses older coordinates exactly. When scanning, a delete cell suppresses older
versions. To delete a cell from 't1' at row 'r1' under column 'c1' versions. To delete a cell from 't1' at row 'r1' under column 'c1'
marked with the time 'ts1', do: marked with the time 'ts1', do:
hbase> delete 't1', 'r1', 'c1', ts1 hbase> delete 't1', 'r1', 'c1', ts1
EOF EOF
end end
def command(table, row, column, timestamp = org.apache.hadoop.hbase.HConstants::LATEST_TIMESTAMP) def command(table, row, column, timestamp = org.apache.hadoop.hbase.HConstants::LATEST_TIMESTAMP)

View File

@ -23,13 +23,13 @@ module Shell
class Deleteall < Command class Deleteall < Command
def help def help
return <<-EOF return <<-EOF
Delete all cells in a given row; pass a table name, row, and optionally Delete all cells in a given row; pass a table name, row, and optionally
a column and timestamp. Examples: a column and timestamp. Examples:
hbase> deleteall 't1', 'r1' hbase> deleteall 't1', 'r1'
hbase> deleteall 't1', 'r1', 'c1' hbase> deleteall 't1', 'r1', 'c1'
hbase> deleteall 't1', 'r1', 'c1', ts1 hbase> deleteall 't1', 'r1', 'c1', ts1
EOF EOF
end end
def command(table, row, column = nil, timestamp = org.apache.hadoop.hbase.HConstants::LATEST_TIMESTAMP) def command(table, row, column = nil, timestamp = org.apache.hadoop.hbase.HConstants::LATEST_TIMESTAMP)

View File

@ -23,9 +23,9 @@ module Shell
class Describe < Command class Describe < Command
def help def help
return <<-EOF return <<-EOF
Describe the named table. For example: Describe the named table. For example:
hbase> describe 't1' hbase> describe 't1'
EOF EOF
end end
def command(table) def command(table)

View File

@ -23,8 +23,8 @@ module Shell
class Disable < Command class Disable < Command
def help def help
return <<-EOF return <<-EOF
Start disable of named table: e.g. "hbase> disable 't1'" Start disable of named table: e.g. "hbase> disable 't1'"
EOF EOF
end end
def command(table) def command(table)

View File

@ -23,15 +23,15 @@ module Shell
class DisablePeer< Command class DisablePeer< Command
def help def help
return <<-EOF return <<-EOF
Stops the replication stream to the specified cluster, but still Stops the replication stream to the specified cluster, but still
keeps track of new edits to replicate. keeps track of new edits to replicate.
CURRENTLY UNSUPPORTED CURRENTLY UNSUPPORTED
Examples: Examples:
hbase> disable_peer '1' hbase> disable_peer '1'
EOF EOF
end end
def command(id) def command(id)

View File

@ -23,10 +23,10 @@ module Shell
class DisableRegion < Command class DisableRegion < Command
def help def help
return <<-EOF return <<-EOF
Disable a single region. For example: Disable a single region. For example:
hbase> disable_region 'REGIONNAME' hbase> disable_region 'REGIONNAME'
EOF EOF
end end
def command(region_name) def command(region_name)

View File

@ -23,11 +23,11 @@ module Shell
class Drop < Command class Drop < Command
def help def help
return <<-EOF return <<-EOF
Drop the named table. Table must first be disabled. If table has Drop the named table. Table must first be disabled. If table has
more than one region, run a major compaction on .META.: more than one region, run a major compaction on .META.:
hbase> major_compact ".META." hbase> major_compact ".META."
EOF EOF
end end
def command(table) def command(table)

View File

@ -23,8 +23,8 @@ module Shell
class Enable < Command class Enable < Command
def help def help
return <<-EOF return <<-EOF
Start enable of named table: e.g. "hbase> enable 't1'" Start enable of named table: e.g. "hbase> enable 't1'"
EOF EOF
end end
def command(table) def command(table)

View File

@ -23,15 +23,15 @@ module Shell
class EnablePeer< Command class EnablePeer< Command
def help def help
return <<-EOF return <<-EOF
Restarts the replication to the specified peer cluster, Restarts the replication to the specified peer cluster,
continuing from where it was disabled. continuing from where it was disabled.
CURRENTLY UNSUPPORTED CURRENTLY UNSUPPORTED
Examples: Examples:
hbase> enable_peer '1' hbase> enable_peer '1'
EOF EOF
end end
def command(id) def command(id)

View File

@ -23,10 +23,10 @@ module Shell
class EnableRegion < Command class EnableRegion < Command
def help def help
return <<-EOF return <<-EOF
Enable a single region. For example: Enable a single region. For example:
hbase> enable_region 'REGIONNAME' hbase> enable_region 'REGIONNAME'
EOF EOF
end end
def command(region_name) def command(region_name)

View File

@ -23,8 +23,8 @@ module Shell
class Exists < Command class Exists < Command
def help def help
return <<-EOF return <<-EOF
Does the named table exist? e.g. "hbase> exists 't1'" Does the named table exist? e.g. "hbase> exists 't1'"
EOF EOF
end end
def command(table) def command(table)

View File

@ -23,12 +23,12 @@ module Shell
class Flush < Command class Flush < Command
def help def help
return <<-EOF return <<-EOF
Flush all regions in passed table or pass a region row to Flush all regions in passed table or pass a region row to
flush an individual region. For example: flush an individual region. For example:
hbase> flush 'TABLENAME' hbase> flush 'TABLENAME'
hbase> flush 'REGIONNAME' hbase> flush 'REGIONNAME'
EOF EOF
end end
def command(table_or_region_name) def command(table_or_region_name)

View File

@ -23,18 +23,18 @@ module Shell
class Get < Command class Get < Command
def help def help
return <<-EOF return <<-EOF
Get row or cell contents; pass table name, row, and optionally Get row or cell contents; pass table name, row, and optionally
a dictionary of column(s), timestamp and versions. Examples: a dictionary of column(s), timestamp and versions. Examples:
hbase> get 't1', 'r1' hbase> get 't1', 'r1'
hbase> get 't1', 'r1', {COLUMN => 'c1'} hbase> get 't1', 'r1', {COLUMN => 'c1'}
hbase> get 't1', 'r1', {COLUMN => ['c1', 'c2', 'c3']} hbase> get 't1', 'r1', {COLUMN => ['c1', 'c2', 'c3']}
hbase> get 't1', 'r1', {COLUMN => 'c1', TIMESTAMP => ts1} hbase> get 't1', 'r1', {COLUMN => 'c1', TIMESTAMP => ts1}
hbase> get 't1', 'r1', {COLUMN => 'c1', TIMESTAMP => ts1, VERSIONS => 4} hbase> get 't1', 'r1', {COLUMN => 'c1', TIMESTAMP => ts1, VERSIONS => 4}
hbase> get 't1', 'r1', 'c1' hbase> get 't1', 'r1', 'c1'
hbase> get 't1', 'r1', 'c1', 'c2' hbase> get 't1', 'r1', 'c1', 'c2'
hbase> get 't1', 'r1', ['c1', 'c2'] hbase> get 't1', 'r1', ['c1', 'c2']
EOF EOF
end end
def command(table, row, *args) def command(table, row, *args)

View File

@ -23,12 +23,12 @@ module Shell
class GetCounter < Command class GetCounter < Command
def help def help
return <<-EOF return <<-EOF
Return a counter cell value at specified table/row/column coordinates. Return a counter cell value at specified table/row/column coordinates.
A cell cell should be managed with atomic increment function oh HBase A cell cell should be managed with atomic increment function oh HBase
and the data should be binary encoded. Example: and the data should be binary encoded. Example:
hbase> get_counter 't1', 'r1', 'c1' hbase> get_counter 't1', 'r1', 'c1'
EOF EOF
end end
def command(table, row, column, value = nil) def command(table, row, column, value = nil)

View File

@ -23,14 +23,14 @@ module Shell
class Incr < Command class Incr < Command
def help def help
return <<-EOF return <<-EOF
Increments a cell 'value' at specified table/row/column coordinates. Increments a cell 'value' at specified table/row/column coordinates.
To increment a cell value in table 't1' at row 'r1' under column To increment a cell value in table 't1' at row 'r1' under column
'c1' by 1 (can be omitted) or 10 do: 'c1' by 1 (can be omitted) or 10 do:
hbase> incr 't1', 'r1', 'c1' hbase> incr 't1', 'r1', 'c1'
hbase> incr 't1', 'r1', 'c1', 1 hbase> incr 't1', 'r1', 'c1', 1
hbase> incr 't1', 'r1', 'c1', 10 hbase> incr 't1', 'r1', 'c1', 10
EOF EOF
end end
def command(table, row, column, value = nil) def command(table, row, column, value = nil)

View File

@ -23,8 +23,8 @@ module Shell
class IsDisabled < Command class IsDisabled < Command
def help def help
return <<-EOF return <<-EOF
Is named table disabled?: e.g. "hbase> is_disabled 't1'" Is named table disabled?: e.g. "hbase> is_disabled 't1'"
EOF EOF
end end
def command(table) def command(table)
@ -37,42 +37,3 @@ module Shell
end end
end 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

View File

@ -23,8 +23,8 @@ module Shell
class IsEnabled < Command class IsEnabled < Command
def help def help
return <<-EOF return <<-EOF
Is named table enabled?: e.g. "hbase> is_enabled 't1'" Is named table enabled?: e.g. "hbase> is_enabled 't1'"
EOF EOF
end end
def command(table) def command(table)
@ -37,42 +37,3 @@ module Shell
end end
end 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

View File

@ -23,12 +23,12 @@ module Shell
class List < Command class List < Command
def help def help
return <<-EOF return <<-EOF
List all tables in hbase. Optional regular expression parameter could List all tables in hbase. Optional regular expression parameter could
be used to filter the output. Examples: be used to filter the output. Examples:
hbase> list hbase> list
hbase> list 'abc.*' hbase> list 'abc.*'
EOF EOF
end end
def command(regex = ".*") def command(regex = ".*")

View File

@ -23,9 +23,9 @@ module Shell
class MajorCompact < Command class MajorCompact < Command
def help def help
return <<-EOF return <<-EOF
Run major compaction on passed table or pass a region row Run major compaction on passed table or pass a region row
to major compact an individual region to major compact an individual region
EOF EOF
end end
def command(table_or_region_name) def command(table_or_region_name)

View File

@ -23,12 +23,12 @@ module Shell
class Put < Command class Put < Command
def help def help
return <<-EOF return <<-EOF
Put a cell 'value' at specified table/row/column and optionally Put a cell 'value' at specified table/row/column and optionally
timestamp coordinates. To put a cell value into table 't1' at timestamp coordinates. To put a cell value into table 't1' at
row 'r1' under column 'c1' marked with the time 'ts1', do: row 'r1' under column 'c1' marked with the time 'ts1', do:
hbase> put 't1', 'r1', 'c1', 'value', ts1 hbase> put 't1', 'r1', 'c1', 'value', ts1
EOF EOF
end end
def command(table, row, column, value, timestamp = nil) def command(table, row, column, value, timestamp = nil)

View File

@ -23,12 +23,11 @@ module Shell
class RemovePeer< Command class RemovePeer< Command
def help def help
return <<-EOF return <<-EOF
Stops the specified replication stream and deletes all the meta Stops the specified replication stream and deletes all the meta
information kept about it. information kept about it. Examples:
Examples:
hbase> remove_peer '1' hbase> remove_peer '1'
EOF EOF
end end
def command(id) def command(id)

View File

@ -23,23 +23,23 @@ module Shell
class Scan < Command class Scan < Command
def help def help
return <<-EOF return <<-EOF
Scan a table; pass table name and optionally a dictionary of scanner Scan a table; pass table name and optionally a dictionary of scanner
specifications. Scanner specifications may include one or more of specifications. Scanner specifications may include one or more of
the following: LIMIT, STARTROW, STOPROW, TIMESTAMP, or COLUMNS. If the following: LIMIT, STARTROW, STOPROW, TIMESTAMP, or COLUMNS. If
no columns are specified, all columns will be scanned. To scan all no columns are specified, all columns will be scanned. To scan all
members of a column family, leave the qualifier empty as in members of a column family, leave the qualifier empty as in
'col_family:'. Examples: 'col_family:'. Examples:
hbase> scan '.META.' hbase> scan '.META.'
hbase> scan '.META.', {COLUMNS => 'info:regioninfo'} hbase> scan '.META.', {COLUMNS => 'info:regioninfo'}
hbase> scan 't1', {COLUMNS => ['c1', 'c2'], LIMIT => 10, STARTROW => 'xyz'} hbase> scan 't1', {COLUMNS => ['c1', 'c2'], LIMIT => 10, STARTROW => 'xyz'}
For experts, there is an additional option -- CACHE_BLOCKS -- which For experts, there is an additional option -- CACHE_BLOCKS -- which
switches block caching for the scanner on (true) or off (false). By switches block caching for the scanner on (true) or off (false). By
default it is enabled. Examples: default it is enabled. Examples:
hbase> scan 't1', {COLUMNS => ['c1', 'c2'], CACHE_BLOCKS => false} hbase> scan 't1', {COLUMNS => ['c1', 'c2'], CACHE_BLOCKS => false}
EOF EOF
end end
def command(table, args = {}) def command(table, args = {})

View File

@ -23,8 +23,8 @@ module Shell
class Shutdown < Command class Shutdown < Command
def help def help
return <<-EOF return <<-EOF
Shut down the cluster. Shut down the cluster.
EOF EOF
end end
def command def command

View File

@ -23,8 +23,8 @@ module Shell
class Split < Command class Split < Command
def help def help
return <<-EOF return <<-EOF
Split table or pass a region row to split individual region Split table or pass a region row to split individual region
EOF EOF
end end
def command(table_or_region_name) def command(table_or_region_name)

View File

@ -23,14 +23,14 @@ module Shell
class StartReplication < Command class StartReplication < Command
def help def help
return <<-EOF return <<-EOF
Restarts all the replication features. The state in which each Restarts all the replication features. The state in which each
stream starts in is undetermined. stream starts in is undetermined.
WARNING: WARNING:
start/stop replication is only meant to be used in critical load situations. start/stop replication is only meant to be used in critical load situations.
Examples: Examples:
hbase> start_replication hbase> start_replication
EOF EOF
end end
def command def command

View File

@ -23,14 +23,14 @@ module Shell
class Status < Command class Status < Command
def help def help
return <<-EOF return <<-EOF
Show cluster status. Can be 'summary', 'simple', or 'detailed'. The Show cluster status. Can be 'summary', 'simple', or 'detailed'. The
default is 'summary'. Examples: default is 'summary'. Examples:
hbase> status hbase> status
hbase> status 'simple' hbase> status 'simple'
hbase> status 'summary' hbase> status 'summary'
hbase> status 'detailed' hbase> status 'detailed'
EOF EOF
end end
def command(format = 'summary') def command(format = 'summary')

View File

@ -23,14 +23,14 @@ module Shell
class StopReplication < Command class StopReplication < Command
def help def help
return <<-EOF return <<-EOF
Stops all the replication features. The state in which each Stops all the replication features. The state in which each
stream stops in is undetermined. stream stops in is undetermined.
WARNING: WARNING:
start/stop replication is only meant to be used in critical load situations. start/stop replication is only meant to be used in critical load situations.
Examples: Examples:
hbase> stop_replication hbase> stop_replication
EOF EOF
end end
def command def command

View File

@ -23,8 +23,8 @@ module Shell
class Truncate < Command class Truncate < Command
def help def help
return <<-EOF return <<-EOF
Disables, drops and recreates the specified table. Disables, drops and recreates the specified table.
EOF EOF
end end
def command(table) def command(table)

View File

@ -23,13 +23,13 @@ module Shell
class Version < Command class Version < Command
def help def help
return <<-EOF return <<-EOF
Output this HBase version Output this HBase version
EOF EOF
end end
def command def command
# Output version. # 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()}, " + "r#{org.apache.hadoop.hbase.util.VersionInfo.getRevision()}, " +
"#{org.apache.hadoop.hbase.util.VersionInfo.getDate()}" "#{org.apache.hadoop.hbase.util.VersionInfo.getDate()}"
end end

View File

@ -23,9 +23,9 @@ module Shell
class Zk < Command class Zk < Command
def help def help
return <<-EOF return <<-EOF
Low level ZooKeeper surgery tools. Type "zk 'help'" for more Low level ZooKeeper surgery tools. Type "zk 'help'" for more
information (Yes, you must quote 'help'). information (Yes, you must quote 'help').
EOF EOF
end end
def command(*args) def command(*args)

View File

@ -23,8 +23,8 @@ module Shell
class ZkDump < Command class ZkDump < Command
def help def help
return <<-EOF return <<-EOF
Dump status of HBase cluster as seen by ZooKeeper. Dump status of HBase cluster as seen by ZooKeeper.
EOF EOF
end end
def command def command