Deploy a Migrated MongoDB Workload to Oracle Database Appliance

Migrate an existing workload that uses a document database, in this case MongoDB, to Oracle Database 23ai on Oracle Database Appliance for simplified development of JSON-centric applications using a converged, multi-model database.

Workloads and applications that use documents and document databases to evolve data schemas and applications are popular due to the flexibility they offer to developers. Schema flexibility, rapid development, and scalability enable accelerated prototyping of application features, easier application evolution, and the ability to build iteratively smaller applications and features that developers can scale to address a large user base. However, these types of workloads have their challenges, including weaker transactional guarantees, data query versatility, and the inability to support other workloads on documents, such as analytics or machine learning.

What if these workloads can benefit from the advantages of traditional document databases and leverage the benefits of relational databases? For instance, have stronger transactional guarantees and added functionality such as analytics and machine learning, without the need to replicate data to another database or system.

Oracle Database 23ai, designed to simplify development for AI, microservices, graph, document, spatial, and relational applications, is a converged database platform offering everything that is needed in one powerful solution.

Oracle Database Appliance is an engineered system that streamlines the deployment, management, and support of high-availability Oracle Database solutions. By integrating software, compute, storage, and networking, it delivers reliable performance for a wide variety of online transaction processing (OLTP), analytics, data warehousing, and AI applications.

Functional Architecture

This reference architecture assumes a workload composed of an application and MongoDB database exists on-premises and will be migrated to use Oracle Database 23ai as the database. It describes the future state architecture, its benefits, how it can be deployed, and what additional features can be used to augment the existing workload.

This reference architecture focuses on deploying the migrated workload, and not the migration process. To learn more about the migration process, see the Explore More section.

One of the key features used in this architecture is the Oracle Database API for MongoDB, which lets applications interact with collections of JSON documents in Oracle Database using MongoDB commands. This enables existing application code to work with data stored in Oracle Database 23ai, without the need to refactor code.

The following diagram illustrates a typical application composed of a database, back-end tier, and front-end tier.



mongodb-logical-arch-migration.zip

A popular stack used to implement this pattern is the MEAN stack:

  • MongoDB: Document database
  • Express: Back-end framework
  • Angular: Front-end framework
  • Node.js: Back-end server

This architecture uses a MEAN stack as an example of an existing deployment to migrate to Oracle Database 23ai. The migration of this workload to Oracle Database 23ai consists of the following high-level steps:

  1. Deploy and configure Oracle Database Appliance.
  2. Create an Oracle Database 23ai instance in Oracle Database Appliance.
  3. Migrate metadata and data from MongoDB to Oracle Database.
  4. Create VMs in Oracle Database Appliance to run the back-end tier and Oracle REST Data Services.
  5. Deploy and configure the back-end tier and Oracle REST Data Services in Oracle Database Appliance VMs.
  6. Configure Oracle REST Data Services to enable the MongoDB API, so the application can communicate with the database using MongoDB drivers.
  7. Configure the application to use the new database connection string.
  8. Connect the backend application to Oracle Database using the same MongoDB tools and drivers used in the application.

After migrating the workload to Oracle Database, you can enhance functionality by enabling additional features - such as improved security, operational reporting, analytics, and machine learning - without copying data out of the database. Oracle Database 23ai is a multi-model, multi-workload platform, which enables you to seamlessly integrate features that utilize relational, spatial, graph, or vector data types alongside your existing application.

To improve workload scalability, allocate more compute and memory to the database by adjusting the CPU cores assigned to the database and applications VMs.

To improve availability, Oracle Database Appliance has a fully redundant highly available system, Oracle Database Appliance high availability, which uses two compute nodes to deploy the database and back-end tier. If used with Oracle Database 23ai Real Application Clusters, full high availability is achieved.

Physical Architecture

The physical architecture for this migrated workload to Oracle Database 23ai supports the following:

Front-end tier

  • The current deployment is used.
  • Users can connect from the internet or the corporate network.
  • There is DNS capability, configured to route requests to the standby data center in the event of failover.

Back-end tier

  • Existing applications are deployed in Oracle Database Appliance VMs to allow workload consolidation and reduce overall costs.
  • Customer-managed Oracle REST Data Services are colocated and deployed on the application servers Oracle Database Appliance VMs, so the application code can connect to Oracle Database 23ai through Oracle REST Data Services.
  • Backend tier scalability is achieved by adding more Oracle Database Appliance VMs when needed, implicitly scaling Oracle REST Data Services, installed in each application server VM.

Database tier

  • Oracle Database 23ai is deployed on Oracle Database Appliance in a single node configuration, used to store and serve JSON documents to the back-end tier.
  • The Oracle Database API for MongoDB is enabled using Oracle REST Data Services, which allows existing application code to be used without changes to code.

Business continuity

  • A backup-based disaster recovery strategy is used.
  • To ensure the same application service-level objectives (SLOs) are maintained when running the workload from the standby data center, run a comparable Oracle Database Appliance infrastructure at that location.

The following diagram illustrates this reference architecture.



mongodb-oda-physical-arch.zip

The design for the physical architecture:

Business continuity

  • There are two data centers with identical deployments: one active, the other on standby.
  • Backups are stored on network file storage (NFS) and replicated to the standby site.
  • In case of a failure at the active data center, the latest backup allows workloads to be quickly launched in the standby center.
  • DNS traffic steering directs user requests to the active data center. If the DNS health check probes executed on the application tier recurrently fail, DNS is reconfigured to route traffic to the standby data center workload.
  • A load balancer distributes incoming requests across multiple back-end tier VMs, preventing a single point of failure.
  • Customer-managed Oracle REST Data Services is deployed and configured on the back-end tier VMs. Whenever a VM is added, both the application server and Oracle REST Data Services are scaled accordingly.
  • The recovery time objective (RTO) is dependent on the deployment of all workload components in the standby data center, including restoring the database from the last replicated backup.
  • The recovery point objective (RPO) depends on the most recent replicated backup.

Networking

  • There is a public subnet receiving incoming user requests from the internet.
  • The Oracle Database Appliance public network interface card (NIC) is attached to the workload private subnet.
  • Load balancer requests are routed to the Oracle Database Appliance backend tier VMs that serve user requests.

Database

  • Oracle Database 23ai is deployed in Oracle Database Appliance.
  • Data is stored redundantly, either with double or triple mirroring, for increased data resilience.
  • Automated database backups are configured to backup to NFS, those backups are replicated to the standby data center NFS, using existing NFS replication capabilities.

Security

  • Database role-based access control (RBAC) capabilities are used to secure the workload.
  • Data stored in the database can be encrypted using transparent data encryption (TDE), if the Oracle Database Enterprise Edition Advanced Security Option is used.

Potential design improvements not depicted on this deployment for simplicity's sake include:

  • Leverage an Oracle Database Appliance high availability (HA) system composed of two compute nodes to ensure backend workload high availability. Deploy VMs with automatic restart and failover across both nodes.
  • Use Oracle Database Appliance HA with Oracle Database Enterprise Edition and Oracle Real Application Clusters (Oracle RAC) to provide high availability for the database tier.

Recommendations

Use the following recommendations as a starting point to further improve and evolve the workload. Your requirements might differ from the architecture described here.
  • Application Deployment

    Leverage several backend tier VMs to increase resilience. Enable Oracle Database Appliance management of CPU resources, to allocate the right amount of VMs compute, guaranteeing the quality of service needed for the application.

  • Security

    Consider using Oracle Database Advanced Security Option features to encrypt data at rest and enable dynamic data redaction, an Oracle Database Enterprise Edition license is required to use Oracle Database Advanced Security Option.

  • Observability

    Consider using Oracle Data Safe to further increase the workload security posture and be able to perform database auditing.

  • Operational Efficiency

    Consider using infrastructure as code, namely Terraform, in conjunction with the Oracle Database Appliance SDK, to automate the deployment of VMs and databases.

  • Application Evolution
    • Consider deploying operational analytics and real-time reporting in Oracle Database 23ai using SQL and a frontend like Oracle APEX, keeping data within the database for trusted, real-time analysis.
    • Consider using Oracle Database 23ai for machine learning using Oracle Machine Learning for SQL, to build and train models with JSON data without any need for data movement and to deploy the models alongside the existing workload for efficient inferencing.
    • Consider using the database to store additional data types (relational, vector, spatial or graph) for added workload functionality and flexibility.
    • Consider using Oracle Database Appliance and Oracle Database 23ai for analytics beyond operational analytics, benefiting from the Hybrid Columnar Compression, an efficient columnar format tailored for data analytics, that increases analytics performance while reducing the space needed to store data. Hybrid Columnar Compression is supported in Oracle Database Appliance and is included with an Oracle Database Enterprise Edition license.

Explore More

Learn more about deploying migrated workloads from MongoDB to Oracle Database Appliance.

Review these additional resources:

Acknowledgments

  • Author: José Cruz
  • Contributors: Massimo Castelli, Simon Griffiths, Matt DeMarco, Julian Dontcheff