簡體   English   中英

Azure Service Fabric:無法運行本地 Service Fabric 群集

[英]Azure Service Fabric: cannot run local Service Fabric Cluster

我在使用 Azure Service Fabric 時遇到問題。

我已經安裝了它(在 Windows 7 上),正如https://azure.microsoft.com/en-gb/documentation/articles/service-fabric-get-started/中所說。

然后我嘗試從 Visual Studio 2015 運行 Service Fabric 應用程序。我收到錯誤“ Connect-ServiceFabricCluster:無法訪問群集端點,請檢查是否存在連接/防火牆/DNS 問題”。

這是該運行的填充日志:

1>------ Build started: Project: Application2, Configuration: Debug x64 ------
2>------ Deploy started: Project: Application2, Configuration: Debug x64 ------
-------- Package started: Project: Application2, Configuration: Debug x64 ------
  Application2 -> c:\temp\Application2\Application2\pkg\Debug
-------- Package: Project: Application2 succeeded, Time elapsed: 00:00:01.7361084 --------
2>Started executing script 'Set-LocalClusterReady'.
2>Import-Module 'C:\Program Files\Microsoft SDKs\Service Fabric\Tools\Scripts\DefaultLocalClusterSetup.psm1'; Set-LocalClusterReady
2>--------------------------------------------
2>Local Service Fabric Cluster is not setup...
2>Please wait while we setup the Local Service Fabric Cluster. This may take few minutes...
2>
2>Using Cluster Data Root: C:\SfDevCluster\Data
2>Using Cluster Log Root: C:\SfDevCluster\Log
2>
2>Create node configuration succeeded
2>Starting service FabricHostSvc. This may take a few minutes...
2>
2>Waiting for Service Fabric Cluster to be ready. This may take a few minutes...
2>Local Cluster ready status: 4% completed.
2>Local Cluster ready status: 8% completed.
2>Local Cluster ready status: 12% completed.
2>Local Cluster ready status: 17% completed.
2>Local Cluster ready status: 21% completed.
2>Local Cluster ready status: 25% completed.
2>Local Cluster ready status: 29% completed.
2>Local Cluster ready status: 33% completed.
2>Local Cluster ready status: 38% completed.
2>Local Cluster ready status: 42% completed.
2>Local Cluster ready status: 46% completed.
2>Local Cluster ready status: 50% completed.
2>Local Cluster ready status: 54% completed.
2>Local Cluster ready status: 58% completed.
2>Local Cluster ready status: 62% completed.
2>Local Cluster ready status: 67% completed.
2>Local Cluster ready status: 71% completed.
2>Local Cluster ready status: 75% completed.
2>Local Cluster ready status: 79% completed.
2>Local Cluster ready status: 83% completed.
2>Local Cluster ready status: 88% completed.
2>Local Cluster ready status: 92% completed.
2>Local Cluster ready status: 96% completed.
2>Local Cluster ready status: 100% completed.
2>WARNING: Service Fabric Cluster is taking longer than expected to connect.
2>
2>Waiting for Naming Service to be ready. This may take a few minutes...
2>Connect-ServiceFabricCluster : **No cluster endpoint is reachable, please check 
2>if there is connectivity/firewall/DNS issue.**
2>At C:\Program Files\Microsoft SDKs\Service 
2>Fabric\Tools\Scripts\ClusterSetupUtilities.psm1:521 char:12
2>+     [void](Connect-ServiceFabricCluster @connParams)
2>+            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2>    + CategoryInfo          : InvalidOperation: (:) [Connect-ServiceFabricClus 
2>   ter], FabricException
2>    + FullyQualifiedErrorId : TestClusterConnectionErrorId,Microsoft.ServiceFa 
2>   bric.Powershell.ConnectCluster
2> 
2>Naming Service ready status: 8% completed.
2>Naming Service ready status: 17% completed.
2>Naming Service ready status: 25% completed.
2>Naming Service ready status: 33% completed.
2>Naming Service ready status: 42% completed.
2>Naming Service ready status: 50% completed.
2>Naming Service ready status: 58% completed.
2>Naming Service ready status: 67% completed.
2>Naming Service ready status: 75% completed.
2>Naming Service ready status: 83% completed.
2>Naming Service ready status: 92% completed.
2>Naming Service ready status: 100% completed.
2>WARNING: Naming Service is taking longer than expected to be ready...
2>Local Service Fabric Cluster created successfully.
2>--------------------------------------------------
2>Launching Service Fabric Local Cluster Manager...
2>You can use Service Fabric Local Cluster Manager (system tray application) to manage your local dev cluster.
2>Finished executing script 'Set-LocalClusterReady'.
2>Time elapsed: 00:07:01.8147993
2>The PowerShell script failed to execute.
========== Build: 1 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========

這對我有用,我偶然發現了 MSDN 論壇上的解決方案

很可能您的 C++ 運行時已損壞,需要重新安裝。 您必須手動執行 vcredist_x64.exe,它可以在以下位置找到

C:\Program Files\Microsoft Service Fabric\bin\Fabric\Fabric.Code\vcredist_x64.exe

完成后,您可以選擇是否重新啟動機器,我選擇重新啟動它然后運行以下命令

C:\Program Files\Microsoft SDKs\Service Fabric\ClusterSetup\CleanCluster.ps1
C:\Program Files\Microsoft SDKs\Service Fabric\ClusterSetup\DevClusterSetup.ps1

我希望這會有所幫助!

我不得不斷開我的 VPN 與辦公室的連接以及 Varun 上面顯示的指示。

感謝@Varun 分享這個!!

一旦我連接了我的 VPN,我就無法再次運行系統。

希望這可以幫助某人。

在嘗試了許多解決方案后,我發現這個GitHub 問題有助於在設置配置中添加一個條目,然后我不得不重新創建集群。

配置文件

C:\Program Files\Microsoft SDKs\Service Fabric\ClusterSetup\NonSecure\OneNode\ClusterManifestTemplate.json:

要添加的條目

{
  "name": "FabricContainerAppsEnabled",
  "value": "false"
}

如果 C++ 運行時不能解決您的問題,您可以將解決方案縮小到防火牆問題。 由於安全問題,網絡不允許用戶運行您可以在 services.msc 中檢查的FabricHostSvc服務。 如果您只能無限制地禁用防火牆/更改網絡,則問題應自行解決。

如果您能夠啟動 FabricHostSvc,您的問題將得到解決。

希望這有幫助......

默認情況下,Service Fabric 開發實例正在運行以僅偵聽環回地址(只需在 CMD 中運行netstat -an命令即可查看哪些端口已打開):

在此處輸入圖片說明

正如您在屏幕上方看到的,我的 SF 實例正在偵聽端口 19000 的所有地址(可用的外部連接)

默認情況下,端口 19000 僅偵聽環回地址 (127.0.0.1)

[::1]:19000

您所需要做的就是將您的 IPAddressOrFQDN 從 localhost 更改為您的 IPv4 外部地址。 吊鈎應該在清單文件中可見:

在此處輸入圖片說明

Windows 7 中的所有 SF 集群配置文件都位於C:\\SfDevCluster\\Data 在那里您可以找到許多 XML 文檔,例如:

  • 集群清單
  • 結構主機設置

要更改 IPAddressOrFQDN,我已將所有出現的“localhost”替換為“my.ip.address.here”。 要修改的文件也比較深:

  • C:\\SfDevCluster\\Data\\_Node_0\\Fabric
  • C:\\SfDevCluster\\Data\\_Node_0\\Fabric\\Fabric.Data
  • C:\\SfDevCluster\\Data\\_Node_0\\Fabric\\Fabric.Config.0.0
  • 等等

在此處輸入圖片說明

在更改停止您的集群之前:

在此處輸入圖片說明

畢竟再次運行它:

在此處輸入圖片說明


還有另一種 - 更好的方法。 您可以更改目錄C:\\Program Files\\Microsoft SDKs\\Service Fabric\\ClusterSetup生成腳本。

集群重置后,此設置將丟失。 請記住,您自行承擔風險,開發版本是不安全的,不應在生產環境中使用。

如果掛起后您無法連接到 SF - 確保防火牆沒有阻止端口(您可以暫時禁用防火牆)

嘿第一個答案(@ Varun Rathore給出)對我有用 但是當我嘗試在本地服務結構上部署容器時,一次又一次地從 1 節點集群切換到 5 節點集群,這個錯誤經常出現。 所以我所做的是以管理員身份打開powershell並按照接下來的 2 個步驟進行操作。

  1. 首先轉到以下路徑

    cd "C:\\Program Files\\Microsoft SDKs\\Service Fabric\\ClusterSetup"

  2. 第二次運行這兩個文件

    .\\CleanCluster.ps1

    .\\DevClusterSetup.ps1

這將在您的本地機器上設置 1 個節點集群。 您可以從服務結構集群管理器執行此操作,但它對我不起作用。 每次修復 vcredist_x64.exe 文件並重新啟動計算機(Windows 10 Pro)都令人沮喪。 這對我有用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM