Aurora MySQL集群如何识别Read Repli

2024-09-24 08:38:50 发布

您现在位置:Python中文网/ 问答频道 /正文

我们有一堆auroramysql集群,需要使用boto3确定哪些实例是主实例,哪些是读取副本。集群端点的副本名称中有“-ro-”。这是唯一的办法吗? 抱歉,如果这已经得到答复


Tags: 实例名称ro副本集群boto3端点办法
1条回答
网友
1楼 · 发布于 2024-09-24 08:38:50

终于找到了。。。需要使用“describe\u db\u cluster\u endpoints”方法

import boto3
client = boto3.client('rds', 'my-region')
my_cluster = client.describe_db_cluster_endpoints(DBClusterIdentifier='my-aurora-cluster')
print my_cluster

如果查找“EndpointType”,则会有“WRITER”或“READER”

相关问题 更多 >