我正在设计一个包含Redis服务的模板,我想在Redis中启用多可用区功能,以便在主群集出现故障时,可以将只读副本提升为主要副本。我查看了CloudFormation文档,但我找不到此功能,即多可用区。它可用于RDS服务,但不适用于Redis。我是否可以知道如何为redis提供此功能,以便AWS负责自动故障转移?
下面列出了可用于弹性缓存的属性列表。
"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, ...]
答案 0 :(得分:2)
这是您可以通过两种方式将Redis设置为以编程方式使用Multi Az。
使用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选择Multi Az时应阅读的一些注释。
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
}
}
您必须为Multi Az调整此属性
AutomaticFailoverEnabled
指示是否启用了多可用区。启用多可用区时,如果现有主群集出现故障,则只读副本将自动提升为读写主群集。如果指定true,则必须为NumCacheNodes属性指定大于1的值。默认情况下,AWS CloudFormation将值设置为true。
有关多可用区的更多信息,请参阅Amazon ElastiCache用户指南中的Multi-AZ with Redis Replication Groups。
请注意 您无法为2.8.6之前的Redis版本或T1和T2缓存节点类型启用自动故障转移。 必填:否
类型:布尔值