Modern applications need to be highly responsive and always online. Developers can ensure low latency and high availability of applications by deploying them in data centers that are closest to their users. Web, mobile, gaming, and IoT applications that handle large volumes of data and need to respond in real-time to large changes in usage at peak hours often use MongoDB in their tech stack due to its versatility. In this article, we will focus on migrating MongoDB to Azure Cosmos DB service to take advantage of its high availability, high throughput, low latency, and tunable consistency.
How to Perform MongoDB to Azure Cosmos DB Migration?
MongoDB can be migrated to Azure using the Azure Database Migration Service. Follow the steps below to migrate MongoDB to Azure.
- As a part of the pre-migration process, discover the assets in the current MongoDB estate, assess the readiness for migration, map their requirements to Azure Cosmos DB, and plan the logistics.
- Create an Azure Cosmos DB’s API for MongoDB account and enable SSR (server side retry).
- Use the Azure Resource Manager deployment model to create a Microsoft Azure Virtual Network for Azure Database Migration Service for site-to-site connectivity to the on-premises source servers using either ExpressRoute or VPN. Ensure that ports 53, 443, 445, 9354, and 10000-2000 are open.
Creating Azure Database Migration Service instance
- Register the Microsoft.DataMigration resource provider for the subscription in which the Azure Database Migration Service instance has to be created.
- Create the Azure Database Migration Service instance and specify the service name, subscription, resource group, and location in which it has to be created.
- Create a virtual network if required and select an appropriate SKU from the Premium pricing tier to create the service.
Creating migration project
- Once the service is created, a migration project can be created using the Azure Database Migration Service.
- Click on + New Migration Project, and provide the details for the project name, source, and target server, and the type of activity.
- Click on Select Save> Create and run activity to create the project.
- Provide the connection details for the source MongoDB server on the Source details screen.
- Provide the Azure Cosmos DB account details on the Migration target details screen.
- On clicking Save on the Migration target details page, the Map to target databases screen, on which the source and target databases have to be mapped. Specify the throughput request units (RU) at the database level or individually for each collection.
Completing Cosmos DB migration
- The Migration summary screen will appear on clicking Save. Provide a name for the migration activity in the Activity name text box and click on Run migration.
- Monitor the migration status and verify that the data is replicated from the source MongoDB server to Azure.
- Click on Finish from the migration activity’s context menu once data from the source MongoDB server is available on the COSMOS DB target.
Apps4Rent Can Help with MongoDB to Azure Migration
Although the Azure Database Migration Service is designed to perform MongoDB migrations, there are known issues and limitations associated with migrations from MongoDB to Cosmos DB’s API for MongoDB. These often require manual intervention, and technical expertise in troubleshooting issues.
As a Microsoft Gold Partner for Cloud Platform, Cloud Productivity, and Application Integration, Apps4Rent provides managed Azure services to facilitate migrating databases MongoDB, SQL Server, and other solutions to Azure. Call, chat or email our database migration experts, available 24/7 for assistance.