Support Questions

Find answers, ask questions, and share your expertise

ambari cluster + auto process to start all services that are down

avatar

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?

Michael-Bronson
1 ACCEPTED SOLUTION

avatar
Master Mentor

@uri ben-ari

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

.

View solution in original post

7 REPLIES 7

avatar
Master Mentor

@uri ben-ari

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

.

avatar

this is great answer , I will test the syntax above , thank you so much for your fast response and your professional knowledge ,

Michael-Bronson

avatar

can you please defined all the syntax with -

  1. http://amb25101.example.com:8080/api/v1/clusters/plain_ambari/requests/134
Michael-Bronson

avatar

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

Michael-Bronson

avatar
Master Mentor

@uri ben-ari

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",

.

avatar
Master Mentor

@uri ben-ari

Is the request ID correct?

avatar

now I see the req ID , all is right now

Michael-Bronson