0

I am going to buy two servers shortly which will be exact copies of each other in terms of hardware, software and WAMP setup.

I would like to give my users maximum up-time by having one of the servers as a live backup of the other one.

That is, when the main server fails for whatever reason, all traffic is routed to the backup so users don't notice a thing. When the main server comes back up, any new data that went into the database on the backup server is copied over to the main one.

How can I achieve this without having any inconsistencies with the data? Up-time and data integrity are vital.

imperium2335
  • 23,402
  • 38
  • 111
  • 190

2 Answers2

1

What you want to achieve is called fail-over cluster. Here is an article how to configure Apache cluster. Also you have to configure MySQL databases either like a cluster, more information here. Your task does not fit in one answer as configuration has to be done in terms of your particular case.

Red
  • 6,599
  • 9
  • 43
  • 85
Oskars Pakers
  • 699
  • 3
  • 11
0

For Dual-Master-Single-Writer, see MHA. It works well, except for "split brain".

For data integrity, never write to more than one Master at a time.

Don't forget to worry about hurricanes, earthquakes, etc. Your two setups should be in geographically distinct locations.

With only two servers, and with them geographically separated, the network becomes a potential problem. This could lead to a "Split brain", wherein you can't really tell that one is dead and you need to switch to the other.

Any type of automatic failover will have a few seconds of not-quite-failure.

To talk about "uptime", the common technique is to tell them how many "nines" they get.

See Galera (available through MariaDB or Percona) as perhaps the best (today) HA setup.

Rick James
  • 135,179
  • 13
  • 127
  • 222