Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the advantages and disadvantages of chain replication of Mysql

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "what are the advantages and disadvantages of chain replication of Mysql". In daily operation, I believe that many people have doubts about the advantages and disadvantages of chain replication of Mysql. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts of "what are the advantages and disadvantages of chain replication of Mysql?" Next, please follow the editor to study!

The purpose of this is to relieve the pressure on mysql A when mysql C synchronizes data from mysql A.

The disadvantage is that if something goes wrong with mysql B, mysql C will stop synchronizing.

The common reasons for failed synchronization from the database are

1. The delay of the network is not the separation of mysql across the computer room. when there is a bottleneck in mysql A, it will also cause mysql B synchronization to fail. The log shows that the delay of the network is caused by the delay of the network.

2. In the case of abnormal mysql A, synchronization failure will also occur. In this case, re-change file value and posvalue will be fine.

But the probability of occurrence is very small.

Here is the process of configuration ~

In fact, this is not difficult ~ is mainly a parameter on b ~

MYSQL chain copy: a = > B = > C

A: 192.168.2.155

B: 192.168.2.156 Slave / Master

C: 192.168.2.160 from

Double click code 123456 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 25 26 27A Host: vi / etc/my.cnf log-bin=mysql-bin server-id=1 binlog-do-db=tongbu (Note: if this parameter is not specified, binlog records the operation of all libraries, adding user binlog will also be changed and copied to slave server) service mysqld restart mysql- uroot-p123456 create database tongbu;use tongbu;create table tbl1 (id int); insert into tbl1 values (1) Select * from tbl1; grant replication slave on *. * to tongbu156@192.168.2.156 identified by '123456; flush tables with read lock; (you can lock multiple libraries at the same time, do not create tables when locking, etc., and automatically unlock all libraries after exiting) show master status; (write down log files and position) exit Mysqldump-uroot-p123456 tongbu > / tongbu.sql (copy this file to host B / below) double-click the code to select all 123456 7 8 9 10 11 12 13 14 15 16 17 19 19 21 22 23 25 26 27 29 30 31 33 34 36 37 38 39 40 41 42 43B Host: vi / etc/my.cnf log-bin=mysql-bin server-id=2 binlog-do-db=tongbu (Note: if this parameter is not specified, binlog records the operation of all libraries, adding user binlog will also change It will also be copied to the slave server) log-slave-updates (generate your own log file, it is recommended to add the line at this location) service mysqld restart mysql-uroot-p123456 create database tongbu Use tongbu; source / tongbu.sql enable slave server role change master to master_host='192.168.2.155',master_user='tongbu156',master_password='123456',master_log_file='mysql-bin.000007',master_log_pos=107 start slave; grant replication slave on *. * to tongbu160@192.168.2.160 identified by '123456slave; flush tables with read lock; show master status; (write down log files and position) exit Mysqldump-uroot-p123456 tongbu > / tongbu.sql (copy this file to the C host /) double-click the code to select all 123456 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25C host: vi / etc/my.cnf log-bin=mysql-bin server-id=3 service mysqld restart mysql- uroot-p123456 create database tongbu; use tongbu Source / tongbu.sql enable slave server role Change master to master_host='192.168.2.156',master_user='tongbu160',master_password='123456',master_log_file='mysql-bin.000009',master_log_pos=222 start slave

Note:

Show slave status; view the status of the slave server

Show processlist; to view log processing status

At this point, the study of "what are the advantages and disadvantages of chain replication of Mysql" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report