“重置本地集群”后 Connect-ServiceFabricCluster 不起作用

Tim*_*ell 4 powershell azure-service-fabric

使用本地 Service Fabric 群集的任务托盘图标运行“重置本地群集”后,powershell 命令不再能够在该命令之前成功的 powershell 窗口中连接到群集。Connect-ServiceFabricCluster

重置前

连接工作正常:

PS C:\Users\Administrator> Connect-ServiceFabricCluster
True
WARNING: Cluster connection with the same name already existed, the old connection will be deleted


ConnectionEndpoint   :
FabricClientSettings : {
                       ClientFriendlyName                   : PowerShell-46eba43f-9981-4a04-93ce-dcc8bc707059
                       PartitionLocationCacheLimit          : 100000
                       PartitionLocationCacheBucketCount    : 1024
                       ServiceChangePollInterval            : 00:02:00
                       ConnectionInitializationTimeout      : 00:00:02
                       KeepAliveInterval                    : 00:00:20
                       ConnectionIdleTimeout                : 00:00:00
                       HealthOperationTimeout               : 00:02:00
                       HealthReportSendInterval             : 00:00:00
                       HealthReportRetrySendInterval        : 00:00:30
                       NotificationGatewayConnectionTimeout : 00:00:30
                       NotificationCacheUpdateTimeout       : 00:00:30
                       AuthTokenBufferSize                  : 4096
                       }
GatewayInformation   : {
                       NodeAddress                          : localhost:19000
                       NodeId                               : bf865279ba277deb864a976fbf4c200e
                       NodeInstanceId                       : 131314568099152528
                       NodeName                             : _Node_0
                       }
Run Code Online (Sandbox Code Playgroud)

重启

使用托盘图标右键单击手动“重置本地集群”,然后:

重置后

如果在同一个 powershell 窗口中再次运行,则连接失败:

PS C:\Users\Administrator> Connect-ServiceFabricCluster
WARNING: Failed to contact Naming Service. Attempting to contact Failover Manager Service...
WARNING: Failed to contact Failover Manager Service, Attempting to contact FMM...
False
Connect-ServiceFabricCluster : The object is closed.
At line:1 char:1
+ Connect-ServiceFabricCluster
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Connect-ServiceFabricCluster], FabricObjectClosedException
    + FullyQualifiedErrorId : TestClusterConnectionErrorId,Microsoft.ServiceFabric.Powershell.ConnectCluster
Run Code Online (Sandbox Code Playgroud)

新窗户

启动一个新的 powershell 窗口并Connect-ServiceFabricCluster在那里工作,但原始的 powershell 窗口永远不会恢复。


我无法弄清楚它在哪里隐藏了它用来记住断开的连接的状态。

我尝试删除$ClusterConnection变量无效。

Remove-Variable ClusterConnection
Run Code Online (Sandbox Code Playgroud)

我看了一下,C:\Windows\System32\WindowsPowerShell\v1.0\Modules\ServiceFabric\但它是一个编译的 .net 模块,所以不是最容易理解的。


相关:https : //stackoverflow.com/a/38104087/10245

小智 8

这是一个已知问题。

群集连接失败并显示“对象已关闭” 解决方案 关闭当前的 PowerShell 窗口并以管理员身份打开一个新的 PowerShell 窗口。您现在应该能够成功连接