手动回滚应用程序/服务 [英] Manual rollback of an application / service

查看:84
本文介绍了手动回滚应用程序/服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Service Fabric应用程序,下面有一些服务.它们目前都位于1.0.0版.

I have a Service Fabric application with a few services underneath it. They are all currently sitting at version 1.0.0.

我将更新发布到2.0.0版的集群中.一切运行正常,部署成功.我注意到一个很大的版本.有没有办法手动回滚到1.0.0版?我唯一发现的是升级过程中的自动回滚.

I deploy an update out to the cluster for version 2.0.0. Everything is running fine and the deployment succeeds. I notice a very large but in the version. Is there a way to manually rollback to version 1.0.0? The only thing I have found is automatic rollback during an upgrade.

推荐答案

马特的答案是正确的,但我将在这里详细说明.

Matt's answer is correct, but I'll elaborate a bit on it here.

关键在于理解应用程序部署期间的不同步骤:

The key is in understanding the different steps during application deployment:

  • Copy
  • Register
  • Create
  • Upgrade

Visual Studio将这些内容汇总为单个发布"和升级"操作,以使其变得轻松便捷.但是这些实际上是Service Fabric管理API中的单个命令(通过PowerShell,C#或HTTP).让我们快速看一下这些步骤是什么:

Visual Studio rolls these up into single "publish" and "upgrade" operations to make it easy and convenient. But these are actually individual commands in the Service Fabric management API (through PowerShell, C# or HTTP). Let's take a quick look at what these steps are:

复制: 这只是将您的已编译应用程序包复制到群集中.没关系.

Copy: This just takes your compiled application package and copies it up to the cluster. No big deal.

注册: 这是您案件中的重要步骤.注册基本上告诉集群,它现在可以创建您的应用程序实例.最重要的是,您可以注册同一应用程序的多个版本.此时,您的应用程序尚未运行.

Register: This is the important step in your case. Register basically tells the cluster that it can now create instances of your application. Most importantly, you can register multiple versions of the same application. At this point, your applications aren't running yet.

创建: 在此创建已注册应用程序的实例并开始运行.

Create: This is where instances of your registered applications are created and start running.

在进行升级之前,让我们看一下集群中的内容.第一次使用应用程序1.0.0版(称为FooType)进行此部署过程时,将只注册一种类型:

Before we get to upgrade, let's look at what's on your cluster. The first time you go through this deployment process with version 1.0.0 of your application (call it FooType), you'll have just that one type registered:

FooType 1.0.0

现在您可以升级了.您首先复制具有新版本(2.0.0)的新应用程序包,直至群集.然后,您注册您的应用程序的新版本.现在,您已经注册了该类型的两个版本:

Now you're ready to upgrade. You first copy your new application package with a new version (2.0.0) up to the cluster. Then, you register the new version of your application. Now you have two versions of that type registered:

FooType 1.0.0

FooType 2.0.0

然后,当您运行 upgrade 命令时,Service Fabric将您的实例1.0.0升级到2.0.0.如果升级完成后需要回滚,只需使用相同的 upgrade 命令将应用程序实例从2.0.0升级"到1.0.0.您可以执行此操作,因为1.0.0仍在群集中注册.请注意,除了它们是不同的字符串以外,版本号实际上对Service Fabric没有意义.如果需要,我可以使用"orange"和"banana"作为版本字符串.

Then when you run the upgrade command, Service Fabric takes your instance of 1.0.0 and upgrades it to 2.0.0. If you need to roll it back once the upgrade is complete, you simply use the same upgrade command to "upgrade" the application instance from 2.0.0 back to 1.0.0. You can do this because 1.0.0 is still registered in the cluster. Note that the version numbers are in fact not meaningful to Service Fabric other than that they are different strings. I can use "orange" and "banana" as my version strings if I want.

因此,这里的关键是,当您从Visual Studio进行发布"以升级应用程序时,它正在执行所有以下步骤:复制,注册和升级.在您的情况下,您实际上不想重新注册1.0.0,因为它已经在集群上注册了.您只想再次发出升级命令.

So the key here is that when you do a "publish" from Visual Studio to upgrade your application, it's doing all of these steps: it's copying, registering, and upgrading. In your case, you don't actually want to re-register 1.0.0 because it's already registered on the cluster. You just want to issue the upgrade command again.

有关甚至更长的时间的解释,请参见:

For an even longer explanation, see: Blue/Green Deployments with Azure ServiceFabric

这篇关于手动回滚应用程序/服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆