How to sync dta between cosmos DB instances

Navelkar, Abhijeet-Narendra-XT 21 Reputation points
2021-09-30T10:41:19.947+00:00

My goal is to sync collection from 1st cosmos DB instance to 2nd DB instance. Want to replicate a limited set of fields for a collection from 1st instance to 2nd instance. Do not want a one time migration but an ongoing synchronization.

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,742 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Anurag Sharma 17,616 Reputation points
    2021-10-01T06:08:25.487+00:00

    Hi @Navelkar, Abhijeet-Narendra-XT , welcome to Microsoft Q&A forum. There are multiple ways to achieve this requirement.

    1) First is we can make use of Data Migration Tool to migrate data from one Azure Cosmos DB to another one, however this is one time activity which will migrate the data. Here we can customize the query to include only few properties which we want to migrate instead of everything.

    Use Data migration tool to migrate your data to Azure Cosmos DB

    Once this data migration is done, we can make use of change feed to take care of new documents. The Azure Cosmos DB change feed is a mechanism for getting a continuous and incremental feed of records from a Cosmos DB container as those records are being created or modified. This can be used to migrate new documents after the migration process.

    Azure Cosmos DB - Change Feed Lab

    2) Another way to use the ADF. Below example shows a way how can we achieve it, it is not direct example but can be customized to achieve the requirements. Again ADF pipelines can be scheduled, so they will take care of new loads as well.

    Copy and transform data in Azure Cosmos DB (SQL API) by using Azure Data Factory

    3) We can create our own customized code to migrate the data from one Cosmos account to another and then can be scheduled it as well. Here we will have the complete liberty of adding/updating details if needed.

    Please let us know if this helps or else we can discuss further on the same.


    Please don't forgot to click on accept it as answer button 136892-image.png wherever the information provided helps you. This can be beneficial to other community members as well.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.