Many of my friends have made mysql master and slave databases for a while, but sometimes they have taken a lot of detours and wasted a lot of time. The main problem is that there is no information about other ChaYue host configurations, I only read the Configuration documentation. The following is a summary of the master-slave configuration.
I have been doing mysql Master/Slave for some time. I checked the disk space in the past two days and found that the disk in the database partition surged by more than 40 Gb. I checked it all the way, it has been found that Debinlog has more than 40 Gb since the master-slave replication is configured. The original source is here. Check my. cnf: The size of binlog is 1 GB, and Zuo is split. However, the deleted configuration is not displayed. in mysql, show variables:
The original cause is as follows:
The default value is 0, that is, logs does not expire. This is a global parameter, so you need to execute
In this way, the log will be deleted eight days ago. If you need a reply, back up the log. However, this setting does not work. The next time you restart mysql, the configuration will be restored to the default value, so Xu is in my. set in cnf,
In this way, restart is not afraid.
Now, in the production environment, set this time to 0, back up the mysql Log file, and then manually clear the file.
To restore the data before the database, execute
As there is a large amount of data, it is very troublesome to view it. It takes half a day to open a file, so some unnecessary logs should be deleted by ShiDang.
And if it takes enough time, I will eat all my hard disk space.
① Log on to the system,/usr/bin/mysql
Use mysql to view logs:
(2) Delete the bin-log (before deleting ablelee.000003, but not including ablelee.000003 ):
③ Query results (only one record is available now ):
Deletes all binary logs listed in the log index of the specified log or date ZhiQian. These logs will also be deleted from the list of records in the log index file, so that the given log becomes the first.
For example: