【问题标题】:MariaDB HAProxy deadlockMariaDB HAProxy 死锁
【发布时间】:2021-01-14 21:46:01
【问题描述】:

我正在尝试使用 haproxy、keepalived、mariadb 和 galera 集群运行 Zabbix。你能帮帮我吗?

  • 3 mariadb 集群数据库服务器。
  • 2 keepalived 和 haproxy 服务器。
  • 1 个 zabbix 服务器。

日志:

Error in query [COMMIT] [Deadlock found when trying to get lock; try restarting transaction]

日志2:

Sep 28 13:59:41 db2 mysqld[18273]: 2020-09-28 13:59:41 101 [Warning] Aborted connection 101 to db: 'mydb' user: 'myuser' host: '192.168.1.107' (Got an error reading communication packets)

日志3:

Sep 28 14:01:58 hake haproxy[16785]: 192.168.1.103:37036 [28/Sep/2020:14:01:58.229] galera_cluster_frontend galera_cluster_backend/db2 1/1/8 295 -- 14/14/13/4/0 0/0
Sep 28 14:01:59 hake haproxy[16785]: 192.168.1.103:36960 [28/Sep/2020:14:01:09.283] galera_cluster_frontend galera_cluster_backend/db1 1/0/50008 364 cD 13/13/12/4/0 0/0
Sep 28 14:01:59 hake haproxy[16785]: 192.168.1.103:37038 [28/Sep/2020:14:01:59.492] galera_cluster_frontend galera_cluster_backend/db3 1/0/27 2550 -- 14/14/13/4/0 0/0

日志4:

Sep 28 14:05:29 hake Keepalived_vrrp[19536]: Opening file '/etc/keepalived/keepalived.conf'.
Sep 28 14:05:29 hake Keepalived_vrrp[19536]: WARNING - default user 'keepalived_script' for script execution does not exist - please create.
Sep 28 14:05:29 hake Keepalived_vrrp[19536]: Truncating auth_pass to 8 characters
Sep 28 14:05:29 hake Keepalived_vrrp[19536]: SECURITY VIOLATION - scripts are being executed but script_security not enabled.
Sep 28 14:05:29 hake Keepalived_vrrp[19536]: Using LinkWatch kernel netlink reflector...
Sep 28 14:05:29 hake Keepalived_vrrp[19536]: VRRP_Script(chk_haproxy) succeeded
Sep 28 14:05:30 hake Keepalived_vrrp[19536]: VRRP_Instance(LB_VIP) Transition to MASTER STATE
Sep 28 14:05:30 hake Keepalived_vrrp[19536]: VRRP_Instance(LB_VIP) Changing effective priority from 101 to 103
Sep 28 14:05:31 hake Keepalived_vrrp[19536]: VRRP_Instance(LB_VIP) Entering MASTER STATE
Sep 28 14:05:31 hake Keepalived_vrrp[19536]: SMTP connection ERROR to [127.0.0.1]:25.

【问题讨论】:

    标签: mariadb deadlock haproxy zabbix keep-alive


    【解决方案1】:

    HAProxy 日志给你一个提示:

    Sep 28 14:01:59 hake haproxy[16785]: 192.168.1.103:36960 [28/Sep/2020:14:01:09.283] galera_cluster_frontend galera_cluster_backend/db1 1/0/50008 364 cD 13/13/12/4/0 0/0
    

    如您所见,session state at disconnectcD 给出。这意味着,引用链接的文档:

    客户端没有发送或确认任何数据,只要 “超时客户端”延迟。这通常是由网络故障引起的 客户端,或者客户端只是不干净地离开网络。

    因此,您的客户端实际上已经消失,或者您的 MySQL 客户端和 HAProxy 之间发生了一些网络更改,或者(更有可能):您在 HAProxy 中设置了一个太短的 timeout client 设置。

    在这种情况下,您或许可以增加此超时时间,以确保现有连接保持打开更长时间。但是,您应该确保此超时时间不要太长,以确保最终检测到并回收实际断开或不干净中止的连接。

    尤其是在 TCP 模式下,将timeout clienttimeout server 设置为相同的值通常是一种很好的做法。

    【讨论】:

    • 我之前增加了超时时间。但是一旦超时到期,我就会失去连接
    猜你喜欢
    • 2017-12-17
    • 2018-02-16
    • 2019-05-21
    • 2021-02-23
    • 1970-01-01
    • 1970-01-01
    • 2018-11-13
    • 1970-01-01
    • 2017-12-27
    相关资源
    最近更新 更多