0

I've just setup MariaDB replication with 2 slaves in Debian 11 (Bullseye). I'm a bit alarmed to see the file size reach such a size without log rotation:

-rw-rw----  1 mysql adm  297394983 Dec  8 05:55 master-bin.000001
-rw-rw----  1 mysql adm         33 Dec  5 19:32 master-bin.index

In the steps to setup replication I modified the master MariaDB /etc/mysql/my.cnf file [mariadb] section

[mariadb]
log-bin
server_id=1
log-basename=master1
binlog-format=mixed

It isn't clear to me how to setup log rotation for this in a way that isn't going to break the 2 slaves. I am wondering if it is possible to setup master-bin.000001 to rotate once a day and delete old ones after 28 days.

I have searched the web. I am seeing comments about slave log rotation online. It isn't "clicking" how to do this for this master files.

1 Answer 1

2

What is the value of max_binlog_size? Older versions of MySQL/MariaDB default it to 1G, which you have not yet hit. Newer versions rotate at 100M. Either value works equally well (unless you are extremely tight on disk space).

Each replica is taking care of itself; don't worry about rotations.

After it passes the specified size, rotation occurs. The Both Replicas will be informed by the Primary.

See binlog_expire_logs_seconds or expire_logs_days for how to cause 'old' logs to be deleted automatically.

sync_binlog is another one to check. Set it to 1.

Be aware the logs on different servers in a replication setup will rotate independently.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.