点击下面的链接:
http://docs.aws.amazon.com/AmazonElastiCache/latest/UserGuide/ClientConfig.ReplicationGroup.html
目前存在以下内容:
REPLICATIONGROUP my-repgroup My replication group available
CLUSTERID my-redis-primary
CLUSTERID my-replica-1
NODEGROUP 0001 my-repgroup.f310xz.ng.0001.cache.amazonaws.com 6379 available
NODEGROUPMEMBER my-redis-primary 0001 my-redis-primary.f310xz.0001.cache.amazonaws.com 6379 us-west-2a primary
NODEGROUPMEMBER my-replica-1 0001 my-replica-1.f310xz.0001.cache.amazonaws.com 6379 us-west-2b replica
Connecting to Clusters in a Replication Group (ElastiCache API)在上图中,最右边
有‘主’和‘副本’
从今天起,在aws控制台中,
当我发出“describe-replication-groups”命令
我看不到‘主’和‘副本’
相反,我看到的内容如下所示:
"NodeGroupMembers": [
{
"PreferredAvailabilityZone": "us-west-2b",
"CacheNodeId": "0001",
"CacheClusterId": "ec-redis-cluster1-0001-001"
},
{
"PreferredAvailabilityZone": "us-west-2b",
"CacheNodeId": "0001",
"CacheClusterId": "ec-redis-cluster1-0001-002"
},
{
"PreferredAvailabilityZone": "us-west-2b",
"CacheNodeId": "0001",
"CacheClusterId": "ec-redis-cluster1-0001-003"
}
]我试过各种命令,都没找到。
我可以通过什么方式查看某些碎片/节点是否是主/复制副本的详细信息
提前感谢
发布于 2019-03-20 16:48:30
echo "cluster nodes" | redis-cli -c -h redis-cluster | grep master
发布于 2019-06-12 18:42:00
AWS Elasticache Redis设置创建为多节点设置时有两种模式-群集模式启用和禁用,如here所述。这对手头的问题很重要。
如果您的ElastiCache群集中处于群集模式,则禁用,然后执行
aws describe-elasticache-replication-groups --replication-group-id test-1 将显示类似以下内容的输出:
{
"CurrentRole": "replica",
"PreferredAvailabilityZone": "us-west-1c",
"CacheNodeId": "0001",
"ReadEndpoint": {
"Port": 6379,
"Address": "xxxx"
},
"CacheClusterId": "xxxx"
},
{
"CurrentRole": "primary",
"PreferredAvailabilityZone": "us-west-1c",
"CacheNodeId": "0001",
"ReadEndpoint": {
"Port": 6379,
"Address": "xxxx"
},
"CacheClusterId": "xxxx"
}这将帮助您确定目标节点的主角色或副本角色。密钥CurrentRole在AWS Elasticache群集模式enabled中不可用
aws describe-elasticache-replication-groups --replication-group-id test-2 将显示类似于以下内容的输出:
{
"PreferredAvailabilityZone": "us-west-1c",
"CacheNodeId": "0001",
"CacheClusterId": "xxxxx"
},
{
"PreferredAvailabilityZone": "us-west-1c",
"CacheNodeId": "0001",
"CacheClusterId": "xxxxxxx"
},上面的输出没有、CurrentRole、或任何其他相应的键来深入了解节点的角色。在这种情况下,您有两个选择:
aws cloudwatch get-metric-data --cli-input-json file://test.json
其中test.json看起来像这样:
{
"MetricDataQueries": [
{
"Id": "is_master_test",
"MetricStat": {
"Metric": {
"Namespace": "AWS/ElastiCache",
"MetricName": "IsMaster",
"Dimensions": [
{
"Name": "CacheClusterId",
"Value": "xxxxx"
},
{
"Name": "CacheNodeId",
"Value": "0001"
}
]
},
"Period": 60,
"Stat": "Minimum",
"Unit": "Count"
},
"Label": "is_master_test",
"ReturnData": true
}
],
"StartTime": "2019-06-12T10:08:0000",
"EndTime": "2019-06-12T10:09:0000"
}如果目标节点是主节点,则输出将如下所示:
{
"MetricDataResults": [
{
"Timestamps": [
"2019-06-12T10:05:00Z"
],
"StatusCode": "Complete",
"Values": [
1.0
],
"Id": "is_master_test",
"Label": "is_master_test"
}
]
}如果目标节点不是主节点,则输出将如下所示:
{
"MetricDataResults": [
{
"Timestamps": [
"2019-06-12T10:05:00Z"
],
"StatusCode": "Complete",
"Values": [
0.0
],
"Id": "is_master_test",
"Label": "is_master_test"
}
]
}请注意,我使用指标"Minimum“来检查此节点是否至少在最后1分钟内作为Master。
https://stackoverflow.com/questions/42061598
复制相似问题