Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I recently bought a second webserver because I worry about hardware failure of my old server. Now that I have that second server I wish to do a little more then just have one server standby and replicate all day. As long as it's there I might as well get some advantage our of it !

I have a website powered by ubuntu 12.04, nginx, php-fpm, apc, mysql (5.5) and couchdb.

Im currently testing configurations where i can achieve failover AND make good use of the extra harware for faster responses / distributed load.

The setup I am testing nowinvolves heartbeat for ip failover and two identical servers. Of the two servers only one has a public ip adress. If one server crashes the other server takes over the public ip adress. On an incoming request nginx forwards the request tot php-fpm to either server a of server b (50/50 if both servers are alive). Once the request has been send to php-fpm both servers look at localhost for the mysql server. I use master-master mysql replication for this. The file system is synced with lsyncd.

This works pretty well but Im reading it's discouraged by the (mysql) community.

Another option I could think of is to use one server as a mysql master and one server as a web/php server. The servers would still sync their filesystem, would still run the same duplicate software (nginx,mysql) but master slave mysql replication could be used. As long as bother servers are alive I could just prefer nginx to listen to ip a and mysql to ip b. If one server is down, the other server could take over the task of the other server, simply by ip switching.

But im completely new at this so I would greatly value your expert advice. Is either of the two setups any good ? If you have any thoughts on this please let me know !

PS, virtualisation, hosting on different locations or active/passive setups are not solutions im looking for. I find virtual server either too slow or too expensive. I already have a passive failover on another location. But in case of a crash I found the site was still unreachable for too long due to dns caching.

share|improve this question

1 Answer 1

We do it on all our customer HA boxes and our Magento MicroCloudTM/ configurations, so that the fail over system(s) isn't idle. Look into DRBD, Linux VServer and heartbeat.

Read the following for an insight into it.

http://linux-vserver.org/Getting_high_with_lenny

Caveat But as always, we advise not trying to do this unless you have substantial experience, as you are more likely to end up with a more unreliable configuration, that is harder to debug and if you end up in a split brain situation, more likely to have data loss ... than a plain old single server.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.