Saturday, January 29, 2011

Forwarding HTTP requests from old server to new server

I am moving many sites from an old web server to a new one. It needs to be done as transparently as possible.

The sites are backed by a WCMS, so there is a possibility that clients can make changes to what is actually their old site. To avoid this, I was thinking of setting up either a TCP or HTTP proxy on the old machine which transparently forwards on to the new machine. This would greatly reduce pressure to deal with the DNS, which is going to be a colossal job in itself due to some poorly made decisions in the past.

Should I use an HTTP or TCP proxy, or is this just generally a bad call? Note that I am dealing with a few thousand sites basically on my own.

  • There are a few ways to do this which may or may not work in your situation, but here's one option:

    • setup a copy of the sites on the new server and have your site owners confirm that they are correct (by new or testing IPs)
    • if you can't move the IPs over, about a day in advance set your TTL on DNS really low, like 5 minutes
    • run robocopy on the site to push everything to the new server. Run it often and run it again just before going live
    • to ensure that your users can't write to the old location, at a go live time in the best off-peak time, stop IIS on the old server
    • do a final robocopy to ensure that the new server is 100% up to date
    • start IIS on the new server and update DNS or move the IPs

    You could set a redirect on the old server instead of just stopping it but it will need to redirect to another IP, so that's not always very clean. If you figure you can setup a proxy, that wouldn't hurt, but you'll still need to have a time when you stop the site, to the final robocopy, and then start the new site. Otherwise the data could be out of sync.

    If your site owners manage their own DNS and you can't cut it all over at the same time then the proxy sounds good. If you can move the IPs, you don't need to worry about the proxy, but if not, probably a HTTP proxy is the way to go.

    Bill Weiss : This doesn't actually help with the question, which is proxying between the servers during the time that DNS is propagating.
    Scott Forsyth - MVP : My main point there is that if the TTL is set low a day in advance, it's going to switch over in about the time that the final data copy can be done. It's not possible to do a full server move without any downtime if data integrity is a requirement and data is written to disk from the application. Since there needs to be downtime anyway, line it up with DNS and the proxy isn't required. A proxy certainly isn't the easiest solution, but can be done if required. Also, I assume since it's an old server that it's not IIS7 which has ARR as a good proxy option.
  • If you're using IIS on both servers (even better if you're using IIS 7+), you could set up a forwarding rule on the old server that would forward all traffic to the new IP. This may not be very clean, as users may be shown the new server's IP address. The other option would be to put up a new page that all traffic is sent through on the old server that rewrites the output from the new IP. (i.e. old- http://www.example.com IP = 0.0.0.1 new IP = 0.0.0.2, 0.0.0.1 has a page that requests http://0.0.0.2/whatever, and sends that response back to the user). The trick would be sending the form data from the one server to the other.

  • FWIW when I was ready to funnel incoming mail to the new server, I just changed the NAT rules on the firewall to point the external IP to the updated internal IP. Quick, easy, and best of all - if I needed to revert in a hurry, it'd only take a few seconds to change.

0 comments:

Post a Comment