Nginx+Keepalived dual master configuration
1. Architecture In the Keepalived + Nginx high-reliability load balancing architecture, keepalived is responsible for achieving High-availability (HA) The function controls the VIP (virtual network address) of the front-end machine. When a device fails, the hot standby server can automatically switch over to the VIP in an instant. In actual operation, the switching time is only 2 seconds. The DNS service can be responsible for the front-end VIP. load balancing. 2. Topology 3. Simple principle Both Nginx-Keepalived-M (nginx master server) and Nginx-Keepalived-S (standby server) use keepalived software to tie the eth0 network card to a virtual IP (VIP1) address: 172.16.1.20 , this VIP1 is currently bound to whose eth0 is whoever carries the service. When Nginx-Keepalived-M fails, Nginx-Keepalived-S will pass the heartbeat time advert_int set in the /etc/keepalived/keepalived.conf file 1 check, unable to obtain the normal state of Nginx-Keepalived-M, switch to Nginx-Keepalived-S instantly to achieve hot dual-machine load balancing, when Nginx-Keepalived-M recovers, keepalived will pass the priority Parameter judgment priority Rebind the virtual VIP1 address 172.16.1.20 to the eth0 network card of Nginx-Keepalived-M; similarly, the virtual IP (VIP2) address 172.16.1.21 regards the previous Nginx-Keepalived-S as the main server, Nginx -Keepalived-M is used as a secondary server to achieve load balancing…