mysql5.6.x Gtid-based multi-threaded replication-installation configuration
Operating system:
RHEL6 Or CentOS6 x86_64
MySQL version:
mysql-5.6.20
Server IP:
10.57.1.131 mysql-master10.57.1.132 Mysql-slave
First, yum install MySQL
# Download the MySQL RPM package
Mkdir-pv/root/softcd/root/soft
#这里提供三个版本的官方64位rpm下载路径, choose the corresponding RPM download according to your system platform
# RHEL6 and CentOS6 x86_64 RPM package
wget Http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-shared-compat-5.6.20-1.el6.x86_64.rpmwget/HTTP Dev.mysql.com/get/downloads/mysql-5.6/mysql-test-5.6.20-1.el6.x86_64.rpmwget http://dev.mysql.com/get/Downloads /mysql-5.6/mysql-devel-5.6.20-1.el6.x86_64.rpmwget http://dev.mysql.com/get/Downloads/MySQL-5.6/ Mysql-client-5.6.20-1.el6.x86_64.rpmwget http://dev.mysql.com/get/Downloads/MySQL-5.6/ Mysql-server-5.6.20-1.el6.x86_64.rpmwget http://dev.mysql.com/get/Downloads/MySQL-5.6/ Mysql-shared-5.6.20-1.el6.x86_64.rpmwget http://dev.mysql.com/get/Downloads/MySQL-5.6/ mysql-embedded-5.6.20-1.el6.x86_64.rpm
# RHEL5 and CentOS5 x86_64 RPM package
wget Http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-embedded-5.6.20-1.rhel5.x86_64.rpmwget/HTTP Dev.mysql.com/get/downloads/mysql-5.6/mysql-shared-compat-5.6.20-1.rhel5.x86_64.rpmwget http://dev.mysql.com/ Get/downloads/mysql-5.6/mysql-test-5.6.20-1.rhel5.x86_64.rpmwget http://dev.mysql.com/get/Downloads/MySQL-5.6/ Mysql-devel-5.6.20-1.rhel5.x86_64.rpmwget http://dev.mysql.com/get/Downloads/MySQL-5.6/ Mysql-client-5.6.20-1.rhel5.x86_64.rpmwget http://dev.mysql.com/get/Downloads/MySQL-5.6/ Mysql-server-5.6.20-1.rhel5.x86_64.rpmwget http://dev.mysql.com/get/Downloads/MySQL-5.6/ mysql-shared-5.6.20-1.rhel5.x86_64.rpm
# RHEL7 and CentOS7 x86_64 RPM package
wget Http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-shared-compat-5.6.20-1.el7.x86_64.rpmwget/HTTP Dev.mysql.com/get/downloads/mysql-5.6/mysql-test-5.6.20-1.el7.x86_64.rpmwget http://dev.mysql.com/get/Downloads /mysql-5.6/mysql-devel-5.6.20-1.el7.x86_64.rpmwget http://dev.mysql.com/get/Downloads/MySQL-5.6/ Mysql-client-5.6.20-1.el7.x86_64.rpmwget http://dev.mysql.com/get/Downloads/MySQL-5.6/ Mysql-server-5.6.20-1.el7.x86_64.rpmwget http://dev.mysql.com/get/Downloads/MySQL-5.6/ Mysql-shared-5.6.20-1.el7.x86_64.rpmwget http://dev.mysql.com/get/Downloads/MySQL-5.6/ mysql-embedded-5.6.20-1.el7.x86_64.rpm
# Note that the above three items only download one item
# Introduction to each RPM package
Mysql-server:mysql
# MySQL Official provides 7 rpm, of course not all packages are installed, according to their own needs to selectively install a few RPM packages just downloaded
# generally installed Mysql-server, mysql-client, Mysql-devel, mysql-shared, mysql-shared-compat these RPM packages are sufficient, installed as follows
# Install the downloaded RPM package
Yum localinstall mysql-server* mysql-client* mysql-shared* mysql-shared-compat* mysql-devel*
# automatically start the MySQL service setup boot
Chkconfig--add mysqlchkconfig MySQL on
# Build MySQL Data directory
Mkdir-p/data/mysql/data
# Start the MySQL service
Server MySQL Start
Second, multi-threaded replication of gtid based on mysql-5.6.x
1. Configuring the Master Node
Vim/etc/my.cnf
# The content is as follows, end ends
[Mysqld]# mysql server listens on port port=3306# socket file path socket=/data/mysql/data/mysql.sock# data store path datadir=/ data/mysql/data/# Enable Bin-log log log-bin=master-bin# binlog log format binlog-format=row# server id The ID value in the master-slave or main-host environment must be globally unique server-id=1# shutdown DNS resolution skip-name-resolve# Whether or not the server writes information about the event to the log log-slave-updates=true# whether the Gtid feature is enabled gtid-mode=on# Whether to force Gtid consistency enforce-gtid-consistency=true# show slave hosts; the IP and port that are displayed report-port= 3306report-host=10.57.1.131# slave logs master status and connection Information# slave logs ,master status, and connection information is recorded in a File or table (table) master-info-repository=tablerelay-log-info-repository=table# Synchronous Master-info Information sync-master-info=1# The number of SQL threads from the server, the value is best consistent with the number of databases, 0 means disabling multithreading slave-parallel-workers=2# whether to verify the integrity of the Binlog log, The following three options are enabled for the check function in the replication feature binlog-checksum=crc32master-verify-checksum=1slave-sql-verify-checksum=1# Enabling information related to logging events in and out can reduce the complexity of troubleshooting Binlog-rows-query-log_events=1[mysqld_safe]log-error=/var/log/mysqld.log[client]socket=/data/mysql/data/mysql.sock # end
# Initialize MySQL database
/usr/bin/mysql_install_db--user=mysql--datadir=/data/mysql/data
# Restart MySQL Service
Service mysqld Restart
# Create a replication user
Mysql> GRANT REPLICATION SLAVE on * * to [e-mail protected] "10.57.1.131" identified by ' Redhat ';mysql> FLUSH privileg ES;
2. Configure the slave node
Vim/etc/my.cnf
# The content is as follows, end ends
[mysqld]datadir=/data/mysql/dataport=3306socket=/data/mysql/data/mysql.socklog-bin=mysql-binserver-id= 2slave-parallel-workers=2binlog-format=rowlog-slave-updates=truegtid-mode=on enforce-gtid-consistency= truemaster-info-repository=tablerelay-log-info-repository=tablesync-master-info=1binlog-checksum= crc32master-verify-checksum=1slave-sql-verify-checksum=1binlog-rows-query-log_events=1report-port= 3306report-host=10.57.1.132[mysqld_safe]log-error=/var/log/mysqld.log[client]socket=/data/mysql/data/ mysql.sock# End
# Restart MySQL Service
Service mysqld Restart
mysql> change MASTER to master_host= ' 10.57.1.131 ', master_user= ' slave ', master_password= ' Redhat ', master_auto_ Position=1;
Mysql> START SLAVE;
3. Testing
# First perform a write operation on the main library and then check from the library to see if there is any synchronization.
This article from the "Past with the Wind" blog, declined reprint!
mysql5.6.x Gtid-based multi-threaded replication-installation configuration