目录
前言
上文讲到https://blog.csdn.net/Delicious_Life/article/details/106186973
本篇是综合架构的最后一步,配置HAProxy代理
配置HAProxy
修改配置文件
vim /haoke/haproxy/haproxy.cfg
global
log 127.0.0.1 local2
maxconn 4000
daemon
defaults
mode http
log global
option httplog
option dontlognull
option http-server-close
option forwardfor except 127.0.0.0/8
option redispatch
retries 3
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 1m
timeout http-keep-alive 10s
timeout check 10s
maxconn 3000
listen admin_stats
bind 0.0.0.0:4001
mode http
stats uri /dbs
stats realm Global\ statistics
stats auth admin:admin123
listen proxy-mysql
bind 0.0.0.0:4002
mode tcp
balance roundrobin
option tcplog
#代理mycat服务
server mycat_1 192.168.62.132:18067 check port 18067 maxconn 2000
server mycat_2 192.168.62.132:18068 check port 18068 maxconn 2000
启动HAProxy
docker restart haproxy && docker logs -f haproxy
访问地址
http://192.168.xx.xxx:4001/dbs
连接navicat查看数据
我们再来回顾下整体架构图