1

I have a server hosting several websites.

From time to time I migrate the websites on a second server to get the latest hardware and software.

The second server has a different IP and this causes the problem that any user not using my nameservers (and their automatically updated DNS zones) has to manually update the IP (for example if the user is using cloudflare)

Can you think of any way I can update my hardware and software without having to use a different IP?

1

There are several ways to approach this problem. All of them you can test using virtual machines.

  1. The most simple one is to use DNS. DNS was created exactly to hide what is happening with your IP. Use IN CNAME for all web sites (www.example-site1.com) and IN A for the host (e.g. myserver.example.com). To do the migration, prepare a new server that is in sync with the old one. Make sure all sites are working fine on the new server. Use rsync for the web pages. If you are running a MySQL, then you create a MySQL slave on the new server. During the migration, stop the application (apache, tomcat...), then change the roles of the DBs, so that the new server becomes the MySQL master.

  2. You can just swap the IPs, but you have to be careful. You can make your life easier if you have out of band management (LOM, ILOM, BMC, IPMI).

  3. You can use virtualization and you can stop the old VM and start the new VM with the new IP.

  4. You can use a load balancer or reverse proxy (as suggested by TheFiddlerWins) that will hold your public IP and internally you will use different IPs for the web servers, and make the swap in the load balancer/reverse proxy. See: http://www.apachetutor.org/admin/reverseproxies and http://www.cisco.com/en/US/products/hw/contnetw/ps792/index.html

  5. If you have a firewall you can do DNAT and "change" the IP on the fly.

| improve this answer | |
  • Interesting answer, I will study all the options as soon as I complete this hideous migration. Thanks for sharing Mircea. – wlf Aug 19 '13 at 15:03
  • 1&2) I am not sure I follow. Do you mean domain.com > hs1.hosting.com and then change hs1.hosting.com's IP? The problem with solution 1 & 2 is that there are thousands of small websites to migrate on the server, the migration takes a whole day. I can change hs1.hosting.com's IP at once or at the end of the migration, but in either case some websites won't be online the whole day. – wlf Aug 19 '13 at 20:30
  • 3) The virtualization solution would work and it deserves to be in the list, but unfortunately it's not an option in my case. I am no fan of VMs and the extra layer of complexity, also it would be there just for migration purposes. However it deserves to be in the list. – wlf Aug 19 '13 at 20:40
  • 4) I have 0 experience with load balancers, it's something on the network before the server, right? I am just renting a server, would I have to rent a load balancer for that? – wlf Aug 19 '13 at 20:51
  • 1,2,3,5, just prepare the new server with all sites and swap all of them at once. – Mircea Vutcovici Aug 20 '13 at 14:27
1

Do you want to eventually get them pointed to the new IPs? You can use ProxyPass /oldpath http://newsiteIP/newpath/ for specific locations

or just redirect the whole site with

<VirtualHost Oldsite:80>
    Redirect Permanent / http://newsiteIP/newpath/
</VirtualHost>`

Which will give the browser a 303, this will let you change the DNS for "oldsite" to point at the new location (via IP) as long as folks are resolving the old IP. Eventually everyone will resolve to the new IP (assuming you changed DNS) and you can remove this from the old host completely.

| improve this answer | |
  • I have somewhat clarified my question, check it out – wlf Aug 19 '13 at 14:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.