【问题标题】:Troubleshooting ServiceFabric StatefulService DeploymentServiceFabric StatefulService 部署故障排除
【发布时间】:2017-01-08 09:54:18
【问题描述】:

使用 ServiceFabric 版本 5.1.163.9590 中的状态服务,我正在尝试部署一个演示应用程序,其中包含三个管理自己状态的 WebApi 服务。

三个服务中的两个启动并创建它们的分区没有错误,但最后一个喷出事件一系列警告和错误,错误详细信息有这个有趣的消息:

   Microsoft.ServiceFabric.Replicator.LoggingReplicator : GetCopyState The parameter copyContext is null. This might be caused by deployment bug that 'hasPersistedState' attribute is false. 

我找不到对此错误消息的任何外部引用。

有没有办法从应用程序和服务部署端或集群管理端纠正这个问题?

【问题讨论】:

    标签: azure-service-fabric service-fabric-stateful


    【解决方案1】:

    该错误表明您有一个具有持久状态的有状态服务,但在您部署该服务时没有告诉 Service Fabric。

    需要设置一个标志,以向 Service Fabric 指示有状态服务具有持久状态(与“易失性”状态相反,表示仅在内存中)。

    在您的 ServiceManifest.xml 中,确保您在服务类型上设置了此标志:

      <ServiceTypes>
          <StatefulServiceType ServiceTypeName="MyServiceType" HasPersistedState="true" />
      </ServiceTypes>
    

    如果您通过 PowerShell 进行部署,请确保在创建服务实例时设置此标志:

    PS > New-ServiceFabricService -Stateful -HasPersistedState -ServiceTypeName "MyServiceType" ...
    

    【讨论】:

    • 服务创建后能否更改 HasPersistedState 标志?
    猜你喜欢
    • 2014-10-05
    • 1970-01-01
    • 1970-01-01
    • 2016-02-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-15
    相关资源
    最近更新 更多