2016-07-27 60 views
2

我正在设计一个包含Redis服务的模板,并且我希望在Redis中启用多可用区功能,以便在主群集故障时,只读副本可以升级为主要副本。我查看了CloudFormation文档,但找不到这个功能,即多可用区。它可用于RDS服务,但不适用于Redis。我能否知道如何将这个功能包含在Redis中,例如AWS会自动处理故障转移?CloudFormation中的Redis多可用区功能

来源: 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, ...] 

回答

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> 

这一些,而选择多AZ获取的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 
    } 
} 

你必须调整这个属性的多了Az

AutomaticFailoverEnabled

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

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

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

类型:Boolean

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

+0

感谢error2007s但我想这个功能是Redis的集群CloudFormation模板的一部分。有什么方法可以配置吗? – Momooo

+0

查看我编辑的答案 – error2007s

+0

感谢错误。这只是memcached支持,但redis引擎呢? – Momooo