• 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.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro haproxy:1.9.11
  • 相关阅读:
    jmeter-获取数据库中的数据
    jmeter常见报错汇总
    学习目录
    Spring+Spring Security+JSTL实现的表单登陆的例子
    Spring+Spring Security+Maven 实现的一个Hello World例子
    第六章:位置匹配
    第五章:重复匹配
    第四章:使用元字符
    第三章:匹配一组字符
    第二章:匹配单个字符
  • 原文地址:https://www.cnblogs.com/nihaorz/p/10783249.html
Copyright © 2020-2023  润新知