use haproxy

2023-01-06

1、install
yum -y install haproxy
systemctl start haproxy

2、vi /etc/haproxy/haproxy

listen stats
bind *:80
stats uri /status

frontend main
bind *:5000
mode tcp

backend app
balance roundrobin
server app1 127.0.0.1:5001 check
server app2 127.0.0.1:5002 check
server app3 127.0.0.1:5003 check
server app4 127.0.0.1:5004 check

#Haproxy 负载均衡实例:
frontend webserver
bind 192.168.1.97:80
default_backend webservers
backend webservers
balance roundrobin
server web1 192.168.1.100:80 check
server web2 192.168.1.101:80 check
#或者
#listen webservers
# bind 192.168.1.97:80
# server web1 192.168.1.100:80 check
# server web2 192.168.1.101:80 check

3、tail -f /var/log/message

分类:Linux | 标签: |

相关日志

评论被关闭!