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.

Point website to new server

Discussion in 'General Discussion' started by Tagor, Dec 8, 2005.

  1. Tagor

    Tagor Well-Known Member

    Joined:
    Mar 6, 2004
    Messages:
    193
    Likes Received:
    0
    Trophy Points:
    16
    I have a new server but I would like to transfer my website without having downtime. So I want to point all visitors from the old server, to the new server. Can someone tell me how I can do that?

    Thanks :)
     
  2. Lyttek

    Lyttek Well-Known Member

    Joined:
    Jan 2, 2004
    Messages:
    770
    Likes Received:
    3
    Trophy Points:
    18
    In a nutshell:

    1) at least 48hrs before the switch, set the TTL on your domains to expire on a short interval, say 15 minutes.

    2) When you're ready to move, shutdown the old site, move to the new one and bring it up.

    3) once the move is complete, change the TTL back to a normal setting.

    Since DNS isn't the always the most responsive thing, setting the TTL to a short setting makes it expire from other servers and caches throughout the web. This minimizes the possibility that someone will hit the old site instead of the new one.

    Zat what you were looking for?
     
  3. yapluka

    yapluka Well-Known Member

    Joined:
    Dec 24, 2003
    Messages:
    301
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    France
    cPanel Access Level:
    Root Administrator
    You can edit the DNS file on the old server and change the current IP to the new one so your visitors still resolving to the old server will be redirected to the new one.
     
  4. HostMerit

    HostMerit Well-Known Member

    Joined:
    Oct 24, 2004
    Messages:
    160
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    New Jersey, USA
    cPanel Access Level:
    DataCenter Provider
    12 hours before you change the name servers, make sure the site is on the new server fully setup.

    On the OLD machine, pico /var/named/DOMAINNAME.COM.db file.

    Change all instances of the IP to the new one, example - Old Machine is 127.0.0.1, new is 127.0.0.2. Also change the expire to 3600, for 1 hour on the old machine.

    Code:
    ; cPanel 10.1.0
    ; Zone file for demomove.com
    $TTL 14400
    @      IN      SOA     ns1.hostmerit.com. kris.hostmerit.com. (
                    2005082001      ; serial, todays date+todays
                    14400           ; refresh, seconds
                    7200            ; retry, seconds
                    3600000         ; expire, seconds
                    86400 )         ; minimum, seconds
    
    demomove.com. IN NS ns1.hostmerit.com.
    demomove.com. IN NS ns2.hostmerit.com.
    
    demomove.com. IN A 127.0.0.1
    
    localhost.demomove.com. IN A 127.0.0.1
    
    demomove.com. IN MX 0 demomove.com.
    
    mail IN CNAME demomove.com.
    www IN CNAME demomove.com.
    ftp IN CNAME demomove.com.
    


    Code:
    ; cPanel 10.1.0
    ; Zone file for demomove.com
    $TTL 14400
    @      IN      SOA     ns1.hostmerit.com. kris.hostmerit.com. (
                    2005082001      ; serial, todays date+todays
                    14400           ; refresh, seconds
                    7200            ; retry, seconds
                    3600000         ; expire, seconds
                    [b]3600[/b] )         ; minimum, seconds
    
    demomove.com. IN NS ns1.hostmerit.com.
    demomove.com. IN NS ns2.hostmerit.com.
    
    demomove.com. IN A [b]127.0.0.2[/b]
    
    localhost.demomove.com. IN A 127.0.0.1
    
    demomove.com. IN MX 0 demomove.com.
    
    mail IN CNAME demomove.com.
    www IN CNAME demomove.com.
    ftp IN CNAME demomove.com.
    

    Make sure not to edit the localhost.domain entry. After that, run:

    Code:
    /etc/init.d/named restart;rndc reload
    In 3-4 hours the domain will start resolving to the new machine. It is at this time, you should change the name servers of the domain, and since it will be moving from the same machine to the same machine, there will be no loss of email / forum posts etc.

    Hope this helps
     
  5. Tagor

    Tagor Well-Known Member

    Joined:
    Mar 6, 2004
    Messages:
    193
    Likes Received:
    0
    Trophy Points:
    16
    @Lyttek
    Thanks that's what I mean. I have a question left; why is the TTL always set at say 4 hours and not at 1 minute for example?

    @yapluka
    Is it correct that you first need to change the TTL because else that doesn't work?

    @HostMerit
    Thanks for the clear tutorial. Do you know if there is also a way to route the visitors directly, so that you don't have to change the TTL 12 hours before?
     
  6. Lyttek

    Lyttek Well-Known Member

    Joined:
    Jan 2, 2004
    Messages:
    770
    Likes Received:
    3
    Trophy Points:
    18
    The TTL basically sets how long information is valid before it expires and is removed from a cache or refreshed. Because this information is propogated throughout the internet, you don't want a really low (say 1 minute) TTL because it will basically constantly expire everywhere, which will generate a lot more traffic because DNS servers will keep asking for information, rather than looking at their own info. If you had a high-traffic site such as slashdot.or for example, with a TTL of 1 minute, the amount of traffic generated by DNS requests could bog down the server. That's a worst-case example, but it's the principle.

    So, in normal everyday situations, the TTL can vary widely, anywhere from several hours to several days.

    If a DNS server has your information cached, and it's not set to expire for three days, and during that three-day period you make a change, it's possible that people, whose systems use that particular DNS for resolution, will not be able to access your site by domain name. That's the reason for setting the TTL down before the move, to give the new TTL time to propogate.
     
  7. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    Do bear in mind that a lot of ISP's will ignore your TTL (AOL have been infamous for this) and will use an arbitrary 24 hours TTL, as they prefer to force their users to used cached information and they consider short TTL's as an excessive burden.

    I remember in years gone by where some countries on bits of string connected to the internet enforced 7 day TTL's. Thankfully, those days are gone ;)
     
Loading...

Share This Page