Ich versuche, Server mit dem Cmdlet Move-AzureDeployment auszutauschen, indem Sie es in meiner Powershell ausführen. Es dauert ungefähr 4 Minuten, bis es von der Inszenierung in die Produktion wechselt. Das ist 4 Minuten Ausfallzeit und es ist nicht wirklich akzeptabel. Wenn ich die Server manuell vom Azure-Portal aus tausche, passiert das fast augenblicklich.Move-AzureDeployment dauert zu lange, um Server auszutauschen?
Ich habe mich gefragt, warum es länger dauert mit dem Cmdlet und was kann ich tun, um dieses Problem zu beheben, weil ich in der Lage sein, meine Staging und Production Server mit Powershell zu tauschen.
Hier ist mein Powershell-Skript:
try
{
$ErrorActionPreference = "stop"
Write-Host "Deploying build build no. $env:build_number to $_serviceName"
#import azure cmdlets module
Write-Host "Importing azure service management modules (i.e for the old portal)"
Import-Module "C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ServiceManagement\Azure\Azure.psd1"
Write-Host "Started Command for Switching Slots"
#Switch slots from Staging to Production
Move-AzureDeployment -ServiceName $_serviceName
Write-Host "Finished Command for Switching Slots"
#make sure deployment is in running state
$deployment = Get-AzureDeployment -servicename $_serviceName -slot $_slotName
Write-Host "$_serviceName is in state $($deployment.status)"
$StopWatch = [System.Diagnostics.Stopwatch]::StartNew() #declare stopwatch
while (($deployment.Status -ne "running") -and ($StopWatch.Elapsed.Hours -lt 2)) #running the loop for a maximum of 2 hours
{
Write-Host "wait 5 seconds before trying again"
Start-Sleep -s 5
$deployment = Get-AzureDeployment -servicename $_serviceName -slot $_slotName
Write-Host "$_serviceName is in state $($deployment.status)"
}
#make sure all roles are in ready state
$nonReadyInstances = (Get-AzureDeployment $_serviceName -Slot $_slotName).RoleInstanceList | Where-Object { $_.InstanceStatus -ne "ReadyRole" } | ft -Property RoleName, InstanceName, InstanceStatus
$nonReadyInstances
$StopWatch = [System.Diagnostics.Stopwatch]::StartNew() #declare stopwatch
while (($nonReadyInstances -ne $null) -and ($StopWatch.Elapsed.Hours -lt 2)) #running the loop for a maximum of 2 hours
{
Write-Host "wait 5 seconds before trying again"
Start-Sleep -s 5
$nonReadyInstances = (Get-AzureDeployment $_serviceName -Slot $_slotName).RoleInstanceList | Where-Object { $_.InstanceStatus -ne "ReadyRole" }
$nonReadyInstances
}
#output deployment id
#$deploymentid = Check-Deployment -serviceName $_serviceName -slotName $_slotName
#Write-Host "Deployed to $_serviceName with deployment id $deploymentid and slot $_slotName"
exit 0
}
catch [System.Exception]
{
Write-Host $_.Exception.ToString()
exit 1
}
Ich sprach mit Microsoft Support Rep und er erwähnt, obwohl sie den VIP-Swap als eine keine Ausfallzeit-Operation, aber in Wirklichkeit gibt es einige Ausfallzeiten damit verbunden ist und das ist, was ich gesehen habe. Ich frage mich, wie wir das schaffen können? – chillax786