[Warning] Aborted connection to db: user: host: mariadb error log

MariaDB error log reporting multiple error like this and flooding the logs.

Due to refused connections max_connect_errors and max_error_count is breaching its limit and impacting new connections 


[Warning] Aborted connection xxxx to db: xxxx user: xxxx host: xxxx (xxxx)


Although I am still struggling to fix those , have taken below steps to reduce the impact 

1. Stop logging errors in log , although its not good idea but if its repetitive in nature better to let it go



set global log_warning=1


2. Increase max_error_count & max_connect_errors


set global max_error_count=1000
set global max_connect_errors=2000


3. Only solutions to these errors to rectify if permissions of the user are correct , stop such connection coming from application end or perform flush hosts. lets schedule it


Create event flush_host_hourly 
ON SCHEDULE EVERY 1 HOUR
ON COMPLETION PRESERVE
begin
DO flush hosts
end;


Make sure begin/end clause , PRESERVE and schedule is set correctly can be verified using 


select * from information_schema.events\G;

keep eye on LAST_EXECUTED in mariadb event schedule showing NULL ; which means job is not getting trigger. Solution to same is to enable event_scheduler


set global event_scheduler=ON


This may be just workaround to underlying problem ; if its taking too much time to fix above can be implemented.



No comments:

Post a Comment