简体   繁体   English

定期将 azure cosmos db 复制到 dev cosmos db 的最佳方法?

[英]Best way to copy an azure cosmos db to a dev cosmos db at regular intervals?

I'm looking to update my dev db to match my prod db at regular intervals (say weekly).我希望定期(比如每周)更新我的开发数据库以匹配我的生产数据库。 Is there a way to do this using Azure itself or do I need to write a script to do this?有没有办法使用 Azure 本身来执行此操作,还是我需要编写脚本来执行此操作?

Thank you!谢谢!

I have an idea upon your case but I'm not sure if it fits what you want.我对您的情况有一个想法,但我不确定它是否符合您的要求。 This is an answe r from @David Makogon to other question.这是@David Makogon 对其他问题的 r 的回答。 How do you think about exporting and importing documents manually?您如何看待手动导出和导入文档? Or trying to create an function to execute these operations which can be activated by time trigger.或者尝试创建一个 function 来执行这些可以通过时间触发器激活的操作。

I have tried migration tool, it's ok to import data.我试过迁移工具,导入数据就可以了。 在此处输入图像描述

You can use Copy activity and then use schedule trigger to execute it in Azure Data Factory.您可以使用复制活动,然后使用计划触发器在 Azure 数据工厂中执行它。

1.select upsert as write behavior. 1.select upsert作为写行为。 在此处输入图像描述

2.add a schedule trigger and set running interval according to your need. 2.添加计划触发器并根据需要设置运行间隔。 在此处输入图像描述

I would suggest Azure Data Factory.我会建议 Azure 数据工厂。

Probably the easiest way these days would be to have the production account set up to use the continuous backup model .现在最简单的方法可能是将生产帐户设置为使用连续备份 model

This allows self service point in time restore to a new Cosmos account and can be set to either 30 day retention (chargeable) or 7 day (currently free).这允许自助服务时间点恢复到新的 Cosmos 帐户,并且可以设置为 30 天保留(收费)或 7 天(目前免费)。

There is a restore cost based on the GB size of data restored but this may well be cheaper than paying for the Request Units involved in reading batches from the source and writing them to the destination (unless the container is big and you are just writing incremental changes).有一个基于恢复数据的 GB 大小的恢复成本,但这可能比支付从源读取批次并将它们写入目标所涉及的请求单位要便宜(除非容器很大并且你只是写增量变化)。

The main caveats from this are主要注意事项是

  • The restore each time will be to a different account so the account you regard as "your dev account" will change over time and you'll need to update connection strings etc.每次恢复都将针对不同的帐户,因此您视为“您的开发帐户”的帐户会随着时间的推移而改变,您需要更新连接字符串等。
  • Moving from periodic backup model to continuous is not reversible so you need to make sure you read up on the limitations and are happy with them (incompatibility with analytical store and multi region write are probably the main ones).从定期备份 model 转移到连续备份是不可逆的,因此您需要确保阅读了这些限制并对其感到满意(与分析存储和多区域写入的不兼容可能是主要的)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM