Reduce the latency of MySQL Master/Slave Data Synchronization

Source: Internet
Author: User
Tags dedicated server
Generally, the masterslave Mechanism Based on LAN can meet the requirements of rsquo, real-time rsquo, and backup. If the latency is high, confirm the following factors:

Generally, the LAN-based master/slave mechanism can meet the requirements of rsquo, real-time rsquo, and backup. If the latency is high, confirm the following factors:

Generally, the master/slave Mechanism Based on LAN can meet the requirements of 'realtime' backup. If the latency is high, first confirm the following factors:

1. network latency
2. master Load
3. slave Load
The general practice is to use multiple slave to allocate read requests, and then retrieve a dedicated server from these slave for backup purposes only, without any other operations, it can meet the 'realtime' requirement to the maximum extent.

In addition, we will introduce two parameters that can reduce latency.

-Slave-net-timeout = seconds
Parameter description: When slave fails to read log data from the master database, how long will it take to re-establish a connection and obtain data?

Slave_net_timeout is measured in seconds. The default value is 3600 seconds.
| Slave_net_timeout | 3600

-Master-connect-retry = seconds
Parameter description: When a master-slave connection is re-established, if the connection fails to be established, retry after the interval.

The unit of master-connect-retry is seconds. The default value is 60 seconds.

Generally, the above two parameters can reduce the Master/Slave Data Synchronization latency caused by network problems.

The common network error is:

070401 16:16:55 [ERROR] Error reading packet from server: Lost connection to MySQL server during query (server_errno = 2013)
070401 16:16:55 [ERROR] Slave I/O thread: Failed reading log event, reconnecting to retry, log 'mysql _ master-bin.000134 'position 115817861

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.