简体   繁体   English

AWS RDS aurora-通过boto3或AWS CLI创建跨区域读取副本

[英]AWS RDS aurora - create cross region read replica - via boto3 or aws cli

AWS RDS aurora mysql - from console we can do "cross region read replica" and its working . AWS RDS aurora mysql-从控制台,我们可以执行“跨区域读取副本”及其工作。

but I don't see any option to do so with - AWS CLI - Boto3 但我看不到这样做的任何选择-AWS CLI-Boto3

What I found is with boto3 we can do replication for cluster but not for instance . 我发现通过boto3,我们可以为群集执行复制操作,但不能进行复制。

Please suggest if am missing something as am working on lambda function to do below operation once any new aurora rds instance being created - create cross region read replica on "Oregon" region 请建议是否在创建任何新的aurora rds实例后在lambda函数上执行以下操作时丢失某些东西-在“俄勒冈州”区域上创建跨区域读取副本

If you are referring to creating a Cross-Region Read Replica , then the boto3 documentation says this for the create_db_cluster command : 如果您要创建跨区域只读副本 ,则boto3文档会针对create_db_cluster命令对此进行说明:

You can use the ReplicationSourceIdentifier parameter to create the DB cluster as a Read Replica of another DB cluster or Amazon RDS MySQL DB instance. 您可以使用ReplicationSourceIdentifier参数将数据库集群创建为另一个数据库集群或Amazon RDS MySQL数据库实例的只读副本。

Commands for Aurora always refer to a cluster whereas commands for non-Aurora Amazon RDS instances refer to instance . 用于Aurora的命令始终引用集群,而用于非Aurora Amazon RDS实例的命令引用instance

This is very tricky. 这非常棘手。 It seems like you should create two or above instances to associate with cluster you created. 似乎您应该创建两个或以上实例以与您创建的集群相关联。 The two instances should be in different zones, then the cluster will use the first as writer, the others as read replica. 这两个实例应该位于不同的区域中,然后群集将使用第一个实例作为写入器,而其他实例作为读取副本。 The Multi-AZ field will show "2 zones" (depends on how many zones you use to create instances) 多可用区字段将显示“ 2个区域”(取决于您用于创建实例的区域数)

Pseudo code like: 伪代码如下:

 cluster_response = rds.create_db_instance(....)

 instance_response = rds.create_db_instance(
          DBInstanceIdentifier='name1',
          DBInstanceClass='instance_type',
          AvailabilityZone='zone1',
          Engine=aurora-mysql,
          DBClusterIdentifier=cluster_response['DBCluster']['DBClusterIdentifier'],
 )

 instance_response = rds.create_db_instance(
          DBInstanceIdentifier='name2',
          DBInstanceClass='instance_type',
          AvailabilityZone='zone2',
          Engine=aurora-mysql,
          DBClusterIdentifier=cluster_response['DBCluster']['DBClusterIdentifier'],
 )

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM