NGINX Plus can be configured into a high‑availability cluster to ensure application availability. The cluster consists of an active‑passive pair of NGINX Plus instances: a master that actively processes traffic and a backup that monitors the health of the master, becoming active and taking over if the master fails.
The advanced load balancing and health monitoring features in NGINX Plus provide resiliency and scalability for your upstream application servers. Configuring NGINX Plus into a high‑availability cluster provides further resiliency for applications, and eliminates any single points of failure in the application stack. If the master NGINX Plus instance becomes unable to process traffic, the backup instance takes over.
You can also extend the configuration to support multiple active‑passive NGINX Plus instances for higher levels of redundancy, or if you need more throughput than a single NGINX Plus cluster can provide.
The NGINX Plus high‑availability solution is based on
keepalived, which itself uses an implementation of the Virtual Router Redundancy Protocol (VRRP). After you install the nginx-ha-keepalived package and configure
keepalived, it runs as a separate process on each NGINX instance in the cluster and manages a shared virtual IP address. The virtual IP address is the IP address advertised to downstream clients, for example via a DNS record for your service.
Based on initial configuration,
keepalived designates one NGINX instance as master and assigns the virtual IP address to it. The master periodically verifies that
keepalived and NGINX Plus are both running, and sends VRRP advertisement messages at regular intervals to let the backup instance know it’s healthy. If the backup doesn’t receive three consecutive advertisements, it becomes the new master and takes over the virtual IP address.
Installing the NGINX Plus HA capability is very straightforward; it is distributed in the nginx-ha-keepalived package from the NGINX Plus repository:
$ apt-get install nginx-ha-keepalived
Install the package on each NGINX Plus instance in your planned HA cluster, then run the included nginx-ha-setup script to configure and run the HA service. For complete instructions, see the NGINX Plus Admin Guide.
High‑availability failover takes place in the event of a catastrophic failure on the master NGINX Plus instance – a hardware failure, operating system shutdown, or termination of the NGINX Plus software. Internal health checks can be extended to identify more failure situations if necessary.
With NGINX Plus you can synchronize configuration between the servers in a cluster. With configuration sharing you make changes to a designated “master” server and then push those changes to the remaining servers in the cluster.
This functionality is distributed in the
nginx-sync package from the NGINX Plus repository:
$ apt-get install nginx-sync
For details, see the NGINX Plus Admin Guide.
The solution based on
keepalived for high availability of NGINX Plus is not available on Microsoft Azure or the Google Cloud Platform (GCP). You can use their native load balancers as a frontend high‑availability solution for NGINX Plus.
keepalivedhome page – Details about extending and customizing