how to create simple backup mirror dns failover?

questions

Verified User
Joined
Oct 24, 2009
Messages
144
I'm not an expert sys admin or expert programmer, so go easy on me, I just want more redundancy and to sleep soundly while not getting to complex

#####################################

Here's my idea, let me know where I have problems/holes in my process/logic or break rules:

I want a little more redundancy so I have an idea to have all my customers use 4 DNS servers on their domains. The first two dns point to server 1 the 2nd two point to server 2.

Server 1 is a standard DA install. The user uploads all web data to here as well as the DA control panel. This server sends a live rsync mirror of all needed files and directories at every x minutes to server 2.

Server 2 is a standard DA install identical to the master server. It get's a copy of all the data on the master every x minutes. It should not do any mail, mysql, ftp, DA. It should only serve web data in case the master is down.

#####################################

Questions/thoughts:

1) is it better to just keep server 2 offline and manually setup server 2 to assume the IP's of server 1 in case server 1 fails? (not good if you are on vacation)

2) is it better to come up with some kind of autofailover (server 2 checks to see if server 1 is online, if its offline then it automatically assumes the IP's of server 1)

3) how does DNS work more exactly? Does DNS always seek 1, 2, 3, 4 in that order or is it random?

4) Has anyone done this?

5) Is it better to use shell scripts or Perl running cron to do the scripting in 2)?

6) What data/files/directories need to be rsynced to server 2 to create an auto-failover that just works without configuration (like running ip switch scripts or other DA scripts)?

7) can rsync really create a live mirror, what is the latency and what should the copy frequency be?

8) what are any firewall issues assuming that each server runs ipfw?

#####################################

Ideas/comments/suggestions?
 
And what advantage you get out of it?

For example server one is down and the fallback server is taking over, but is doesnt have mail, mysql, ftp and so on.. so what is the point?
Most websites use mysql, people get theyr mail lost and so on.. i think you get very mad customers when you do this.
 
And what advantage you get out of it?

For example server one is down and the fallback server is taking over, but is doesnt have mail, mysql, ftp and so on.. so what is the point?
Most websites use mysql, people get theyr mail lost and so on.. i think you get very mad customers when you do this.

server 2 is identical to server 1 (it has all the services, its just not using them until server 1 fails)

advantage: redundancy, backup, failover... if your server crashes then you don't have to come home from vacation or wake up in the middle of the night
 
MySQL replication/rsync? With VRRP/CARP?

ive copied MYSQL files from backups just like flat files by creating the username file sinside /home/mysql, this gave me no problem, so i thought you could just use rsync to copy all the files to server 2?

i suppose there is something more you need to do to mirror mysql?
 
I should have said

+ MySQL replication
+ homedirs rsyncing...
+ /etc/virtual rsyncing...
+ /var/www/html rsyncing...

to mirror mysql?

is to use replication.
 
By the way, if the first 2 DNS point to one server, and the last two to another IP, don't you think that:

1. DNS cache might do the trick with you and your customers?
2. Some clients won't query the 3rd and the 4th NS if the fist and the second name servers fail to respond?
3. Some kind of a mess might occur, if for any reason the 3rd NS will respond instead of the first two, even the first two work, but for any reason temporary fails to respond.


And how are you going to sync DNS records between all of the 4th server? If a customer makes any changes to his/her domain zone, how will you copy changes to the others servers? Manually or with a script with IP substitution?
 
I thought about it some more and just rsyncing /home/mysql might work since its a one way copy and if server 1 fails the copying will stop before the user of the copy will start to be used... sure it could result in partial data or incomplete data being copied, but that's ok with me...

in the past i've been able to just put (copy/rsync/whatever) the database file inside the /home/mysql directory and issue the right ownership/permissions and it just works like i've created the mysql databse using DA or phpmyadmin, can anyone confirm this?
 
Server 1 is a standard DA install. The user uploads all web data to here as well as the DA control panel. This server sends a live rsync mirror of all needed files and directories at every x minutes to server 2.
Use rsync, but beware that the current one has to finish before the next one starts. So rather than a cronjob, perhaps a script that calls itself, and the end of the script, before it calls itself, has a wait command if you don't want the rsync to immediately start again.
Server 2 is a standard DA install identical to the master server. It get's a copy of all the data on the master every x minutes. It should not do any mail, mysql, ftp, DA. It should only serve web data in case the master is down.
As others have mentioned, it needs to backup mysql. I'd do it with replication.
1) is it better to just keep server 2 offline and manually setup server 2 to assume the IP's of server 1 in case server 1 fails? (not good if you are on vacation)
No
2) is it better to come up with some kind of autofailover (server 2 checks to see if server 1 is online, if its offline then it automatically assumes the IP's of server 1)
Yes.
3) how does DNS work more exactly? Does DNS always seek 1, 2, 3, 4 in that order or is it random?
Order is always random, but all nameservers are queried at once, and the first reply becomes the accepted IP#. There's nothing to be gained by having two nameservers pointing to the same running copy of BIND; either will either work or fail.
l5) Is it better to use shell scripts or Perl running cron to do the scripting in 2)?
Use whichever is more comfortable for you. Again since script should complete before it runs again, I'd prefer a script which calls itself.
7) can rsync really create a live mirror, what is the latency and what should the copy frequency be?
Yes, but you'll need to experiment to get the details which work in your environment.

Jeff
 
what kind of changes to domain zone?

I don't know anything of your environment and what sites you're hosting. Is it one project server? Or you sell shared hosting? If the second, your customer might want to add/delete domain/sub-domain. With this actions a DNS zone should get updated on all of your name servers. And if you say

I want a little more redundancy so I have an idea to have all my customers use 4 DNS servers on their domains. The first two dns point to server 1 the 2nd two point to server 2.

then I guess the second server is supposed to have a different IP server (do I understand it correct?). If so, you can not just rsync files with zones of BIND. Or I missed anything?
 
shared hosting

2nd server has different IP until the first one fails, then it assumes the IP of the server 1 so the downtime is under 5 minutes

the services are setup identically so i think you can get away with just using rsync, even for mysql, bind, but I'll have to experiment to see

might be easier if DirectAdmin builds a 2nd server autofailover feature :) (keeps amateurs like me from trying it)
 
Yes, I guess it's possible to do so, but here and further you are mostly on your own, until you want to hire somebody from us, or have a concrete question.
 
Back
Top