SQL Server故障转移群集-确定活动节点 [英] SQL Server failover cluster - determine active node

查看:223
本文介绍了SQL Server故障转移群集-确定活动节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以通过编程方式确定SQL Server故障转移群集中的哪个节点是活动节点?或者至少确定当前计算机是否是活动节点?

Is there a way to programmatically determine which node in a SQL Server failover cluster is the active node? Or at least determine whether the current machine is the active node?

我有一个Windows程序,该程序在故障转移群集中的两个物理节点上运行,但是根据不同的运行方式,它是否在活动节点上运行。 部分原因是该程序不应在非活动和活动节点上同时运行

I have a Windows program which runs on both physical nodes in a failover cluster, but that should operate differently depending on whether it is running on the active node. Part of the reason is that this program should not run simultaneously on the inactive and the active node.

(我已经读了一些有关使得程序群集可以感知,但是对于这种简单情况而言,似乎显得过于矫kill过正。)

(I've read a bit about making the program cluster aware, but that seems heavily overkill for this simple scenario.)

推荐答案

从SQL Server:

From SQL Server:

Select ServerProperty('ComputerNamePhysicalNetBIOS')

您还可以通过Microsoft.SqlServer.Management.Smo命名空间访问它,如此处

You can also access it through the Microsoft.SqlServer.Management.Smo Namespace as shown here.

这篇关于SQL Server故障转移群集-确定活动节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆