MySQL5.7在线开启/关闭GTID(3)

mysql> set global gtid_mode='OFF_PERMISSIVE';
Query OK, 0 rows affected (0.01 sec)
mysql> set global gtid_mode='ON_PERMISSIVE';
Query OK, 0 rows affected (0.01 sec)
mysql> set global enforce_gtid_consistency=ON;
Query OK, 0 rows affected (0.00 sec)
mysql> set global gtid_mode='ON';
Query OK, 0 rows affected (0.01 sec)
mysql> 
mysql> 
mysql> show variables like '%gtid%';
+----------------------------------+----------------------------------------+
| Variable_name                    | Value                                  |
+----------------------------------+----------------------------------------+
| binlog_gtid_simple_recovery      | ON                                    |
| enforce_gtid_consistency        | ON                                    |
| gtid_executed_compression_period | 1000                                  |
| gtid_mode                        | ON                                    |
| gtid_next                        | AUTOMATIC                              |
| gtid_owned                      |                                        |
| gtid_purged                      | 82b160c7-9a8f-11e6-8412-000c29c6361d:1 |
| session_track_gtids              | OFF                                    |
+----------------------------------+----------------------------------------+
8 rows in set (0.00 sec)
 
主库做操作,从库执行如下命令会看到gtid_set的值在变化
mysql> show master status;
+------------------+----------+--------------+------------------+------------------------------------------+
| File            | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set                        |
+------------------+----------+--------------+------------------+------------------------------------------+
| mysql-bin.000011 |      154 |              |                  | 82b160c7-9a8f-11e6-8412-000c29c6361d:1-2 |
+------------------+----------+--------------+------------------+------------------------------------------+
1 row in set (0.00 sec)
 
mysql> show master status;
+------------------+----------+--------------+------------------+------------------------------------------+
| File            | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set                        |
+------------------+----------+--------------+------------------+------------------------------------------+
| mysql-bin.000011 |      154 |              |                  | 82b160c7-9a8f-11e6-8412-000c29c6361d:1-3 |
+------------------+----------+--------------+------------------+------------------------------------------+
1 row in set (0.00 sec)

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/8f3bf307c1512ee223091333ebc9c174.html