可以用HA负载mysql吗_使用HAProxy负载均衡MySQL:读取通信数据包时出错?

在尝试使用HAProxy通过xinetd负载均衡两个MySQL从库时遇到问题,MySQL的日志显示大量'Got an error reading communication packets'警告。配置包括由Pacemaker管理的虚拟IP和HAProxy配置文件,但连接建立后频繁出现断开情况。检查了max_allowed_packet设置和各种timeout变量,但问题依旧存在。怀疑可能与HAProxy有关,寻求解决方案。
摘要由CSDN通过智能技术生成

我已经设置了

load balancing MySQL slaves using HAProxy via a xinetd. 2个负载均衡器共享了一个由Pacemaker管理的虚拟IP:

crm configure show:

node SVR120-27148.localdomain

node SVR255-53192.localdomain

primitive failover-ip ocf:heartbeat:IPaddr2 \

params ip="192.168.5.9" cidr_netmask="32" \

op monitor interval="5s" \

meta is-managed="true"

primitive haproxy ocf:heartbeat:haproxy \

params conffile="/etc/haproxy/haproxy.cfg" \

op monitor interval="30s" \

meta is-managed="true"

colocation haproxy-with-failover-ip inf: haproxy failover-ip

order haproxy-after-failover-ip inf: failover-ip haproxy

property $id="cib-bootstrap-options" \

dc-version="1.0.12-unknown" \

cluster-infrastructure="openais" \

no-quorum-policy="ignore" \

expected-quorum-votes="2" \

stonith-enabled="false" \

last-lrm-refresh="1342783084"

/etc/haproxy/haproxy.cfg:

global

log 127.0.0.1 local1 debug

maxconn 4096

pidfile /var/run/haproxy.pid

daemon

defaults

log global

mode tcp

option dontlognull

retries 3

option redispatch

maxconn 2000

contimeout 5000

clitimeout 50000

srvtimeout 50000

frontend FE_mysql

bind 192.168.5.9:3307

default_backend BE_mysql

backend BE_mysql

mode tcp

balance roundrobin

option tcpka

option httpchk

#server mysql1 192.168.6.47:3306 weight 1 check port 9199 inter 12000 rise 3 fall 3

server mysql2 192.168.6.248:3306 weight 1 check port 9199 inter 12000 rise 3 fall 3

server mysql3 192.168.6.129:3306 weight 1 check port 9199 inter 12000 rise 3 fall 3

我的问题是大多数时候通过虚拟IP连接,/ var / log / mysqld.log保持泛滥:

120719 12:59:46 [Warning] Aborted connection 17237 to db: 'db' user: 'user' host: '192.168.5.192' (Got an error

reading communication packets)

120719 12:59:49 [Warning] Aborted connection 17242 to db: 'db' user: 'user' host: '192.168.5.192' (Got an error

reading communication packets)

120719 12:59:52 [Warning] Aborted connection 17248 to db: 'db' user: 'user' host: '192.168.5.192' (Got an error

reading communication packets)

(连接仍然建立)

192.168.5.192是HAProxy的IP地址.

mysql> show global status like 'Aborted%';

+------------------+-------+

| Variable_name | Value |

+------------------+-------+

| Aborted_clients | 53626 |

| Aborted_connects | 400 |

+------------------+-------+

我不认为128M对于max_allowed_pa​​cket是不够的:

max_connections = 300

max_allowed_packet = 128M

_timeout变量:

mysql> show global variables like '%timeout';

+----------------------------+----------+

| Variable_name | Value |

+----------------------------+----------+

| connect_timeout | 10 |

| delayed_insert_timeout | 300 |

| innodb_lock_wait_timeout | 60 |

| innodb_rollback_on_timeout | OFF |

| interactive_timeout | 3600 |

| lock_wait_timeout | 31536000 |

| net_read_timeout | 30 |

| net_write_timeout | 60 |

| slave_net_timeout | 3600 |

| wait_timeout | 600 |

+----------------------------+----------+

有什么可以导致这个吗?它与HAProxy有关吗?

有什么想法吗?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值