Results 1 to 16 of 16

Thread: how to create simple backup mirror dns failover?

  1. #1
    Join Date
    Oct 2009
    Posts
    101

    how to create simple backup mirror dns failover?

    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?

  2. #2
    Join Date
    Dec 2010
    Location
    PL/EU
    Posts
    170
    Quote Originally Posted by questions View Post
    4) Has anyone done this?
    No, because it's stupid to have 4 DNS on 2 servers If you want real redundancy make 3 DNS on 3 servers.

  3. #3
    Join Date
    Oct 2011
    Posts
    4
    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.

  4. #4
    Join Date
    Apr 2005
    Location
    GMT +7.00
    Posts
    11,023
    Quote Originally Posted by questions View Post
    Ideas/comments/suggestions?
    MySQL replication/rsync? With VRRP/CARP?
    With regards, Alex.

    Professional Server Management for web hosting companies and individuals
    Hourly Support, Disaster Recovery, Server Hardening, Monthly Subscription
    Directadmin installation and optimization

    Click here if you need a Linux Admin

  5. #5
    Join Date
    Oct 2009
    Posts
    101
    Quote Originally Posted by phoenix78 View Post
    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

  6. #6
    Join Date
    Oct 2009
    Posts
    101
    Quote Originally Posted by zEitEr View Post
    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?

  7. #7
    Join Date
    Oct 2009
    Posts
    101

  8. #8
    Join Date
    Apr 2005
    Location
    GMT +7.00
    Posts
    11,023
    I should have said

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

    to mirror mysql?
    is to use replication.
    With regards, Alex.

    Professional Server Management for web hosting companies and individuals
    Hourly Support, Disaster Recovery, Server Hardening, Monthly Subscription
    Directadmin installation and optimization

    Click here if you need a Linux Admin

  9. #9
    Join Date
    Apr 2005
    Location
    GMT +7.00
    Posts
    11,023
    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?
    With regards, Alex.

    Professional Server Management for web hosting companies and individuals
    Hourly Support, Disaster Recovery, Server Hardening, Monthly Subscription
    Directadmin installation and optimization

    Click here if you need a Linux Admin

  10. #10
    Join Date
    Apr 2005
    Location
    GMT +7.00
    Posts
    11,023
    Quote Originally Posted by questions View Post
    mysql replication is tricky?
    Not, for me. Can't say anything about you....
    With regards, Alex.

    Professional Server Management for web hosting companies and individuals
    Hourly Support, Disaster Recovery, Server Hardening, Monthly Subscription
    Directadmin installation and optimization

    Click here if you need a Linux Admin

  11. #11
    Join Date
    Oct 2009
    Posts
    101
    what kind of changes to domain zone?

  12. #12
    Join Date
    Oct 2009
    Posts
    101
    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?

  13. #13
    Join Date
    Jun 2007
    Location
    California
    Posts
    498
    Quote Originally Posted by questions View Post
    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
    Serving the DirectAdmin community since 2003
    See Additional posts under user nobaloney

    directadmin@nobaloney.net +1 951 643-5345
    Contract DirectAdmin administration and support
    Dedicated Servers, Dedicated Reseller Accounts
    http://www.nobaloney.net
    NoBaloney Internet Services div. Qnito Incorporated
    848 North Rainbow Blvd., Suite #3789
    Las Vegas, NV 89107-1103

  14. #14
    Join Date
    Apr 2005
    Location
    GMT +7.00
    Posts
    11,023
    Quote Originally Posted by questions View Post
    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?
    With regards, Alex.

    Professional Server Management for web hosting companies and individuals
    Hourly Support, Disaster Recovery, Server Hardening, Monthly Subscription
    Directadmin installation and optimization

    Click here if you need a Linux Admin

  15. #15
    Join Date
    Oct 2009
    Posts
    101
    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)

  16. #16
    Join Date
    Apr 2005
    Location
    GMT +7.00
    Posts
    11,023
    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.
    With regards, Alex.

    Professional Server Management for web hosting companies and individuals
    Hourly Support, Disaster Recovery, Server Hardening, Monthly Subscription
    Directadmin installation and optimization

    Click here if you need a Linux Admin

Similar Threads

  1. DNS failover
    By guaro001 in forum DNS
    Replies: 5
    Last Post: 07-09-2011, 03:42 PM
  2. Failover system
    By cwfie in forum Installation / System Requirements
    Replies: 3
    Last Post: 01-27-2010, 07:44 PM
  3. Poor man's failover cluster
    By df-sean in forum General Technical Discussion & Troubleshooting
    Replies: 4
    Last Post: 02-21-2009, 02:57 PM
  4. Directories to Backup/Mirror
    By jmackler in forum General Technical Discussion & Troubleshooting
    Replies: 1
    Last Post: 03-23-2005, 04:56 PM
  5. DA Failover Clustering.
    By KacangPutih in forum Installation / System Requirements
    Replies: 1
    Last Post: 01-20-2005, 09:36 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •