AWS ElastiCache for Redis集群与复制组

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

AWS ElastiCache for Redis Cluster vs Replication group

问题

I'm here to provide the translation of your text:

"我对AWS ElastiCache的术语,如集群、复制组等感到相当困惑。

让我从我所知道的内容开始描述,然后困惑将浮现出来:
让我们从ElastiCache组件和功能中描述的ElastiCache组件开始。

所以我们有一个“节点”,它是系统中最小的单位。一个节点是计算和内存容量的一部分。每个节点运行在创建时选择的引擎和版本的实例上。

然后我们有“分片”,它是一个包含一到六个节点的分组。Redis(群集模式禁用)始终有一个分片,一个节点是主节点,其余是副本。

然后我们有“集群”,它是一个或多个分片。

现在,一个集群可以是禁用群集模式,其中集群只有一个分片,也可以启用群集模式,其中我们有多个分片。

到目前为止,一切都很好,直到我尝试使用Terraform创建用于Redis的ElastiCache集群。

因此,通过terraform,我们使用aws_elasticache_replication_group资源来创建禁用群集模式的多节点集群。因此,如果我想要一个带有一个读/写主节点和2个副本节点的单分片,我需要使用此资源。

相反,要创建单节点集群,我可以使用aws_elasticache_cluster资源。

在尝试运行Terraform配置时,我遇到了错误:

错误:创建ElastiCache复制组(my-redis-cluster):AccessDenied:用户:arn:aws:iam::xxx:user/bob
未被授权执行:资源上的elasticache:CreateReplicationGroup:arn:aws:elasticache:us-east-1:xxx:replicationgroup:my-redis-cluster
带有服务控制策略中的显式拒绝

由于我可以使用AWS控制台创建这样的集群,我不明白问题出在哪里。

在调查过程中,我发现API参考中有两个API操作:CreateReplicatioGroupCreateCacheCluster

CreateReplicationGroup页面中写道:
>Redis(禁用群集模式)复制组是一组集群,其中一个集群是读/写主要集群,其他集群是只读副本。对主节点的写操作会异步传播到副本。

现在困惑的是:什么意思是它是一个“集群”的集合?根据我们之前的说法,集群是最高级别的实体,其中包含一个或多个分片,分片又包含一个或多个节点。

当我创建了这个Terraform资源后,在AWS控制台中我看到只有一个集群,这使得困惑加剧。

所以,有人可以澄清术语“集群”究竟是什么意思吗?复制组是什么?为什么它们在API中是两个单独的操作?

谢谢。"

英文:

I'm quite confused from the terminology of AWS ElastiCache with regards to clusters, replication groups, etc.

Let me start describing what I know and the confusion will emerge:
Let's begin with the components of ElastiCache described in ElastiCache components and features

So we have a node which is the smallest unit in the system. A node is a chunk of compute and memory capacity. Each node runs an instance of the engine and version chosen in the creation.

Then we have the shard, which is a grouping of one to six nodes. Redis (cluster mode disbaled) has always one shard, with one node being the primary node, and the rest are replicas.

Then we have the cluster, which is one or more shards.

Now a cluster may be cluster-mode disabled, in which the cluster has only one shard, and cluster-mode enabled, where we have more than one shard.

Up to here everything is great, until I've tried to create an ElastiCache for Redis cluster using Terraform.

So with terraform, we use the aws_elasticache_replication_group resource in order to create a cluster-mode disabled multi node cluster. So if I want to have a single shard with one read/write primary node and 2 replica nodes, I need to use this resource.

In contrast, in order to create a single-node cluster, I can use the aws_elasticache_cluster resource.

When trying to run the Terraform configuration, I've got the error:

 Error: creating ElastiCache Replication Group (my-redis-cluster): AccessDenied: User: arn:aws:iam::xxx:user/bob
 is not authorized to perform: elasticache:CreateReplicationGroup on resource: arn:aws:elasticache:us-east-1:xxx:replicationgroup:my-redis-cluster 
with an explicit deny in a service control policy

Since I could, using the AWS Console, create such cluster exactly, I didn't understand what the problem is.

During investigation, I found that there are two API actions in the API reference: CreateReplicatioGroup and CreateCacheCluster.

In the page of CreateReplicationGroup stated:
> A Redis (cluster mode disabled) replication group is a collection of clusters, where one of the clusters is a read/write primary and the others are read-only replicas. Writes to the primary are asynchronously propagated to the replicas.

Now the confusion: What does it mean that it's a collection of "clusters"? From what we said above, a cluster is the top-level entity, which contains one/more shards, which in turn contain one/more nodes.

Now the confusion increases when I did create this Terraform resource, and then in the AWS Console I saw that I do have only one cluster.

So, can someone clarify what exactly the term "cluster" mean? What is this replication group thing? And why these are 2 separate Actions in the API?

Thank you.

答案1

得分: 2

在澄清术语之前,让我们解决一下你提到的IAM错误。这个错误很可能与用户附加的IAM策略中存在明确的“Deny”语句有关。你可以在IAM文档中了解更多有关如何排除这类错误的信息。

以下内容需要重新表述:

一个Redis(禁用集群模式)复制组是一组实例,其中一个实例是读/写主实例,其他实例是只读副本。对主实例的写操作会异步传播到副本实例。

建议重新表述为:

一个Redis(禁用集群模式)复制组是一组实例,其中一个实例是读/写主实例,其他实例是只读副本。对主实例的写操作会异步传播到副本实例。

一个启用集群模式的Redis复制组是一组分片,其中一个分片具有主...

为了保持其余定义不变,最简单的方法是在此CMD上下文中将“clusters”替换为“instances”。在CME上下文中,replication group本质上与cluster相同。

ElastiCache是Memcached和Redis的托管服务。文件中有时会用到“cluster”这个词,我同意将复制组描述为“一组集群”确实令人困惑。

关于API问题,如果我们仔细查看你提到的API文档:CreateCacheClusterCreateReplicationGroup,我们可以提出一些关于何时以及如何采取行动以及澄清某些术语的良好做法。

当创建一个新的Redis集群时,使用CreateCacheCluster将导致禁用集群模式的部署,其中只有一个主实例且没有副本。将副本附加到此集群的唯一方法是创建一个复制组。因此,使用CreateCacheCluster API创建Redis集群是没有好处的。此API在我们想要创建一个可以定义1-40个Memcached实例的Memcached集群时很有用。请注意,Memcached不支持复制。

CreateReplicationGroup允许我们创建启用或禁用集群模式的部署。在创建禁用集群模式时,我们可以定义1个主实例和最多5个副本。在创建启用集群模式时(除非需要仅存在于禁用集群模式中的功能),你可以定义最多500个实例(主实例+副本)。文档中的“clusters”一词在这一部分应该被改为“shards”。请注意,CreateReplicationGroup仅支持其Engine参数的“Redis”。

CreateReplicationGroup文档中:

此操作仅适用于Redis。

总结一下,我建议在创建Redis部署时使用CreateReplicationGroup API,并在创建Memcached部署时使用CreateCacheCluster

英文:

Before I jump into clarifying the terminology, let’s address the IAM error you mentioned. This error is likely related to an explicit Deny statement in user’s attached IAM policy. You can read more about how to troubleshoot these kind of errors in the IAM documentation.

>A Redis (cluster mode disabled) replication group is a collection of clusters, where one of the clusters is a read/write primary and the others are read-only replicas. Writes to the primary are asynchronously propagated to the replicas.

should probably be re-worded to:

>A Redis (cluster mode disabled) replication group is a collection of instances, where one of the instances is a read/write primary and the others are read-only replicas. Writes to the primary are asynchronously propagated to the replicas.

>A Redis (cluster mode enabled) replication group is a collection of shards where one of the shards has a primary...

To keep the rest of the definition the same, the easiest way would be to replace "clusters" -> "instances" in this CMD context.
In a CME context, replication group is essentially the same thing as a cluster.

ElastiCache is a managed service for both Memcached and Redis. The word “cluster” is used in the documentation circumstantially, I agree that describing replication group as a “collection of clusters” is indeed confusing.

For the API question, if we look carefully into the documentation of the APIs you mentioned; CreateCacheCluster and, CreateReplicationGroup - we can come up with some good practices on what to action to use and when and also clarify some of the terminology.

When creating a new Redis cluster, using the CreateCacheCluster will result in a cluster mode disabled deployment with a single primary instance and no replicas. The only way to attach replicas to this cluster would be to create a replication group. Therefore, it is not beneficial to use the CreateCacheCluster API to create a Redis cluster. This API is useful when we want to create a Memcached cluster where we can define 1-40 Memcached instances. Note that Memcached doesn’t support replication.

CreateReplicationGroup allows us to create a cluster mode disabled or a cluster mode enabled deployment. When creating a cluster mode disabled, we can define 1 primary and up to 5 replicas. When creating a cluster mode enabled (Which is preferred, unless you need features that exist only in cluster mode disabled), you can define up to 500 instances (primaries + replicas). The word clusters in that part of the documentation is synonymous to “shards” which should be reworded. Note that CreateReplicationGroup only supports “Redis” for its Engine param.

From CreateReplicationGroup docs:
>This operation is valid for Redis only.

To sum up. I advise to use the CreateReplicationGroup API when creating a Redis deployment and, use CreateCacheCluster when creating a Memcached deployment.

huangapple
  • 本文由 发表于 2023年4月17日 17:32:00
  • 转载请务必保留本文链接:https://go.coder-hub.com/76033657.html
匿名

发表评论

匿名网友

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

确定