gpt4 book ai didi

amazon-web-services - 如何确定 Redis(已启用集群模式)复制组中的主要端点

转载 作者:行者123 更新时间:2023-12-05 06:23:20 24 4
gpt4 key购买 nike

我们有一个集群 Redis 设置(引擎版本 5.04),三个节点组每个都在自己的 AZ 中,每个组包含三个节点,在传输和静止时启用加密。 Stunnel 在堡垒主机上配置,这允许我运行 bash 脚本以在需要时刷新每个主副本(在升级我们的应用程序期间)。

通过控制台应用最新的 Redis 软件补丁后,由于自动故障转移,每个节点组中的主要端点都发生了变化,我正在寻找确定新主要端点的最佳方法,以便我的 bash 脚本可以相应地更新.

documentation声明运行 aws elasticache describe-replication-groups --replication-group-id my-replication-group 应该指示节点组成员的 CurrentRole,例如

"NodeGroupMembers": [
{
"CurrentRole": "primary",
"PreferredAvailabilityZone": "us-west-2a",
"CacheNodeId": "0001",
"ReadEndpoint": {
"Port": 6379,
"Address": "myreplgroup-001.1abc4d.0001.usw2.cache.amazonaws.com"
},
"CacheClusterId": "myreplgroup-001"
},
{
"CurrentRole": "replica",
"PreferredAvailabilityZone": "us-west-2b",
"CacheNodeId": "0001",
"ReadEndpoint": {
"Port": 6379,
"Address": "myreplgroup-002.1abc4d.0001.usw2.cache.amazonaws.com"
},
"CacheClusterId": "myreplgroup-002"
},
{
...
}
]

我对此命令的响应根本不包含 CurrentRole:

"NodeGroupMembers": [
{
"PreferredAvailabilityZone": "ap-southeast-2c",
"CacheNodeId": "0001",
"CacheClusterId": "my-replication-group-0001-001"
},
{
"PreferredAvailabilityZone": "ap-southeast-2b",
"CacheNodeId": "0001",
"CacheClusterId": "my-replication-group-0001-002"
},
{
"PreferredAvailabilityZone": "ap-southeast-2a",
"CacheNodeId": "0001",
"CacheClusterId": "my-replication-group-0001-003"
}
]

是否有可用于确定主要终端节点的替代 aws cli 命令?通过控制台对主节点进行故障转移非常容易,但由于我无法通过控制台/cli 确定哪个节点是当前主节点,这意味着猜测需要在我的刷新脚本中定位哪些节点。

最佳答案

我找到了 this paragraph在 Elasticache 的文档中:

Redis (cluster mode enabled) clusters with replicas, because they have multiple shards (API/CLI: node groups), which mean they also have multiple primary nodes, have a different endpoint structure than Redis (cluster mode disabled) clusters. Redis (cluster mode enabled) has a configuration endpoint which "knows" all the primary and node endpoints in the cluster. Your application connects to the configuration endpoint. Whenever your application writes to or reads from the cluster's configuration endpoint, Redis, behind the scenes, determines which shard the key belongs to and which endpoint in that shard to use. It is all quite transparent to your application.

我猜您提供的示例输出是针对禁用了集群模式的复制组的,因为该片段来自与上述相同的文章:

Redis (cluster mode disabled) clusters with replicas have three types of endpoints; the primary endpoint, the reader endpoint and the node endpoints.

我知道这可能是一个有争议的问题(因为你在 2 年前问过这个问题),但如果你需要刷新集群中的主节点(启用集群模式),只需使用配置端点,更改将传播到每个节点。

关于amazon-web-services - 如何确定 Redis(已启用集群模式)复制组中的主要端点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58443808/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com