amazon-web-services - CloudFormation 中的 Redis 多可用区功能

标签 amazon-web-services redis aws-cloudformation

我正在设计一个包含 Redis 服务的模板,我想在 Redis 中启用多可用区功能,以便在主集群发生故障时,只读副本可以提升为主集群。我查看了 CloudFormation 文档,但找不到此功能,即多可用区。它适用于 RDS 服务,但不适用于 Redis。我能否知道如何包含 redis 功能,例如 AWS 负责自动故障转移?

来源: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-cache-cluster.html

下面列出了可用于弹性缓存的属性列表。

"AutoMinorVersionUpgrade"    : Boolean,
"AZMode"                     : String,
"CacheNodeType"              : String,
"CacheParameterGroupName"    : String,
"CacheSecurityGroupNames"    : [ String, ... ],
"CacheSubnetGroupName"       : String,
"ClusterName"                : String,
"Engine"                     : String,
"EngineVersion"              : String,
"NotificationTopicArn"       : String,
"Port"                       : Integer,
"PreferredAvailabilityZone"  : String,
"PreferredAvailabilityZones" : [String, ... ],
"PreferredMaintenanceWindow" : String,
"SnapshotArns"               : [String, ... ],
"SnapshotName"               : String,
"SnapshotRetentionLimit"     : Integer,
"SnapshotWindow"             : String,
"Tags"                       : [Resource Tag, ...],
"VpcSecurityGroupIds"        : [String, ...]

最佳答案

这是您可以将 Redis 设置为以编程方式使用多可用区的两种方法。

使用 CLI

aws elasticache modify-replication-group \
    --replication-group-id myReplGroup \
    --automatic-failover-enabled 

使用Elasticache API

https://elasticache.us-west-2.amazonaws.com/
    ?Action=ModifyReplicationGroup
    &AutoFailover=true
    &ReplicationGroupId=myReplGroup
    &Version=2015-02-02
    &SignatureVersion=4
    &SignatureMethod=HmacSHA256
    &Timestamp=20140401T192317Z
    &X-Amz-Credential=<credential>

这是您在为 Redis 选择多可用区时应阅读的一些注意事项。

http://docs.aws.amazon.com/AmazonElastiCache/latest/UserGuide/AutoFailover.html#AutoFailover.Notes

下面是云形成的属性:

{
  "Type" : "AWS::ElastiCache::ReplicationGroup",
  "Properties" : {
    "AutomaticFailoverEnabled" : Boolean,
    "AutoMinorVersionUpgrade" : Boolean,
    "CacheNodeType" : String,
    "CacheParameterGroupName" : String,
    "CacheSecurityGroupNames" : [ String, ... ],
    "CacheSubnetGroupName" : String,
    "Engine" : String,
    "EngineVersion" : String,
    "NotificationTopicArn" : String,
    "NumCacheClusters" : Integer,
    "Port" : Integer,
    "PreferredCacheClusterAZs" : [ String, ... ],
    "PreferredMaintenanceWindow" : String,
    "ReplicationGroupDescription" : String,
    "SecurityGroupIds" : [ String, ... ],
    "SnapshotArns" : [ String, ... ],
    "SnapshotRetentionLimit" : Integer,
    "SnapshotWindow" : String
  }
}

您必须针对多可用区调整此属性

自动故障转移已启用

指示是否启用多可用区。启用多可用区后,如果现有主集群发生故障,只读副本会自动提升为读写主集群。如果指定 true,则必须为 NumCacheNodes 属性指定大于 1 的值。默认情况下,AWS CloudFormation 将该值设置为 true。

有关多可用区的更多信息,请参阅 Multi-AZ with Redis Replication Groups在 Amazon ElastiCache 用户指南中。

注意 您无法为早于 2.8.6 的 Redis 版本或 T1 和 T2 缓存节点类型启用自动故障转移。 必填:否

类型: bool 值

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticache-replicationgroup.html

关于amazon-web-services - CloudFormation 中的 Redis 多可用区功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38619473/

相关文章:

Python编码错误? Unicode解码错误: 'ascii' codec can't decode byte ordinal not in range(128)

amazon-web-services - 我需要在 IAM 策略中添加什么来授予 API Gateway 资源标签处理权限?

amazon-web-services - 将 S3 中存储的 .csv 文件迁移到 DynamoDB 的方法?

java - Spring Security 与 Redis 的并发控制

amazon-web-services - AWS CloudFormation 用于更新(重新运行?)下游嵌套堆栈

amazon-web-services - 云信息 : parameterize the name of a parameter?

python - 如何在我的模板 View python django 中查看 redis json 数据

caching - 如何使用golang(beego)在redis中放置没有过期的缓存

amazon-web-services - 如何同步EC2实例

amazon-web-services - 是否可以通过cloudformation模板更新资源?