【发布时间】:2017-11-02 07:05:37
【问题描述】:
我想用redis创建一个elasticache实例。
我认为我应该使用它“禁用集群模式”,因为一切都适合一台服务器。 为了没有 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 文档,首先我无法弄清楚我应该在两者之间使用哪种类型:
- 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
既然cloudformer创建了AWS::ElastiCache::CacheCluster我就用它,但我感觉它应该只创建一个资源,并使用NumCacheNodes参数来创建两个资源。
redis 无法使用:
NumCacheNodes-
AZMode和PreferredAvailabilityZones
所以我不知道如何使这个解决方案多可用区...
【问题讨论】:
标签: redis amazon-cloudformation amazon-elasticache