DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Newsletter
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Code and Connect: MCP + MuleSoft
  • Implementing Budget Policies and Budget Limits on Databricks
  • Generic and Dynamic API: MuleSoft
  • Releasing MuleSoft API

Trending

  • Designing Memory Architecture for Stateful AI Agents: Short-Term Context and Long-Term Persistence
  • Part 4: Multi-Agent Orchestration — Pairing Goose With Quarkus Flow State Machines
  • The SDLC After AI
  • MQTT, Kafka, NATS, or Zenoh? Choosing Edge-to-Cloud Messaging by Traffic Pattern

Draft This article hasn't been published, so readers can't see it.

In moderation This article is waiting for review, so readers can't see it yet.

Deleted This article has been deleted, so readers can't see it.

  1. DZone
  2. Software Design and Architecture
  3. Integration
  4. Create Clusters in MuleSoft Runtime Manager Using APIs

Create Clusters in MuleSoft Runtime Manager Using APIs

Learn how to create clusters of a group of servers in MuleSoft, using either the Anypoint Platform console, or the RunTime Manager API.

By 
Shantha Priya
·
Oct. 10, 17 · Tutorial
Post on X (opens in a new tab) Share on LinkedIn (opens in a new tab)
5.9K Views

Join the DZone community Save articles, join the discussion, and download Refcards and Trend Reports with a free account.

Join for free Already a member? Log in

In the case of MuleSoft, we can create clusters of a group of servers either using the Anypoint Platform console, or by using the RunTime Manager API. The following list of APIs should be used sequentially in order to create a cluster in Runtime through the API.

We mainly go for the cluster concept in MuleSoft to ensure high availability of the Mule applications running on the server, which means that all the servers that belong to a cluster will have one single application running on the top of it.

Note: Mulesoft API's are by default REST API  so all the output will be in JSON Format.

Step 1: Get the Authorization Token

The first step is to authenticate our AnyPoint Platform account in order to get access to it. The following API is used to get the authorization token by passing our Anypoint Platform login credentials.

API: https://anypoint.mulesoft.com/accounts/login

Method: POST

Parameters: username=

                           password=

Output:Image title

From the above output, we can make use of the access token as our authentication-id to perform the further actions.

Note:This token will be valid only a shorter duration after which you have to generate a new token.

Step 2: Get the Organization ID

After generating the access token, pass that access token value as a header in order the get the organization ID.

As in Anypoint Platform, all the APIs, Clusters, Mule applications, and servers fall under the organization. We can have multiple organization and sub-organizations under one Anypoint Platform account. 

API: https://anypoint.mulesoft.com/accounts/api/me

Method: GET

Headers:

Authorization= ‘access_token’

OUTPUT:

Image title

From the above output in JSON format, obtain the id of the organization class, as this will be passed as a parameter in the upcoming API.

STE 3: Get the Environment ID

After obtaining the organization id, we have to filter the environment under which the cluster should be created. Under each organization, we can create multiple environments; the default one would be the sandbox environment. 

API: https://anypoint.mulesoft.com/accounts/api/organizations/{org-id}/environments

Method: GET

Headers: Authorization= bearer ‘access_token’

OUTPUT:

Image title


Step 4: Get the List of Servers

After getting the desired environment id and organization id, we have to be aware of the list of the servers available in the environment, and we have to fetch the id assigned to the particular server that has to be added to the cluster. In order to obtain that, we make use of the below API.

API: https://anypoint.mulesoft.com/hybrid/api/v1/servers    

Method: GET

Headers: Authorization= bearer ‘access_token’

                 X-ANYPNT-ORG-ID= ‘org-id’

                 X-ANYPNT-ENV-ID=  ‘env-id’

Here we pass the headers of token org-id and env-id that are obtained from the previous API's.

OUTPUT:

Image title

From the output, we obtain the server id of the servers that are present in that particular environment that should be formed as a cluster.

Step 5: Create Clusters

After obtaining all the details, we can go ahead and pass the same set of headers that we have sent for the previous API along, which you should pass as a message body in JSON format that provides the name of a cluster that we are going to create along with the server id's field (mandatory).

Apart from this, we can also pass the Server IP and a few other fields as a field in the JSON body.

API: https://anypoint.mulesoft.com/hybrid/api/v1/clusters     

Method: POST

Headers: Authorization= bearer ‘access_token’

                 X-ANYPNT-ORG-ID= ‘org-id’

                 X-ANYPNT-ENV-ID=  ‘env-id’

Body:

{  "name": "cluster1",

   "multicastEnabled": "true",

   "servers": [ {"serverId" : 30433433}]

}

Finally, the cluster will be created with either a single or a group of servers; provided that the servers are of multi-cast, then the servers should be up and running, whereas in uni-cast, the server can even be in disconnected mode.

cluster MuleSoft API

Opinions expressed by DZone contributors are their own.

Related

  • Code and Connect: MCP + MuleSoft
  • Implementing Budget Policies and Budget Limits on Databricks
  • Generic and Dynamic API: MuleSoft
  • Releasing MuleSoft API

Partner Resources

×

Comments

Loading comments

The comments didn't load

Please try again in a moment.

Likes

Loading

The next likes didn't load. Please try again.

The likes didn't load

Please try again in a moment.

See who liked this

Log in or join DZone for free to see who liked this article.

Log in Join for free
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook