nginx HA
HA can be configured in the nodes running Nginx Plus
It implement by running vrrp between the nodes, where the user can specify priority, unicast_src_ip, unicast_peer, and cirtual ipadress. The node with higher number of priority will run as master. The peer check each other's state by chk_nginx_service. It returns 0 if the check is succeeds and increate the weight based on the initial priority. It will fail of the timeout is reached (3 sec in the example below)
User can fource the failover by create file under /var/run/keepalived-manual-failvoer.
global_defs {
vrrp_version 3 } vrrp_script chk_manual_failover { script "/usr/libexec/keepalived/nginx-ha-manual-failover" interval 10 weight 50 } vrrp_script chk_nginx_service { script "/usr/libexec/keepalived/nginx-ha-check" interval 3 weight 50 } vrrp_instance VI_1 { interface eth0 priority 101 virtual_router_id 51 advert_int 1 accept garp_master_refresh 5 garp_master_refresh_repeat 1 unicast_src_ip 192.168.100.100 unicast_peer { 192.168.100.101 } virtual_ipaddress { 192.168.100.150 } track_script { chk_nginx_service chk_manual_failover } notify "/usr/libexec/keepalived/nginx-ha-notify" //where to save the log }