Semi-synchronous replication instance of MySQL5.6 one master and multiple slaves

Source: Internet
Author: User

Semi-synchronous replication instance of MySQL5.6 one master and multiple slaves

Semi-sync introduction:
By default, MySQL replication is asynchronous, which means that the master server and its slave server are independent. Asynchronous replication can provide optimal performance because the master server does not have to wait to verify whether the updated data has been copied to the slave server after writing the updated data to its binary log file, you can freely process other incoming transaction processing requests. However, this also brings a high risk. If a fault occurs on the master server or slave server, the data inconsistency between the master and slave servers may occur, or even data loss may occur during recovery.
A semi-synchronous replication function is introduced from MySQL5.5 to ensure data consistency and redundancy between the master server and at least one slave server in the access chain. In this configuration structure, a master server and many of its slave servers are configured. In this way, in the replication topology, at least one slave server before the parent master server performs transaction processing, you must confirm that the update has been received and written into its Relay Log ). When a timeout occurs, the source master server must temporarily switch to the asynchronous replication mode and re-copy until at least one slave server set to the semi-synchronous replication mode receives the information in a timely manner.
After 5.5 semi-synchronous replication, MySQL5.6 has optimized and improved it. Two of them are important:

1. After the master-slave switchover, in the traditional method, you need to find the binlog and POS points, and then change the master point. In mysql5.6, you no longer need to know the binlog and POS points, you only need to know the master's IP address, port, and account and password. Because synchronous replication is automatic, mysql automatically finds a point for synchronization through the internal mechanism GTID.
2. multi-threaded replication. In the previous version, synchronous replication is single-threaded and can only be executed one by one. In MySQL, multi-threaded replication can be performed between multiple databases, but tables in one database, multi-threaded replication is invalid.

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

Important parameter log_slave_updates for MySQL master-slave Synchronization

Install MySQL in Ubuntu 14.04

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

Load Nginx in Ubuntu for high-performance WEB Server 5 --- MySQL master/Master Synchronization

Production Environment MySQL master/Master synchronization primary key conflict handling

MySQL Master/Slave failure error Got fatal error 1236

MySQL master-slave replication, implemented on a single server

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

I. test environment preparation
1.1 Installation Platform: vmware workstation 10
Operating System: CentOS release 6.6 (Final) x86_64, minimal installation.
MySQL version: mysql-5.6.24-linux-glibc2.5-x86_64
Disable Firewall
1.2 Server IP address planning:
MySQL Master: 192.168.1.152
MySQL Slave1: 192.168.1.201
MySQL Slave2: 192.168.1.202

1.3. Experiment topology:

Ii. Install Mysql5.6
2.1 As It Is a minimal installation system, some basic components need to be installed.

# Yum-y groupinstall "Perl Support"
# Yum-y instdall vim wget
# Cd/usr/local/src
# Wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.24-linux-glibc2.5-x86_64.tar.gz

2.2 create a user and a data directory.
# Mkdir-pv/mydata/data
# Groupadd-r mysql
# Useradd-g mysql-r-s/sbin/nologin-M-d/mydata/data mysql
# Chown-R mysql: mysql/mydata/data

2.3 install and initialize mysql
# Tar zxvf mysql-5.6.24-linux-glibc2.5-x86_64.tar.gz-C/usr/local
# Cd/usr/local/
# Ln-sv mysql-5.6.24-linux-glibc2.5-x86_64 mysql
# Cd mysql
# Chown-R mysql: mysql.
# Scripts/mysql_install_db -- user = mysql -- datadir =/mydata/data
# Chown-R root.

2.4 provide the primary configuration file for mysql
12 # cd/usr/local/mysql
# Cp support-files/my-default.cnf/etc/my. cnf

2.5 configure the sysv service script for mysql
# Cd/usr/local/mysql
# Cp support-files/mysql. server/etc/rc. d/init. d/mysqld
# Chkconfig -- add mysqld // add to service list
# Chkconfig mysqld on

To use mysql installation to comply with the system usage specifications and export its development components to the system, perform the following steps:
2.6 output the mysql man manual to the man command search path.
Edit/etc/man. config and add the following lines.
MANPATH/usr/local/mysql/man

2.7 output the mysql header file to the system header file path/usr/include
This can be achieved through simple link Creation
# Ln-sv/usr/local/mysql/include/usr/include/mysql

2.8 output the mysql database file to the system database search path.
# Echo '/usr/local/mysql/lib'>/etc/ld. so. conf. d/mysql. conf
# Ldconfig // Let the system reload the system library

2.9 modify the PATH environment variable so that the system can directly use mysql-related commands.
# Echo "export PATH = $ PATH:/usr/local/mysql/bin">/etc/profile. d/mysql. sh
# Source/etc/profile. d/mysql. sh

The above installation process must be performed on three servers.

For more details, please continue to read the highlights on the next page:

  • 1
  • 2
  • 3
  • Next Page

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.