我在EC2-Classic中有一个很重的RDS实例(MySQL),有三个只读副本实例。 我们正计划将一些微服务转移到VPC中,其中一些需要阅读这些副本实例(我们还没有计划在中期将这些RDS实例完全转移到VPC)。 我想到的第一个想法是在VPC内创build一个只读副本(我已经创build了一个子网组),但是我收到了错误信息:
At least one security group 'xxxxx' (Non-VPC) and subnet group 'dbsubnetgroup' (in VPC 'vpc-123456') are not in common VPC. (Service: AmazonRDS; Status Code: 400; Error Code: InvalidParameterCombination; Request ID: 5a8f57fb-f5b4-11e5-996f-d16e3527730f)
我试图使用AWS CLI来实现这一点:
aws rds create-db-instance-read-replica --db-instance-identifier replica-name --source-db-instance-identifier spurce-name --db-subnet-group-name sbsubnetgroup-name --region us-east-1 A client error (DBSubnetGroupNotAllowedFault) occurred when calling the CreateDBInstanceReadReplica operation: DbSubnetGroupName should not be specified for read replicas that are created in the same region as the master
所以,据我所知,这种复制在同一地区是不允许的,但它只能以跨地域的方式工作?
有没有办法解决它?
提前致谢
是的,它在区域内工作,但在一个区域内,除了在单个VPC内,它不能工作。
尽pipe如此,还是有一些解决方法。
您不需要创build副本,而是创build一个主副本。 使用原始主服务器的转储加载它,然后自己将其configuration为临时从“外部”主服务器进行复制。 在每个RDS实例上都有存储过程来完成这个过程,因为缺lessSUPER特权,否则就不可能。
请参阅使用Amazon RDS外部运行的MySQL或MariaDB实例进行复制 。
您将不得不跳过步骤1和步骤4,并find另一种方法来防止在启动转储文件时写入主文件,因为RDS将不允许FLUSH TABLES WITH READ LOCK; 。