在 Azure 门户中管理云服务Manage Cloud Services in the Azure portal

在 Azure 门户的“云服务”区域中,可以:In the Cloud Services area of the Azure portal, you can:

  • 更新服务角色或部署。Update a service role or a deployment.
  • 将预留部署升级到生产环境。Promote a staged deployment to production.
  • 将资源链接到云服务,以便可以查看资源依赖关系和对资源进行整体缩放。Link resources to your cloud service so that you can see the resource dependencies and scale the resources together.
  • 删除云服务或部署。Delete a cloud service or a deployment.

有关如何缩放云服务的详细信息,请参阅如何在门户中为云服务配置自动缩放For more information about how to scale your cloud service, see Configure auto-scaling for a cloud service in the portal.

更新云服务角色或部署Update a cloud service role or deployment

如果需要更新云服务的应用程序代码,请使用云服务边栏选项卡上的“更新” 。If you need to update the application code for your cloud service, use Update on the cloud service blade. 可以更新一个角色或所有角色。You can update a single role or all roles. 若要进行更新,可以上传新服务包或服务配置文件。To update, you can upload a new service package or service configuration file.

  1. Azure 门户中,选择要更新的云服务。In the Azure portal, select the cloud service you want to update. 此步骤打开云服务实例边栏选项卡。This step opens the cloud service instance blade.

  2. 在边栏选项卡上,选择“更新”。On the blade, select Update.

    更新按钮

  3. 使用新服务包文件 (.cspkg) 和服务配置文件 (.cscfg) 更新部署。Update the deployment with a new service package file (.cspkg) and service configuration file (.cscfg).

    更新部署

  4. (可选)更新存储帐户和部署标签。Optionally, update the storage account and the deployment label.

  5. 如果任何角色只有一个角色实例,请选择“即使一个或多个角色包含单个实例也进行部署”复选框,使升级能够继续进行。If any roles have only one role instance, select the Deploy even if one or more roles contain a single instance check box to enable the upgrade to proceed.

    如果每个角色至少具有两个角色实例(虚拟机),那么 Azure 在云服务更新期间只能保证 99.95% 的服务可用性。Azure can guarantee only 99.95 percent service availability during a cloud service update if each role has at least two role instances (virtual machines). 因为有两个角色实例,因此其中一个虚拟机可以在另一个虚拟机更新时处理客户端请求。With two role instances, one virtual machine processes client requests while the other is updated.

  6. 选中“开始部署”复选框,以便在上传包完成后应用更新。Select the Start deployment check box to apply the update after the upload of the package has finished.

  7. 选择“确定”开始更新服务。Select OK to begin updating the service.

交换部署以将预留部署升级到生产环境Swap deployments to promote a staged deployment to production

如果决定部署云服务的新版本,可以在云服务过渡环境中暂存和测试新版本。When you decide to deploy a new release of a cloud service, stage and test your new release in your cloud service staging environment. 使用“交换”将用于寻址这两个部署的 URL 地址互换,将新版本提升到生产环境。Use Swap to switch the URLs by which the two deployments are addressed and promote a new release to production.

可以通过“云服务” 页面或仪表板交换部署。You can swap deployments from the Cloud Services page or the dashboard.

  1. Azure 门户中,选择要更新的云服务。In the Azure portal, select the cloud service you want to update. 此步骤打开云服务实例边栏选项卡。This step opens the cloud service instance blade.

  2. 在边栏选项卡上,选择“交换”。On the blade, select Swap.

    云服务“交换”按钮

  3. 将打开以下确认提示:The following confirmation prompt opens:

    云服务交换

  4. 验证部署信息后,选择“确定”交换部署。After you verify the deployment information, select OK to swap the deployments.

    交换部署的速度很快,因为唯一发生更改的是部署所用的虚拟 IP 地址 (VIP)。The deployment swap happens quickly because the only thing that changes is the virtual IP addresses (VIPs) for the deployments.

    若要节省计算成本,可以在验证生产部署是否能够按预期运行后删除过渡部署。To save compute costs, you can delete the staging deployment after you verify that your production deployment is working as expected.

有关交换部署的常见问题Common questions about swapping deployments

交换部署的先决条件是什么?What are the prerequisites for swapping deployments?

成功的部署交换有两个先决条件:There are two key prerequisites for a successful deployment swap:

  • 如果想要将静态 IP 地址用于生产槽,还必须为过渡槽保留一个静态 IP 地址。If you want to use a static IP address for your production slot, you must reserve one for your staging slot as well. 否则,交换将失败。Otherwise, the swap fails.

  • 在执行交换之前,角色的所有实例必须都在运行。All instances of your roles must be running before you can perform the swap. 可在 Azure 门户的“概述”边栏选项卡中检查实例的状态。You can check the status of your instances on the Overview blade of the Azure portal. 或者,可以在 Windows PowerShell 中使用 Get-AzureRole 命令。Alternatively, you can use the Get-AzureRole command in Windows PowerShell.

请注意,来宾 OS 更新和服务修复操作也会导致部署交换失败。Note that guest OS updates and service healing operations also can cause deployment swaps to fail. 有关详细信息,请参阅排查云服务部署问题For more information, see Troubleshoot cloud service deployment problems.

应用程序的交换是否会导致停机?应如何处理它?Does a swap incur downtime for my application? How should I handle it?

如上一部分中所述,部署交换通常非常快,因为它只更改 Azure 负载均衡器中的配置。As described in the previous section, a deployment swap is typically fast because it's just a configuration change in the Azure load balancer. 在某些情况下,它会需要 10 秒或更长时间并导致暂时性连接故障。In some cases, it can take 10 or more seconds and result in transient connection failures.

删除部署和云服务Delete deployments and a cloud service

必须先删除每个现有部署,才能删除云服务。Before you can delete a cloud service, you must delete each existing deployment.

为节省计算成本,可以在验证生产部署能够按预期运行后删除过渡部署。To save compute costs, you can delete the staging deployment after you verify that your production deployment is working as expected. 停止的已部署角色实例仍会产生计算成本。You are billed for compute costs for deployed role instances that are stopped.

可使用以下过程删除部署或云服务。Use the following procedure to delete a deployment or your cloud service.

  1. Azure 门户中,选择要删除的云服务。In the Azure portal, select the cloud service you want to delete. 此步骤打开云服务实例边栏选项卡。This step opens the cloud service instance blade.

  2. 在边栏选项卡上,选择“删除”。On the blade, select Delete.

    云服务“删除”按钮

  3. 若要删除整个云服务,请选中“云服务及其部署”复选框。To delete the entire cloud service, select the Cloud service and its deployments check box. 或者,可以选中“生产部署”或“过渡部署”复选框。Or you can choose either the Production deployment or the Staging deployment check box.

    云服务删除

  4. 选择底部的“删除”。Select Delete at the bottom.

  5. 若要删除云服务,请选择“删除云服务”。To delete the cloud service, select Delete cloud service. 然后在出现确认提示时选择“是”。Then, at the confirmation prompt, select Yes.

Note

删除云服务时,如果已配置详细监视,则必须从存储帐户中手动删除数据。When a cloud service is deleted and verbose monitoring is configured, you must delete the data manually from your storage account. 有关在何处查找指标表的信息,请参阅云服务监视简介For information about where to find the metrics tables, see Introduction to cloud service monitoring.

查找有关部署失败的详细信息Find more information about failed deployments

“概述”边栏选项卡的顶部提供了一个状态栏。The Overview blade has a status bar at the top. 选择状态栏时,会打开新的边栏选项卡并显示错误信息。When you select the bar, a new blade opens and displays any error information. 如果部署没有任何错误,则信息边栏选项卡为空白。If the deployment doesn't contain any errors, the information blade is blank.

云服务概述

后续步骤Next steps