I need to replace an aging webserver which runs a busy website. I have the new hardware up and running, all software is installed. There's only one problem left where I'm looking for a solution:
When I change the A record for the domain in DNS, it takes a while for the change to propagate through the internet due to DNS caching. During that time, some users will hit the new server, and some will hit the old one, leading to data inconsistencies because there are now two databases. How can I switch everyone over instantly? I do not run the DNS server and cannot change anything but the A and CNAME records, but I could setup my own if that helps.
I can probably have an hour or two of downtime when moving overnight.
Thanks, Simon
edit: Thank you for all your answers. I'm accepting SmallClanger's answer because it's a viable solution, and I'm upvoting Brian because his answer gave me a new idea: Follow SmallClanger's solution up to the database migration, and then replace the old apache with an HTTP proxy which proxies all requests to the new server. I'd configure the proxy to address the new server by IP address, and it does not involve a temporary subdomain which might (despite the 302 code) end up in some bookmark directory, social network or browser cache.