【发布时间】:2021-02-24 09:32:26
【问题描述】:
我在美国西部有一个 Azure 存储帐户,启用了异地复制以与美国东部同步,我想根据需要使用 bash 脚本执行故障转移。
我已经定义了以下函数
_STORAGE_ACCOUNT_FAILOVER () {
echo "Storage account failover is initiated.."
az storage account failover --name $STORAGEACCOUNT --no-wait --yes
echo "Storage account failover is completed successfully.."
}
在尝试执行上述功能时,我收到以下错误
ERROR: (ResourceCollectionRequestsThrottled) Operation 'Microsoft.Storage/storageAccounts/read' failed as server encountered too many requests.
Please try after '17' seconds. Tracking Id is ''.
如果出现任何问题,我想实现重试逻辑?如何实现重试逻辑?
类似
_STORAGE_ACCOUNT_FAILOVER () {
echo "Storage account failover is initiated.."
performFailover:
az storage account failover --name $STORAGEACCOUNT --no-wait --yes
if [ "$?" -ne 0 ]; then
goto performFailover;
fi
echo "Storage account failover is completed successfully.."
}
或类似的东西
_STORAGE_ACCOUNT_FAILOVER () {
echo "Storage account failover is initiated.."
while true; do
az storage account failover --name $STORAGEACCOUNT --no-wait --yes
if [ "$?" -eq 0 ]; then
break;
fi
sleep 30s
done
echo "Storage account failover is completed successfully.."
}
【问题讨论】:
标签: bash azure azure-storage-account