The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 08-07-2008
Ikon's Avatar
Ikon Ikon is offline Forum Advisor  
Registered User
  
 

Join Date: Jul 2008
Location: Phoenix, Arizona
Posts: 669
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...