MMC Rest API - Clusters

Post on 15-Apr-2017

242 views 2 download

Transcript of MMC Rest API - Clusters

MMC Rest API - ClustersBY KIRAN KUMAR

Introduction

Continuous Deployment is always needed to make the things automate. Mule ESB cluster is a server which uses the active-active model to the

nodes. The advantage of active-active model is no one server acts as a

primary node. Both of the nodes will share the load. MMC provides Rest API’s to manage the cluster nodes, applications and

flows.

Create a Cluster

To create a cluster, need to provide cluster name and server ids as shown in the below URL.

curl --basic -u username:password -d '{"name":"Cluster Name","version":"3.6.1", "nodes":["serverId-1", "serverId-2"]}' --header 'Content-Type: application/json' http://localhost:8585/mmc/api/clusters

HTTP Method: POST

Get All Clusters

To get all the clusters in the MMC, need to provide the below URL. curl --basic -u username:password

http://localhost:8585/mmc/api/clusters HTTP Method: GET

Get a Cluster

To get a specific cluster, need to provide cluster id as shown in the below URL.

curl --basic -u username:password http://localhost:8585/mmc/api/clusters/{clusterId}

HTTP Method: GET

Cluster Status

To get the status of a cluster, need to provide the cluster id as shown in the below URL.

curl --basic -u username:password http://localhost:8585/mmc/api/clusters/{clusterId}/status

HTTP Method: GET

Disband a Cluster

To disband(delete) a cluster, need to provide the cluster Id as shown in the below URL.

curl --basic -u username:password -X DELETE http://localhost:8585/mmc/api/clusters/{clusterId}

HTTP Method: DELETE

Restart a Cluster

To restart the Cluster, need to provide the cluster Id as shown in the below URL.

curl --basic -u username:password -X POST http://localhost:8585/mmc/api/clusters/{clusterId}/restart

HTTP Method: POST

Stop a Cluster

To stop a Cluster, nedd to provide the Cluster Id as shown in the below URL.

curl --basic -u username:password -X POST http://localhost:8585/mmc/api/clusters/{clusterId}/stop

HTTP Method: POST

Add Nodes to a Cluster

To add nodes to the existing cluster, need to provide the node ids in the data as shown in the below URL.

curl --basic -u username:password -d '{"nodes":"serverId-1", "serverId-2"}' --header 'Content-Type: application/json' http://localhost:8585/api/clusters/{clusterId}/addnodes

HTTP Method: POST

Remove Nodes from a Cluster

To remove nodes on a Cluster, need to provide the node ids of the cluster as shown in the below URL.

curl --basic -u username:password -d '{"nodes":"serverId-1", "serverId-2"}' --header 'Content-Type: application/json' http://localhost:8585/api/clusters/{clusterId}/removenodes

HTTP Method: POST

Get All Applications on Cluster

To get all applications on a cluster, need to provide the cluster id as shown in the below URL.

curl --basic -u username:password http://localhost:8585/mmc/api/clusters/{clusterId}/applications

HTTP Method: GET

Start an Application

To start an application on a cluster, need to provide the cluster id and the application name as shown in the below URL.

curl --basic -u username:password -X POST http://localhost:8585/mmc/api/clusters/{clusterId}/applications/{applicationName}/start

HTTP Method: POST

Restart an Application

To restart an application on a cluster, need to provide the cluster id and application name as shown in the below URL.

curl --basic -u username:password -X POST http://localhost:8585/mmc/api/clusters/{clusterId}/applications/{applicationName}/restart

HTTP Method: POST

Stop an Application

To stop an application on a cluster, need to provide cluster Id and application name as shown in the below URL.

curl --basic -u username:password -X POST http://localhost:8585/mmc/api/clusters/{clusterId}/applications/{applicationName}/stop

HTTP Method: POST

Get All Flows

To get all available flows on a cluster, need to provide the cluster id as shown in the below URL.

curl --basic -u username:password http://localhost:8585/mmc/api/clusters/{clusterId}/flows

HTTP Method: GET

Restart a Flow

To restart a flow of an application on a cluster, need to provide the cluster id, application name and flow name as shown in the below URL.

curl --basic -u username:password -X POST http://localhost:8585/mmc/api/clusters/{clusterId}/flows/{flowName}/{applicationName}/start

HTTP Method: POST

Pause a Flow

To pause a flow of an application on a cluster, need to provide the cluster id, application name and flow name as shown in the below URL.

curl --basic -u username:password -X POST http://localhost:8585/mmc/api/clusters/{clusterId}/flows/{flowName}/{applicationName}/pause

HTTP Method: POST

Stop a Flow

To stop a flow of an application on a cluster, need to provide the cluster id, application name and flow name as shown in the below URL.

curl --basic -u username:password -X POST http://localhost:8585/mmc/api/clusters/{clusterId}/flows/{flowName}/{applicationName}/stop

HTTP Method: POST

Get All Endpoints

To get all flow endpoints from an application on a cluster, need to provide the cluster id, application name and flow name as shown in the below URL.

curl --basic -u username:password http://localhost:8585/mmc/api/clusters/{clusterId}/flows/{flowName}/{applicationName}/endpoints

HTTP Method: GET

Start an Endpoint

To start an flow endpoint in the application on cluster, need to provide the cluster id, application name, flow name and endpoint id as shown in the below URL.

curl --basic -u username:password -X POST http://localhost:8585/mmc/api/clusters/{clusterId}/flows/{flowName}/{applicationName}/endpoints/{endpointId}/start

HTTP Method: POST

Stop an Endpoint

To stop an flow endpoint in the application on cluster, need to provide the cluster id, application name, flow name and endpoint id as shown in the below URL.

curl --basic -u username:password -X POST http://localhost:8585/mmc/api/clusters/{clusterId}/flows/{flowName}/{applicationName}/endpoints/{endpointId}/stop

HTTP Method: POST

Thank you