AWS ElastiCache 集群和 AWS ElastiCache 复制组有什么区别?

What is the difference between AWS ElastiCache Cluster and AWS ElastiCache Replication Group?

在 terraform/cloudformation 文档中,有两种不同的资源可用于创建 ElastiCache Redis 实例:

  1. aws_elasticache_cluster (https://www.terraform.io/docs/providers/aws/r/elasticache_cluster.html)
  2. aws_elasticache_replication_group (https://www.terraform.io/docs/providers/aws/r/elasticache_replication_group.html)

这两者有什么区别?我应该选择哪一个?

A replication group is a collection of cache clusters, where one of the clusters is a primary read-write cluster and the others are read-only replicas.

AWS::ElastiCache::CacheCluster

AWS::ElastiCache::ReplicationGroup

简单来说,复制组是针对Redis集群的,缓存集群是针对Memcache的。您不能将该命令应用于其他人,即 Redis 集群的缓存集群,反之亦然。

redis也可以使用aws_elasticache_cluster但前提是当redis有节点1时,那不是集群模式。

num_cache_nodes – (Required unless replication_group_id is provided) The initial number of cache nodes that the cache cluster will have. For Redis, this value must be 1. For Memcache, this value must be between 1 and 20. If this number is reduced on subsequent runs, the highest numbered nodes will be removed.