从Powershell向集群添加通用服务 [英] Adding a generic service to cluster from powershell
问题描述
我是集群中的新手,我正尝试使用PowerShell为集群创建通用服务。我可以使用GUI毫无问题地添加它,但是由于某些原因我不能从PowerShell添加它。
I'm a newbie in clustering and I'm trying to create a generic service to a cluster using PowerShell. I can add it without any issues using the GUI, but for some reason I cannot add it from PowerShell.
下面是 Add-ClusterGenericServiceRole ,我尝试了以下命令:
Following the first example from the documentation for Add-ClusterGenericServiceRole, I've tried the following command:
Add-ClusterGenericServiceRole -ServiceName "MyService"
这将引发以下错误:
Static network was [network range] was not configured. Please use -StaticAddress to use this network or -IgnoreNetwork to ignore it.
网络与我的服务之间有什么联系?为什么从GUI创建它时不需要这些详细信息?
What's the connection between the network and my service? And why aren't these details required when creating it from the GUI?
我还尝试了另一种方法,用以下方法创建资源:
I also tried another approach, creating the resource with:
Add-ClusterResrouce -Name MyService -ResourceType "Generic Serice"
此命令成功执行,但是我在GUI中注意到ServiceName为空,因此无法启动实际的服务。如果我可以通过某种方式更改ServiceName属性,则可以解决问题。再次,从PowerShell我尝试了以下操作:
This command succeeded but I noticed in the GUI that the ServiceName is blank, and thus the actual service cannot be started. If I could somehow change the ServiceName property it should do the trick. Again, from PowerShell I tried the following:
$resource = Get-ClusterResrouce "MyService"
$Resource.ServiceName = "Actual name of service" //property ServiceName cannot be found on this object.
我已经挣扎了几个小时,没有运气。我缺少基本的东西吗?我认为这应该看起来并不复杂。
I've been struggling for a couple of hours now with no luck. Is there something basic I'm missing? I think this shouldn't be as complicated as it might look.
推荐答案
我遇到了同样的问题。我不得不添加大量服务,并且也不得不使用 ServiceName。
I had the same problem; I had to add a large amount of services and got stuck with the "ServiceName" as well.
首先,请注意Add-ClusterGenericServiceRole命令:这是为了创建服务资源和角色同时使用,而不是将服务资源添加到现有的角色中。
First, a note on the Add-ClusterGenericServiceRole command: this is for creating the service resource and the role at the same time, as opposed to just adding the service resource to an existing role.
现在,解决方案是必须使用 Set-ClusterParameter
命令设置参数 ServiceName。您可以对现有的服务资源执行以下操作:
Now, the solution is that you have to set the parameter "ServiceName" with the Set-ClusterParameter
command. You can do this for an existing service resource like this:
Get-ClusterResource "ServiceDisplayName" | Set-ClusterParameter -Name ServiceName -Value "ServiceName"
但是,您可能希望使用以下命令创建资源一口气完成所有操作,例如:
However, you probably want to create the resource with everything it needs in one go, like this:
Add-ClusterResource -Name "ServiceDisplayName" -Group "cluster role" -ResourceType "Generic Service" | Set-
ClusterParameter -Name ServiceName -Value "ServiceName"
这篇关于从Powershell向集群添加通用服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!