LAMP Server Failover


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users LAMP Server Failover
# 1  
Old 08-07-2008
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...
# 2  
Old 08-08-2008
Solutions like Linux Heartbeat can do the job, too.

Our setup involves 150+ RH boxes. This is not just LAMP webservers but all of the MySQL apps servers - we are on a SAN so failing over for several unrelated apps can be relegated to one server, since if all the servers servers failed at once we would be in disaster mode, failing to a remote site.

You must have an I/O problem with your setup - relegating reads ands writes to separate boxes.
# 3  
Old 08-08-2008
Quote:
Originally Posted by jim mcnamara
Solutions like Linux Heartbeat can do the job, too.
Heartbeast is one optionj I did find but im limited to these 2 servers.

Quote:
Originally Posted by jim mcnamara
You must have an I/O problem with your setup - relegating reads ands writes to separate boxes.
The system I have is working OK, im just trying to find if there is a better solution for the MySQL redundancy than having scripts rewriting hosts files and switching MASTER and SLAVE MySQL servers. It just seem there has to be a better solution.
# 4  
Old 08-08-2008
For what you want you need a disk server/linux cluster box of some kind, maybe with high availability raid.

Then, allow both servers to process read & write. When one fails the other is there by default. The disks are already there, mounted, served out by another box, so they do not have a failover problem.

This also solves the 'out of sync' problem.

This is almost exactly what everybody with a SAN is doing right now. Except for orders of magnitude lower cost. Our SAN costs us $US40 per MB; a PC with SATA can have a MB of raid for 2 orders of magnitude less. Circa $US1.00 - $US2.00 per MB.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. HP-UX

LAMP Installation On HP-UX

Dear Folks, How to Install LAMP on HP-UX system. Please Guide. Regards, KRISHNA (2 Replies)
Discussion started by: krishna.lu
2 Replies

2. Web Development

Building LAMP server from scratch (build a server with compiled LAMP from CentOS mini)

Hello everyone, I would like to setup a lamp server from a minimal distro and to compile PHP, MySQL and Apache myself. I have chosen CentOS minimal for the OS and I am trying to build the stack by hand... But well, it appears I need some help! First: I am looking for good and recent... (3 Replies)
Discussion started by: freddie50
3 Replies

3. Web Development

Ideas for site migration: How would you do it? LAMP -> something w/ Sql Server

I'm afraid I'm going to have to migrate our entire website from Linux. There have been a number of irregularities in our MySQL database and the system that we have set up -probably isn't scalable. Since my manager is re-envisioning (taking the moment to re-engineer) -he wants to move the... (5 Replies)
Discussion started by: Astrocloud
5 Replies

4. Red Hat

DNS server loadbalancing and failover

Hi Friends, I am setting up my new public DNS server using bind 9 on RHEL5.5 64bit. I also want to have an another DNS failover server on one of my another datacenter. My question is, if i installed an new slave DNS server on the second datacenter and configure the zone transfer, do it will be... (2 Replies)
Discussion started by: arumon
2 Replies

5. HP-UX

HP-UX: LVM migration from legacy to agile addressing onto a failover server

Hi there! I'm having problems migrating and vgimport onto a different server. Original server uses the legacy DSF naming (ctd naming like /dev/dsk/c0t1d0) and the new server where i'm migrating those luns to is using the Agile addressing (i.e persistent DSF i.e. /dev/disk/diskxxx) Importing a... (1 Reply)
Discussion started by: ilan
1 Replies

6. Web Development

[PHP] Server Check and Failover Code

Here is some sample PHP code you can run if you have a PHP web application that uses code or images from an ad server, image server, or content deliver network, and you want to check if it is working and if not, failover to another one: <?php $current_server = "server.domain.com"; // set... (0 Replies)
Discussion started by: Neo
0 Replies

7. High Performance Computing

Veritas Cluster Server Management Console IP Failover

I have just completed a first RTFM of "Veritas Cluster Server Management Console Implementation Guide" 5.1, with a view to assessing it to possibly make our working lives easier. Unfortunately, at my organisation, getting a test installation would be worse than pulling teeth, so I can't just go... (2 Replies)
Discussion started by: Beast Of Bodmin
2 Replies

8. UNIX for Dummies Questions & Answers

LAMP configuration

Hi there, I've got a debian 3.1r4 half working (no x yet :P) I need some pointers for installing a Apache - MySQL - PHP configuration on my box, and set them up to work together. I know to use vim a bit :) I would like something that is similar to tanguay.at, or even simpler, since I'm a real... (1 Reply)
Discussion started by: izua
1 Replies
Login or Register to Ask a Question