docker容器启动haproxy

1、在本地新增haproxy.cfg文件(本次haproxy.cfg文件路径为/root/haproxy.cfg),内容如下:

#----------------
# Global settings
#----------------
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                 500
#-------------
#Stats monitor
#-------------
frontend stats_monitor
        bind    *:30001
        stats   enable
        stats   uri     /stats
        stats   auth    admin:admin
        stats   admin   if      TRUE
        stats   refresh 5s
        stats   realm   baison-test-Haproxy
#       stats   hide-version
#--------------------
#Application frontend
#--------------------
frontend        GEOGLOBE
bind    *:8080
#ACL#
acl map_acl path_reg -i /map/
#USE_BACKEND#
use_backend map_backend if map_acl
#map_begin#    
backend map_backend
balance roundrobin
mode http
server map_101 172.15.103.195:20001 check weight 1
#map_end#

2、使用Docker run启动容器

docker run -d -p 8080 -p 30001 --name haproxy -v /root/haproxy:/usr/local/etc/haproxy:ro haproxy:1.9.7

 

转载于:https://www.cnblogs.com/nihaorz/p/10783249.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值