你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
重要
若要使备用池成功创建和管理资源,需要访问订阅中的关联资源。 确保为备用池资源提供程序分配正确的权限,以便备用池正常运行。 有关详细说明,请参阅 为备用池配置角色权限。
备用池是一种动态资源,当你的工作负载纵向扩展或纵向缩减时,它会与你的规模集保持同步。 本文讨论了如何检索有关备用池及其中实例的各种信息。
备用池详细信息
使用备用池运行时视图 API 获取备用池的当前状态,包括有多少实例可用、预配状态以及正在使用的区域。
az standby-vm-pool status --resource-group myResourceGroup --name myStandbyPool
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/myStandbyPool/runtimeViews/latest",
{
"zone": 1
},
"instanceCountsByState": [
{
"count": 5,
"state": "Creating"
},
{
"count": 0,
"state": "Starting"
},
{
"count": 5,
"state": "Running"
},
{
"count": 0,
"state": "Deallocating"
},
{
"count": 10,
"state": "Deallocated"
},
{
"count": 0
"state": "Hibernating",
},
{
"count": 0
"state": "Hibernated",
},
{
"count": 0,
"state": "Deleting"
}
],
"zone": 2
},
{
"instanceCountsByState": [
{
"count": 0,
"state": "Creating"
},
{
"count": 10,
"state": "Starting"
},
{
"count": 0,
"state": "Running"
},
{
"count": 5,
"state": "Deallocating"
},
{
"count": 5,
"state": "Deallocated"
},
{
"count": 0
"state": "Hibernating",
},
{
"count": 0
"state": "Hibernated",
},
{
"count": 0,
"state": "Deleting"
}
],
"zone": 3
},
{
"instanceCountsByState": [
{
"count": 0,
"state": "Creating"
},
{
"count": 0,
"state": "Starting"
},
{
"count": 5,
"state": "Running"
},
{
"count": 10,
"state": "Deallocating"
},
{
"count": 3,
"state": "Deallocated"
},
{
"count": 0
"state": "Hibernating",
},
{
"count": 0
"state": "Hibernated",
},
{
"count": 5,
"state": "Deleting"
}
],
"name": "latest",
"provisioningState": "Succeeded",
"resourceGroup": "myResourceGroup",
"type": "Microsoft.StandbyPool/standbyVirtualMachinePools/runtimeViews"
}
实例详细信息
当虚拟机位于备用池中时,参数 isVmInStandbyPool
设置为 true。 当虚拟机从池实例移动到规模集时,该参数会自动更新为 false。 这对于确定虚拟机是否准备好接收流量来说很有用。
注释
isVmInStandbyPool
仅当备用池创建了虚拟机时,才会显示该属性。 由规模集直接创建的或附加到规模集的虚拟机将不具有此属性。
az vm get-instance-view --resource-group myResourceGroup --name myVM
"extensions": null,
"hyperVGeneration": "V2",
"isVmInStandbyPool": true,
"maintenanceRedeployStatus": null,
"statuses": [
{
"code": "ProvisioningState/succeeded",
"displayStatus": "Provisioning succeeded",
"level": "Info",
"message": null,
"time": "2024-08-02T17:22:46.295536+00:00"
},
{
"code": "PowerState/deallocated",
"displayStatus": "VM deallocated",
"level": "Info",
"message": null,
"time": null
}
],
后续步骤
查看有关虚拟机规模集备用池的最常见问题解答。