HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Need to keep each binlog files to 24 hrs

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
eachneedkeepfileshrsbinlog

Problem

We have a requirement that we need to keep each binlog files(like mysql-bin-changelog.025249, mysql-bin-changelog.025250, mysql-bin-changelog.025251....) of MYSQL RDS to minimum 24 hrs.

However, i see that binlog files are getting purged/deleted after 10-12 mins.

Below is the current setup in my RDS parameter group:

  • binlog retention hours is set to 24 hrs.



  • max_binlog_size is set to 134217728.



  • binlog_expire_logs_seconds is set to 2592000.



Also, my MYSQL RDS database is heavily used and has 400+ tables.

Please let me know which parameter i need to change, so that each bin log should be retained for 24 hrs.

Solution

binlog_expire_logs_seconds = 86400

expire_log_days = 1


It won't hurt to change them both. The latter is the "old" setting; the former (seconds) is new. It is as if they want to change from one to the other, but are not yet forcing the change.

However, note that the purging won't happen exactly at that time; it will 'guarantee' that at least 24 hours is kept.

It looks like the current setting is for 3 days.

The max_binlog_size = 128M gives a clue of when it will think about purging. If it takes a week to fill up that much, it won't purge nearly as often. You could lower it (if Amazon lets you). The size seems not to affect anything more than trivially. (The old default was 1G; I saw no substantive change when that shifted.)

Code Snippets

binlog_expire_logs_seconds = 86400

expire_log_days = 1

Context

StackExchange Database Administrators Q#321573, answer score: 2

Revisions (0)

No revisions yet.