问题
mysql mgr的集群停止了,显示2各备节点脱离了集群。报错如下
2023-09-25T11:36:38.160084+08:00 17 [ERROR] [MY-010584] [Repl] Replica SQL for channel 'group_replication_applier': Worker 1 failed executing transaction 'a6aef99d-4d1d-447b-be83-b9205b003051:18572828'; Error 'This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)' on query. Default database: 'test'. Query: 'CREATE DEFINER=`app`@`%` FUNCTION `XX_SYS_FUNC_GET_MACHINEID`() RETURNS int BEGIN ^M RETURN -1; ^M END', Error_code: MY-001418
2023-09-25T11:36:43.964954+08:00 0 [System] [MY-011504] [Repl] Plugin group_replication reported: 'Group membership changed: This member has left the group.'
分析
日志里提到了log_bin_trust_function_creators这个参数,通过大神博客,可以理解这个参数的意思。
因为时生产环境,需要研发修改相关的函数写法。
解决
集群不同步了,需要设置下log_bin_trust_function_creators=1,放过检查。并停止和启动MGR同步。最后别忘了修改log_bin_trust_function_creators=0