开发者

mysql binary log only log deletes

Is there any way in MySQL to only log deletes? I tried using the mysql binary log option but unfortunately, there are too many inserts to my database and the file swells instantly. If I let it grow for more than a day or so it will take up all the room on the server. I just want to log deletes for disaster recovery 开发者_高级运维purposes. Any thoughts?


A log file contains all changes to a database. It can be used to roll a backup forward:

After a backup file has been restored, the events in the binary log that were recorded after the backup was made are re-executed. These events bring databases up to date from the point of the backup

But in order to roll a database forward, the log has to contain all updates, not just deletes. So I don't think you can change it to just log deletes.

Is it an option to make full backups more often? After a full backup, you delete the old log files. That's a good way to keep the size of the binary log under control.

The MySQL binary logs take up disk space. To free up space, purge them from time to time. One way to do this is by deleting the binary logs that are no longer needed, such as when we make a full backup:

shell> mysqldump --single-transaction --flush-logs --master-data=2 \
     --all-databases --delete-master-logs > backup_sunday_1_PM.sql
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜