Community Articles

Find and share helpful community-sourced technical articles.
Labels (1)
avatar

Maintenance Mode supports suppressing alerts and skipping bulk operations for specific services, components and hosts in an Ambari-managed cluster.

There are many scenarios when we may want to turn on Maintenance Mode specially when we are performing hardware or software maintenance, changing configuration settings, troubleshooting, decommissioning, or removing cluster nodes. In such scenario we can place a service, component, or host object in Maintenance Mode before we start to perform necessary maintenance or troubleshooting tasks.

In maintenance mode following things happen:

1. It causes suppression of alerts, warnings and status change indicators generated for the object.

2. It exempts an object from host-level or service-level bulk operations.

Although it can be done from the ambari UI, However here in this article we will see how to manage the maintenance mode for some Services like HBase using the APIs.

Turning ON Maintenance Mode for any specific component (like: region server on host jss4).

curl -u admin:admin -H "X-Requested-By:ambari"-i -X PUT -d '{"RequestInfo":{"context":"Turn ON Maintenance Mode For RegionServer"}, "Body":{"HostRoles":{"maintenance_state":"ON"}}}' http://jss1:8080/api/v1/clusters/JoyCluster/hosts/jss4.example.com/host_components/HBASE_REGIONSERVE... 

.

Turning OFF Maintenance Mode for any specific component.

curl -u admin:admin -H "X-Requested-By:ambari"-i -X PUT -d '{"RequestInfo":{"context":"Turn OFF Maintenance Mode For RegionServer"}, "Body":{"HostRoles":{"maintenance_state":"OFF"}}}' http://jss1:8080/api/v1/clusters/JoyCluster/hosts/jss4.example.com/host_components/HBASE_REGIONSERVE... 

.

Starting a Host Component When it is in MaintenanceMode

curl -u admin:admin -i -H "X-Requested-By: ambari" -d '{ "RequestInfo":{ "context":"Start RegionServer via REST when it is in MAINTAINANCE", "operation_level":{ "level":"HOST_COMPONENT", "cluster_name":"JoyCluster", "service_name":"HBASE", "host_name":"jss4.example.com" } }, "Body":{ "ServiceInfo":{ "state":"STARTED" } } }' -X PUT  http://jss1:8080/api/v1/clusters/JoyCluster/services/HBASE

.

Stopping a Host Component When it is in MaintenanceMode

curl -u admin:admin -i -H "X-Requested-By: ambari" -d '{ "RequestInfo":{ "context":"Stopping RegionServer via REST when it is in MAINTAINANCE", "operation_level":{ "level":"HOST_COMPONENT", "cluster_name":"JoyCluster", "service_name":"HBASE", "host_name":"jss4.example.com" } }, "Body":{ "ServiceInfo":{ "state":"INSTALLED" } } }' -X PUT  http://jss1:8080/api/v1/clusters/JoyCluster/services/HBASE

.

Stopping Whole HBase Service and it's components:

curl -u admin:admin -i -H "X-Requested-By: ambari" -d '{ "RequestInfo":{ "context":"Stopping Whole HBase Service alons with host components via REST", "operation_level":{ "level":"SERVICE", "cluster_name":"JoyCluster", "service_name":"HBASE" } }, "Body":{ "ServiceInfo":{ "state":"INSTALLED" } } }' -X PUT  http://jss1:8080/api/v1/clusters/JoyCluster/services/HBASE
3,879 Views
Version history
Last update:
‎12-13-2016 03:50 AM
Updated by:
Former Member
Contributors