stop cloudera CDH5 cluster command line

2.5k views Asked by At

I would like to know command line for stopping and starting cloudera CDH5.2 cluster.

Reason, I am writing an automation script for running some benchmark tests and want to stop and start cluster before starting with each benchmark test.

I have seen stopping CDH cluster is not exactly equivalent to :-

service cloudera-scm-server stop

service cloudera-scm-server-db stop

service cloudera-scm-agent stop

2

There are 2 answers

0
kulssaka On

If you stop the scloudera scm server/agent you will not stop the services. In order to do so:

You need to make a REST request with curl to your cloudera scm server.

The documentation is here: http://cloudera.github.io/cm_api/apidocs/v5/

Here is an example of one of mine:

        PARAM="/api/$CV/clusters/$CLUSTER_NAME/commands/start"
        echo "starting all services"
        curl -X POST -u "$LOGIN:$PASS" "http://""$HOSTNAME""$PARAM"

Don't forget to change your hostname. The hostname point to the cloudera manager server.

You can find the full script I didn't finish, but can help you: http://pastebin.com/d71is5Sx

0
Milan Das On

https://milandas.wordpress.com/2018/12/25/automate-your-hadoop-cluster-cdh-part-2/

export basicauth=admin:admin
export apiVersion=$(curl -k -s -X GET  -u "${basicauth}" $(hostname -f):7180/api/version)

export apiURL=http://$(hostname -f):7180/api/${apiVersion}
curl -u "${basicauth}" \  
-H "Content-Type: application/json" \  
-X POST \  
--data '{}' \  
${apiURL}/cm/service/commands/stop