首页 > 解决方案 > 带有 xinetd 的 haproxy 显示警告:无法获取客户端地址:对等方重置连接

问题描述

我已经按照本教程设置了一个带有 2 个 MariaDB 服务器的 Galera 集群的 HAProxy 服务器;因此,HAProxy、前端和后端运行良好,除了我在下面收到此警告消息。怎么了?或者我怎样才能摆脱这个警告?

tail -f /var/log/messages

Jun  5 17:15:43 mariadb-01 xinetd[105173]: warning: can't get client address: Connection reset by peer
Jun  5 17:15:44 mariadb-01 xinetd[105177]: warning: can't get client address: Connection reset by peer
Jun  5 17:15:45 mariadb-01 xinetd[105181]: warning: can't get client address: Connection reset by peer
Jun  5 17:15:46 mariadb-01 xinetd[105185]: warning: can't get client address: Connection reset by peer
Jun  5 17:15:47 mariadb-01 xinetd[105189]: warning: can't get client address: Connection reset by peer
Jun  5 17:15:48 mariadb-01 xinetd[105193]: warning: can't get client address: Connection reset by peer
Jun  5 17:15:49 mariadb-01 xinetd[105197]: warning: can't get client address: Connection reset by peer
Jun  5 17:15:50 mariadb-01 xinetd[105201]: warning: can't get client address: Connection reset by peer
Jun  5 17:15:51 mariadb-01 xinetd[105205]: warning: can't get client address: Connection reset by peer
Jun  5 17:15:52 mariadb-01 xinetd[105209]: warning: can't get client address: Connection reset by peer
Jun  5 17:15:53 mariadb-01 xinetd[105213]: warning: can't get client address: Connection reset by peer
Jun  5 17:15:54 mariadb-01 xinetd[105217]: warning: can't get client address: Connection reset by peer
Jun  5 17:15:55 mariadb-01 xinetd[105221]: warning: can't get client address: Connection reset by peer
Jun  5 17:15:56 mariadb-01 xinetd[105225]: warning: can't get client address: Connection reset by peer
Jun  5 17:15:57 mariadb-01 xinetd[105229]: warning: can't get client address: Connection reset by peer
Jun  5 17:15:58 mariadb-01 xinetd[105233]: warning: can't get client address: Connection reset by peer
Jun  5 17:16:00 mariadb-01 xinetd[105237]: warning: can't get client address: Connection reset by peer
Jun  5 17:16:01 mariadb-01 xinetd[105241]: warning: can't get client address: Connection reset by peer
Jun  5 17:16:02 mariadb-01 xinetd[105245]: warning: can't get client address: Connection reset by peer
Jun  5 17:16:03 mariadb-01 xinetd[105249]: warning: can't get client address: Connection reset by peer
Jun  5 17:16:04 mariadb-01 xinetd[105253]: warning: can't get client address: Connection reset by peer

这是我的 mysqlchk 文件

[root@mariadb-01 ~]# cat /etc/xinetd.d/mysqlchk 
# default: on
# description: mysqlchk
service mysqlchk
{
    log_type = FILE /var/log/clustercheck.log
    disable = no
    flags = REUSE
    socket_type = stream
    port = 9200
    wait = no
    user = nobody
    server = /usr/bin/clustercheck
    log_on_failure += USERID
    log_on_success  =
    only_from = 0.0.0.0/0 ::/0
    per_source = UNLIMITED
}

haproxy.cfg

global
    maxconn         100
    log         /var/run/log    local0  info
    stats socket /tmp/haproxy.socket level admin  expose-fd listeners
    uid         80
    gid         80
    nbproc          1
    nbthread            1
    hard-stop-after     15m
    chroot              /tmp/haproxy_chroot
    daemon
    server-state-file /tmp/haproxy_server_state

listen HAProxyLocalStats
    bind 127.0.0.1:2200 name localstats
    mode http
    stats enable
    stats refresh 1
    stats admin if TRUE
    stats show-legends
    stats uri /haproxy/haproxy_stats.php?haproxystats=1
    timeout client 5000
    timeout connect 5000
    timeout server 5000

frontend frontend-mariadb
    bind            0.0.0.0:3306 name 0.0.0.0:3306   
    mode            tcp
    log         global
    option          log-separate-errors
    option          tcplog
    timeout client      30000
    default_backend backend-mariadb_ipvANY

backend backend-mariadb_ipvANY
    mode            tcp
    id          102
    log         global
    option          log-health-checks
    balance         leastconn
    timeout connect     30000
    timeout server      30000
    retries         3
    server          mariadb-01 10.20.30.106:3306 id 104 check inter 1000 port 9200
    server          mariadb-02 10.20.30.107:3306 id 105 check inter 1000 port 9200

当我远程登录到 Mariadb 之一时,它显示了这一点,但 /var/log/messages 中没有警告消息

[root@client ~]# telnet 10.20.30.106 9200
Trying 10.20.30.106...
Connected to 10.20.30.106.
Escape character is '^]'.
HTTP/1.1 200 OK
Content-Type: text/plain
Connection: close
Content-Length: 40

Percona XtraDB Cluster Node is synced.
Connection closed by foreign host.

标签: mysqlmariadbhaproxyxinetd

解决方案


推荐阅读