【问题标题】:How create a Redis ElastiCache cluster using AWS-CLI from snapshots in S3?如何使用 AWS-CLI 从 S3 中的快照创建 Redis ElastiCache 集群?
【发布时间】:2017-07-10 03:29:44
【问题描述】:

我要做的是使用 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:

然后我认为是我需要为启用集群的模式分配超过1个节点,所以我将这个参数--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集群呢? 请帮忙。

谢谢。

【问题讨论】:

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


    【解决方案1】:

    API documentation 中所述,redis 不支持 size > 1 的缓存集群。

    另外,对于redis,如果你想从快照中恢复,你必须使用--snapshot-name参数来指定快照而不是--snapshot-arns参数。

    【讨论】:

    • 谢谢。那么从快照恢复重做集群的正确方法是什么?不是单节点 Redis。
    【解决方案2】:

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

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

    每个 AWS Doc

    看起来Replication Group from Scratch 是要走的路。我现在就试试。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-10-24
    • 1970-01-01
    • 2020-07-10
    • 2021-02-05
    • 2019-09-12
    • 2018-05-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多