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

Mysql master-slave configuration realizes the separation of one master and one slave read and write

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

Share

Shulou(Shulou.com)06/01 Report--

Master-slave introduction

Mysql master and slave is also called Replication and AB replication. To put it simply, after the two machines An and B act as masters and slaves, they will write data on A, and the other B will also write data to achieve real-time data synchronization.

Mysql master / slave is based on binlog, and binlog needs to be enabled on the master to perform master / slave.

The master-slave process has about three steps.

The master records the change operation in binlog

Synchronize the master binlog event (sql statement) locally from the slave and record it in relaylog

Execute sequentially according to the sql statements in relaylog

Master-slave role

Real-time disaster recovery, used for failover read-write separation, providing query service backup to avoid affecting business

Master-slave form

* one master, one slave * master replication * one master and multiple slaves-expand the performance of system reading, because the read is read from the library * multi-master one slave-- 5.7 version supports * cascading replication

Principle of master-slave replication

< /opt/all-20180907.sqlmysql: [Warning] Using a password on the command line interface can be insecure.[root@yanyinglai ~]# mysql -uroot -p123456mysql: [Warning] Using a password on the command line interface can be insecure.Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 4Server version: 5.7.22 MySQL Community Server (GPL)Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql>

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