Title

CDH-mysql 开启关闭 gtid

在线开启步骤:

首先查询gtid状态

mysql> show variables like '%gtid%';
+----------------------------------+-----------+
| Variable_name | Value |
+----------------------------------+-----------+
| binlog_gtid_simple_recovery | ON |
| enforce_gtid_consistency | ON |
| gtid_executed_compression_period | 1000 |
| gtid_mode | OFF |
| gtid_next | AUTOMATIC |
| gtid_owned | |
| gtid_purged | |
| session_track_gtids | OFF |
+----------------------------------+-----------+
8 rows in set (0.01 sec)

 

1、要求:

(1)必须是5.7.6版本以上的mysql

(2)GTID状态为OFF

2、开启步骤:

(1):SET GLOBAL ENFORCE_GTID_CONSISTENCY = 'WARN';

(2):SET GLOBAL ENFORCE_GTID_CONSISTENCY = 'ON';

(3):SET GLOBAL GTID_MODE = 'OFF_PERMISSIVE';

(4):SET GLOBAL GTID_MODE = 'ON_PERMISSIVE';

(5):SET GLOBAL GTID_MODE = 'ON';

 3、要永久启用,在my.cnf配置文件中添加参数:

gtid-mode=ON

enforce-gtid-consistency

 

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 | |
| session_track_gtids | OFF |
+----------------------------------+-----------+

在线关闭步骤:

1、要求:

(1)必须是5.7.6版本以上的mysql

(2)GTID状态为OFF

2、关闭步骤:

(1):stop slave;

(2):SET GLOBAL GTID_MODE = 'ON_PERMISSIVE';

(3):SET GLOBAL GTID_MODE = 'OFF_PERMISSIVE';

(4):SET GLOBAL GTID_MODE = 'OFF';

 

mysql> show variables like '%gtid%';
+----------------------------------+-----------+
| Variable_name | Value |
+----------------------------------+-----------+
| binlog_gtid_simple_recovery | ON |
| enforce_gtid_consistency | ON |
| gtid_executed_compression_period | 1000 |
| gtid_mode | OFF |
| gtid_next | AUTOMATIC |
| gtid_owned | |
| gtid_purged | |
| session_track_gtids | OFF |
+----------------------------------+-----------+
8 rows in set (0.01 sec)

注:

每次开启和关闭时,都是这样一个过程:

打开-->过度模式-->完全打开

停止-->过度模式-->完全关闭

posted @ 2019-12-17 18:17  jasonchao  阅读(548)  评论(0编辑  收藏  举报
#编辑目录