global daemon #以后台形式运行harpoxy ########默认配置############ defaults log global mode http #日志格式 option httplog #日志中不记录负载均衡的心跳检测记录 option dontlognull #连接超时(毫秒) timeout connect 5000 #客户端超时(毫秒) timeout client 50000 #服务器超时(毫秒) timeout server 50000 #------------- #Stats monitor #------------- frontend stats_monitor bind *:30001 stats enable stats uri /stats stats auth admin:AOOB.hy.db stats admin if TRUE stats refresh 5s stats realm baison-test-Haproxy ########统计页面配置######## listen test1 #这里是配置负载均衡,test1是名字,可以任意 bind 0.0.0.0:6556 #这里是监听的IP地址和端口,端口号可以在0-65535之间,要避>免端口冲突 mode tcp #连接的协议,这里是tcp协议 option mysql-check user root server s1 127.0.0.1:3306 check weight 1 maxconn 2000 #负载的机器 server s2 127.0.0.1:3306 check weight 1 maxconn 2000 server s3 127.0.0.1:3306 check weight 1 maxconn 2000
docker container run -p 6556:6556 -p 30001:30001 -d -v haproxy:/usr/local/etc/haproxy --name=haproxy --net=pxcNet0 --ip 172.18.0.50 haproxy:1.8.8
创建监听的用户
CREATE USER 'haproxy'@'%' IDENTIFIED by '';
FLUSH PRIVILEGES
评论 (0)