keepalived+haproxy+apache (highly available load balancing web)
surroundings
Four: CentOS Linux release 7.5.1804 (Core)
- 192.168.153.179 keepalived haproxy (master)
192.168.153.178 keepalived haproxy (backup)
192.168.153.177 httpd (web1)
192.168.153.176 httpd (web2)
firewall and selinux closed
Start operation
- installation
Install according to the environment
yum -y install keepalived haproxy
yum -y install httpd
MASTER BACKUP end operation: keepalived
If you don’t know what to change, click
vim /etc/keepalived/keepalived.conf
MASTER BACKUP end operation: haproxy
Both sides operate exactly the same
vim /etc/haproxy/haproxy.cfg
systemctl start haproxy
web (1, 2) operation: httpd
The web2 server can change the page to web
echo web1 > /var/www/html/index.html
systemctl start httpd