The RelayLog cannot be automatically deleted (Neither -- relay-lognor -- relay-log-ind

Source: Internet
Author: User
Check the mysqlerr log today and find that the following logs will always appear during mysql restart: [Warning] Neither -- relay-lognor -- relay-log-indexwereused;

Check the mysql err log today and find that the following logs will always appear during mysql restart: [Warning] Neither -- relay-log nor -- relay-log-index were used;

Check the mysql err log today and find that the following logs will always appear during mysql restart:

[Warning] Neither -- relay-log nor -- relay-log-index were used; so replication may break when this MySQL server acts as a slave and has his hostname changed !! Please use '-- relay-log = liytest-relay-bin' to avoid this problem.

The warning itself means that, as slave, it is best to set '-- relay-log = liytest-relay-bin' to prevent invalid relay log file names due to host name changes'

But the problem, I am this machine does not enable the slave mode, and the data directory has been under the liytest-relay-bin.000001, the emergence of relay and accumulation, internet search to summarize the reasons

This instance was originally a Slave ------- resulting in the existence of relay-log and relay-log.index

This instance is no longer Slave ------- because I/O-Thread is absent, the relay-log-purge does not work (this is also the reason why other Slave instances do not, because IO-thread will perform the automatic rotate operation ).

This instance performs daily backup ------- Flush logs every day, resulting in a relay-log generated every day.

This instance is not configured with expire-logs-days ------, causing flush logs, no relay-log cleanup will be performed.

In short, a relay-log accumulation occurs when an instance is a server Load balancer instance and the stop Server Load balancer instance is stopped and expire-logs-days is not configured.

We also share with you the internal Logrotate mechanism of MySQL.

Binary Log rotate mechanism:

Rotate: after each binary log is written, it determines whether the current file has exceeded max_binlog_size. if it exceeded, A binlog file is automatically generated.

Delete: expire-logs-days is determined only when the instance is started and flush logs. If the file access time is earlier than the set value, purge file

Relay Log rotate mechanism:

Rotate: each time an events is fetch from the Master, a new relay-log-file is automatically generated if the current file exceeds max_relay_log_size.

Delete: purge-relay-log is determined every time an SQL Thread executes an events. If this relay-log is no longer needed, it is automatically deleted.

Therefore, we recommend that you use reset slave to cancel relaylog when slave is no longer used. Otherwise, even if you restart mysql, the problem still exists.

-------------------------------------- Split line --------------------------------------

Install MySQL in Ubuntu 14.04

MySQL authoritative guide (original book version 2nd) Clear Chinese scan PDF

Ubuntu 14.04 LTS install LNMP Nginx \ PHP5 (PHP-FPM) \ MySQL

Build a MySQL Master/Slave server in Ubuntu 14.04

Build a highly available distributed MySQL cluster using Ubuntu 12.04 LTS

Install MySQL5.6 and Python-MySQLdb in the source code of Ubuntu 12.04

MySQL-5.5.38 universal binary Installation

-------------------------------------- Split line --------------------------------------

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.