不能将默认服务描述作为升级集的一部分进行修改,将EnableDefaultServicesUpgrade设置为true

时间:2018-08-11 10:58:56

标签: c# azure-service-fabric

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

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

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

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

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。

使用PowerShell很少能获得喜悦。

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

我在应用程序清单中尝试了此尝试,但没有成功:

<?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>

保罗

1 个答案:

答案 0 :(得分:3)

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

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

  • 设置为 false (默认)时,它将进行检查以防止发生故障
  • 设置为 true 时,您将承担这些更改安全的风险

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

解决方法:

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

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

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

要在 Azure 上进行更改:

您可以按照http://resources.azure.com

中的说明使用门户网站“ this link

本地群集上:

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

应用更改触发集群升级

顺便说一句...

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