How to check the gtid_mode_configuration of mysql. When MHA turns on master-slave synchronization, it will prompt that the slave database gtid_mode is ON...

How to check the gtid_mode_configuration of mysql. When MHA turns on master-slave synchronization, it will prompt that the slave database gtid_mode is ON...

Check show slave status \G through MHA slave library; the following error will be prompted!
Last_IO_Error: The replication receiver thread cannot start because the master has GTID_MODE = ON and this server has GTID_MODE = OFF.

[Cause of error report]

The MySQL Master and Slave must enable or disable the enforce-gtid-consistency and gtid-mode functions at the same time, that is, they must be consistent.

【Solution】

mysql> set global gtid_mode=on;
ERROR 1788 (HY000): The value of @@GLOBAL.GTID_MODE can only be changed one step at a time: OFF OFF_PERMISSIVE ON_PERMISSIVE ON. Also note that this value must be stepped up or down simultaneously on all servers. See the Manual for instructions.
mysql> set global gtid_mode=OFF_PERMISSIVE;
Query OK, 0 rows affected (0.00 sec)
mysql> set global gtid_mode=ON_PERMISSIVE;
Query OK, 0 rows affected (0.02 sec)
mysql> set global gtid_mode=ON; 开启gtid之前 ,必须设置enforce_gtid_consistency=on
ERROR 3111 (HY000): SET @@GLOBAL.GTID_MODE = ON is not allowed because ENFORCE_GTID_CONSISTENCY is not ON.
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)

【Reference】

gtid-mode is used to set whether to enable the GTID function. If you want to enable the GTID function, you need to enable the log-bin and log_slave_updates functions at the same time. You also need to enable the enforce_gtid_consistency function. The gtid_mode parameter can be set to four values: on, off, upgrade_step_1, and upgrade_step_2. Upgrade_step_1 and upgrade_step_2 are reserved for possible new functions of mysql in the future and have no meaning for the current myql. At the same time, mysql recommends turning off the gtid_mode function and enforce_gtid_consistency function during mysql_upgrade, because Mysql may operate non-transactional MyISAM storage engine tables during the upgrade, which will cause errors.

Supongo que te gusta

Origin blog.csdn.net/weixin_46010834/article/details/131825279
Recomendado
Clasificación