"mysql5.6 Master-slave Replication" 1, configure the master-slave node service profile 1.1, configure the master node
[mysqld]binlog-format=rowlog-bin=master-binlog-slave-updates=truegtid-mode=onenforce-gtid-consistency= truemaster-info-repository=tablerelay-log-info-repository=tablesync-master-info=1slave-parallel-workers= 1BINLOG-CHECKSUM=CRC32 # #循环冗余校验法32位master-verify-checksum=1slave-sql-verify-checksum= 1binlog-rows-query-log_events=1server-id=1report-port=3306port=3306datadir=/mydata/datasocket=/var/lib/mysql/ Mysql.sock # #此项可以不改report-host=master.node1 # #报告主机一般是自己的主机名
1.2. Configure the slave node
[Mysqld]binlog-format=Rowlog-slave-updates=trueGtid-mode=Onenforce-gtid-consistency=trueMaster-Info-repository=Tablerelay-log-Info-repository=TABLESync-master-Info=1slave-parallel-workers=2Binlog-checksum=Crc32master-verify-checksum=1slave-sql-verify-checksum=1 binlog-rows-query-log_events=1server-id=one report- port=3306Port=3306log-bin=mysql-bin.logdatadir=/mydata/ Datasocket=/var/lib/mysql/mysql.sock # #此项可以不改report-host=slave.node2
2. Create a replication user on the master node
Mysql> GRANT REPLICATION SLAVE on * * to [email protected]192.168. 1.110 ' Password ';
Description: 192.168.1.110 is from the node server, if you want to authorize more nodes at once, you can modify them as needed.
3. To provide the initial data set from the server node
Lock the primary table, back up the data on the primary node, restore it to the slave node, and if not, use the show Master Status command on master to view the binary log file name and the event location when you back up the Gtid, so that you can use it later when you start the slave node.
4. Start the replication thread from the node
If the Gtid feature is enabled, use the following command:
mysql> Change MASTER to master_host='master.magedu.com', master_user='Repluser', master_password='Password', master_auto_position=1; Gtid is not enabled, you need to use the following command: Slave> Change MASTER to Master_host='192.168.1.102',Master_user='Repluser',master_password='Password',master_log_file='master-bin.000003',master_log_pos=1174
5, start the root user all permissions (mainly used to allow the front-end amoeba agent can root access to the master-slave database), respectively, in the main, from the database to execute the following commands:
' Root '@'%' password ' with GRANT OPTION;
mysql_5.6 Master-Slave database configuration in CentOS 6.6