色婷婷狠狠18禁久久YY,CHINESE性内射高清国产,国产女人18毛片水真多1,国产AV在线观看

mysql 差異同步

MySQL差異同步是一種用于同步數(shù)據(jù)庫(kù)中數(shù)據(jù)的工具,它可以在數(shù)據(jù)庫(kù)中的多個(gè)實(shí)例之間自動(dòng)同步數(shù)據(jù)。其原理是通過(guò)在主數(shù)據(jù)庫(kù)上進(jìn)行數(shù)據(jù)更改,并通過(guò)二進(jìn)制日志中的記錄將更改反映到從數(shù)據(jù)庫(kù)中。

在主數(shù)據(jù)庫(kù)上啟用二進(jìn)制日志功能,并在從數(shù)據(jù)庫(kù)上使用MySQL Replication Slave I/O Thread和MySQL Replication Slave SQL Thread兩個(gè)線程進(jìn)行差異同步。
mysql>show variables like 'log_bin';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| log_bin       | ON    |
+---------------+-------+
mysql>call mysql.rds_start_replication;
+------------------+-------------+-------------+
| Replica_Server_ID | Master_Host | Master_Port |
+------------------+-------------+-------------+
|              3002 | 172.16.0.12 |        3306 |
+------------------+-------------+-------------+

在主數(shù)據(jù)庫(kù)上更改數(shù)據(jù)后,mysql會(huì)將更改保存到二進(jìn)制日志中,之后從數(shù)據(jù)庫(kù)上的兩個(gè)線程會(huì)將更改信息同步到從數(shù)據(jù)庫(kù)中:

mysql>insert into user values('user1','123456');
Query OK, 1 row affected (0.01 sec)
mysql>select * from user;
+---------+--------+
| user    | pwd    |
+---------+--------+
| user1   | 123456 |
+---------+--------+
mysql>show binlog events in 'mysql-bin.000001';
+---------------+-----+----------------+-----------+-------------+------------+
| Log_name      | Pos | Event_type     | Server_id | End_log_pos | Info       |
+---------------+-----+----------------+-----------+-------------+------------+
| mysql-bin.000001 |   4 | Format_desc    |         1 |         120 | MySQL replication: xid 7 |
| mysql-bin.000001 | 120 | Query          |         1 |         180 | insert into user values('user1','123456') |
| mysql-bin.000001 | 180 | Xid            |         1 |         211 | MySQL_commit_ts: 964 |
+---------------+-----+----------------+-----------+-------------+------------+
mysql>select * from user limit 1;
+---------+--------+
| user    | pwd    |
+---------+--------+
| user1   | 123456 |
+---------+--------+

以上是MySQL差異同步的簡(jiǎn)單介紹,希望對(duì)你有所幫助。