.net active passive cluster algorithm
I have a number of Windows servers. I want to run one copy of the same Windows Service (written in .NET) on each of the servers such that at any one t开发者_Python百科ime only one of them is "active" and all the others are passive. If the active windows service dies then a very short time later one, and only one, of the remaining passive windows services becomes active.
Any ideas of simple ways to achieve this?
Well you need to keep them in sync, the easiest way to go would be to have an entry somewhere in a database that they can all access. Have the active service update a particular row etc. every so many minutes. If an update isn't found within a specific amount of time, the other services can take that as the active one has gone offline. Of course your problem here is that if the database goes off line, then the services will have problems, so that is potentially a single point of failure. You can alleviate this by having the db clustered as well though.
You could have them all communicate with each other like a peer to peer network too, but that will be more work, for essentially the same outcome, although this approach does have it's benefits.
精彩评论