- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Can anyone tell me REST API to put the host component in maintenance mode through REST API?
- Labels:
-
Apache Ambari
Created ‎03-07-2016 09:44 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tried this one..
curl -u admin:OpsAm-iAp1Pass -H "X-Requested-By:ambari" -i -X PUT -d '{"RequestInfo":{"context":"Turn on Maintenance mode"}, "Body":{"ServiceInfo":{"maintenance state":"ON"}}}' http://viceroy10:8080/api/v1/clusters/et_cluster/hosts/serf120int.etops.tllsc.net/host_components/DA...
Result :
HTTP/1.1 200 OK User: admin Set-Cookie: AMBARISESSIONID=1acil15v0h4ve2hk9a1ac5gux;Path=/;HttpOnly Expires: Thu, 01 Jan 1970 00:00:00 GMT Content-Type: text/plain Content-Length: 0 Server: Jetty(8.1.17.v20150415)
I checked in ambari dashboard, nothing happend..
Created on ‎03-07-2016 10:17 PM - edited ‎08-19-2019 03:58 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Use the below command instead. Note that to check whether datanode was put into maintenance mode, you will need to go to the Hosts tab in Ambari, navigate to the host running datanode and look for the maintenance icon there (ie the icon won't show up under Ambari > HDFS > Datanode because its a 'slave' component)
curl -u admin:OpsAm-iAp1Pass -H "X-Requested-By:ambari" -i -X PUT -d '{"RequestInfo":{"context":"Turn On Maintenance Mode For DataNode"}, "Body":{"HostRoles":{"maintenance_state":"ON"}}}' http://viceroy10:8080/api/v1/clusters/et_cluster/hosts/serf120int.etops.tllsc.net/host_components/DA...
Created on ‎03-07-2016 10:17 PM - edited ‎08-19-2019 03:58 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Use the below command instead. Note that to check whether datanode was put into maintenance mode, you will need to go to the Hosts tab in Ambari, navigate to the host running datanode and look for the maintenance icon there (ie the icon won't show up under Ambari > HDFS > Datanode because its a 'slave' component)
curl -u admin:OpsAm-iAp1Pass -H "X-Requested-By:ambari" -i -X PUT -d '{"RequestInfo":{"context":"Turn On Maintenance Mode For DataNode"}, "Body":{"HostRoles":{"maintenance_state":"ON"}}}' http://viceroy10:8080/api/v1/clusters/et_cluster/hosts/serf120int.etops.tllsc.net/host_components/DA...
Created ‎03-08-2016 03:11 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Ali Bajwa I tried same for NODEMANAGER, i am getting http 200 code. Its not getting excuted. Here is my command. Can you please tell me is there anything wrong?
curl -u admin:OpsAm-iAp1Pass -H "X-Requested-By:ambari" -i -X PUT -d '{"RequestInfo":{"context":"Stop NODEMANAGER"}, "Body":{"HostRoles":{"state":"INSTALLED"}}}' http://viceroy10:8080/api/v1/clusters/et_cluster/hosts/serf120int.etops.tllsc.net/host_components/NO...
Thank you in advance.
Created ‎03-09-2016 05:54 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You are invoking the API to stop nodemanager (not put in maintenance mode).
To put it in maintenance mode, try below:
curl -u admin:OpsAm-iAp1Pass -H "X-Requested-By:ambari"-i -X PUT -d '{"RequestInfo":{"context":"Turn On Maintenance Mode For NodeManaager"}, "Body":{"HostRoles":{"maintenance_state":"ON"}}}' http://viceroy10:8080/api/v1/clusters/et_cluster/hosts/serf120int.etops.tllsc.net/host_components/NODEMANAGER
