我想使用redis创建一个弹性缓存实例。AWS cloudformation:如何正确地创建一个redis缓存集群
我认为我应该使用它“集群模式禁用”,因为一切都将适合一台服务器。 为了不拥有SPOF,我想创建一个只读副本,在主服务器出现故障的情况下,AWS将会提升它。 如果可能的话,平衡主机和从机之间的只读操作是非常好的,但它不是强制性的。
我使用aws控制台创建了一个有效的主/读副本,然后使用cloudformer创建了cloudformation json conf。 Cloudformer为我创建了两个未链接的AWS::ElastiCache::CacheCluster
,但是通过阅读文档。我不明白如何将其链接...现在我有这样的配置:
{
"cachehubcache001": {
"Type": "AWS::ElastiCache::CacheCluster",
"Properties": {
"AutoMinorVersionUpgrade": "true",
"AZMode": "single-az",
"CacheNodeType": "cache.t2.small",
"Engine": "redis",
"EngineVersion": "3.2.4",
"NumCacheNodes": "1",
"PreferredAvailabilityZone": { "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "Az1B"]},
"PreferredMaintenanceWindow": "sun:04:00-sun:05:00",
"CacheSubnetGroupName": {
"Ref": "cachesubnethubprivatecachesubnetgroup"
},
"VpcSecurityGroupIds": [
{
"Fn::GetAtt": [
"sgiHubCacheSG",
"GroupId"
]
}
]
}
},
"cachehubcache002": {
"Type": "AWS::ElastiCache::CacheCluster",
"Properties": {
"AutoMinorVersionUpgrade": "true",
"AZMode": "single-az",
"CacheNodeType": "cache.t2.small",
"Engine": "redis",
"EngineVersion": "3.2.4",
"NumCacheNodes": "1",
"PreferredAvailabilityZone": { "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "Az1A"]},
"PreferredMaintenanceWindow": "sun:02:00-sun:03:00",
"CacheSubnetGroupName": {
"Ref": "cachesubnethubprivatecachesubnetgroup"
},
"VpcSecurityGroupIds": [
{
"Fn::GetAtt": [
"sgiHubCacheSG",
"GroupId"
]
}
]
}
},
}
我知道这是错的,但我无法弄清楚如何创建一个正确副本。我无法理解的AWS文档,一开始我想不通至极类型,我应该使用之间:由于cloudformer创建AWS::ElastiCache::CacheCluster
我会去
- http://docs.aws.amazon.com/fr_fr/AWSCloudFormation/latest/UserGuide/aws-resource-elasticache-replicationgroup.html
- http://docs.aws.amazon.com/fr_fr/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-cache-cluster.html
与它,但我有一种感觉,它应该只创建一个资源,并使用NumCacheNodes
参数为了创建两个资源。
Redis的不能使用:
NumCacheNodes
AZMode
和PreferredAvailabilityZones
,所以我不知道如何使这个解决方案多AZ ...