Amazon web services 如何确定创建读取副本操作是否已完成
我正在尝试创建生产数据库的读取副本,然后希望将读取副本升级到测试数据库 我已使用此awscli命令创建读取副本Amazon web services 如何确定创建读取副本操作是否已完成,amazon-web-services,amazon-rds,aws-cli,Amazon Web Services,Amazon Rds,Aws Cli,我正在尝试创建生产数据库的读取副本,然后希望将读取副本升级到测试数据库 我已使用此awscli命令创建读取副本 aws rds create-db-instance-read-replica --db-instance-identifier test-database --source-db-instance-identifier production-database --region eu-central-1 我知道我不能立即发出“升级读取副本”命令,因为这样会出错 bash-3.2$ a
aws rds create-db-instance-read-replica --db-instance-identifier test-database --source-db-instance-identifier production-database --region eu-central-1
我知道我不能立即发出“升级读取副本”命令,因为这样会出错
bash-3.2$ aws rds promote-read-replica --db-instance-identifier test-database --region eu-central-1
An error occurred (InvalidDBInstanceState) when calling the PromoteReadReplica operation: DB Instance is not in an available state.
如何检查读取副本是否已成功创建,以便发出“升级读取副本”命令
我试图查询数据库的事件,但返回为空
bash-3.2$ aws rds describe-events --source-identifier test-database --source-type db-instance
{
"Events": []
}
我试图在Jenkins管道中执行此操作,因此必须以编程方式对其进行检查
请告知。您可以使用并创建一个简单的基于while的服务生,以便复制副本可用
例如:
while true; do
db_status=$(aws rds describe-db-instances \
--db-instance-identifier test-database \
--query 'DBInstances[0].DBInstanceStatus' \
--output text)
[[ $db_status != "available" ]] \
&& (echo $db_status; sleep 5) \
|| break
done
echo "Finally ${db_status}"
上述操作将每隔5秒检查测试数据库的状态,直到其可用为止