同一服务器上同一后端的多个端口

同一服务器上同一后端的多个端口

我将 haproxy 与 ceph 集群结合使用,并在一台服务器上创建了多个具有不同端口的网关。我已将不同的端口号添加到后端配置,但似乎 haproxy 忽略了它。配置中缺少什么?

这是在网关运行的服务器上:

netstat -an|grep :808
tcp        0      0 10.118.199.1:8084       0.0.0.0:*               LISTEN
tcp        0      0 10.118.199.1:8080       0.0.0.0:*               LISTEN
tcp        0      0 10.118.199.1:8081       0.0.0.0:*               LISTEN
tcp        0      0 10.118.199.1:8082       0.0.0.0:*               LISTEN
tcp        0      0 10.118.199.1:8083       0.0.0.0:*               LISTEN
tcp        0      0 10.118.199.1:8080       10.100.112.111:56906    TIME_WAIT

 

这是我的 haproxy 配置:

global
    log         127.0.0.1 local2
    chroot      /var/lib/haproxy
    pidfile     /var/run/haproxy.pid
    maxconn     100000
    user        haproxy
    group       haproxy
    daemon
    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

listen stats 0.0.0.0:9000
    mode http
    balance
    timeout client 5000
    timeout connect 4000
    timeout server 30000
    stats uri /haproxy_stats
    stats realm HAProxy\ Statistics
    stats auth pw:pw
    stats admin if TRUE

frontend  http *:8080
    mode http
    default_backend             rgw_http

frontend https
    bind *:443 ssl crt /opt/certificate/wildcard.comp.local/PEM/wildcard_comp_local.pem crt /opt/certificate/wildcard.comp.local/PEM/wildcard.compdev.io.pem
    #http-request set-header X-Forwarded-Proto https
    mode http
    default_backend rgw_http
    log global

backend rgw_http
    balance roundrobin
    mode http
    server server01-1 10.118.199.1:8080 check inter 3s
    server server02 10.118.199.2:8080 check inter 3s
    server server03 10.118.199.3:8080 check inter 3s
    server server01-2 10.118.199.1:8081 check inter 3s
    server server01-3 10.118.199.1:8082 check inter 3s
    server server01-4 10.118.199.1:8083 check inter 3s
    server server01-5 10.118.199.1:8084 check inter 3s

这是统计页面:

统计页面

我遗漏了什么或者误解了什么?

答案1

似乎多次查看 iptables -L 来判断操作系统防火墙是否正在运行还不够。即使它返回空表,服务是否正在运行,我都快疯了……

相关内容