Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand
titleRemove Superflous Bin Log Files...

Binary log files (often referred to as binlogs) in MySQL are a record of all changes made to the database. They are essential for replication, backups, and recovery purposes. Binlogs track events such as:

  • Data modifications (e.g., INSERT, UPDATE, DELETE statements)
  • Table and database schema changes (e.g., CREATE, ALTER statements)

MySQL uses binlogs to propagate changes from a master database to one or more slave databases in a replication setup. The slaves read and apply the binlogs from the master to stay synchronized.

Over time the the amount of bin log files increase and therefore so does the size of the file they are stored in.  This will take up hard drive space plus, this will significantly slow the process if you are cloning the system as the more bin log files there are, the more that have to be copied during the cloning process.

Therefore there is some house keeping that needs to be done to ensure the older bin log files get deleted.


Expand
titleModify the das.ini file to housekeep automatically.......
  • expire_logs_days
    • You can control how long binary logs are kept by setting the expire_logs_days parameter in the MySQL configuration file
    • To do this go to  C:\Program Files\Deepnet DualShield\mysql
    • Edit the das.ini file in elevated Notepad or Notepad++
    • Add an entry under [mysqld] for example expire_logs_days = 30

    • This will ensure that logs over 30 days old will be deleted.  You can set the a different amount of day days, but we recommend at least 30 to ensure no loss of data.
    • Remeber to Save the das.ini file
    • Restart the MySQL(Dual) service

Expand
titleUse a MySQL query to manually purge binlogs...
    •  Log into MySQL Console in command prompt (refer to Login to MySql console)
    • Use the following query... show binary logs;

Image Added

    • Use the following query... PURGE BINARY LOGS BEFORE NOW() - INTERVAL 30 DAY;Image Added
    • Logs over 30 days old will be deleted right away.  You can set a different amount of days, but we recommend at least 30 to ensure no loss of data.
    • Use the following query... show binary logs;

Image Added

    • You can see that the number of bin log files has been greatly reduced. * 
    • *Please note the screenshots were taken from a test server with a low amount of bin log files to start with so in this example it was reduced to 7 days, but most likely you will see more bin log files if reduced to 30 days as recommended.