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
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Generic and Dynamic API: MuleSoft
  • Releasing MuleSoft API
  • API-Led Example: MuleSoft
  • On-Demand-Schedulers With MuleSoft CloudHub APIs

Trending

  • The Human Side of Logs: What Unstructured Data Is Trying to Tell You
  • Testing SingleStore's MCP Server
  • Vibe Coding With GitHub Copilot: Optimizing API Performance in Fintech Microservices
  • The Cypress Edge: Next-Level Testing Strategies for React Developers
  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 user avatar
Shantha Priya
·
Oct. 10, 17 · Tutorial
Likes (6)
Comment
Save
Tweet
Share
5.7K Views

Join the DZone community and get the full member experience.

Join For Free

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

  • Generic and Dynamic API: MuleSoft
  • Releasing MuleSoft API
  • API-Led Example: MuleSoft
  • On-Demand-Schedulers With MuleSoft CloudHub APIs

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

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 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!