DynamoDB 单活动跨区域复制

huangapple go评论65阅读模式
英文:

DynamoDB single-active cross region replication

问题

我正在尝试了解DynamoDB的复制和故障转移策略,但在网上找不到任何澄清它们的文章。我了解到DynamoDB可以通过全局表实现跨区域复制,但我也了解到这是一个多活动表设置,意味着有多个活动表和多个副本表。是否有一个单活动表和多个副本的设置?我在这篇文章中简要了解了一下,但在包括AWS文档在内的任何其他地方都找不到相关提及。

我还在尝试了解这两种情况下的故障转移策略 - 是否有一种DynamoDB Java客户端可以在一个可用区发生问题时在多个可用区之间进行读写故障转移?

英文:

I'm trying to understand DynamoDB replication & failover strategies but do not find any articles on the web which clarifies them. I understand cross-region replication can be achieved by DynamoDB with Global Tables but I also understand this is a multi-active table setup, meaning there are multiple active tables and multiple replica table. Is there a setup with single-active table and multiple replicas? I briefly read about this in this article but do not find any mentions anywhere else including AWS documentation.

I'm also trying to understand failover strategies for both cases - Is there a DynamoDB Java Client which can failover across AZs in case of issues in one AZ for both reads & writes?

答案1

得分: 1

DynamoDB 全局表始终处于活跃-活跃状态,但如果您愿意,也可以将其视为活跃-被动状态。许多人这样做。如果您想要使用条件表达式、事务或执行任何非幂等的写入操作,可能会在两个区域中大致同时写入相同的项目,且第二个写入操作发生在第一个写入操作被复制之前,这将导致第一个写入操作实际上丢失,这时将非常有用。

要实现这一点,您只需将写入流量路由到一个区域,然后在需要故障切换时决定何时写入到另一个区域。故障切换区域始终愿意成为活动区域,如果您允许的话。

至于可用区 (AZs),DynamoDB 是一个区域性服务,意味着它始终跨越至少3个可用区,即使一个完整的可用区宕机,它也能正常运行,您无需担心这个问题。

英文:

DynamoDB Global Tables are always active-active but you can treat it as active-passive if you prefer. Many people do. That's useful if you want to use features like condition expressions, transactions, or do any non-idempotent wheres where you could have the same item being written around the same time in both regions with the second write happening before the first replicates, because this would cause the first write to be effectively lost.

To do this you just route your write traffic to one region, and to failover you decide when it's time to write to another. The failover region is always happy to be an active region if you'll let it.

As for AZs, DynamoDB is a regional service meaning it crosses at least 3 AZs always and would keep operating fine even if a full AZ were to be down. You don't have to worry about that.

答案2

得分: 0

很抱歉,全局表在跨地区使用时,没有单活动表和多个副本的设置。因此,故障转移策略将是多个活动表和多个副本表! - 来源 - 文档

关于故障转移策略,

根据文档

如果单个AWS区域变得孤立或降级,您的应用程序可以重定向到不同的区域,并对不同的副本表执行读取和写入操作。

这意味着这是一个无缝的平稳过程,默认情况下会发生,当然您可以添加自定义逻辑以确定何时进行重定向。

英文:

>Is there a setup with single-active table and multiple replicas

Unfortunately there is no such single active and multiple replica setup for cross region in dynamodb using global tables, so failover strategy will be for multiple active tables and multiple replica tables! - Source - docs

Fro failover strategies

According to docs

>If a single AWS Region becomes isolated or degraded, your application can redirect to a different Region and perform reads and writes against a different replica table.

This means this is seamingless smooth process which happends by default ofcourse you can add custom logic when to redirect

huangapple
  • 本文由 发表于 2023年1月6日 14:04:55
  • 转载请务必保留本文链接:https://go.coder-hub.com/75027495.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定