How to make C#.net Windows Service be programmed to run on onlyactive sql server cluster node

S

Shuchi

Hi,

I have a C# windows service developed using .NET 2000. This windows
service is installed on both Active and Passive Clusters of Sql Server
2000. Currently we manually ensure that service runs on active node
only.
But we want service to be cluster aware.

Requirement is that this service should run only on the active cluster
and stop on the other. and only one instance of it should be running
at one point of time.

So can you please suggest a approach.

Also how in C# programming i can determine Active SQL Server node.

Thanks in Advance,

Shuchi.
 
P

Peter Bromberg [C# MVP]

What does your service actually do? What it is supposed to do, and how it
does it, could be a big part of the determination on how to proceed. For
example, once you have a method that can determine the active SQL Server
node, you might not want to stop either service, only just have the correct
service do its work and the other do nothing.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
MetaFinder: http://www.blogmetafinder.com
 
S

Shuchi

Thanks for responding.

My Windows Service executes jobs ( DTS or SQL serbver jobs ) that are
required to run in a specific order in SQL Server. This is defined in
a sql table.
Only one instance of service is required to run at one point of time
on the active cluster node. If its 2 instances run at one point of
time, one on active and other on passive then it executes each job in
queue 2 times. It is basically a process queue executer service.

I would not want only one instance to run on active node and another
instance in case ( on passive ) is running should either do nothing or
should stop.

It would be good that in case of a fail over the service stops on the
active node that has failed and starts on the passive node and then
the passive node becomes active..and so on.

Thanks again.
Shuchi.
 
W

Willy Denoyette [MVP]

Shuchi said:
Thanks for responding.

My Windows Service executes jobs ( DTS or SQL serbver jobs ) that are
required to run in a specific order in SQL Server. This is defined in
a sql table.
Only one instance of service is required to run at one point of time
on the active cluster node. If its 2 instances run at one point of
time, one on active and other on passive then it executes each job in
queue 2 times. It is basically a process queue executer service.

I would not want only one instance to run on active node and another
instance in case ( on passive ) is running should either do nothing or
should stop.

It would be good that in case of a fail over the service stops on the
active node that has failed and starts on the passive node and then
the passive node becomes active..and so on.

Thanks again.
Shuchi.

All "Windows Services" can be registered as a generic cluster resource in
MSCS. In such scenario, your service can be active on one node, and be
failed-over to another node either by a node or service failure of the
active node/resource, or manually by means of a user action. The problem is
that your service must be implemented as such that it handles "restart
points", that is you need to keep track of the tasks states, so that you can
restart a task where it was left off by at the moment of fail-over.


Willy.
 
S

Shuchi

Thanks Willy for you response.

Can you please suggest a link where i can find any similar
implementation based on your comments.

" The problem is that your service must be implemented as such that it
handles "restart
points", that is you need to keep track of the tasks states "

Shuchi.
 

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