简体   繁体   English

Azure 容器定期同步

[英]Azure container sync periodically

I have a scenario where i am storing payload from 2 subscriber (Service bus topics) into 2 different storage/container.我有一个场景,我将来自 2 个订户(服务总线主题)的有效负载存储到 2 个不同的存储/容器中。 Storing mechanism are different in these case.这些情况下的存储机制不同。 Now i have to run a sync every 30 minutes which will compare the files created target and Source, if anything is missing in the target it should be able to copy that file from source to target.现在我必须每 30 分钟运行一次同步,这将比较目标和源创建的文件,如果目标中缺少任何内容,它应该能够将该文件从源复制到目标。

I am looking at AZCopy sync, but that is a local application.我正在查看 AZCopy sync,但那是一个本地应用程序。 There are logic app and Function app option as well.还有逻辑应用程序和 Function 应用程序选项。

Kindly share what is the best solution to this problem请分享这个问题的最佳解决方案是什么

This method is a little on the brute force side, but should work.这种方法有点偏蛮力,但应该有效。 Here is the top level pipeline diagram:这是顶层管道图:

在此处输入图像描述

Here are the steps:以下是步骤:

  1. Get Metadata for the "Needs sync" folder (FolderA).获取“需要同步”文件夹 (FolderA) 的元数据。 Be sure to check add the "Child items" argument:请务必检查添加“子项”参数:

在此处输入图像描述

  1. ForEach over the FolderA child items to extract the file names and append them to an array variable: ForEach 在 FolderA 子项上提取文件名并将它们 append 到一个数组变量:

在此处输入图像描述

在此处输入图像描述

This makes it easier to work with the names later.这使得以后使用这些名称更容易。

  1. Get Metadata for the "Always right" folder (FolderB).获取“始终正确”文件夹 (FolderB) 的元数据。 Same process as above, but over the FolderB location.与上述过程相同,但在 FolderB 位置。

  2. ForEach over FolderB's child items. ForEach 在 FolderB 的子项上。

在此处输入图像描述

  1. Inside the ForEach, add an If Condition to test whether or not the FolderB item exists in the FolderA list.在 ForEach 内部,添加一个 If 条件来测试 FolderB 项目是否存在于 FolderA 列表中。

在此处输入图像描述

在此处输入图像描述

  1. If the FolderB item is not in the FolderA list, append it to a Missing_Items array variable.如果 FolderB 项目不在 FolderA 列表中,则将其 append 赋给 Missing_Items 数组变量。

在此处输入图像描述

From here, it's a matter of looping over the Missing Items array and handling it however you prefer [probably with a Copy activity].从这里开始,就是遍历 Missing Items 数组并按您喜欢的方式处理它 [可能使用 Copy 活动]。

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

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