views:

512

answers:

3

I am planning to deploy my web app to EC2. I have several webserver instances. I have 1 primary database instance. I have 1 failover database instance. I need a strategy to redirect the webservers to the failover database instance IP when the primary database instance fails.

I was hoping I could use an Elastic IP in my connection strings. But, the webservers are not able to access/ping the Elastic IP. I have several brute force ideas to solve the problem. However, I am trying to find the most elegant solution possible.

I am using all .Net and SQL Server. My connection strings are encrypted.

Does anybody have a strategy for failing over a database instance in EC2 using some form of automation or DNS configuration?

Please let me know.

A: 

Haven't used EC2 but surely you need to either:

(a) put your front-end into some custom maintenance mode, that you define, while you switch the IP over; and have the front-end perform required steps to manage potential data integrity and data loss issues related to the previous server going down and the new server coming up when it enters and leaves your custom maintenance mode

OR, for a zero down-time system:

(b) design the system at the object/relational and transaction levels from the ground up to support zero-down-time fail-over. It's not something you can bolt on quicjkly to just any application.

(c) use some database support for automatic failover. I am unaware whether SQL Server support for failover suitable for your application exists or is appropriate here. I suggest adding a "sql-server" tag to the question to start a search for the right audience.

If Elastic IPs don't work (which sounds odd to say the least - shouldn't you talk to EC2 about that), you mayhave to be able to instruct your front-end which new database IP to use at the same time as telling it to go from maintenance mode to normal mode.

martinr
Might be worth asking the question on a sister sites serverfault.com and/or superuser.com as well...
martinr
thanks for your reply. I have asked EC2.. but they have really bad forms. Pretty much a waste of time.(b) I am already there with the app. I have a single interface to get/set the IP for the connection string. So, I can change it on the fly...I was just hoping someone had a clever DNS solution. I will ask this question over on serverfault.com and see what I get.
Dave
A: 

http://alestic.com/2009/06/ec2-elastic-ip-internal

tells you how to use the Elastic IP public DNS.

Dave
Which is of course a total waste of a perfectly good external IP address.
Ranieri
A: 

If you're willing to shell out a bit of extra money, take a look at Rightscale's tools; they've built custom server images and supporting tools that handle database failover (among many other things). This link explains how to do it with MySQL, so will hopefully show you some principles even though it doesn't use SQL Server.

gareth_bowles