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

  • Thread starter J. Patrick Brandt
  • 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!
 
J

John Toner [MVP]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top