Mastering Nginx High Availability: Master‑Slave Architecture Explained
This article explains how Nginx master‑slave (high‑availability) setups work, why a virtual IP is used, and how Keepalived monitors health and automatically fails over to ensure continuous service without single‑point failures.
Nginx Master‑Slave Overview
In Nginx, “master‑slave” refers to a high‑availability architecture that uses two or more Nginx servers: one acts as the Master and the others as Slave/Backup servers.
The goal is to keep the service available when the master becomes unavailable due to hardware failure, network interruption, or software crash. Traffic is automatically switched to the slave, avoiding a single point of failure.
How It Works
The master holds a virtual IP (VIP) that serves as the entry point for clients. The slave servers do not expose the service directly; they bind to the same VIP. When the master fails, a slave takes over the VIP, seamlessly handling all traffic.
Keepalived Integration
Implementing Nginx high availability typically involves Keepalived, which monitors network interfaces and performs health checks on Nginx processes via scripts. If Keepalived detects a failure, it triggers VIP migration to the backup server.
Keepalived is based on the VRRP protocol and can create a virtual IP that floats between servers.
In summary, Nginx itself does not provide built‑in master‑slave functionality; the “master‑slave” concept is realized through external high‑availability tools like Keepalived, which enable automatic failover and continuous service availability.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Mike Chen's Internet Architecture
Over ten years of BAT architecture experience, shared generously!
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
