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
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Useful System Table Queries in Relational Databases
  • Fine-Tuning Performance, Resolving Common Issues in FinTech Application With MySQL
  • Optimizing Data Management: Migrating From AWS RDS MySQL to Snowflake
  • Sample Data Generation With Built-In Database Capabilities

Trending

  • Building an Image Classification Pipeline With Apache Camel and Deep Java Library (DJL)
  • End-to-End Event Streaming With Kafka, Spring Boot and AWS SQS/SNS (Production-Ready Code Guide)
  • RAG Done Right: When to Use SQL, Search, and Vector Retrieval and How To Combine Them
  • Understanding MCP Architecture: LLM + API vs Model Context Protocol
  1. DZone
  2. Data Engineering
  3. Databases
  4. Implementing JDBC Persistent Object Store With Anypoint Clustering | MySQL Database

Implementing JDBC Persistent Object Store With Anypoint Clustering | MySQL Database

Clustering is group of nodes that act as a single unit. With JDBC Persistent Object Store, data can be persisted in case of Mule Runtime failure, crashes or shutdown.

By 
Jitendra Bafna user avatar
Jitendra Bafna
·
Updated Aug. 21, 21 · Tutorial
Likes (3)
Comment
Save
Tweet
Share
19.0K Views

Join the DZone community and get the full member experience.

Join For Free

In this blog, we will be discussing about implementing persistent object store using MYSQL with Anypoint Clustering. We will going to see that how we can use MYSQL database to persist the object store data. One of the advantages of using persistent object store is that we will be not loosing data in case Mule Runtime or Mule Application get restarted or shutdown or crashes. In such cases, your object store data will persisted in Database. 

Enabling Persistent Object Store Using MySQL With Anypoint Clustering

To enable, Persistent object store using MySQL required few steps and there are few prerequisites.

Below list of the relational databases supported

  • MySQL 5.5+
  • PostgreSQL 9
  • Microsoft SQL Server 2014

To enable persistent object store, add below list of properties to {MULE_HOME}/.mule/mule-cluster.properties. This properties needs to be add to all nodes in the cluster.

  • mule.cluster.jdbcstoreurl: JDBC Connection URL to database
  • mule.cluster.jdbcstoreusername: Database username
  • mule.cluster.jdbcstorepassword: Database user password
  • mule.cluster.jdbcstoredriver: JDBC Driver class name
  • mule.cluster.jdbcstorequerystrategy: SQL dialect (It can be mysql, mssql, postgresql)

In our article, we will use MySQL as a Database for persistent object store and value for above properties will look like this.

Plain Text
 
mule.cluster.jdbcstoreurl=jdbc:mysql://localhost:3306/object_store
mule.cluster.jdbcstoreusername=root
mule.cluster.jdbcstorepassword=sqlserver12345
mule.cluster.jdbcstoredriver=com.mysql.cj.jdbc.Driver
mule.cluster.jdbcstorequerystrategy=mysql

In above example, I have used object_store as database. You can provide any name according to your convenience and make sure database is created before adding above properties.

Now, you need to copy driver file to {MULE_HOME}/lib/user. In my case, I have copied mysql-connector-java-8.0.26.jar file and that is MySQL driver file will be used to enable connection with MySQL database. 

Once above configuration is done, you just need to restart the cluster.

The database’s tables are created automatically once you deploy application having persistent object store, as this feature creates tables for each different object store that you want to persist.
Two tables are created per object store:

  • One table stores data
  • Another table stores partitions.

Recommendation for Object store Database

  • Create dedicated Schema or Database that can be only used by JDBC Object Store.
  • Always keep in mind that the data storage needs to be hosted in a centralized DB reachable from all nodes.  
  • The database username configured for JDBC Object Store needs to have permission to:
    • Create objects in the database (DDL), CREATE and DROP for tables.
    • Access and manage the objects it creates (DML), INSERT, UPDATE, DELETE, and SELECT.

Here is the step by step video tutorial explaining how to enable JDBC Persistent Object Store With Anypoint Clustering.


You can learn more about Anypoint Clustering here.

Now, you know how to implement JDBC Persistent Object Store With Anypoint Clustering.

Relational database Object (computer science) MySQL clustering

Opinions expressed by DZone contributors are their own.

Related

  • Useful System Table Queries in Relational Databases
  • Fine-Tuning Performance, Resolving Common Issues in FinTech Application With MySQL
  • Optimizing Data Management: Migrating From AWS RDS MySQL to Snowflake
  • Sample Data Generation With Built-In Database Capabilities

Partner Resources

×

Comments

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

  • 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