In-depth introduction: Summary of MySQL master-slave Configuration

Source: Internet
Author: User

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:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.