Mysql one master two transitions from schema to cascade replication

Source: Internet
Author: User

Because the company server is recently migrated, the original database schema is a master-one from the schema (main Library a---from library c), and one more from library server B.

Now you will replace the main library A from library B, and from library C continue as the from Library of B.

A Master 2 from a simple step, specific steps omitted.

First set up from the library B, configuration good my.cnf server_id

1, first stop from the library c.stop slave

2, remember the sync state from library C. Show slave Status\g remembers the location and points of Master_log_file and Read_master_log_pos.

3, back up from library C, after the backup is complete, import from library B.

4, the master library a authorizes the user from library B.

5, change master from library B to copy from. (use from the location and point of the library C)

When the above operation is complete, the current schema is a master two-from-one schema, and now you want to upgrade from library B to a cascading schema from library C's main library.

Start the binary log from library B first. And also add the parameter Log_slave_updates = 1 in authorizing a copy with the account given from library C.

When the Log_slave_updates parameter from the library is not turned on, the Binlog from the library does not record the operation from the main library. Only the log_slave_updates is turned on, and the operation log of the main library synchronization is recorded from the library Binlog.

    1. Stop SLAVE is executed from library C first. Show slave status \g View the location Exec_master_log_pos from library c to copy the main library A.
    2. Perform a show slave status \g from library B, see if exec_master_log_pos from library B is already greater than exec_master_log_pos from library C, and if it is greater than, then do stop slave to stop copying from library B. You need to write down the relay_master_log_file:tex-bin.003882 from library B, exec_master_log_pos:322474479 two values, and perform the show Master status from library B. Note the name of the Binlog file (b) and the location position (b), and then start slave to turn on replication.
    1. Execute start slave until master_log_file= ' tex-bin.003882 ', master_log_pos=322474479 from library C;  Let's copy from library C to the location from library B. Show slave status \g see if until_log_pos from library c is equal to Exec_master_log_pos, and if equal, stop slave to close replication. Then point from library C's main library to the library B,change master to
      Master_host= ' B_ip ',
      master_port=3306,
      Master_user= ' rep ',
      master_password= ' xxxx ',
      Master_log_file=file (B),
      Master_log_pos=position (B),
      master_connect_retry=3;

Then start slave to turn on replication. OK, it's over, that's it!

Mysql one master two transitions from schema to cascade replication

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.