【问题标题】:Application version management for VM's in Azure Autoscaling groupAzure 自动缩放组中 VM 的应用程序版本管理
【发布时间】:2018-05-14 01:34:06
【问题描述】:

目前,我正在使用自动缩放的 Azure VM 运行应用程序。所以,假设我当前的应用程序版本,即 1.0 由 4 个 VM 提供服务,根据应用程序的当前负载。 现在,如果我有一个补丁更新并发布了一个新版本的应用程序,即 2.0,那么这个新版本的应用程序将如何更新到当前 VM 的运行状态? 如果负载增加,并且新的虚拟机启动,他们都将拥有这个新版本的应用程序 2.0,但是之前运行的 4 个虚拟机,他们会拥有这个新版本的应用程序吗?如果是,如何?

【问题讨论】:

    标签: azure cloud azure-web-app-service devops autoscaling


    【解决方案1】:

    您必须从 ARM 模板启动 Azure VMSS,并将自定义映像作为源映像,而不是来自市场的映像。要更新 VM 上的应用程序,请再次创建具有更新应用程序的 VM 的自定义映像,然后使用 Powershell 在 VMSS 中更新此新 VM。然后,Azure VMSS 会使用更新的映像自动更新规模集中的所有 VM。以下是使用新的自定义映像更新现有 VMSS 的代码。

        $rgname = "myrg"
        $vmssname = "myvmss"
        # get the VMSS model
        $vmss = Get-AzureRmVmss -ResourceGroupName $rgname -VMScaleSetName $vmssname
        # set the new version in the model data
        $vmss.virtualMachineProfile.storageProfile.imageReference.id = $newImageReference
        # update the virtual machine scale set model
        Update-AzureRmVmss -ResourceGroupName $rgname -Name $vmssname -VirtualMachineScaleSet $vmss
        # now start updating instances
        Update-AzureRmVmssInstance -ResourceGroupName $rgname -VMScaleSetName $vmssname -InstanceId $instanceId
    

    【讨论】:

      猜你喜欢
      • 2019-10-21
      • 2018-11-02
      • 2018-02-02
      • 2017-11-21
      • 2021-11-05
      • 2017-10-19
      • 2013-04-23
      • 2018-09-12
      • 2019-10-14
      相关资源
      最近更新 更多