Master-slave master-Slave synchronization of MySQL master-slave architecture

Source: Internet
Author: User

MySQL Replication

MySQL replication refers to the transfer of DDL and DML operations on the main library to the library from the binary log, keeping the master and the data from the library in sync

MySQL Master-slave Architecture: Advantages: Can cut the library when failure, read and write separation, perform other business from the library such as backup.

1:master-slave Master-Slave synchronization

2:master-slave-slave ... Cascade

3:master-master Mutual Primary Preparation

"Master-Slave Synchronization" Master-slave

Note: The main library is required to open log-bin; set Server-id

#mysqldump-uroot-p--all-databases--master-data=2--routines--events--quick>

  

--master-data=2 indicates that the export data needs to be recorded at the time the Binlog location of the main library--routines represents the export stored procedure--events represents the export event--quick means that the server does not send the result set one at a time, but sends it in batches. Reduced pressure Note: The--master-data is the lock library by default, ensuring data consistency, that is, the consistency of the exported data and the Binlog location. For the InnoDB engine, you can increase the--single-transaction unlock library and use the INNODB Transaction feature to ensure consistent data

 

#创建同步账号

#grant replication Slave, replication client on * * to  [email protected] '% ' identified by ' Gechong ';

#确定主库同步点

You can perform the SHOW master STATUS on master; You can also view the file you just exported

#从库同步数据

#mysql-uroot-p < Master_data_20140920.sql

  

#从库CHANGE

#CHANGE MASTER to master_log_file= ' mysql.000002 ', master_log_pos=525, master_host= ' 10.1.29.10 ', master_port=3306, Master_user= ' replication ', master_password= ' Gechong ';

  

#查看从库状态

#SHOW SLAVE STATUS \g

If both slave_io_running and slave_sql_running are yes, the Master-slave is built successfully.

 

Master-slave master-Slave synchronization of MySQL master-slave architecture

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.