Thursday, July 9, 2015

MySQL server has gone away - Galera with HAProxy


Whew! Been a long time. I've been working on some interesting projects and will update with more info soon. Recently, I created a MySQL Galera cluster with HAProxy load balancing.

I saw these errors
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
[Z3005] query failed: [2006] MySQL server has gone away [select m.maintenanceid,m.maintenance_type,m.active_since,tp.timeperiod_type,tp.every,tp.month,tp.dayofweek,tp.day,tp.start_time,tp.period,tp.start_date from maintenances m,maintenances_windows mw,timeperiods tp where m.maintenanceid=mw.maintenanceid and mw.timeperiodid=tp.timeperiodid and m.active_since<=1436204460 and m.active_till>1436204460]

Tweak the following

On Galera nodes, add to /etc/my.cnf
wait_timeout = 28000
max_allowed_packet = 64M

In HAProxy config /etc/haproxy/haproxy.cfg increase timeout values
timeout connect  10s
timeout client   2m
timeout server   2m

No comments:

Post a Comment