[英]Can we promote RDS read replica to primary using cloud formation template?
我们可以使用控制台和 CLI 轻松提升 RDS 只读副本,但是有没有办法让主访问意味着使用云形成提升主访问?
CloudFormation uses the property "SourceDBInstanceIdentifier" to determine whether a DBInstance is a read replica or not. CloudFormation 使用“SourceDBInstanceIdentifier”属性来确定 DBInstance 是否为只读副本。 If this property has any non-empty value, the DBInstance will be created as a read replica.
如果此属性具有任何非空值,则 DBInstance 将创建为只读副本。
If you remove this property once a read replica is created and update your CloudFormation stack, a new DBInstance will be created that won't be a read replica, it will be it's own standalone database.如果您在创建只读副本后删除此属性并更新您的 CloudFormation 堆栈,则会创建一个新的 DBInstance,它不是只读副本,而是它自己的独立数据库。 However, the new standalone database will not have the contents of the read replica.
但是,新的独立数据库将没有只读副本的内容。
The solution to this will be to regularly back up your read replica.对此的解决方案是定期备份您的只读副本。 When you want to promote your read replica, remove "SourceDBInstanceIdentifier" and set "DBSnapshotIdentifier" to the most recent snapshot of the read replica.
如果要提升只读副本,请删除“SourceDBInstanceIdentifier”并将“DBSnapshotIdentifier”设置为只读副本的最新快照。 This should effectively promote your read replica to master with most the data still intact
这应该有效地将您的只读副本提升为 master,并且大部分数据仍然完好无损
The RDS standby replica (multi-az) will automatically be switched to master in case of failures on the master node. RDS备用副本(multi-az)会在master节点出现故障时自动切换到master。
How you setup the multi-az replica (could be through cloudformation) will determine the automatic switch over.您如何设置多可用区副本(可以通过 cloudformation)将决定自动切换。 Please note that the standby replica becomes the master only when there is an AZ outage, primary instance fail, software patching and not when there is scenarios of locks or database level operation timeouts.
请注意,备用副本仅在出现可用区中断、主实例故障、软件补丁时才成为主副本,而不会出现锁定或数据库级操作超时的情况。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.