0

現在、仮想 IP を使用して 2 つのサーバー間でルーティングするように HAProxy を構成しようとしています。

テストのために、172.16.4.130 と 172.16.4.131 の 2 つのインスタンスを作成しました。次に、2 つのサーバーをブリッジする keepalived を使用して、172.16.4.99 の仮想 IP アドレスを作成します。これらのサーバーはどちらも apache2 を実行しており、テスト用の単純な index.html ランディング ページをホストしています。上記のすべてが実行されています。

172.16.4.99 に移動すると、ページが読み込まれず、どちらの index.html ページにもリダイレクトされません。ただし、この IP アドレスに ping を実行することはできます。これは単純な構成の問題だと思います。私は HAproxy の経験があまりないので、助けてほしいと思います。以下は、私の haproxy.cfg ファイルと keepalived です。

global
    log 127.0.0.1   local0
    log 127.0.0.1   local1 notice
    #log loghost    local0 info
    maxconn 4096
    #debug
    #quiet
    user haproxy
    group haproxy

defaults
    log     global
    mode    http
    option  httplog
    option  dontlognull
    retries 3
    option redispatch
    maxconn 2000
    contimeout      5000
    clitimeout      50000
    srvtimeout      50000

listen webfarm 172.16.4.99:80
   mode http
   stats enable
   stats auth user:password
   balance roundrobin
   cookie JSESSIONID prefix
   option httpclose
   option forwardfor
   option httpchk HEAD /check.txt HTTP/1.0
   server webA 172.16.4.130:8080 cookie A check
   server webB 172.16.4.131:8080 cookie B check

172.16.4.130 の keepalived.conf

vrrp_script chk_haproxy {           # Requires keepalived-1.1.13
    script "killall -0 haproxy"     # cheaper than pidof
    interval 2                      # check every 2 seconds
    weight 2                        # add 2 points of prio if OK
}

vrrp_instance VI_1 {
    interface eth0
    state MASTER
    virtual_router_id 51
    priority 101                    # 101 on master, 100 on backup
    virtual_ipaddress {
        172.16.4.99
    }
    track_script {
        chk_haproxy
    }
}

172.16.4.131 の keepalived.conf:

vrrp_script chk_haproxy {           # Requires keepalived-1.1.13
    script "killall -0 haproxy"     # cheaper than pidof
    interval 2                      # check every 2 seconds
    weight 2                        # add 2 points of prio if OK
}

vrrp_instance VI_1 {
    interface eth0
    state MASTER
    virtual_router_id 51
    priority 100                    # 101 on master, 100 on backup
    virtual_ipaddress {
        172.16.4.99
    }
    track_script {
        chk_haproxy
    }
}
4

1 に答える 1