Mysql advanced master-slave replication, mysql master-slave

Source: Internet
Author: User

Mysql advanced master-slave replication, mysql master-slave

Master-slave replication is more than multiple servers !, One change changes the other, and the content is actually the same!

Principle:

Operations on the database will generate a file, binlog (binary file), and configure the relaylog file from the server to read the binlog in the master (it is necessary to enable binlog, which is equivalent to backup ), of course, you must have the permission to read data. This requires the last permission configuration! It is no different from normal logon.

What actions the master makes and what actions it also makes.

In this case, you need to pay attention to the binlog-format in the main configuration file, where the nominal value is row, the binary record is disk change, and the value is statusment. If the update statement is executed, the slave server also records the update statement.

If the statement is long and the disk changes little, easy to use row

Easy to use statusment

There is also a mixed, which is determined by system analysis.

1. Open the configuration file in the master server.


2. Configure slave server


3. Assign permissions and view the master status. Write down the value of FILE and Position, which will be used later When configuring slave server



4. Specify the master server to be copied from the server

Mysql> change master to aster_host = '192. 168.1.201 ', master_user = 'repl', master_password = 'q123456 ',
Master_log_file = 'mysql-bin., 100', master_log_pos = 000001;

5. Check the replication status of the slave 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/write splitting is the judgment of SQL statements, which can be achieved through programs.


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.