Binlogs piling up in /opt/bitnami/mysql/data

Keywords: MySQL - AWS - Technical issue - Other
bnsupport ID: fc612c5b-a3ea-1e62-140a-f98f576b1ed1
Description:
Site has been running for weeks for no issue, and today in a the span of a few hours 15+ GB of binlogs have been saved in the mysql.

Adding an expiry to my.cnf does not seem to work.

[mysqld]
basedir=/opt/bitnami/mysql
datadir="/opt/bitnami/mysql/data"
port=3306
socket=/opt/bitnami/mysql/tmp/mysql.sock
tmpdir=/opt/bitnami/mysql/tmp
max_allowed_packet=32M
bind-address=127.0.0.1
skip-name-resolve=1
log-bin
binlog_expire_logs_seconds=60
expire_logs_days = 0
character-set-server=utf8mb4
collation-server=utf8mb4_general_ci

2 Likes

Here’s a screenshot of my data folder.

Hi @joshm,

Can you check the solution from the following post:

https://community.bitnami.com/t/cannot-start-mysql-after-clear-some-files-to-free-space/69699/6

Regards,
Michiel

Got it. I’ve added the following to the end of the MYSQL_START string (within the quotes):

–binlog-expire-logs-seconds=10 --skip-log-bin

I haven’t seen the addition of any new binlogs but none of the existing binlogs have expired. How do I remove them.

I’ve tried PURGE BINARY LOGS at the mysql command line, but it doesn’t seem to affect anything.

Thanks,
Josh

I’ve also tried:

PURGE BINARY LOGS TO ‘binlog.000021’;
PURGE BINARY LOGS BEFORE ‘2020-03-04 22:46:26’;
PURGE BINARY LOGS BEFORE DATE(NOW());

Each command responds with ‘Query OK. 0 rows affected’.

Looking in the data folder the binlog files are still there.

Hi @joshm,

Can you check the contents of the /opt/bitnami/mysql/data/binlog.index file? Does it contain the paths of the binlog files?

Regards,
Michiel

Yes. Pasted below.

./binlog.000007
./binlog.000008
./binlog.000009
./binlog.000010
./binlog.000011
./binlog.000012
./binlog.000013
./binlog.000014
./binlog.000015
./binlog.000016
./binlog.000017
./binlog.000018
./binlog.000019
./binlog.000020
./binlog.000021
./binlog.000022
./binlog.000023
./binlog.000024
./binlog.000025
./binlog.000026
./binlog.000027
./binlog.000028
./binlog.000029
./binlog.000030
./binlog.000031
./binlog.000032
./binlog.000033
./binlog.000034
./binlog.000035
./binlog.000036
./binlog.000037
./binlog.000038
./binlog.000039
./binlog.000040
./binlog.000041
./binlog.000042
./binlog.000043
./binlog.000044
./binlog.000045
./binlog.000046
./binlog.000047
./binlog.000048
./binlog.000049
./binlog.000050
./binlog.000051
./binlog.000052
./binlog.000053
./binlog.000054
./binlog.000055
./binlog.000056
./binlog.000057
./binlog.000058
./binlog.000059
./binlog.000060

Hi @joshm,

A colleague from a dedicated team will follow up.

Regards,
Michiel

Hi @joshm, that is happening because you set the below configuration:

expire_logs_days = 0

Please refer to the documentation of expire_logs_days https://dev.mysql.com/doc/refman/5.7/en/replication-options-binary-log.html#sysvar_expire_logs_days

The number of days for automatic binary log file removal. The default is 0, which means “no automatic removal.”

If you set it to a value such as 7, and then restart MySQL, you will see those files get removed. See a related post.

Hi Marcos,

I have removed expire_log_days = 0 from my.cnf and
added --binlog-expire-logs-seconds=3000 to the ctlh.sh script. The binlogs
still remain.

Please advise.

Best,
Josh

Hi @joshm, I suggested in my previous post to add a line such as the below:

expire_logs_days = 7

(do NOT specify 0 as it will disable the functionality)

After adding it (inside [mysqld] section), restart MySQL. Could you check if it works?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.