So... yesterday I received an "after the fact email" about a campaign that has started for one of the services that I run. Now the DB server is getting hammered, hard, to the tune of about 300mb/min in binary logging for the replicate. As you could imagine, this is chewing up space at a fairly tremendous rate.
My normal 7 day expiry of binary logs just isn't cutting it. I've resorted to truncating logs to just the last for 4 hours with(I'm verifying that replication is up to date with mk-heartbeat
):
PURGE MASTER LOGS BEFORE DATE_SUB( NOW(), INTERVAL 4 HOUR);
I'm just running that from cron every few hours to weather the storm, but it made me question the minimum value for expire_logs_days
. I haven't come across a value that is less than 1, but that doesn't mean that it isn't possible. http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#sysvar_expire_logs_days gives the type as being numeric, but doesn't indicate if it's expecting integers.
Actually, there is a way to emulate it.
Here are the steps to purge binary logs to 1 hour.
STEP 01) Create an SQL script that will delete all binary logs whose timestamp is older than an hour:
STEP 02) Create a shell script (
/usr/bin/purge.sh
) to callmysql
withpurge.sql
STEP 03) Make
/usr/bin/purge.sh
executableSTEP 04) Add
usr/bin/purge.sh
to the crontab to kick off every hourGive it a Try !!!
Experimenting was the order of the evening...
That page does say the range is 0-99.. so yeah, it is an integer.
0 = No expire..
You have got me wondering what 0.5 would do.. I'm thinking it would ignore the .5 part and just not expire them..
Mysql (community) Version 8.0.17-1.sles12 - OpenSUSE tumbleweed 2019.10.02
..
I added this my.cnf file