High-availability load balancing (hproxy)

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

Insert picture description here
Insert picture description here

MASTER BACKUP end operation: haproxy

Both sides operate exactly the same

vim /etc/haproxy/haproxy.cfg 
systemctl start haproxy

Insert picture description here

web (1, 2) operation: httpd

Insert picture description here
The web2 server can change the page to web

echo web1 > /var/www/html/index.html
systemctl start httpd
Test visit

Insert picture description here

End here~ _ ~

Guess you like

Origin blog.csdn.net/qq_49296785/article/details/109340205