1

Is there a way to perform the following under Linux:

  1. There are two web servers, main and backup
  2. There are two database servers (postgres), main and backup
  3. Web Servers are in sync with each other, ie. configuration/content/applications are the same
  4. Backup database is continuously synced up with main database.
  5. If either of main servers goes down, it's being replaced with backup one on the fly.
  6. When main database server goes back up, all the data from backup server is uploaded to it.

To make it more complex, an important detail is that the two servers are actually VPS and they are hosted in different countries by diferent providers, so none of the obvious solutions for servers in the same subnet/rack etc are going to work here.

Essentially, I need the hot swapping working automatically with no or minimal user intervention, if possible. Recovery procedure is preferably automatic but can include some manual steps.

Art
  • 297
  • 4
  • 12

3 Answers3

1

http://www.linuxvirtualserver.org/

would allow you to put a load balancer (or better, two) in front of your production and backup servers.

You could use heartbeat alone which would allow a public IP to be served by two IPs. It would have to sense the primary or secondary going down, and then would send out an announcement to become that public IP.

You would have something like:

Public IP   1.2.3.4
Primary Server 1.2.3.5
Backup Server 1.2.3.6

Everyone would see the single IP which would be served virtually by whichever machine was 'active'

  • it does not seem to mention DB sever hot swapping, can it do that? – Art Apr 15 '10 at 03:29
  • Yes, you can do the same with your SQL servers. heartbeat runs a virtual IP that is served by the 'active' server. –  Apr 15 '10 at 04:09
  • http://www.linux-ha.org/wiki/Main_Page for heartbeat. –  Apr 15 '10 at 04:10
1

Look into haproxy or Nginx as the frontend load balancer. This will monitor and redirect traffic from your primary to your backup server if primary goes down or vice versa aka automatic fail-over.

For the data syncing between your database, look into multi-master replication.

cma
  • 1
  • 1
0

You should probably look at DNS failover for the web tier and perhaps Tungsten Cluster for the DB tier.

Cheers

HTTP500
  • 4,833
  • 4
  • 23
  • 31