2017-02-28 45 views
2

我正在Azure Service Fabric中开发,并且由于某些原因(通常在重新引导后)服务Fabric未启动时出现了多次。系统托盘中的服务结构管理器具有可怕的响应时间(如果它响应的话)。如何使用PowerShell或CLI启动本地Azure服务Fabric群集

是否有PowerShell cmdlet甚至可用于启动本地服务结构的cli命令?

回答

1

您可以只使用Start-Service cmdlet的

PS C:\windows\system32> Start-Service FabricHostSvc 
WARNING: Waiting for service 'Microsoft Service Fabric Host Service (FabricHostSvc)' to start... 

您还可以检查主机运行Get-Service

PS C:\windows\system32> Get-Service FabrichostSvc 

Status Name    DisplayName 
------ ----    ----------- 
Running FabrichostSvc  Microsoft Service Fabric Host Service 

运行如果它的运行,你也可以使用Restart-Service

PS C:\windows\system32> Restart-Service FabrichostSvc 
WARNING: Waiting for service 'Microsoft Service Fabric Host Service (FabrichostSvc)' to start... 
WARNING: Waiting for service 'Microsoft Service Fabric Host Service  (FabrichostSvc)' to start... 
2

我有一个类似的问题,并最终使用uti lity功能具备,我发现这里的SDK:

C:\ Program Files文件\微软的SDK \服务布料\工具\脚本\ ClusterSetupUtilities.psm1

在我的PowerShell脚本我用下面的导入实用功能:

# Import the cluster setup utility module 
$sdkInstallPath = (Get-ItemProperty 'HKLM:\Software\Microsoft\Service Fabric SDK').FabricSDKScriptsPath 
$modulePath = Join-Path -Path $sdkInstallPath -ChildPath "ClusterSetupUtilities.psm1" 
Import-Module $modulePath 

然后我有以下的检查,如果集群正在运行,并启动它,如果它是不是:

# Start the local cluster if needed 
if (-not (IsLocalClusterRunning)) 
{ 
    StartLocalCluster 
} 

在封面下,它基本上和凯文在他的回答(Start-Service FabricHostSvc)中所做的一样。因此,如果您正在设置PowerShell脚本,这可能会有所帮助,但如果您只是想在PowerShell中运行命令,导入这些实用程序可能会很麻烦。

相关问题