Score:0

WordPress MYSQL DB BINARY LOG - Droplet/SERVER Volume Increasing rapidly

de flag

My WordPress website uses Nginx. Recently I have noticed that server volume has increased from 8GB to 40GB. I have found that the WordPress MYSQL Binary Log is taking more space. Each second, database transactions are written to the Binlog files.

I am wondering that we do not have massive traffic on our website/WordPress. And having so many and large MySQL binlog files, as well as a lot of database events that are logged in the binlog files per second, could cause by a bot attack or any plugins are heavily using the database for temporal storage.

What I have done so far, I ran mysql> PURGE BINARY LOGS BEFORE '2021-08-30 22:46:26'. This reduces disk size from 40GB to 10GB which is good.

My question: (1) Since I use a single server and I am not using a replica, can I disable BINARY LOG (mysql> SET SQL_LOG_BIN =0), if I disable BINARY LOG, will this cause an issue?

(2) What causes binary log files to increase raipdaly, could this be malicious traffic? if so how can I stop it?

Any thought?

Score:0
ua flag

Set expire_logs_days or binlog_expire_logs_seconds so that the binlogs will be automatically (periodically) purged.

Binlogs are used for replication and/or certain types of backup. Since you don't seem to do either, yes, change to log_bin = OFF. Note: executing SET will not persist past the next restart. You must change the config file (perhaps my.cnf).

Why so rapidly growing? That's hard to say without looking in the binlog to see what bulky or repeated or naughty things are there.

DBA type questions would be better directed to dba.stackexchange.com

If the file has one or more "include", follow them to the files there. For example:

!includedir /etc/mysql/conf.d/

That directory will contain 0 or more continuations of the config. Consider adding a new file with your name as the file name and contents like

[mysqld]
log_bin = OFF

It may actually be better to name the file starting with z so that it will be (alphabetically) handled last.

 Ibrahim EL-Sanosi avatar
de flag
my my.cnf file has only this two lines !includedir /etc/mysql/conf.d/ !includedir /etc/mysql/mysql.conf.d/. So where to add log_bin = OFF?. I only use the normal backup to restore the website if some things go wrong. So, what do you mean by "certain types of backup"?
ua flag
@IbrahimEL-Sanosi - I added to my Answer.
 Ibrahim EL-Sanosi avatar
de flag
I only use the normal backup to restore the website if some things go wrong. So, what do you mean by "certain types of backup"?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.