HBASE-16191 Add stop_regionserver and stop_master to shell

Amending-Author: Peter Somogyi <psomogyi@apache.org>
This commit is contained in:
Enis Soztutar 2018-05-11 14:32:13 +02:00 committed by Peter Somogyi
parent d1cc92599a
commit 91756d7f79
5 changed files with 95 additions and 0 deletions

View File

@ -0,0 +1,5 @@
Naming/HeredocDelimiterNaming:
Enabled: false
Layout/IndentHeredoc:
Enabled: false

View File

@ -1309,6 +1309,16 @@ module Hbase
TableName.valueOf(new_table_name),
preserve_splits)
end
# Stop the active Master
def stop_master
@admin.stopMaster
end
# Stop the given RegionServer
def stop_regionserver(hostport)
@admin.stopRegionServer(hostport)
end
end
# rubocop:enable Metrics/ClassLength
end

View File

@ -357,6 +357,8 @@ Shell.load_command_group(
list_deadservers
clear_deadservers
clear_block_cache
stop_master
stop_regionserver
],
# TODO: remove older hlog_roll command
aliases: {

View File

@ -0,0 +1,38 @@
#
#
# 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
# Stop active Master
class StopMaster < Command
def help
<<-EOF
Stop active Master. For experts only.
Examples:
hbase> stop_master
EOF
end
def command
admin.stop_master
end
end
end
end

View File

@ -0,0 +1,40 @@
#
#
# 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
# Stop a RegionServer
class StopRegionserver < Command
def help
<<-EOF
Stop a RegionServer. For experts only.
Consider using graceful_stop.sh script instead!
Examples:
hbase> stop_regionserver 'hostname:port'
EOF
end
def command(hostport)
admin.stop_regionserver(hostport)
end
end
end
end