使用-Name参数时,Get-Cluster cmdlet失败

概要

当我调用Get-Cluster powershell会返回我的集群的名称。 为了简单起见,我们称之为Cluster1 。 如果我调用Get-Cluster -Name Cluster1则会失败,并显示错误消息。

错误:

 Get-Cluster : Check the spelling of the cluster name. Otherwise, there might be a problem with your network. Make sure the cluster nodes are turned on and connected to the network or contact your network administrator. The RPC server is unavailable At line:1 char:1 + Get-Cluster -Name Cluster1 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ConnectionError: (:) [Get-Cluster], ClusterCmdletException + FullyQualifiedErrorId : ClusterRpcConnection,Microsoft.FailoverClusters.PowerShell.GetClusterCommand 

详情

我的第一个想法是,我使用错误的cmdlet或winrm不工作(这是)。 我也认为,这可能是导致失败的方式。 遵循该逻辑,我在cmdlet上查看了以下technet页面:

研究 : http : //technet.microsoft.com/zh-CN/library/hh847254(v=wps.630).aspx

根据那里的写作,我无法辨别出明显的用户错误。 所以我已经尝试了一些东西来弄清楚。 首先,我想也许我只是不断打字,所以我这样做:

 $Cluster = Get-Cluster ($cluster.Name -like "Cluster1") 

条件返回True所以我不是一个群集f键入。 接下来我尝试了以下内容:

 Get-Cluster | Where-Object{$_.Name -like "Cluster1"} 

哪一个当然返回集群对象。 那么,这是怎么回事? Get-Cluster -Name "Cluster1"Get-Cluster -Name "Cluster1"有什么不同?

编辑

来自Powershell的版本信息:

 PSVersion 4.0 WSManStackVersion 3.0 SerializationVersion 1.1.0.1 CLRVersion 4.0.30319.34209 BuildVersion 6.3.9600.17090 PSCompatibleVersions {1.0, 2.0, 3.0, 4.0} PSRemotingProtocolVersion 2.2 

根据我对运行Get-Cluster观察,对照我在工作的几个集群,在我看来, -Name使用名称parsing,所以如果任何导致parsing名称的问题,它将会失败,即使名称给它是本地机器。

我尝试了集群名称和集群服务名称以及集群中各个节点的名称。

我还在我的HOSTS文件中添加了一个条目,指向其中一个集群的虚假名称,并且能够成功地将该名称与Get-Cluster

对我来说,这强烈暗示-Name的使用完全依赖于操作系统中的标准名称parsing。

Get-Cluster没有名字的情况下工作,而Get-Cluster -Name localhost Name Get-Cluster -Name localhost (或当前机器的实际主机名)不起作用的情况下,向我暗示,如果没有名称参数, Get-Cluster尝试与群集服务直接在当前的机器上,这不需要任何名称parsing。

除了名称parsing之外,我相信在使用-Name (即使是本地计算机)时,也会向目标服务器build立RPC连接,因此,即使名称parsing有效,RPC服务实际上不可用,或者防火墙处于打开状态实际上可能会阻止该连接并导致您看到的错误。

我无法对此进行testing,因为我目前在我们的testing环境中没有集群,所以我不能在生产集群上故意破坏名称parsing或RPC!

不幸的是,我不能用任何权威来源来支持这个假设(我无法find这个行为的明确描述)。