sbathehwx / failhadoop

A framework for running various failure tests against a Hadoop cluster
0 stars 1 forks source link

Add a script to restart all services via Ambari #16

Closed sbathehwx closed 7 years ago

sbathehwx commented 7 years ago

We need a script to stop / start or restart all the services in the cluster. While restart stale is good, it does not cover all our use cases.

sbathehwx commented 7 years ago
  1. To Stop: curl -vv -u admin:admin -H "X-Requested-By: ambari" -i -X PUT -d '{"RequestInfo":{"context":"_PARSE_.STOP.ALL_SERVICES","operation_level":{"level":"CLUSTER","cluster_name":"sbathe-hdp"}},"Body":{"ServiceInfo":{"state":"INSTALLED"}}}' http://node1.openstacklocal:8080/api/v1/clusters/sbathe-hdp/services

  2. look for the task/request URL in the response:

    • the response code should be 202 Accepted
    • Requests['status'] should be Accepted and
    • href would have the URL for the request to track its completion
  3. Poll the URL for "request_status"

    • successful completion would be :
      • "request_status" : "COMPLETED" and
      • "failed_task_count" : 0,
  4. Once successful, sleep 30 seconds (to give java time to cleanup and exit cleanly)

  5. To start back: curl -vv -u admin:admin -H "X-Requested-By: ambari" -i -X PUT -d '{"RequestInfo":{"context":"_PARSE_.START.ALL_SERVICES","operation_level":{"level":"CLUSTER","cluster_name":"sbathe-hdp"}},"Body":{"ServiceInfo":{"state":"STARTED"}}}' http://node1.openstacklocal:8080/api/v1/clusters/sbathe-hdp/services

  6. Again poll for completion like we did for stop.