Haproxy のフロントエンド セクションに不明なキーワード bind *:80 があります

Haproxy のフロントエンド セクションに不明なキーワード bind *:80 があります

次のコマンドを使用して、Haproxy LTS 2.2 バージョンをソースからコンパイルしました。

make TARGET=linux-glibc USE_PCRE=1 USE_OPENSSL=1 USE_ZLIB=1 USE_CRYPT_H=1 USE_LIBCRYPT=1

コンパイル中にエラーは発生しませんでした。これが私のHaproxy設定です:

global
    log         127.0.0.1 local2

    chroot      /var/lib/haproxy
    pidfile     /var/run/haproxy.pid
    maxconn     4000
    user        haproxy
    group       haproxy
    daemon
    
    # turn on stats unix socket
    stats socket /var/lib/haproxy/stats

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                 3000

frontend http-in
        bind 192.168.123.40:80
        acl gerrit hdr(host) -i gerrit.example.local
        acl jenkins hdr(host) -i jenkins.example.local
        use_backend gerrit if gerrit
        use_backend jenkins if jenkins

backend gerrit
        server gerrit 127.0.0.1:8080

backend jenkins
        server jenkins 127.0.0.1:8081

コマンドで設定を確認すると、haproxy -c -q -V -f /etc/haproxy/haproxy.cfg次のエラーが発生します。

[NOTICE] 226/130914 (35193) : haproxy version is 2.2.2
[NOTICE] 226/130914 (35193) : path to executable is /usr/sbin/haproxy
[ALERT] 226/130914 (35193) : parsing [/etc/haproxy/haproxy.cfg:33] : unknown keyword 'bind 192.168.123.40:80' in 'frontend' section
[ALERT] 226/130914 (35193) : Error(s) found in configuration file : /etc/haproxy/haproxy.cfg
[ALERT] 226/130914 (35193) : Fatal errors found in configuration.

bindドキュメントを確認したところ、フロントエンドセクションでキーワード を使用することは許可されていますhttp://cbonte.github.io/haproxy-dconv/2.2/configuration.html#bind (アルファベット順に並べられたキーワードリファレンス)

bindフロントエンド セクションでキーワードをコメント アウトすると、さらに混乱が生じます。次に、エラーが表示されます。

[WARNING] 226/132456 (36642) : config : frontend 'http-in' has no 'bind' directive. Please declare it as a backend if this was intended.

答え1

bindとの間に、スペースのように見えるが実際には通常のスペース文字ではない他の空白文字が使用されているようです192.168.123.40:80。 テキストをもう一度入力してみてください。ただし、今回は通常のスペース (U+0020、ASCII 32) を使用してください。

関連情報