The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

DNS Failover

Discussion in 'Bind / DNS / Nameserver Issues' started by muliahosting, Jun 8, 2009.

  1. muliahosting

    muliahosting Member

    Joined:
    Feb 4, 2008
    Messages:
    20
    Likes Received:
    0
    Trophy Points:
    1
    Dear all,

    is there any API or script to make DNS failover working upon WHM?

    Eg. I have domain abc.com which using Cpanel DNS only for DNS. I have 2 server with same content as www.abc.com (currently I add manual www.abc.com and www1.abc.com).

    Now, how do I create simple script (combine ping and wget for small txt from other server and compare it). If www is down, then I asked Cpanel DNS to update or create A record for www same with www1, so user does not need type www1.abc.com manually.

    Sorry for my english, and thank you.
     
  2. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    In cPanel 11.25, we will be introducing an Edit DNS XML-API function. However, I have no ETA on 11.25.
     
  3. muliahosting

    muliahosting Member

    Joined:
    Feb 4, 2008
    Messages:
    20
    Likes Received:
    0
    Trophy Points:
    1
    Thank you for your response,

    but we can not wait, so is there any solution for temporary? or little script?
     
  4. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    Why not just use rollover DNS resolution and mirror the accounts?

    I would presume you already have the mirroring portion setup if you
    already have the same content setup on both servers. In that case,
    all you would need to do is have (2) TWO entries in the DNS 'A' records
    for the same web address and you'll already have most of what you ask.

    In example ...
    Code:
    www IN A 127.0.0.1
    www IN A 127.0.0.2
    
    (Surprisingly most people don't know that you can actually do that)

    IE: instead of "www" on one server and "www1" and the other,
    you instead make both servers "www" and update the DNS zone
    files to have both IP addresses with (2) separate "A" records with
    the same "www" host identifier.

    Upon DNS resolution, BIND will normally rollover between the two
    IP addresses at each query and basically but not exactly load balance
    all you incoming connections between the two servers.

    If one server is down, the DNS resolution will fail but having both entries
    delivered will trigger most hosts to try the alternate IP for connectivity.

    The one thing that would be important though is that the DNS is not
    handled solely by the downed server. I would instead cluster your DNS
    between the servers and set both servers as authoritative servers for
    the domain name in question.

    You can also update the ZONE templates in Cpanel if you want to have
    the secondary IP address automatically added at account creation time.

    If you need to access a specific server, you can either create an alias
    address such as "www1" or "www2" or just add the IP of the server you
    need to connect to the "hosts" file on your own local computer.

    Hope that helps
     
    #4 Spiral, Jun 13, 2009
    Last edited: Jun 13, 2009
  5. muliahosting

    muliahosting Member

    Joined:
    Feb 4, 2008
    Messages:
    20
    Likes Received:
    0
    Trophy Points:
    1
    Hello Spiral,

    I already setup "failover" like your suggestion, create www and www1 with different IP/location. But what I want to do is:

    If www (as main webserver) down then I execute some scripts on main DNS server to change IP of www to IP of www1 and spread to slave DNS.

    Thank you.
     
  6. damianz

    damianz Member

    Joined:
    May 28, 2009
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    United Kingdom
    cPanel Access Level:
    DataCenter Provider
    A round robin effect as described by Spiral would be much more effective. Due to such factors as DNS propogation etc even if the DNS switched straight away the would be hours of downtime for DNS propogration to the new IP then if you switch it back you would have to wait for it to propogate again. The easiest way is to do what Spiral said which would just cause all requests to go to the live server but it would cause the requests to go to both servers not just the main one and the second one. If you wanted to specificaly use one main server and one standby then your looking at costly load balancing/network stuff Id guess.

    Also why www and www1 :S

    I mean if you really wanted to do it you would have to edit the raw DNS file then reload BIND but I dont think there is an API call to push the config accross a cluster. So in effect till there is an API function to do it it would be quite tricky.
     
    #6 damianz, Jun 17, 2009
    Last edited: Jun 17, 2009
  7. fineline

    fineline Active Member

    Joined:
    Apr 10, 2006
    Messages:
    25
    Likes Received:
    0
    Trophy Points:
    1
    I would suggest DNS Made Easy it's free and they handle it all. no need for a script or anything. set a 3 min TTL... If server "A" is down it updates ip to server "B". as soon as "A" is back online it changes over to "A" again. It checks the server status every 30-60 seconds i believe. It also allows you input a a file to run on your server and a string to grab.

    I'm attaching a screenie of there demo fail over page...
     

    Attached Files:

  8. muliahosting

    muliahosting Member

    Joined:
    Feb 4, 2008
    Messages:
    20
    Likes Received:
    0
    Trophy Points:
    1
    Dear all,

    finally I use webmin system status to do this task :)

    and it is work perfect.

    Thank you
     
Loading...

Share This Page