commit 7bc03c6090e03b674937a2f51f488ac7d44adfda Author: Enis Soztutar Date: Wed Jul 6 16:45:22 2016 -0700 v1 diff --git hbase-shell/src/main/ruby/hbase/admin.rb hbase-shell/src/main/ruby/hbase/admin.rb index 5f04d1d..92fc252 100644 --- hbase-shell/src/main/ruby/hbase/admin.rb +++ hbase-shell/src/main/ruby/hbase/admin.rb @@ -1169,5 +1169,16 @@ module Hbase set_user_metadata(htd, arg.delete(METADATA)) if arg[METADATA] set_descriptor_config(htd, arg.delete(CONFIGURATION)) if arg[CONFIGURATION] end + + # Stop the active Master + def stop_master() + @admin.stopMaster() + end + + # Stop the given RegionServer + def stop_regionserver(hostport) + @admin.stopRegionServer(hostport) + end + end end diff --git hbase-shell/src/main/ruby/shell.rb hbase-shell/src/main/ruby/shell.rb index bb6a604..6e6ff61 100644 --- hbase-shell/src/main/ruby/shell.rb +++ hbase-shell/src/main/ruby/shell.rb @@ -353,6 +353,8 @@ Shell.load_command_group( trace splitormerge_switch splitormerge_enabled + stop_master + stop_regionserver ], # TODO remove older hlog_roll command :aliases => { diff --git hbase-shell/src/main/ruby/shell/commands/stop_master.rb hbase-shell/src/main/ruby/shell/commands/stop_master.rb new file mode 100644 index 0000000..3896d3d --- /dev/null +++ hbase-shell/src/main/ruby/shell/commands/stop_master.rb @@ -0,0 +1,39 @@ +# +# +# 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 StopMaster < Command + def help + return <<-EOF +Stop active Master. For experts only. +Examples: + + hbase> stop_master +EOF + end + + def command() + format_simple_command do + admin.stop_master() + end + end + end + end +end diff --git hbase-shell/src/main/ruby/shell/commands/stop_regionserver.rb hbase-shell/src/main/ruby/shell/commands/stop_regionserver.rb new file mode 100644 index 0000000..ba8fa3c --- /dev/null +++ hbase-shell/src/main/ruby/shell/commands/stop_regionserver.rb @@ -0,0 +1,39 @@ +# +# +# 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 StopRegionserver < Command + def help + return <<-EOF +Stop a RegionServer. For experts only. +Examples: + + hbase> stop_regionserver 'hostname:port' +EOF + end + + def command(hostport) + format_simple_command do + admin.stop_regionserver(hostport) + end + end + end + end +end