How to Set Up Hetzner Multi-DC Failover for Maximum Uptime

Introduction

Running a website or application on a single data center is risky – a network outage, power failure, or hardware issue can bring your services down in minutes. Hetzner’s multi‑DC (data centre) architecture lets you distribute resources across several locations, providing automatic failover and near‑zero downtime. This guide walks beginners and intermediate users through the entire process, from planning to monitoring.

Why Multi‑DC Failover Matters

  • Redundancy: If one Hetzner location goes offline, traffic is rerouted to another.
  • Performance: Users connect to the nearest data centre, reducing latency.
  • Compliance: Geographic distribution can help meet data‑residency requirements.

Planning Your Hetzner Multi‑DC Architecture

Choose the Right Data Centres

Hetzner operates three main sites in Germany (Nuremberg, Falkenstein, and another in the Frankfurt region) and one in Finland. Consider proximity to your main audience and the network routes offered by each location.

Decide on the Failover Model

There are two common setups:

  1. Active‑Passive: Primary servers run in DC A, while standby servers sit idle in DC B, ready to take over.
  2. Active‑Active: Traffic is load‑balanced across both sites, and each can handle the full load if the other fails.

Step‑by‑Step Configuration

1. Provision Matching Servers

Create identical server instances in each chosen data centre. Use the same OS version, disk size, and network configuration to simplify synchronization.

2. Synchronize Data

For databases, use rsync, mysqldump, or built‑in replication (e.g., MySQL Group Replication, PostgreSQL streaming). For file storage, consider lsyncd or a distributed file system like GlusterFS.

3. Set Up a Floating IP

Hetzner offers a failover IP that can be moved between servers with a single API call. Assign the IP to the primary server, then automate the switch using a script that triggers on health‑check failures.

4. Health Checks & Automation

Use a monitoring tool (e.g., Prometheus + Alertmanager or UptimeRobot) to ping a health endpoint on your primary node. When a failure is detected, the alert triggers a small script that calls Hetzner’s /failover API to move the floating IP to the standby server.

5. DNS Configuration (Optional)

If you prefer DNS‑based failover, configure a low TTL (30–60 seconds) A record pointing to both data centre IPs and use a service like Cloudflare Load Balancing to handle automatic failover.

Testing Your Failover

  1. Stop the primary service (e.g., systemctl stop nginx).
  2. Verify that the health check flags a failure.
  3. Confirm the floating IP moves to the standby server (use ping or curl the endpoint).
  4. Restart the primary service and test the reverse failback.

Run these tests during off‑peak hours to avoid disrupting real users.

Monitoring & Ongoing Maintenance

  • Set up Grafana dashboards to visualize latency, uptime, and failover events.
  • Schedule regular data sync checks (e.g., daily checksum validation).
  • Update both servers simultaneously with security patches.

FAQ

Do I need separate SSL certificates for each data centre?
No. Install the same certificate on both servers; the floating IP ensures traffic reaches the active node.
How much does a failover IP cost at Hetzner?
Hetzner charges a modest monthly fee (usually €1–€2). Check the current price list on their website.
Can I use Hetzner’s Load Balancer instead of a floating IP?
Yes, Hetzner offers a managed Load Balancer that can distribute traffic across multiple nodes and handle health‑checks automatically.
What if both data centres experience issues simultaneously?
Deploy a third backup node in a different region (e.g., Finland) as a tertiary failover to increase resilience.

Conclusion

Implementing Hetzner multi‑DC failover transforms a single‑point‑of‑failure setup into a robust, high‑availability architecture. By provisioning matching servers, synchronising data, using a floating IP, and automating health checks, you can keep your services online even when an entire data centre goes down.

Call to Action

Ready to protect your business from outages? Contact our team today for a free consultation on building a Hetzner multi‑DC failover solution tailored to your needs.

Comments are closed, but trackbacks and pingbacks are open.