如何使用AWS-CLI从S3中的快照创建Redis ElastiCache集群?

时间:2017-02-20 18:09:52

标签: amazon-web-services amazon-s3 redis aws-cli amazon-elasticache

我要做的是使用aws-cli根据S3中的ElastiCache快照创建ElastiCache群集,而我的ElastiCache是​​启用群集的模式。

我按照tutorial创建了一个支持群集的Redis缓存,这是我的命令: aws elasticache create-cache-cluster --cache-cluster-id stevescachecluster1 --cache-node-type cache.m4.large --engine redis --engine-version 3.2.4 --cache-parameter-group default.redis3.2.cluster.on --num-cache-nodes 1 --snapshot-arns arn:aws:s3:::MY_S3_BUCKET-elasticache/stevesun-elasticache-0002.rdb --cache-subnet-group-name my-cache-dev

由于以上命令失败 An error occurred (InvalidParameterCombination) when calling the CreateCacheCluster operation: Cluster mode should be disabled in parameter group, but found it is enabled.

这让我感到困惑,上面链接的教程明确表示如果你想要一个支持集群模式的缓存,请在你的参数中使用 .cluster.on 选项

然后我更多地查看了这个aws-cli命令reference:对于此参数:--cache-parameter-group-name,其文档说明:You cannot use any parameter group which has cluster-enabled='yes' when creating a cluster.

这个cli参考文档对于那个cli教程不是这个矛盾吗?

请在我明白错误的地方纠正我。 此外,如何从S3快照创建启用集群模式的缓存?

感谢。

我查了一下,发现3.2.4是AWS ElatiCache现在拥有的最新version

编辑1:

然后我使用此命令创建了一个单节点缓存: aws elasticache create-cache-cluster --cache-cluster-id stevescachecluster1 --cache-node-type cache.m4.large --engine redis --engine-version 3.2.4 --cache-parameter-group default.redis3.2 --num-cache-nodes 1 --snapshot-arns arn:aws:s3:::MY_S3_BUCKET-elasticache/stevesun-elasticache-0002.rdb --cache-subnet-group-name my-cache-dev

然后我进入控制台并选择了我新推出的单节点缓存并单击了Modify,我尝试将其更改为cluster.on,但是遇到了这个异常: The parameter cluster-enabled has a different value in the requested parameter group than the current parameter group. This parameter value cannot be changed for a cache cluster.

因此,我首先尝试启动单节点缓存然后将其更改为群集模式也失败了。

编辑2:

然后我认为我需要为启用群集的模式分配多个节点,因此我将此参数--num-cache-nodes更改为2,但我遇到了以下异常: An error occurred (InvalidParameterValue) when calling the CreateCacheCluster operation: Cannot create a Redis cluster with a NumCacheNodes parameter greater than 1. 这对我来说更加困惑,一个集群肯定需要超过1个节点,那为什么它不允许大于1?

虽然documentation表示For clusters running Redis, this value must be 1.。为什么这个要求?那么我们如何从快照创建一个新的redis集群呢? 请帮助。

感谢。

2 个答案:

答案 0 :(得分:0)

API documentation中所述,缓存群集的大小为> redis时不支持1。

此外,对于redis,如果要从快照还原,则必须使用--snapshot-name参数指定快照而不是--snapshot-arns参数。

答案 1 :(得分:0)

创建Redis(已启用集群模式)群集(AWS CLI)

无法使用create-cache-cluster操作创建Redis(已启用集群模式)群集(API / CLI:复制组)。要创建Redis(已启用集群模式)集群(API / CLI:复制组),请参阅从Scratch创建Redis(已启用集群模式)复制组(AWS CLI)。

每个AWS Doc

看起来Replication Group from Scratch是可行的方法。我现在就试试吧。