ambari-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Krzysztof Adamski <adamskikrzys...@gmail.com>
Subject Start/stop all services programmatically
Date Tue, 07 Apr 2015 07:15:37 GMT
Hello,

I am busy implementing a manual job to stop all hosts services via script
before rebooting the OS. The examples I found in wiki are per service or
component.

1. Is there any way to invoke the stop/start for all hosts components just
like from a web interface?
2. How ambari determines the proper order for the services to start/stop
e.g. first stop hiveserver before stopping mysql etc.

curl -s --user admin:admin -H "X-Requested-By: ambari" -X GET "
http://ambari:8080/api/v1/clusters/ing_hdp/components/?
ServiceComponentInfo/category.in(SLAVE,MASTER)&host_
components/HostRoles/host_name=host1&fields=host_components/HostRoles/
component_name,host_components/HostRoles/state" | jq -r
'[[.items[].host_components[].HostRoles.component_name]]|tostring' | sed -r
's/[\["]//g' | sed -r 's/[]]//g'

  function stop(){

curl -u admin:admin -i -H 'X-Requested-By: ambari' -X PUT -d
'{"RequestInfo": {"context" :"Stop ‘"$1"’ via REST"}, "Body": {"HostRoles":
{"state": "INSTALLED"}}}' http://ambari:8080/api/v1/
clusters/ing_hdp/hosts/host1/host_components/$1

}

Thanks for any guide.

Mime
View raw message