A zero-downtime Magento 2 DNS cutover lowers DNS TTL to 300 seconds 48 hours ahead of launch, pre-stages files and OpenSearch indices, verifies checkout via hosts override, briefly enables maintenance mode for a final database delta sync, and switches DNS A records to prevent split-brain orders.
Completing file and database transfers is only half of a safe migration—poor DNS cutover timing still causes split-brain orders. Execute this 48-hour zero-downtime DNS cutover for Magento protocol using 300s TTLs, maintenance-mode delta syncs, and post-switch checks.
Main Problem
High default DNS TTLs (3,600–86,400 seconds) cause split-brain traffic where overlapping customer orders and auto-increment IDs collide across two databases.
Technical Consideration
Reducing TTL to 300 seconds at T-48 hours and proxying or freezing the old host at T-0 guarantees single-writer database consistency.
Practical Implication
Storefronts remain fast and consistent throughout cutover, with zero lost sales, zero duplicate order numbers, and instant rollback capability.
The Split-Brain Nightmare: Why Unplanned DNS Changes Corrupt Orders
In distributed systems, a “split-brain” occurs when two independent nodes both believe they are the authoritative primary database. During a Magento 2 host switch, if your DNS A record has a 24-hour TTL (86,400 seconds) and you change it to point to your new server without freezing the old host, mobile carriers and corporate ISPs will continue sending shoppers to the old IP for hours. Both servers will generate overlapping sales_order increment IDs (for example, order #10004512 on both servers for two different customers), making post-migration reconciliation nearly impossible.
The 48-hour cutover protocol below—designed as the operational companion to our step-by-step Magento 2 migration runbook—ensures only one database ever accepts live checkout writes at any given second.
| Timeline | Critical Action | Operational Goal |
|---|---|---|
| T-48 Hours | Lower DNS A, AAAA, and CNAME TTL to 300 seconds |
Force global DNS caches to expire within 5 minutes at cutover |
| T-24 Hours | Pre-stage files via rsync and build OpenSearch indices |
Minimize delta transfer size during the live cutover window |
| T-2 Hours | Test storefront and checkout via local hosts file |
Verify SSL, PHP-FPM, Varnish, and payment callbacks before DNS flip |
| T-0 to T+30m | Freeze old host, run final delta DB sync, switch DNS | Guarantee 100% order integrity and single-writer state |
| T+48 Hours | Restore standard 3600s TTL; archive old server | Complete migration cleanly with full rollback archive retained |
T-48 Hours: Lowering DNS TTL to 300 Seconds
Two full days before your planned cutover, log into your authoritative DNS provider (Cloudflare, Route 53, or your domain registrar) and reduce the TTL on your apex A record (yourdomain.com) and www record to 300 seconds (5 minutes). Do not wait until the morning of the migration to lower TTL: if your old record had an 86,400-second TTL, resolvers around the world will not even check for your new 300-second TTL until their existing 24-hour cache expires.
Verify the active TTL propagation from the command line using dig against public resolvers:
If your domain routes through Cloudflare in proxied (orange-cloud) mode, updating the origin IP inside Cloudflare takes effect at the edge within seconds—making Cloudflare an ideal zero-propagation buffer when migrating Magento stores.
T-24 Hours: Finalizing Codebase Sync and Pre-Warming OpenSearch
Twenty-four hours before cutover, freeze non-essential code deployments and theme edits on the old host. Run a full rsync of the Magento directory and pub/media/ to the new server, import a baseline database snapshot, compile dependency injection (bin/magento setup:di:compile), and run bin/magento indexer:reindex so OpenSearch 2.x is fully populated.
Also provision your Let’s Encrypt or commercial SSL certificate on the new Nginx server using DNS-01 validation (or copy the active certificate and private key from the old host) so HTTPS works immediately before DNS points to the new IP. Verify Nginx configuration syntax with sudo nginx -t and confirm Varnish responds to sudo varnishadm ping before moving to the T-2 hour smoke test.
T-2 Hours: Local Hosts File Preview and Payment Webhook Checks
Two hours before cutover, map your domain to the new server IP in your local workstation’s hosts file and walk through a complete smoke test: verify Varnish X-Magento-Cache-Debug: HIT headers, confirm product images load from pub/media/, and verify outbound connectivity to payment gateways (Stripe, PayPal, Razorpay) and transactional SMTP relays. Ensure your new server’s public IP is allowlisted in any third-party ERP or warehouse firewall before going live.
T-Zero: Freezing Writes on the Old Host to Prevent Split-Brain
At T-Zero (ideally during your store’s lowest-traffic hour, such as 02:00 AM local time), log into the old server via SSH, disable the old Magento cron jobs temporarily, and enable maintenance mode so no new customer orders or account registrations can modify the old database:
T+15 Minutes: Executing the Final Delta Database Sync
With the old server frozen, run a quick rsync pass over pub/media/ (copying only files added in the last 24 hours) and export the final database snapshot from the old host. Because the database is already sized and warmed on the new host, importing the final dump and running bin/magento indexer:reindex + bin/magento cache:flush typically completes in 5 to 12 minutes. Verify that the latest order ID in the new database’s sales_order table matches the last order placed on the old server:
T+30 Minutes: Updating DNS Records and Proxying Straggler Traffic
Update your DNS A records to the new server’s IP address and remove the temporary entry from your local hosts file. To achieve true zero-downtime for any straggler visitors whose ISPs ignore the 300-second TTL, configure Nginx on the old server as a temporary reverse proxy forwarding HTTP/HTTPS requests directly to the new server’s IP:
Including proxy_ssl_server_name on; and proxy_ssl_name $host; ensures the old Nginx server sends the proper SNI hostname during the TLS handshake with the new host. With that reverse proxy active on the old host, even a visitor using a stubborn resolver immediately interacts with the live new database—achieving seamless continuity while DNS finishes propagating globally.
Having a clean rollback plan is equally critical: if a third-party payment gateway or ERP webhook fails unexpectedly within the first 15 minutes after cutover, enable maintenance mode on the new host, point your DNS A records back to the old IP (which propagates in 5 minutes thanks to your 300-second TTL), remove the temporary Nginx proxy block, and disable maintenance mode on the old server. Because only one host accepts writes at any time, you never risk database corruption during a rollback.
After confirming dig +short resolves to the new IP and Varnish returns X-Magento-Cache-Debug: HIT, place one live low-value test order using a real payment method (and refund it afterward) to validate end-to-end checkout, payment gateway webhook callbacks, transactional email delivery, and ERP order sync on the new infrastructure. Also tail var/log/exception.log and /var/log/nginx/error.log for the first 30 minutes to catch any missing PHP extensions, outdated firewall allowlist rules, or third-party API IP restrictions immediately. Finally, confirm bin/magento indexer:status shows every indexer as Ready, cron_schedule is ticking normally, and SSL/TLS certificates validate cleanly across both apex and www domains.
T+48 Hours: Restoring Standard TTLs and Decommissioning the Old Host
Monitor your Nginx access logs on the old server for 48 hours. Once incoming straggler requests drop to zero and payment webhooks are hitting the new server consistently, raise your DNS TTL back to 3600 seconds (1 hour), take one final archive snapshot of the old server as outlined in our Magento 2 automated backups and disaster recovery guide, and decommission the legacy instance.
Frequently Asked Questions
How far in advance should I lower DNS TTL before a Magento migration?
Lower your DNS TTL to 300 seconds at least 48 hours before cutover. This gives all existing 24-hour ISP caches plenty of time to expire and pick up the shorter 5-minute refresh window.
What is split-brain order divergence in a Magento migration?
Split-brain divergence happens when both the old and new servers accept live checkout orders simultaneously during DNS propagation, creating duplicate order increment IDs and unmerged customer records across two separate databases.
How can I prevent any downtime for visitors with cached DNS records?
Configure Nginx on the old server as a reverse proxy (proxy_pass) pointing to the new server’s IP immediately after the final database sync, or use Cloudflare’s orange-cloud proxy to swap origin IPs instantaneously at the edge.
Should I disable maintenance mode before or after updating DNS?
Keep maintenance mode enabled on the old server permanently (or replace it with a reverse proxy to the new host), and ensure maintenance mode is disabled on the new server as soon as the final delta database import and cache flush finish—right as you update DNS.
When is it safe to cancel the old Magento hosting server?
Wait at least 48 to 72 hours after cutover, verify zero traffic in the old server’s Nginx access logs, and confirm all payment webhooks and cron jobs are running cleanly on the new host before decommissioning.
How do I verify order parity between the old and new databases after the delta sync?
Run SELECT MAX(entity_id), MAX(increment_id), MAX(created_at) FROM sales_order; on both the frozen old database and the newly imported database. Both outputs must match identically before you lift maintenance mode on the new host.
What happens to active customer shopping carts during a DNS cutover?
Quote items are stored in the MySQL quote and quote_item tables, which transfer in the final delta dump. However, PHP session keys in Redis are not transferred across hosts unless you explicitly dump Redis, so logged-in shoppers may need to re-authenticate once after cutover.
Execute Zero-Downtime DNS Cutovers With Pre-Staged Magento Nodes
Lowering DNS TTLs 48 hours early and running a fast maintenance-mode database delta sync eliminates split-brain orders during launch. Host your destination stack on fast, pre-warmed Magento infrastructure for a seamless switch.
