HBASE-19886 Display maintenance mode in shell, web UI

This commit is contained in:
Balazs Meszaros 2018-01-29 16:43:20 +01:00 committed by Apekshit Sharma
parent b5ccfecc96
commit 380083e7d3
4 changed files with 52 additions and 0 deletions

View File

@ -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

View File

@ -223,6 +223,13 @@ module Hbase
@admin.isNormalizerEnabled
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

View File

@ -336,6 +336,7 @@ Shell.load_command_group(
normalize
normalizer_switch
normalizer_enabled
is_in_maintenance_mode
close_region
compact
flush

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
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