Do HAProxy load balancing on domestic processor servers
Environment
Hardware platform: home-made arm64 3399cpu Seaboat server
Operating system: sea boat server operating system 1.0A
When the user accesses the 192.168.125 address, haproxy is assigned to two servers, 192.168.1.7192.168.1.8. Achieve load sharing.
Root@bigdataA:/home/zs# apt-get install haproxy / / install the software
Root@bigdataA:/home/zs# nano / etc/haproxy/haproxy.cfg
#-
# main frontend which proxys to the backends
#-
Frontend main
Bind *: 80 / / detect port 80
Default_backend webserver
#-
# static backend for serving up images, stylesheets and such
#-
Backend webserver
Balance roundrobin / / polling mode
Server web1 192.168.1.7 2000ms 80 check / / default check the server once per server, 192.168.1.7 normal.
Server web2 192.168.1.8:80 check
Root@bigdataA:/home/zs# / etc/init.d/haproxy stop / / restart the server for the configuration to take effect
[ok] Stopping haproxy (via systemctl): haproxy.service.
Root@bigdataA:/home/zs# / etc/init.d/haproxy start
[ok] Starting haproxy (via systemctl): haproxy.service.
Root@bigdataA:/home/zs# netstat-an | more / / check whether the port is enabled
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
Tcp 0 0 0.0.0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0
Tcp 0 0 0.0.0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0
Tcp 0 64 192.168.1.125:22 192.168.1.6:1524 ESTABLISHED
Tcp6 0 0: 8080: * LISTEN
Tcp6 0 0: 22:: * LISTEN
Tcp6 00 127.0.0.1 8005:: * LISTEN
Tcp6 00: 8009: * LISTEN
Active UNIX domain sockets (servers and established)
Root@bigdataA:/home/zs#
Enter the address http://192.168.1.125, in the client browser to access the polling web page.