【问题标题】:Config balance haproxy with use tags in header on request根据请求在标头中使用标签配置平衡 haproxy
【发布时间】:2019-07-25 16:11:46
【问题描述】:


我对使用 haproxy 的配置平衡有疑问。
我希望在请求中使用标头标签来平衡配置。
我有 2 个标签 - kasko、osago 和 default_backend。
如何为标签配置余额
- 如果我在标头请求中有一个标签 - 平衡后端 osago,
- 如果是第二个标签 - 平衡后端 kasko,
- 如果没有标签 - 使用默认后端?

我试过用 hdr_val 怎么写的这个说明
https://www.haproxy.com/documentation/aloha/9-5/traffic-management/lb-layer7/acls/
还有这个
https://blog.armbruster-it.de/2015/08/neo4j-and-haproxy-some-best-practices-and-tricks/
但它不起作用。

 frontend web_80
    bind *:80
    mode http
    option httplog
    acl acl_osago hdr_val(Calculation-Type:OSAGO) eq 1
    acl acl_kasko hdr_val(Calculation-Type:KASKO) eq 1
    use_backend osago if acl_osago
    use_backend kasko if acl_kasko
    default_backend web_80

backend osago 
    mode http
    server server5_7003 server5:7003 check port 7001

backend kasko
    mode http
    server server6_7003 server6:7003 check port 7001

backend web_80
    mode http
    balance leastconn
    option httpchk GET /ibss-checker/threads/info/queue-length
    http-check expect rstring ^(0?[0-9]?[0-9]|1[0-1][0-9])$
    server server1_7003 server1:7003 check port 7001
    server server2_7003 server2:7003 check port 7001
    server server3_7003 server3:7003 check port 7001
    server server4_7003 server4:7003 check port 7001

【问题讨论】:

    标签: haproxy


    【解决方案1】:

    帮助开发者重新编译程序和这个配置

    acl acl_osago hdr_val(Calculation-Type:OSAGO) eq 1
    

    工作

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-09-29
      • 1970-01-01
      • 2019-08-18
      • 1970-01-01
      • 2012-11-10
      • 1970-01-01
      相关资源
      最近更新 更多