Created 08-18-2017 10:26 AM
after we install new ambari cluster some of the ambari services are down
I know how to start the service by API
but in case there more services that are down or all them , then need to start according to start priority
is it possible to start all services that are down by API and according to priority , without manual startup?
Created 08-18-2017 10:32 AM
Following API call will check the services that are down and will start them in the correct order if any of the service is down.
# curl -u admin:admin -H "X-Requested-By: ambari" -X PUT -d '{"RequestInfo":{"context":"_PARSE_.START.ALL_SERVICES","operation_level":{"level":"CLUSTER","cluster_name":"plain_ambari"}},"Body":{"ServiceInfo":{"state":"STARTED"}}}' http://amb25101.example.com:8080/api/v1/clusters/plain_ambari/services?
Please replace the following:
- "amb25101.example.com" with your Ambari Server Hostname
- "plain_ambari" with your ambari cluster name
- "8080" with the port of your ambari server.
.
Example Output:
# curl -u admin:admin -H "X-Requested-By: ambari" -X PUT -d '{"RequestInfo":{"context":"_PARSE_.START.ALL_SERVICES","operation_level":{"level":"CLUSTER","cluster_name":"plain_ambari"}},"Body":{"ServiceInfo":{"state":"STARTED"}}}' http://amb25101.example.com:8080/api/v1/clusters/plain_ambari/services? { "href" : "http://amb25101.example.com:8080/api/v1/clusters/plain_ambari/requests/134", "Requests" : { "id" : 134, "status" : "Accepted" } }
.
Later the progress can be tracked by looking at the API response (requestID)
http://amb25101.example.com:8080/api/v1/clusters/plain_ambari/requests/134
.
Created 08-18-2017 10:32 AM
Following API call will check the services that are down and will start them in the correct order if any of the service is down.
# curl -u admin:admin -H "X-Requested-By: ambari" -X PUT -d '{"RequestInfo":{"context":"_PARSE_.START.ALL_SERVICES","operation_level":{"level":"CLUSTER","cluster_name":"plain_ambari"}},"Body":{"ServiceInfo":{"state":"STARTED"}}}' http://amb25101.example.com:8080/api/v1/clusters/plain_ambari/services?
Please replace the following:
- "amb25101.example.com" with your Ambari Server Hostname
- "plain_ambari" with your ambari cluster name
- "8080" with the port of your ambari server.
.
Example Output:
# curl -u admin:admin -H "X-Requested-By: ambari" -X PUT -d '{"RequestInfo":{"context":"_PARSE_.START.ALL_SERVICES","operation_level":{"level":"CLUSTER","cluster_name":"plain_ambari"}},"Body":{"ServiceInfo":{"state":"STARTED"}}}' http://amb25101.example.com:8080/api/v1/clusters/plain_ambari/services? { "href" : "http://amb25101.example.com:8080/api/v1/clusters/plain_ambari/requests/134", "Requests" : { "id" : 134, "status" : "Accepted" } }
.
Later the progress can be tracked by looking at the API response (requestID)
http://amb25101.example.com:8080/api/v1/clusters/plain_ambari/requests/134
.
Created 08-18-2017 10:36 AM
this is great answer , I will test the syntax above , thank you so much for your fast response and your professional knowledge ,
Created 08-18-2017 10:46 AM
can you please defined all the syntax with -
Created 08-18-2017 10:49 AM
do you mean to see the progress like this - curl -u admin:admin -H "X-Requested-By: ambari" -X PUT -d '{"RequestInfo":{"context":"_PARSE_.START.ALL_SERVICES","operation_level":{"level":"CLUSTER","cluster_name":"plain_ambari"}},"Body":{"ServiceInfo":{"state":"STARTED"}}}' http://198.23.45.23:8080/api/v1/clusters/HDP01/requests/134
Created 08-18-2017 10:51 AM
curl -u admin:admin -H "X-Requested-By: ambari" -X GET http://198.23.45.23:8080/api/v1/clusters/HDP01/requests/134
.
Here 134 will be the request ID that you got from the previous command output.
The output contain the request status as following: (Or IN_PROGRESS is the start is going on)
"request_status" : "COMPLETED",
.
Created 08-18-2017 11:05 AM
Is the request ID correct?
Created 08-18-2017 11:06 AM
now I see the req ID , all is right now