You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zh...@apache.org on 2018/05/15 00:40:21 UTC
[02/32] hbase git commit: HBASE-16191 Add stop_regionserver and
stop_master to shell
HBASE-16191 Add stop_regionserver and stop_master to shell
Amending-Author: Peter Somogyi <ps...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/91756d7f
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/91756d7f
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/91756d7f
Branch: refs/heads/HBASE-19064
Commit: 91756d7f796311269154110ca6967eea32d7bab0
Parents: d1cc925
Author: Enis Soztutar <en...@apache.org>
Authored: Fri May 11 14:32:13 2018 +0200
Committer: Peter Somogyi <ps...@apache.org>
Committed: Mon May 14 09:36:20 2018 +0200
----------------------------------------------------------------------
hbase-shell/src/main/ruby/.rubocop.yml | 5 +++
hbase-shell/src/main/ruby/hbase/admin.rb | 10 +++++
hbase-shell/src/main/ruby/shell.rb | 2 +
.../src/main/ruby/shell/commands/stop_master.rb | 38 +++++++++++++++++++
.../ruby/shell/commands/stop_regionserver.rb | 40 ++++++++++++++++++++
5 files changed, 95 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/91756d7f/hbase-shell/src/main/ruby/.rubocop.yml
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/.rubocop.yml b/hbase-shell/src/main/ruby/.rubocop.yml
new file mode 100644
index 0000000..7b04138
--- /dev/null
+++ b/hbase-shell/src/main/ruby/.rubocop.yml
@@ -0,0 +1,5 @@
+Naming/HeredocDelimiterNaming:
+ Enabled: false
+
+Layout/IndentHeredoc:
+ Enabled: false
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hbase/blob/91756d7f/hbase-shell/src/main/ruby/hbase/admin.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/hbase/admin.rb b/hbase-shell/src/main/ruby/hbase/admin.rb
index cb57c4c..c385d3d 100644
--- a/hbase-shell/src/main/ruby/hbase/admin.rb
+++ b/hbase-shell/src/main/ruby/hbase/admin.rb
@@ -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
http://git-wip-us.apache.org/repos/asf/hbase/blob/91756d7f/hbase-shell/src/main/ruby/shell.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell.rb b/hbase-shell/src/main/ruby/shell.rb
index ab07a79..9a79658 100644
--- a/hbase-shell/src/main/ruby/shell.rb
+++ b/hbase-shell/src/main/ruby/shell.rb
@@ -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: {
http://git-wip-us.apache.org/repos/asf/hbase/blob/91756d7f/hbase-shell/src/main/ruby/shell/commands/stop_master.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/stop_master.rb b/hbase-shell/src/main/ruby/shell/commands/stop_master.rb
new file mode 100644
index 0000000..45a2b11
--- /dev/null
+++ b/hbase-shell/src/main/ruby/shell/commands/stop_master.rb
@@ -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
http://git-wip-us.apache.org/repos/asf/hbase/blob/91756d7f/hbase-shell/src/main/ruby/shell/commands/stop_regionserver.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/stop_regionserver.rb b/hbase-shell/src/main/ruby/shell/commands/stop_regionserver.rb
new file mode 100644
index 0000000..127088d
--- /dev/null
+++ b/hbase-shell/src/main/ruby/shell/commands/stop_regionserver.rb
@@ -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