Cluster Service - developer's question: What node is active?

  • Thread starter Thread starter J. Patrick Brandt
  • Start date Start date
J

J. Patrick Brandt

I have a little .NET (C#) Service that works just fine in a Windows 2000
Server environment.
It acts as a go-between with the SQL server running on the same box and an
oddball Internet application on an external machine (that SQL can't directly
talk to).

Anyhow, the powers-that-be want to give this particular box failover
capabilities and have decided to go with Windows 2000 Advanced Server +
Cluster Services. That solves the SQL server problems - it now gets failover
by having two replicated SQL servers and one Virtual IP address and MSCS
figures out which is active.

Fine. That's the architecture.

My (simple?) task is to make my little service "Cluster Aware" - we will run
the service on both machines, only now I just need to mute the one that is
not active.

Note: I develop on Windows XP Pro, and really want to avoid having to set up
a Win2KAS environment just to modify my service. I'd really like to just
deploy on the target, but not have to develop on it.

So - What is the minimal amount of work I can do to simply figure out if the
server I am on is the active one or the passive one?

If SQL Server itself knows whether it is the active copy - maybe I can just
ask it? That's really all I want to do - follow the SQL server around to
whichever node is the active one.

Any ideas will be appreciated.

TIA!
 
You could use a VBScript. Here's a simple VBScript that should work:

Dim objCluster
Set objCluster = CreateObject("MSCluster.Cluster")
objCluster.Open("ENTER_YOUR_CLUSTER_NAME")
WScript.Echo
objCluster.ResourceGroups.Item("ENTER_GROUP_NAME").OwnerNode.Name
Set objCluster = Nothing

Regards,
John
 
Back
Top