开发者

SQL server cluster fail-over programming

I dont currently have access to a SQL server cluster for development (one using cluster services with a SAN behind it) but will do so in the future for the live environment.

When programming this from a .NET environment what should I expect to have to do in my code if the node I am connected to dies? Is the fail-over to the other node completely transparent? Do I need to catch some sort of exception and try to reconnect myself? Is there a co开发者_运维问答de pattern for this?


Failover is a big fat disconnect that will cut all connection to the server. You will be able to reconnect in a few seconds to minutes usually, after the standby server has started and recovered the databases from the shared drive(s). Any transaction in-flight at the moment of the failover will be rolled back.

In your application a failover will be a lights-out event, you'll loose all your connections and any attempt to reconnect will fail until the recovery of the standby server is complete. If you use proper transaction semantics, the data will be correct and an well written application will resume without problems. If you don't use transactions properly, you will have all sort of inconsistencies from logical half-writes not properly guarded by a transaction boundary.

You can always test failover on a couple of virtual machines. Both Virtual Server and HyperV can simulate clusters on virtual hardware (not Virtual PC though), and I expect VMWare can as well (although I never tried it).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜