user2732748
user2732748

Reputation: 97

start or stop a cloudera manager management service using python API

I am trying to use Cloud era manager python API for starting and stopping the cluster.

IS it possible to stop the management roles also using this API?

IF can you let me know the commands or the documentation page?

Thanks

Upvotes: 0

Views: 2747

Answers (2)

Michalis
Michalis

Reputation: 1538

Here's an example on how to stop Management Services using the python CM API

# CM API in python

from cm_api.api_client import ApiResource
api = ApiResource("cm-host.cloudera.com")
mgmt = api.get_cloudera_manager().get_service()

# stop the Mamagement Services

mgmt.stop()

# start the Management Services

mgmt.start()

Upvotes: 3

zhutoulala
zhutoulala

Reputation: 4832

Cloudera Manager provides a number of REST APIs, which also include starting/stopping clusters/services. You can find more from the API documents [your cloudera manager host]:7180/static/apidocs/

/clusters/{clusterName}/commands/start
/clusters/{clusterName}/commands/stop
/clusters/{clusterName}/services/{serviceName}/commands/start
/clusters/{clusterName}/services/{serviceName}/commands/stop

Then there are a number of python modules you could use to visit REST APIs, Requests is one I'd like to recommend.

Upvotes: 0

Related Questions