The "pits" you don't know about in the MySQL master-slave synchronization architecture (end)

The "pits" you don't know about in the MySQL master-slave synchronization architecture (end)

The "pits" you don't know about in the MySQL master-slave synchronization architecture (end)


收录于话题
#MySQL从入门到放弃
26个

Click on the blue text above and follow us!


Before the introduction , I wrote an article about the "pit" of this master-slave synchronization architecture. The specific link is as follows
. The "pit" you don't know about the MySQL master-slave synchronization architecture.
This article is a follow-up introduction to the previous article. Some "pits" encountered in the specified synchronization library

Specify synchronization library situation

1. binlog_format= ROW mode‍


The "pits" you don't know about in the MySQL master-slave synchronization architecture (end)
The "pits" you don't know about in the MySQL master-slave synchronization architecture (end)

mysql> use testdb;
Database changed
mysql> show tables;
+------------------+
| Tables_in_testdb |
+------------------+
| test01 |
| test1 |
+------------------+
3 rows in set (0.00 sec)

mysql> insert into test1 values('zhng','man');
Query OK, 1 row affected (0.05 sec)

mysql> insert into test1 values('meimei','woman');
Query OK, 1 row affected (0.04 sec)

mysql> select * from test1;
+--------+-------+
| id | name |
+--------+-------+
| zhang | man |
| zhng | man |
| meimei | woman |
+--------+-------+
3 rows in set (0.00 sec)

从库查看
mysql> use testdb;
Database changed
mysql> show tables;
+------------------+
| Tables_in_testdb |
+------------------+
| test01 |
| test1 |
+------------------+
2 rows in set (0.01 sec)

mysql> select * from test1;
+--------+-------+
| id | name |
+--------+-------+
| zhang | man |
| zhng | man |
| meimei | woman |
+--------+-------+
3 rows in set (0.01 sec)

2. binlog_format= STATEMENT mode‍


The "pits" you don't know about in the MySQL master-slave synchronization architecture (end)

The "pits" you don't know about in the MySQL master-slave synchronization architecture (end)

The main database configuration is as follows
binlog-do-db = testdb The
slave database configuration is as follows
replicate-wild-do-table = testdb.% The
main database operation
mysql> create database testdb;
Query OK, 1 row affected (0.01 sec)

mysql> use testdb;
Database changed
mysql> create table test01 (
-> id varchar(10) not null,
-> name varchar(10) not null
-> );
Query OK, 0 rows affected (0.04 sec)

mysql> insert into test01 values('zhang','man');
Query OK, 1 row affected (0.01 sec)

mysql> select * from testdb.test01;
+-------+------+
| id | name |
+-------+------+
| zhang | man |
+-------+------+
1 row in set (0.00 sec)

从库查看
mysql> use testdb;
Database changed
mysql> select * from test01;
+-------+------+
| id | name |
+-------+------+
| zhang | man |
+-------+------+
1 row in set (0.00 sec)

Test whether the default library will synchronize data without specifying the ignore library
mysql> create user testdb_user;
Query OK, 0 rows affected (0.03 sec)

mysql> select user from mysql.user;
+-------------+
| user |
+-------------+
| testdb_user |
| mysql.sys |
| root |
+-------------+

[root@mysql-s ~]# mysql -uroot -p -e "select user from mysql.user;"
Enter password:
+-----------+
| user |
+----- ------+
| mysql.sys |
| root |
+-----------+
Note: The data of the default library is not synchronized

Recommended reading

(Multi-map Shenru) illustrates the big rookie to achieve financial freedom to take the road of life, the pinnacle of
technology run video resource Welfare TB level (white road to the big cattle)
MySQL Cluster high-availability architecture of the MHA
LVS load balancing cluster architecture
once the actual production needs triggered by the "cranky" the consequences of
open source components ELK log system configuration and management
Xtrabackup for data backup and recovery
On MySQL cluster high-availability architecture
The "pits" you don't know about in the MySQL master-slave synchronization architecture (end)
cat catches a ball of yarn guide Share
The "pits" you don't know about in the MySQL master-slave synchronization architecture (end)

Guess you like

Origin blog.51cto.com/mingongge/2555348