本文介绍了无法将默认服务描述作为升级集EnableDefaultServicesUpgrade设置为true的一部分进行修改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过Visual Studio升级我的Service Fabric应用程序.

I am trying to upgrade my Service Fabric application via Visual Studio.

我最终不得不使用diff软件包方法来确保只有我更改的服务才在升级中.

I ended up having to use the diff package approach to ensure that only the services I change are in the upgrade.

我通过命令文件删除了不需要的文件.

I did this via a command file which removed the non-required files.

现在,我进入了另一个错误,该错误由于缺乏细节而烦人:

Now I have walked into another error which is annoying with its lack of detail:

Start-ServiceFabricApplicationUpgrade : Default service descriptions can not be modified as part of upgrade. Modified 
2>default service: fabric:/MYAPPLICATION/MYSERVICE. To allow it, set 
2>EnableDefaultServicesUpgrade to true.

我该放在哪里?

请注意,这来自Visual Studio.

Please note that this is coming from Visual Studio.

使用PowerShell很少能获得喜悦.

I rarely get any joy using PowerShell.

我已经看到了对Update-ServiceFabricService CmdLet的引用,但是没有更多关于我需要做什么的信息.

I have seen references to the Update-ServiceFabricService CmdLet, but there is no more information about exactly what I need to do.

我在应用程序清单中尝试了此操作,但未成功:

I have tried this in the application manifest without success:

<?xml version="1.0" encoding="utf-8"?>
<ApplicationManifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ApplicationTypeName="MyServiceFabricApplication.ServiceFabricType" ApplicationTypeVersion="7.0.0" xmlns="http://schemas.microsoft.com/2011/01/fabric">
  <Parameters>
    <Parameter Name="EnableDefaultServicesUpgrade" DefaultValue="true" />
    <Parameter Name="MyParameter" DefaultValue="value" />
    Parameters>
  <ServiceManifestImport>
    <ServiceManifestRef ServiceManifestName="MyServiceFabricApplication.Service1.ServiceFabricPkg" ServiceManifestVersion="4.0.0" />
    <ConfigOverrides>
      <ConfigOverride Name="Config">
        <Settings>
          <Section Name="appSettings">
            <Parameter Name="MyParameter" Value="[MyParameter]" />
          </Section>
        </Settings>
      </ConfigOverride>
    </ConfigOverrides>
  </ServiceManifestImport>
  <ServiceManifestImport>
    <ServiceManifestRef ServiceManifestName="MyServiceFabricApplication.Service2.ServiceFabricPkg" ServiceManifestVersion="2.0.0" />
    <ConfigOverrides>
      <ConfigOverride Name="Config">
        <Settings>
          <Section Name="appSettings">
            <Parameter Name="MyParameter" Value="[MyParameter]" />
          </Section>
        </Settings>
      </ConfigOverride>
    </ConfigOverrides>
  </ServiceManifestImport>
  <ServiceManifestImport>
    <ServiceManifestRef ServiceManifestName="MyServiceFabricApplication.Service3.ServiceFabricPkg" ServiceManifestVersion="3.0.0" />
    <ConfigOverrides>
      <ConfigOverride Name="Config">
        <Settings>
          <Section Name="appSettings">
            <Parameter Name="MyParameter" Value="[MyParameter]" />
          </Section>
        </Settings>
      </ConfigOverride>
    </ConfigOverrides>
  </ServiceManifestImport>
  <ServiceManifestImport>
    <ServiceManifestRef ServiceManifestName="MyServiceFabricApplication.Service4.ServiceFabricPkg" ServiceManifestVersion="2.0.0" />
    <ConfigOverrides>
      <ConfigOverride Name="Config">
        <Settings>
          <Section Name="appSettings">
            <Parameter Name="MyParameter" Value="[MyParameter]" />
          </Section>
        </Settings>
      </ConfigOverride>
    </ConfigOverrides>
  </ServiceManifestImport>
  <ServiceManifestImport>
    <ServiceManifestRef ServiceManifestName="MyServiceFabricApplication.PlatformApi.ServiceFabricPkg" ServiceManifestVersion="2.0.0" />
    <ConfigOverrides>
      <ConfigOverride Name="Config">
        <Settings>
          <Section Name="appSettings">
            <Parameter Name="MyParameter" Value="[MyParameter]" />
          </Section>
        </Settings>
      </ConfigOverride>
    </ConfigOverrides>
  </ServiceManifestImport>
  <ServiceManifestImport>
    <ServiceManifestRef ServiceManifestName="MyServiceFabricApplication.LivePriceManager.ServiceFabricPkg" ServiceManifestVersion="3.0.0" />
    <ConfigOverrides>
      <ConfigOverride Name="Config">
        <Settings>
          <Section Name="appSettings">
            <Parameter Name="MyParameter" Value="[MyParameter]" />
          </Section>
        </Settings>
      </ConfigOverride>
    </ConfigOverrides>
  </ServiceManifestImport>
  <ServiceManifestImport>
    <ServiceManifestRef ServiceManifestName="MyServiceFabricApplication.Service5.ServiceFabricPkg" ServiceManifestVersion="3.0.0" />
    <ConfigOverrides>
      <ConfigOverride Name="Config">
        <Settings>
          <Section Name="appSettings">
            <Parameter Name="MyParameter" Value="[MyParameter]" />
          </Section>
        </Settings>
      </ConfigOverride>
    </ConfigOverrides>
  </ServiceManifestImport>
  <DefaultServices>
    <Service Name="Service1" ServicePackageActivationMode="ExclusiveProcess">
      <StatelessService ServiceTypeName="MyServiceFabricApplication.Service1.ServiceFabricType">
        <SingletonPartition />
      </StatelessService>
    </Service>
    <Service Name="Service2" ServicePackageActivationMode="ExclusiveProcess">
      <StatelessService ServiceTypeName="MyServiceFabricApplication.Service2.ServiceFabricType">
        <SingletonPartition />
      </StatelessService>
    </Service>
    <Service Name="Service3" ServicePackageActivationMode="ExclusiveProcess">
      <StatelessService ServiceTypeName="MyServiceFabricApplication.Service3.ServiceFabricType">
        <SingletonPartition />
      </StatelessService>
    </Service>
    <Service Name="Service7" ServicePackageActivationMode="ExclusiveProcess">
      <StatelessService ServiceTypeName="MyServiceFabricApplication.Service7.ServiceFabricType">
        <SingletonPartition />
      </StatelessService>
    </Service>
    <Service Name="Service5" ServicePackageActivationMode="ExclusiveProcess">
      <StatelessService ServiceTypeName="MyServiceFabricApplication.Service5.ServiceFabricType">
        <SingletonPartition />
      </StatelessService>
    </Service>
    <Service Name="Service6" ServicePackageActivationMode="ExclusiveProcess">
      <StatelessService ServiceTypeName="MyServiceFabricApplication.Service6.ServiceFabricType">
        <SingletonPartition />
      </StatelessService>
    </Service>
    <Service Name="Service4" ServicePackageActivationMode="ExclusiveProcess">
      <StatelessService ServiceTypeName="MyServiceFabricApplication.Service4.ServiceFabricType">
        <SingletonPartition />
      </StatelessService>
    </Service>
  </DefaultServices>
</ApplicationManifest>

保罗

推荐答案

首先,在给您解决方案之前,我将给出一个原因...

First, before I give you a solution, I will give a reason...

EnableDefaultServicesUpgrade是允许在应用程序升级期间升级默认服务描述的标志.设置为true时,默认服务描述会被新值覆盖,这是必需的,以防止对描述的意外更改而导致可能的故障或数据丢失.

EnableDefaultServicesUpgrade is a flag to allow upgrading default services descriptions during application upgrades. When set to true, Default service descriptions are overwritten with new values, this is required to prevent accidental changes to the description that will cause possible failures or dataloss.

  • 设置为 false (默认)时,它将进行检查以防止发生故障
  • 设置为 true 时,您将承担这些更改安全的风险
  • When set to false (default), it will make checks to prevent failures to happen,
  • When set to true, you assume the risk that these changes are safe

例如,当您更改服务中的分区数时,SF预测这将导致数据丢失或其他故障.

An example is when you change the number of partitions in a service and SF predict this will cause dataloss or other failures.

解决方法:

EnableDefaultServicesUpgrade是群集定义中的标志,而不是服务中的标志.您必须在群集清单中进行设置.

EnableDefaultServicesUpgrade is a flag in the cluster definition, not in the service. You have to set this in your cluster manifest.

您的集群清单将具有一个类似于以下内容的部分:

Your cluster manifest will have a section that looks like this:

...some stuff above...
{
  "name": "ClusterManager",
  "parameters": [
  {
    "name": "EnableDefaultServicesUpgrade",
    "value": true
  }]
  ... some more stuf below
 }

要在 Azure 上进行更改:

To change it on Azure:

您可以使用门户网站" http://resources.azure.com ",如此链接

You can use the portal 'http://resources.azure.com' as described in this link

本地群集上:

On local cluster:

您从集群安装文件夹中复制clusterconfig.json,使用以下命令Start-ServiceFabricClusterConfigurationUpgrade -ClusterConfigPath .\clusterconfig.json

You copy the clusterconfig.json from the cluster installation folder, apply the changes a trigger a cluster upgrade using the following command Start-ServiceFabricClusterConfigurationUpgrade -ClusterConfigPath .\clusterconfig.json

顺便说一句...

您正在使用DefaultServices,应该避免使用它,为什么会有很多问题.

You are using DefaultServices, you should avoid it, there are quite a few questions on SO why.

这篇关于无法将默认服务描述作为升级集EnableDefaultServicesUpgrade设置为true的一部分进行修改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 04:44