Binlogs are Taking Up all my HD Space

Hello,

I have been trying to figure this out for weeks. I tried the solution from this article, but it didn’t help: Something Taking Up Space And Growing

Something is overwriting the MySQL configuration, but I can’t figure out what?

What info is needed from me to get help on this issue. I’m currently forced to delete binlog files every few days so my site doesn’t crash.

Thanks!

1 Like

Hi @mmena,

We have a Support Tool that will gather relevant information for us to analyze your configuration and logs. Could you please download and execute it on the machine where the stack is running by following the steps described in the guide below?

How to Run the Bitnami Support Tool

Please note that you need to paste the code outputted by the tool in your reply.

Apart from that information, can you run these commands to know how big are the folders inside the installation directory?

df -ih
df -h
cd /opt/bitnami
sudo find . -type f | cut -d "/" -f 2 | sort | uniq -c | sort -n
du -h -d 1

Thanks

Hello,

Here is the resulting code: 9360757d-61bf-0517-aee6-ec6582c5e358

And here are the other results:

df -ih
Filesystem Inodes IUsed IFree IUse% Mounted on
udev 122K 325 122K 1% /dev
tmpfs 124K 432 124K 1% /run
/dev/xvda1 4.9M 293K 4.6M 6% /
tmpfs 124K 1 124K 1% /dev/shm
tmpfs 124K 3 124K 1% /run/lock
tmpfs 124K 16 124K 1% /sys/fs/cgroup
/dev/loop1 13K 13K 0 100% /snap/core/7270
/dev/loop2 15 15 0 100% /snap/amazon-ssm-agent/1335
/dev/loop3 15 15 0 100% /snap/amazon-ssm-agent/1455
/dev/xvdf 2.5M 20 2.5M 1% /backup
/dev/loop4 13K 13K 0 100% /snap/core/7396
tmpfs 124K 4 124K 1% /run/user/1000

df -h
Filesystem Size Used Avail Use% Mounted on
udev 488M 0 488M 0% /dev
tmpfs 100M 12M 88M 13% /run
/dev/xvda1 39G 28G 12G 72% /
tmpfs 496M 0 496M 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 496M 0 496M 0% /sys/fs/cgroup
/dev/loop1 89M 89M 0 100% /snap/core/7270
/dev/loop2 18M 18M 0 100% /snap/amazon-ssm-agent/1335
/dev/loop3 18M 18M 0 100% /snap/amazon-ssm-agent/1455
/dev/xvdf 40G 11G 27G 29% /backup
/dev/loop4 89M 89M 0 100% /snap/core/7396
tmpfs 100M 0 100M 0% /run/user/1000

cd /opt/bitnami (no results)

sudo find . -type f | cut -d “/” -f 2 | sort | uniq -c | sort -n
1 bnsupport-regex.ini
1 changelog.txt
1 ctlscript.sh
1 img
1 manager-linux-x64.run
1 properties.ini
1 README.txt
1 use_wordpress
2 bnsupport
2 letsencrypt
6 sqlite
6 stats
8 config
15 var
23 scripts
73 licenses
90 varnish
439 mysql
660 php
1613 apache2
4331 common
105729 apps

du -h -d 1
23M./letsencrypt
230M./apache2
2.6M./sqlite
54M./bnsupport
2.8M./varnish
3.0M./stats
96K./var
116K./scripts
114M./common
1.2M./licenses
52K./config
79M./php
6.0G./apps
19G./mysql
8.0K./img
25G.

Thanks for the information @mmena, MySQL is using 19GB of disk. Can you run this command as well?

sudo du -hs /opt/bitnami/*/*/* |sort -rh | head -35

I just notice this sentence, are you editing the /opt/bitnami/mysql/my.cnf file? Can you confirm that the changes are there after editing the file? Please note that you need to add the “expire_logs_days = 7” line under the “[mysqld]” section.

sudo cat /opt/bitnami/mysql/my.cnf

Thanks

Hello:

Here are the results:

sudo du -hs /opt/bitnami///* |sort -rh | head -35

5.9G/opt/bitnami/apps/wordpress/htdocs
130M/opt/bitnami/mysql/lib/mecab
76M/opt/bitnami/apache2/var/cache
49M/opt/bitnami/mysql/bin/mysqld.bin
42M/opt/bitnami/apps/phpmyadmin/htdocs
23M/opt/bitnami/common/lib/libicudata.so.52.1
17M/opt/bitnami/apache2/modules/libphp7.so
16M/opt/bitnami/apache2/logs/access_log
15M/opt/bitnami/php/bin/php-cgi.bin
15M/opt/bitnami/php/bin/php.bin
11M/opt/bitnami/php/lib/php
11M/opt/bitnami/mysql/lib/plugin
11M/opt/bitnami/mysql/bin/mysql_upgrade.bin
11M/opt/bitnami/common/share/terminfo
10M/opt/bitnami/apache2/modules/mod_pagespeed.so
10M/opt/bitnami/apache2/modules/mod_pagespeed_ap24.so
8.1M/opt/bitnami/apps/wordpress/bnconfig
7.9M/opt/bitnami/apache2/logs/access_log-20190528.gz
6.5M/opt/bitnami/apache2/logs/access_log-20190805.gz
6.4M/opt/bitnami/apache2/logs/access_log-20190722.gz
6.3M/opt/bitnami/common/lib/libMagick++-6.Q16.a
6.0M/opt/bitnami/mysql/bin/mysqlpump.bin
5.9M/opt/bitnami/mysql/lib/libmysqlrouter.so.1
5.8M/opt/bitnami/mysql/bin/mysqlbinlog
5.7M/opt/bitnami/mysql/bin/perror
5.7M/opt/bitnami/mysql/bin/mysql.bin
5.6M/opt/bitnami/php/include/php
5.5M/opt/bitnami/mysql/bin/myisamchk.bin
5.5M/opt/bitnami/apache2/logs/access_log-20190811.gz
5.4M/opt/bitnami/mysql/lib/libmysqlclient.so.21.0.13
5.4M/opt/bitnami/mysql/bin/mysqlslap.bin
5.4M/opt/bitnami/mysql/bin/mysqlshow.bin
5.4M/opt/bitnami/mysql/bin/mysql_secure_installation.bin
5.4M/opt/bitnami/mysql/bin/mysqlimport.bin
5.4M/opt/bitnami/mysql/bin/mysqldump.bin

sudo cat /opt/bitnami/mysql/my.cnf

[mysqladmin]
user=root

[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
default-authentication-plugin=mysql_native_password

character-set-server=UTF8
collation-server=utf8_general_ci
[client]
port=3306
socket=/opt/bitnami/mysql/tmp/mysql.sock

default-character-set=UTF8
[manager]
port=3306
socket=/opt/bitnami/mysql/tmp/mysql.sock
pid-file=/opt/bitnami/mysql/tmp/manager.pid
default-mysqld-path=/opt/bitnami/mysql/bin/mysqld.bin


!include /opt/bitnami/mysql/bitnami/my.cnf

Stop the mysql server.

/opt/bitnami/ctlscript.sh stop mysql

Edit the mysql config file and add disable_log_bin in the [mysqld] block of lines, so the file looks like this:

[mysqladmin]
user=root

[mysqld]
disable_log_bin
...

Start the mysql server.

    /opt/bitnami/ctlscript.sh start mysql

Remove binlog files, note you have to use the last one that appears in the table of the first step:

rm /opt/bitnami/mysql/binlog.*
1 Like

Hi @aggressiveGrey and @mmena,

You can also follow these steps to disable the bin log in the database

Can you take a look at that post?

1 Like

Hi Jota,

That did the trick! Fingers crossed… :slight_smile:

Thank you for your help. I will monitor the directory for a few days just in case, but no new files since I added --disable-log-bin.

Thanks Again!!!

-Mario

On more question… Can I safely remove all the binlog files in this directory now? ls -alh /opt/bitnami/mysql/data/*

There are two. Each 1gb in size.

Thanks Again!

Hi @mmena,

Instead of removing the files directly from the command line, just let MySQL do that for you. You can find more information here:

https://dba.stackexchange.com/a/41054
https://dev.mysql.com/doc/refman/8.0/en/purge-binary-logs.html

Note: Please note that the Bitnami WordPress solution is not using replication so it’s safe to purge that information.

Happy to help!


Was my answer helpful? Click on :heart:

I removed them directly in the past. That’s how I got my server back up before the solution you gave me. Will that be an issue?

Also, where do I run these commands:

PURGE BINARY LOGS TO ‘binlogname’;
PURGE BINARY LOGS BEFORE ‘datetimestamp’;

Do I do it from my Bitnami SSH connection?

Thanks Again!

Hi @mmena,

Now that you have disabled the binary logs, there shouldn’t be problems but the MySQL’s documentation mentions that the proper way to do so is by running the other commands

You need to access the MySQL’s server and run those commands

https://docs.bitnami.com/general/apps/wordpress/get-started/connect-mysql/

Happy to help!


Was my answer helpful? Click on :heart:

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

We have added this information to our documentation: https://docs.bitnami.com/aws/apps/wordpress/troubleshooting/disable-binary-logging-mysql/