|
LAMP Server Failover
How does everyone else handle this?
My Setup:
Server A:
CentOS 5.x
10.0.0.1
Apache
MySQL Master
Server B:
CentOS 5.x
10.0.0.2
Apache
MySQL Slave
My Domains:
dom1.com A record: 10.0.0.1
A Record: 10.0.0.2
dom2.com A record: 10.0.0.1
A Record: 10.0.0.2
.
.
.
Since you CANNOT write to the slave, and have master updated, I have heard that 2 way replication will cause problems. I have setup all writes to goto master (write.dom1.com) and reads goto slave (read.dom1.com) via hosts file on each server.
If Server A goes down Server B detects this and rewrited hosts file to (writes.dom1.com) to its self so everything works great.
But if the script on Server B acts to quickly and takes over writes and Server A starts responding now the databases are not consistant anymore.
I guess I could have the script that changes the hosts file to reverse the MASTER and SLAVE computers and reestablish the replication but thats a PITA.
Is there a better way to handle this?
Keep in mind I only have 2 Dual P4 servers. These are just my personal websites and if they go down its not really a big deal but I still would like to know how everyone else would handle this if they were 'somewhat' missioan critical with limited resources.
Thanks...
|