简体   繁体   English

S3 跨区域复制 - 反向复制

[英]S3 Cross Region Replication - Reverse Replication

I currently have replication configured such that my S3 documents on us-east-1 are replicated to a bucket on us-west-2.我目前已配置复制,以便将 us-east-1 上的 S3 文档复制到 us-west-2 上的存储桶。 In light of today's (gasp) AWS outage, I considered failing over to us-west-2 (which appears to be online at the moment).鉴于今天(喘息) AWS 中断,我考虑将故障转移到 us-west-2(目前似乎在线)。 So, I have several questions about this:所以,我对此有几个问题:

  1. Would documents uploaded to us-west-2 be replicated back to us-east-1 once services are restored?服务恢复后,上传到 us-west-2 的文档是否会复制回 us-east-1? I suspect the answer is no since I have not found any documentation regarding bi-directional replication.我怀疑答案是否定的,因为我没有找到任何关于双向复制的文档。
  2. If bi-directional replication does not happen and I decide to failover to us-west-2, what's the process for recovering once us-east-1 comes back online?如果双向复制没有发生并且我决定故障转移到 us-west-2,那么一旦 us-east-1 重新联机,恢复过程是什么? I assume this would require writing a script to copy all missing documents back to us-east-1.我认为这需要编写一个脚本来将所有丢失的文档复制回 us-east-1。 Any other ideas or suggestions?任何其他想法或建议?

The issue with bi-directional replication always boils down to "who has the correct version" of data.双向复制的问题总是归结为“谁拥有正确版本的数据”。 It's not so hard right now when there is only one source of data but what about when there are two?当只有一个数据源时,现在并没有那么难,但是当有两个时呢? If one process writes to one region and another writes the same thing to another, what adjudicates the conflict?如果一个进程写入一个区域而另一个进程将相同的内容写入另一个区域,那么判断冲突的依据是什么?

This is why you don't see documentation about bi-directional replication - it's hard to solve in a generic way.这就是为什么您看不到有关双向复制的文档的原因 - 很难以通用方式解决。 I would look at something like s3 sync or a custom script to get the buckets back in sync.我会查看诸如 s3 同步或自定义脚本之类的内容,以使存储桶恢复同步。

We setup cross region mutual replication rules on both regions so that they could replicate each other.我们在两个区域上设置了跨区域相互复制规则,以便它们可以相互复制。 Seems to be working fine over the years.多年来似乎运作良好。

The reason it does not do infinite loop is the principal is different for upload and replication.它不做无限循环的原因是上传和复制的principal不同。 If you listen to your s3 event in Lambda , this is more obvious:如果您在Lambda 中收听s3 event ,则更明显:

For original upload, it is:对于原始上传,它是:

            "userIdentity": {
                "principalId": "AWS:xxx:YourBucketName"
            },

For replication, it is对于复制,它是

            "userIdentity": {
                "principalId": "AWS:xxx:s3-replication"
            },

As for the replication itself internally, quote:至于内部复制本身,引用:

For an object uploaded by you
    Amazon S3 triggers the rule you configured to replicate it to another bucket
    And sets Replication status to COMPLETED
For an object replicated from another bucket
    Amazon S3 knows not to re-replicate the object
    And sets Replication status to REPLICA

Implementing Bi-Directional Cross-Region Replication for Amazon Simple Storage Service (Amazon S3)为 Amazon Simple Storage Service (Amazon S3) 实施双向跨区域复制

https://wellarchitectedlabs.com/Reliability/200_Bidirectional_Replication_for_S3/README.html https://wellarchitectedlabs.com/Reliability/200_Bidirectional_Replication_for_S3/README.html

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

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