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/02/08 08:57:20 UTC
[04/18] hbase git commit: HBASE-19886 Display maintenance mode in
shell, web UI
HBASE-19886 Display maintenance mode in shell, web UI
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/380083e7
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/380083e7
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/380083e7
Branch: refs/heads/HBASE-19064
Commit: 380083e7d3d9864cacd41a4297914d6789618d78
Parents: b5ccfec
Author: Balazs Meszaros <ba...@cloudera.com>
Authored: Mon Jan 29 16:43:20 2018 +0100
Committer: Apekshit Sharma <ap...@apache.org>
Committed: Tue Feb 6 14:53:32 2018 -0800
----------------------------------------------------------------------
.../hbase/tmpl/master/MasterStatusTmpl.jamon | 6 ++++
hbase-shell/src/main/ruby/hbase/admin.rb | 7 ++++
hbase-shell/src/main/ruby/shell.rb | 1 +
.../shell/commands/is_in_maintenance_mode.rb | 38 ++++++++++++++++++++
4 files changed, 52 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/380083e7/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon
index 3253a57..12e0a69b 100644
--- a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon
+++ b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon
@@ -185,6 +185,12 @@ AssignmentManager assignmentManager = master.getAssignmentManager();
re-enabled from the hbase shell by running the command 'catalogjanitor_switch true'
</div>
</%if>
+ <%if master.isInMaintenanceMode() %>
+ <div class="alert alert-warning">
+ Your Master is in maintenance mode. This may be because of HBCK aborting while
+ running in repair mode. Please re-run HBCK in repair mode.
+ </div>
+ </%if>
<%if !master.isBalancerOn() %>
<div class="alert alert-warning">
The Load Balancer is not enabled which will eventually cause performance degradation
http://git-wip-us.apache.org/repos/asf/hbase/blob/380083e7/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 13b6578..0102118 100644
--- a/hbase-shell/src/main/ruby/hbase/admin.rb
+++ b/hbase-shell/src/main/ruby/hbase/admin.rb
@@ -224,6 +224,13 @@ module Hbase
end
#----------------------------------------------------------------------------------------------
+ # Query the current state of master in maintenance mode.
+ # Returns the state of maintenance mode (true is on).
+ def in_maintenance_mode?
+ @admin.isMasterInMaintenanceMode
+ end
+
+ #----------------------------------------------------------------------------------------------
# Request a scan of the catalog table (for garbage collection)
# Returns an int signifying the number of entries cleaned
def catalogjanitor_run
http://git-wip-us.apache.org/repos/asf/hbase/blob/380083e7/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 4a74646..507c0a9 100644
--- a/hbase-shell/src/main/ruby/shell.rb
+++ b/hbase-shell/src/main/ruby/shell.rb
@@ -336,6 +336,7 @@ Shell.load_command_group(
normalize
normalizer_switch
normalizer_enabled
+ is_in_maintenance_mode
close_region
compact
flush
http://git-wip-us.apache.org/repos/asf/hbase/blob/380083e7/hbase-shell/src/main/ruby/shell/commands/is_in_maintenance_mode.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/is_in_maintenance_mode.rb b/hbase-shell/src/main/ruby/shell/commands/is_in_maintenance_mode.rb
new file mode 100644
index 0000000..8ed244c
--- /dev/null
+++ b/hbase-shell/src/main/ruby/shell/commands/is_in_maintenance_mode.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
+ class IsInMaintenanceMode < Command
+ def help
+ <<-EOF
+Is master in maintenance mode? For example:
+
+ hbase> is_in_maintenance_mode
+EOF
+ end
+
+ def command
+ state = admin.in_maintenance_mode?
+ formatter.row([state.to_s])
+ state
+ end
+ end
+ end
+end