如何为附加节点类型配置本地群集

Joh*_*orn 6 azure-service-fabric

我有一个集群配置,在ServiceManifest.xml中指定了两个节点类型

<?xml version="1.0" encoding="utf-8"?>
<ServiceManifest Name="MKopa.M2M.ConfigurationPkg"
                 Version="1.0.0"
                 xmlns="http://schemas.microsoft.com/2011/01/fabric"
                 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <ServiceTypes>
    <!-- This is the name of your ServiceType. 
         This name must match the string used in RegisterServiceType call in Program.cs. -->
    <StatelessServiceType ServiceTypeName="ConfigurationType">
      <PlacementConstraints>(NodeType == Internal)</PlacementConstraints>
    </StatelessServiceType> 
  </ServiceTypes>

  <!-- Code package is your service executable. -->
  <CodePackage Name="Code" Version="1.0.0">
    <EntryPoint>
      <ExeHost>
        <Program>MKopa.M2M.Configuration.Service.exe</Program>
      </ExeHost>
    </EntryPoint>
  </CodePackage>

  <!-- Config package is the contents of the Config directoy under PackageRoot that contains an 
       independently-updateable and versioned set of custom configuration settings for your service. -->
  <ConfigPackage Name="Config" Version="1.0.0" />

  <Resources>
    <Endpoints>
      <!-- This endpoint is used by the communication listener to obtain the port on which to 
           listen. Please note that if your service is partitioned, this port is shared with 
           replicas of different partitions that are placed in your code. -->
      <Endpoint Name="ServiceEndpoint" />
      <Endpoint Name="HttpEndpoint" Protocol="http" Port="8081"/>
    </Endpoints>
  </Resources>
</ServiceManifest>
Run Code Online (Sandbox Code Playgroud)

我的问题是,这会导致部署到本地群集失败,因为本地群集中不存在此NodeType.

我已经看到提到该cluster.xml文件并且我已经找到它但是对它进行更改似乎没有任何影响.我尝试过重置,启动和停止,但重置会覆盖更改.

这是希望答案不是动态启动服务:-)

Chr*_*iss 7

我不知道在群集运行时它是如何工作的,但我能够通过重新安装本地群集来实现.这些是我的步骤:

  • C:\Program Files\Microsoft SDKs\Service Fabric\ClusterSetup\
  • 通过调用卸载现有群集 .\CleanCluster.ps1
  • 创建文件的备份 C:\Program Files\Microsoft SDKs\Service Fabric\ClusterSetup\NonSecure\ClusterManifestTemplate.xml
  • 现在,您可以调整此文件并向每个节点添加放置属性:
<NodeType ...>
  <Endpoints>...</Endpoints>
  <PlacementProperties>
    <Property Name="NodeType" Value="Internal" />
  </PlacementProperties>
</NodeType>
Run Code Online (Sandbox Code Playgroud)
  • 通过调用重新创建集群 .\DevClusterSetup.ps1