Hello, I recently had downtime on my dedicated server and I am now looking to mirror all the content of my server to another server. I am thinking of simply buying another server like the one I already have and get some mirroring software that would mirro everything to a backup server. In case of failure the main server would shut down (it also runs dns) and than dns of backup server would kick in after some time and take over the traffic. What do you think? What is the best way to make a mirror? I know that with this kind of dns setup there is stil some downtime, but still better than if there is no such setting and I am away and can't fix it. Your experience and feedback on server mirroring is much appriciated!
I'd suggest you keep the DNS separate, either on your own separate servers or from a third-party, though this isn't entirely necessary. For mirroring, use rsync. It is optimized for exactly this and has saved me countless hours, bandwidth and processing when backing up or updating servers. A hidden advantage of mirroring is being able to use the second server to handle some of the load from the main one (can be done via DNS round-robin). You will have to setup the failover mechanism manually though. Write a script that changes the DNS in case there's a failure.
If you want redundant server systems; 2 servers - Both Servers run nearly exactly the same configuration - RSYNC files between servers - /home/* , namedb & mail MySQL - sync/replicate between the two servers Internal VLAN is required otherwise you will encounter some issues. 3rd party round robin DNS Feel free to contact me if you would like this setup.
If you do want easy fail over, and/or third party DNS I highly recommend using http://www.dnsmadeeasy.com/. I have been using them for about 10 months and have had 0 problems.
On one server run your primary dns, on the second server run your secondary dns. Creating fail over using bind is very simple, and does not need a third party to do it. In order to do round robin dns, simply create 2 entries for the same host. So for instance: www.site.com. in a 1.2.3.4 www.site.com. in a 1.2.3.5 When you do a DNS checkup on www.site.com it will reply with both ips and randomly choose which one will be first. (Meaning, both sites will take client load). If one server is offline when the dns check is done, most modern browsers (firefox, ie6, ie7, etc) will automatically attempt to connect to the second one. So, all you need to do is setup dual master mysql replication Here is a step by step how to for creating a dual master mysql setup. http://www.neocodesoftware.com/replication/ This allows both servers to receive and send data to each other. If a user lands on server a and does something, those changes will be replicated to server b, and vice versa. The only other thing you need to do is make sure that your filesystem of server b is up to date with server a. This can be done by using block level network replication, or simply by using an rsync. I'm not sure what you'll be hosting but this is usually where people run into trouble where each server needs to pull the files from a central source. Normally what I do in this case is have the secondary server mount the web directory on an NFS partition remotely, meaning the secondary server will pull files (php/html/images) from the primary server across the web (can be a little slow depending on where your servers are). Then create a crontab script on the secondary server which will backup the nfs drive to a local directory. If anything bad happens to the primary server, all you need to do is copy the backup directory into place and you're live again (total downtime < 30 seconds)
I have used dual master replication before and it works well. Watch out for the masters coming out of sync, it can be a pain to get everything working right.
You don't need round robin dns, you just need to put a dns server on each box. Each dns server reports a different IP for your website (same as its IP). That way when one box goes down the other will automatically take on the dns traffic and it will direct everyone to the server thats still working. I've used it several times to spread out sites over several VPS's and its worked great. 100% reliability, low cost.
Nice thread! I want to do something similar but... Is the DNS check done every time the page is loaded? Or do browsers sometimes cache it meaning the server that is down will still be shown?