gpt4 book ai didi

azure-service-fabric - 如何为其他节点类型配置本地集群

转载 作者:行者123 更新时间:2023-12-04 14:41:24 25 4
gpt4 key购买 nike

我有一个集群配置,在 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>

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

我看到有人提到 cluster.xml文件,我找到了它,但对其进行更改似乎没有任何效果。我尝试过重置、启动和停止,但重置会覆盖更改。

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

最佳答案

我不知道集群运行时它是如何工作的,但我能够通过重新安装本地集群来做到这一点。这些是我的步骤:

  • 转至 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>
  • 通过调用 .\DevClusterSetup.ps1 重新创建集群
  • 关于azure-service-fabric - 如何为其他节点类型配置本地集群,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37881422/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com