MySQL Advanced master-slave replication

Source: Internet
Author: User

Master-slave replication is not more than a server! , one change, the other changes, the content is actually the same!

Principle:

Operation on the database will generate a file, Binlog (binary file), from the server configuration Relaylog file, used to read the master inside Binlog (it is necessary to open binlog, equivalent to backup), of course, to have permission to read it, it needs to use the last permission configuration! It's no different from normal login.

What action does the Lord make, and what action does it make?

At this point you need to pay attention to the main configuration file inside the Binlog-format, the value is row, the binary record is the disk change, the value is Statusment, if the UPDATE statement is executed, from the server will also record the UPDATE statement

If the statement is long and the disk changes small, use row

If the statement is small and the disk changes large, easy to use statusment

There is also a mixed, at which time the system analysis decides

1 Open the main server inside the configuration file


2 configuration from the server


3 Assign permissions and view the master status. Note the value of file and position, which is used when configuring the server from the back .



4 from the server by specifying the primary server to replicate

Mysql>change Master to aster_host= ' 192.168.1.201 ', master_user= ' repl ', master_password= ' q123456 ',
Master_log_file= ' mysql-bin.,000001 ', master_log_pos=106;

5 Checking the replication status from the server


Slave_io_running:yes//This status must be Yes
Slave_sql_running:yes//This status must be Yes

This is OK, very simple!

The so-called read and write separation, is the SQL statement judgment, through the program can be achieved.


MySQL Advanced master-slave replication

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.