MMC Rest API - Clusters

24
MMC Rest API - Clusters BY KIRAN KUMAR

Transcript of MMC Rest API - Clusters

Page 1: MMC Rest API - Clusters

MMC Rest API - ClustersBY KIRAN KUMAR

Page 2: MMC Rest API - Clusters

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.

Page 3: MMC Rest API - Clusters

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

Page 4: MMC Rest API - Clusters

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

Page 5: MMC Rest API - Clusters

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

Page 6: MMC Rest API - Clusters

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

Page 7: MMC Rest API - Clusters

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

Page 8: MMC Rest API - Clusters

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

Page 9: MMC Rest API - Clusters

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

Page 10: MMC Rest API - Clusters

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

Page 11: MMC Rest API - Clusters

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

Page 12: MMC Rest API - Clusters

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

Page 13: MMC Rest API - Clusters

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

Page 14: MMC Rest API - Clusters

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

Page 15: MMC Rest API - Clusters

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

Page 16: MMC Rest API - Clusters

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

Page 17: MMC Rest API - Clusters

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

Page 18: MMC Rest API - Clusters

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

Page 19: MMC Rest API - Clusters

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

Page 20: MMC Rest API - Clusters

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

Page 21: MMC Rest API - Clusters

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

Page 22: MMC Rest API - Clusters

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

Page 24: MMC Rest API - Clusters

Thank you