Created on 03-21-2018 04:37 PM - edited 08-17-2019 11:33 PM
we run the follwing curl in order to check which services/component are in maintenance mode
curl -u admin:admin -H "X-Requested-By: ambari" -X GET http://localhost:8080/api/v1/clusters/sys76/services?ServiceInfo/maintenance_state=OFF
as we can see all zookeeper are in maintenance mode
but the output from API still show - "maintenance_state" : "OFF"
why ? - what its wrong here ?
example
"href" : "http://localhost:8080/api/v1/clusters/sys76/services/ZOOKEEPER", "ServiceInfo" : { "cluster_name" : "sys76", "maintenance_state" : "OFF", "service_name" : "ZOOKEEPER" } } ]
Created 03-21-2018 05:09 PM
You can use this API to check maintenance mode of components in a particular host
To get maintenance_state of all components
curl -u admin:admin -H "X-Requested-By: ambari"-X GET http://localhost:8080/api/v1/clusters/sys76/hosts/{hostname}/host_components?fields=HostRoles/mainte...
To get components which have maintenance mode ON
curl -u admin:admin -H "X-Requested-By: ambari"-X GET http://localhost:8080/api/v1/clusters/sys76/hosts/{hostname}/host_components?HostRoles/maintenance_s...
To get components which have maintenance mode OFF
curl -u admin:admin -H "X-Requested-By: ambari"-X GET http://localhost:8080/api/v1/clusters/sys76/hosts/{hostname}/host_components?HostRoles/maintenance_s...
Note: Replace the hostname with the original hostname in the curl call
.
-Aditya
Created 03-21-2018 04:54 PM
The is the correct way to check for Maintenance Mode being enabled. Which version of Ambari are you running? When I try this locally, the correct value for `maintenance_state` is reflected.
Also - you're putting the ZooKeeper service itself into MM, right? Putting individual hosts/components into MM won't reflect here.
Created 03-21-2018 04:57 PM
so in that case can we capture the individual hosts/components that are in MM?
Created 03-21-2018 04:57 PM
we have ambari version - 2.6.1.0
Created 03-21-2018 07:23 PM
Yes, you can - the above calls can capture it on a host/component basis.
Created 03-21-2018 05:09 PM
You can use this API to check maintenance mode of components in a particular host
To get maintenance_state of all components
curl -u admin:admin -H "X-Requested-By: ambari"-X GET http://localhost:8080/api/v1/clusters/sys76/hosts/{hostname}/host_components?fields=HostRoles/mainte...
To get components which have maintenance mode ON
curl -u admin:admin -H "X-Requested-By: ambari"-X GET http://localhost:8080/api/v1/clusters/sys76/hosts/{hostname}/host_components?HostRoles/maintenance_s...
To get components which have maintenance mode OFF
curl -u admin:admin -H "X-Requested-By: ambari"-X GET http://localhost:8080/api/v1/clusters/sys76/hosts/{hostname}/host_components?HostRoles/maintenance_s...
Note: Replace the hostname with the original hostname in the curl call
.
-Aditya
Created 03-21-2018 05:26 PM
@Aditya
do you think we must check that no maintenance mode in component before HDP upgrade ?
Created 03-21-2018 05:37 PM
I think it is a good idea to check that no component is in maintenance mode. Ambari recommends that all the services must be up and running before upgrade and all the service checks should pass before the upgrade.