Forum Moderators: phranque

Message Too Old, No Replies

Migrate to new ip without downtime

I need to migrate a website to a new ip in the same server without downtime

         

mhamdi

12:35 am on Jan 5, 2010 (gmt 0)

10+ Year Member



Hello!
I need to migrate a website to another IP within the same server.
The nameservers are those of godaddy and I use their dns service to create an A record and point it to the IP in my server.
What I did, is I changed the IP of the website in PLESK. And modified the A record in Godaddy.
It is taking hours now and the website is still down.
Is there a way where I prevent this from happening for the next website?
I found a solution but didn't work for me:
<VirtualHost OLDIP:80 NEWIP:80>

I modified httpd.include to add that line.

Any suggestions? I have root access to the server.

g1smd

8:34 am on Jan 5, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Change the TTL to a very low value.

Make the old site non-writeable by users (disable all dynamic content addition, forum posting, cart functionality, etc), and add a note to explain the upgrade.

Get the site online at new IP.

Change the DNS entries.

Allow a few hours to days for everyone to be able to see the new site. Meanwhile, they can still read the old site, but not interact with it.

Extra optional step, temporarily set up the server on the old IP as a proxy for the new IP, accepting requests for the domain name and forwarding them to the direct IP of the new server. This will mess with your site stats and logging, but users will 'see' the new site immediately and the DNS change (when it happens) will result only in a few minutes of outage.

After a few days, change the TTL value back to whatever it previously was.

mhamdi

7:08 pm on Jan 5, 2010 (gmt 0)

10+ Year Member



Thank you g1smd for your reply.
I am not moving to a new server, I need to assign a new IP for the website in the same server. so I cannot create two copies of the same website.
The solution in my first post consists in:
- assign the new ip to the website. the virtualhost entry in httpd conf will be updated to <VirtualHost NEWIP:80> so those still using the old IP will see the site down. The solution is to add the old IP to VirtualHost as well
<VirtualHost OLDIP:80 NEWIP:80>

I did that and restarted httpd but I still cannot have the server to direct requests of the old IP to the server, so I am certainly doing something wrong.

jdMorgan

8:42 pm on Jan 5, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You don't have to have two copies of the site contents, but you do need to have both IP addresses ultimately resolve to the same (new) server for the length of time needed for DNS propagation.

This requires that you keep the old IP address for a time, and that you implement either a 302-Found redirect or a reverse-proxy through-put from the old IP address to the new IP address as g1smd described. After the DNS change has fully propagated, you can then release the old IP address and remove the redirect/proxy code.

Jim

mhamdi

9:55 pm on Jan 5, 2010 (gmt 0)

10+ Year Member



I am hosting other websites in the old IP so I cannot redirect it to the new IP.
I need to tell Plesk to send the requests to old IP to the new IP for those who did not catch the change yet.
Is this even possible?
Just I want to emphasize that both IPs are in the same server. there is no new server

g1smd

10:08 pm on Jan 5, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I need to tell Plesk to send the requests to old IP to the new IP for those who did not catch the change yet.
Is this even possible?

That would be the 'proxy' solution that was mentioned above.

However it's almost too late to be changing things around, because you have already proceeded to step 4 without doing step 1 or 2.

jdMorgan

10:19 pm on Jan 5, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes. It's too late for this site.

But in the future, it is possible, just not using the simple functions provided by Plesk or other control panels.

You can easily redirect or proxy requests arriving at the old IP address to the new IP address by simply checking the requested hostname in the HTTP request (in the Host header). If the request arrives at old-IP for old-Hostname, then redirect/proxy it to new-IP. If the request is for a different hostname, then leave the request alone.

Three lines of mod_rewrite code in .htaccess will do it either way. If the code is in a server config file, then it only takes two (since the server context is already established by which vHost container it's in).

Jim