1

連接到遠程服務織物簇使用Connect-ServiceFabricCluster PowerShell命令用於在網絡連接的虛擬機上運行的前提(Azure上不)當我已被一個錯誤:爲什麼我無法連接到此Service Fabric羣集?

WARNING: Failed to contact Naming Service. Attempting to contact Failover Manager Service... 
WARNING: Failed to contact Failover Manager Service, Attempting to contact FMM... 
False 
WARNING: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 192.168.1.102:19000 
Connect-ServiceFabricCluster : No cluster endpoint is reachable, please check if there is connectivity/firewall/DNS issue. 
At Install.ps1:3 char:1 
+ Connect-ServiceFabricCluster -ConnectionEndpoint "FABRICTESTSRV:19000" -WindowsCred ... 
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    + CategoryInfo   : InvalidOperation: (:) [Connect-ServiceFabricCluster], FabricException 
    + FullyQualifiedErrorId : TestClusterConnectionErrorId,Microsoft.ServiceFabric.Powershell.ConnectCluster 

的命令是:

Connect-ServiceFabricCluster -ConnectionEndpoint "FABRICTESTSRV:19000" -WindowsCredential:$True 

爲什麼它不工作?

這是我曾嘗試:

  • 我試圖打開Windows防火牆完全關閉。那裏沒有運氣。
  • 本地連接到集羣,同時虛擬機內部工作正常:Connect-ServiceFabricCluster "localhost:19000"
  • 這不是DNS問題。我可以很好地ping通機器的FQDN。

注意:這不是Azure託管的虛擬機。這只是一個運行Service Fabric Core的網絡連接虛擬機,完全是最新版本的Windows 8.1 x64。

編輯Get-ServiceFabricClusterManifest內容如下:

<ClusterManifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Name="ComputerName-Local-Cluster" Version= 
"1.0" xmlns="http://schemas.microsoft.com/2011/01/fabric"> 
    <NodeTypes> 
    <NodeType Name="NodeType0"> 
     <Endpoints> 
     <ClientConnectionEndpoint Port="19000" /> 
     <LeaseDriverEndpoint Port="19001" /> 
     <ClusterConnectionEndpoint Port="19002" /> 
     <HttpGatewayEndpoint Port="19080" Protocol="http" /> 
     <HttpApplicationGatewayEndpoint Port="19081" Protocol="http" /> 
     <ServiceConnectionEndpoint Port="19006" /> 
     <ApplicationEndpoints StartPort="30001" EndPort="31000" /> 
     </Endpoints> 
    </NodeType> 
    <NodeType Name="NodeType1"> 
     <Endpoints> 
     <ClientConnectionEndpoint Port="19010" /> 
     <LeaseDriverEndpoint Port="19011" /> 
     <ClusterConnectionEndpoint Port="19012" /> 
     <HttpGatewayEndpoint Port="19082" Protocol="http" /> 
     <HttpApplicationGatewayEndpoint Port="19083" Protocol="http" /> 
     <ServiceConnectionEndpoint Port="19016" /> 
     <ApplicationEndpoints StartPort="31001" EndPort="32000" /> 
     </Endpoints> 
    </NodeType> 
    <NodeType Name="NodeType2"> 
     <Endpoints> 
     <ClientConnectionEndpoint Port="19020" /> 
     <LeaseDriverEndpoint Port="19021" /> 
     <ClusterConnectionEndpoint Port="19022" /> 
     <HttpGatewayEndpoint Port="19084" Protocol="http" /> 
     <HttpApplicationGatewayEndpoint Port="19085" Protocol="http" /> 
     <ServiceConnectionEndpoint Port="19026" /> 
     <ApplicationEndpoints StartPort="32001" EndPort="33000" /> 
     </Endpoints> 
    </NodeType> 
    <NodeType Name="NodeType3"> 
     <Endpoints> 
     <ClientConnectionEndpoint Port="19030" /> 
     <LeaseDriverEndpoint Port="19031" /> 
     <ClusterConnectionEndpoint Port="19032" /> 
     <HttpGatewayEndpoint Port="19086" Protocol="http" /> 
     <HttpApplicationGatewayEndpoint Port="19087" Protocol="http" /> 
     <ServiceConnectionEndpoint Port="19036" /> 
     <ApplicationEndpoints StartPort="33001" EndPort="34000" /> 
     </Endpoints> 
    </NodeType> 
    <NodeType Name="NodeType4"> 
     <Endpoints> 
     <ClientConnectionEndpoint Port="19040" /> 
     <LeaseDriverEndpoint Port="19041" /> 
     <ClusterConnectionEndpoint Port="19042" /> 
     <HttpGatewayEndpoint Port="19088" Protocol="http" /> 
     <HttpApplicationGatewayEndpoint Port="19089" Protocol="http" /> 
     <ServiceConnectionEndpoint Port="19046" /> 
     <ApplicationEndpoints StartPort="34001" EndPort="35000" /> 
     </Endpoints> 
    </NodeType> 
    </NodeTypes> 
    <Infrastructure> 
    <WindowsServer IsScaleMin="true"> 
     <NodeList> 
     <Node NodeName="_Node_0" IPAddressOrFQDN="localhost" IsSeedNode="true" NodeTypeRef="NodeType0" FaultDomain="fd:/0" UpgradeDomain="0" /> 
     <Node NodeName="_Node_1" IPAddressOrFQDN="localhost" IsSeedNode="true" NodeTypeRef="NodeType1" FaultDomain="fd:/1" UpgradeDomain="1" /> 
     <Node NodeName="_Node_2" IPAddressOrFQDN="localhost" IsSeedNode="true" NodeTypeRef="NodeType2" FaultDomain="fd:/2" UpgradeDomain="2" /> 
     <Node NodeName="_Node_3" IPAddressOrFQDN="localhost" NodeTypeRef="NodeType3" FaultDomain="fd:/3" UpgradeDomain="3" /> 
     <Node NodeName="_Node_4" IPAddressOrFQDN="localhost" NodeTypeRef="NodeType4" FaultDomain="fd:/4" UpgradeDomain="4" /> 
     </NodeList> 
    </WindowsServer> 
    </Infrastructure> 
    <FabricSettings> 
    <Section Name="Security"> 
     <Parameter Name="ClusterCredentialType" Value="None" /> 
     <Parameter Name="ServerAuthCredentialType" Value="None" /> 
    </Section> 
    <Section Name="FailoverManager"> 
     <Parameter Name="ExpectedClusterSize" Value="4" /> 
     <Parameter Name="TargetReplicaSetSize" Value="3" /> 
     <Parameter Name="MinReplicaSetSize" Value="3" /> 
     <Parameter Name="ReconfigurationTimeLimit" Value="20" /> 
     <Parameter Name="BuildReplicaTimeLimit" Value="20" /> 
     <Parameter Name="CreateInstanceTimeLimit" Value="20" /> 
     <Parameter Name="PlacementTimeLimit" Value="20" /> 
    </Section> 
    <Section Name="ReconfigurationAgent"> 
     <Parameter Name="ServiceApiHealthDuration" Value="20" /> 
     <Parameter Name="ServiceReconfigurationApiHealthDuration" Value="20" /> 
     <Parameter Name="LocalHealthReportingTimerInterval" Value="5" /> 
     <Parameter Name="IsDeactivationInfoEnabled" Value="true" /> 
     <Parameter Name="RAUpgradeProgressCheckInterval" Value="3" /> 
    </Section> 
    <Section Name="ClusterManager"> 
     <Parameter Name="TargetReplicaSetSize" Value="3" /> 
     <Parameter Name="MinReplicaSetSize" Value="3" /> 
     <Parameter Name="UpgradeStatusPollInterval" Value="5" /> 
     <Parameter Name="UpgradeHealthCheckInterval" Value="5" /> 
     <Parameter Name="FabricUpgradeHealthCheckInterval" Value="5" /> 
    </Section> 
    <Section Name="NamingService"> 
     <Parameter Name="TargetReplicaSetSize" Value="3" /> 
     <Parameter Name="MinReplicaSetSize" Value="3" /> 
    </Section> 
    <Section Name="Management"> 
     <Parameter Name="ImageStoreConnectionString" Value="file:C:\SfDevCluster\Data\ImageStoreShare" /> 
     <Parameter Name="ImageCachingEnabled" Value="false" /> 
     <Parameter Name="EnableDeploymentAtDataRoot" Value="true" /> 
    </Section> 
    <Section Name="Hosting"> 
     <Parameter Name="EndpointProviderEnabled" Value="true" /> 
     <Parameter Name="RunAsPolicyEnabled" Value="true" /> 
     <Parameter Name="DeactivationScanInterval" Value="60" /> 
     <Parameter Name="DeactivationGraceInterval" Value="10" /> 
     <Parameter Name="EnableProcessDebugging" Value="true" /> 
     <Parameter Name="ServiceTypeRegistrationTimeout" Value="20" /> 
     <Parameter Name="CacheCleanupScanInterval" Value="300" /> 
    </Section> 
    <Section Name="HttpGateway"> 
     <Parameter Name="IsEnabled" Value="true" /> 
    </Section> 
    <Section Name="PlacementAndLoadBalancing"> 
     <Parameter Name="MinLoadBalancingInterval" Value="300" /> 
    </Section> 
    <Section Name="Federation"> 
     <Parameter Name="NodeIdGeneratorVersion" Value="V4" /> 
     <Parameter Name="UnresponsiveDuration" Value="0" /> 
    </Section> 
    <Section Name="ApplicationGateway/Http"> 
     <Parameter Name="IsEnabled" Value="true" /> 
    </Section> 
    <Section Name="FaultAnalysisService"> 
     <Parameter Name="TargetReplicaSetSize" Value="3" /> 
     <Parameter Name="MinReplicaSetSize" Value="3" /> 
    </Section> 
    <Section Name="Trace/Etw"> 
     <Parameter Name="Level" Value="4" /> 
    </Section> 
    <Section Name="Diagnostics"> 
     <Parameter Name="ProducerInstances" Value="ServiceFabricEtlFile, ServiceFabricPerfCtrFolder" /> 
     <Parameter Name="MaxDiskQuotaInMB" Value="10240" /> 
    </Section> 
    <Section Name="ServiceFabricEtlFile"> 
     <Parameter Name="ProducerType" Value="EtlFileProducer" /> 
     <Parameter Name="IsEnabled" Value="true" /> 
     <Parameter Name="EtlReadIntervalInMinutes" Value=" 5" /> 
     <Parameter Name="DataDeletionAgeInDays" Value="3" /> 
    </Section> 
    <Section Name="ServiceFabricPerfCtrFolder"> 
     <Parameter Name="ProducerType" Value="FolderProducer" /> 
     <Parameter Name="IsEnabled" Value="true" /> 
     <Parameter Name="FolderType" Value="ServiceFabricPerformanceCounters" /> 
     <Parameter Name="DataDeletionAgeInDays" Value="3" /> 
    </Section> 
    <Section Name="TransactionalReplicator"> 
     <Parameter Name="CheckpointThresholdInMB" Value="64" /> 
    </Section> 
    </FabricSettings> 
</ClusterManifest> 
+1

我想問題出在'IPAddressOrFQDN =「localhost」'。嘗試將其更改爲遠程機器的IP地址或更好的FQDN。 – cassandrad

+0

@cassandrad你是對的。我將會發布我需要採取的所有步驟,以使它們能夠與遠程連接一起工作,因爲存在一些細微的其他問題,但這是最重要的事情,奇怪的是。請將此作爲回答發佈,我將以您接受的答案的形式發給您。謝謝你的幫助。 – Alexandru

+0

謝謝,您可以將自己的答案標記爲已接受,因爲它比我的好。 – cassandrad

回答

4

爲什麼它不工作?

它不起作用,因爲您將節點的IP地址設置爲localhost,從而使它們無法被發現。它將用於本地調試羣集,但對於本地和Azure羣集,您必須指定有效且可訪問的IP地址或限定名稱。

此外,我現在不是100%確定,但是我可以建議指定FQDN而不是IP地址,如果您希望您的羣集可通過URI訪問而不通過IP訪問。我記得我在這方面遇到了麻煩,但仍然不清楚有什麼幫助 - FQDN或其他。

3

有一些問題,但最大的,如@cassandrad提到,是默認的部署結合本地主機的TCP FQDN(IPAddressOrFQDN="localhost")而不是機器的IP地址,所以默認只允許本地連接。

這裏有固定我的問題完整步驟:

  • 我第一次在命令提示符中運行netstat -a | FindStr "19000"檢查什麼綁定活躍,以確認哪些@cassandrad說。
  • 閱讀this guide,我決定下載Service Fabric standalone package for Windows Server(順便說一句,在Windows Server之外,在Windows 8.1 x64上工作得很好)。
  • 我複製,然後修改ClusterConfig.Unsecure.DevCluster.json,在nodes節我改變了所有節點'iPAddress192.168.1.102。我打電話給新文件ClusterConfig.Unsecure.CustomDevCluster.json
  • 我跑CreateServiceFabricCluster.ps1。它問我使用什麼JSON配置,所以我給了它ClusterConfig.Unsecure.DevCluster.json
  • 它第一次失敗,因爲從跟蹤中可以看到Newtonsoft.JSON版本Newtonsoft.JSON版本的錯誤,這是一個相當惱人的混淆錯誤。錯誤是因爲我沒有.NET Framework 4.6.2,所以我downloaded並安裝它。
  • 第二次因爲安裝了Microsoft Azure Service Fabric MSI而失敗。這個錯誤出現了,因爲我之前安裝了MicrosoftAzure-ServiceFabric-CoreSDK.exe。我去了程序和功能,並卸載Microsoft Azure Service Fabric(我離開了Microsoft Azure Service Fabric SDK安裝)。
  • 我最後一次運行腳本,手指交叉,它終於工作。
  • 這是一個不安全的羣集,所以我可以簡單地使用Connect-ServiceFabricCluster "192.168.1.102:19000"連接到它。如果要啓用其他驗證機制,請修改並使用其他一些.json示例配置。
+0

你是怎麼選擇ip「192.168.1.102」的?我想通過互聯網從遠程PC連接到我的羣集。正如解釋[這裏](https://stackoverflow.com/questions/40192846/cant-publish-to-service-fabric-local-cluster-on-another-machine?rq=1),IP應設置爲外部ip,我擡頭看「whatismyip.com」。但在集羣創建過程中,出現錯誤消息「Machine '94 .xxx.xxx.xx'在端口445上無法訪問。」本地計算機上的所有端口均已打開。 –

相關問題