HAProxy 用两个参数监听?

Sys*_*dox 5 documentation haproxy

我一直看到带有两个参数语法的 HAProxy 配置示例。实际上,1.4.18 提供的默认配置文件包含以下内容:

listen  appli1-rewrite 0.0.0.0:10001
    cookie  SERVERID rewrite
    balance roundrobin
    server  app1_1 192.168.34.23:8080 cookie app1inst1 check inter 2000 rise 2 fall 5
    server  app1_2 192.168.34.32:8080 cookie app1inst2 check inter 2000 rise 2 fall 5
    server  app1_3 192.168.34.27:8080 cookie app1inst3 check inter 2000 rise 2 fall 5
    server  app1_4 192.168.34.42:8080 cookie app1inst4 check inter 2000 rise 2 fall 5
Run Code Online (Sandbox Code Playgroud)

我注意到完全没有任何绑定选项,所以我相信这是绑定的简写吗?

HAProxy 文档 ( http://haproxy.1wt.eu/download/1.5/doc/configuration.txt ) 包含一个与此语法无关的示例,但没有在任何地方指定、记录或解释它。

该文档只是显示listen <name>

All proxy names must be formed from upper and lower case letters, digits,
'-' (dash), '_' (underscore) , '.' (dot) and ':' (colon). ACL names are
case-sensitive, which means that "www" and "WWW" are two different proxies.
Run Code Online (Sandbox Code Playgroud)

(即没有空格,所以这显然不仅仅是名称的一部分)

有没有关于这种语法的官方文档?

谢谢。

Ada*_*ers 3

我想我刚刚通过在 superuser.com 上找到这个答案解决了这个问题。在 HAProxy 1.3.x 中,已弃用的参考手册说:

2) Declaration of a listening service
=====================================

Service sections start with the 'listen' keyword :

    listen <instance_name> [ <IP_address>:<port_range>[,...] ]
Run Code Online (Sandbox Code Playgroud)

到了 1.4,这个手册已经不存在了,但是为了向后兼容,这个语法似乎继续被接受。在 1.6 中,listen没有bind指令的部分开始生成警告

所以答案是它是旧语法,不应再使用。