主从同步配置几天后,突然有一天不同步了,查看同步情况如下:
mysql> show slave status\G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 10.10.xx.xx
Master_User: dt_sync
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000145
Read_Master_Log_Pos: 22358502
Relay_Log_File: relay.000053
Relay_Log_Pos: 68192171
Relay_Master_Log_File: mysql-bin.000018
Slave_IO_Running: Yes
Slave_SQL_Running: No
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 1418
Last_Error: 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: 'sx_mom'. Query: 'CREATE DEFINER=`root`@`%` FUNCTION `getAllChild`(id int) RETURNS varchar(2000) CHARSET utf8mb4 COLLATE utf8mb4_bin
BEGIN
DECLARE str varchar(1000);
DECLARE cid varchar(10000);
DECLARE result varchar(2000);
set result = '';
SET str = '';
SET cid = id;
WHILE cid is not null DO
SET result = concat(result,',',cid);
set str = cid;
select group_concat(menu_id) into cid from sys_menu where find_in_set(parent_id,str)>0;
END WHILE;
RETURN result;
END'
Skip_Counter: 0
Exec_Master_Log_Pos: 68191958
Relay_Log_Space: 13398132029
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 1418
Last_SQL_Error: 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: 'sx_mom'. Query: 'CREATE DEFINER=`root`@`%` FUNCTION `getAllChild`(id int) RETURNS varchar(2000) CHARSET utf8mb4 COLLATE utf8mb4_bin
BEGIN
DECLARE str varchar(1000);
DECLARE cid varchar(10000);
DECLARE result varchar(2000);
set result = '';
SET str = '';
SET cid = id;
WHILE cid is not null DO
SET result = concat(result,',',cid);
set str = cid;
select group_concat(menu_id) into cid from sys_menu where find_in_set(parent_id,str)>0;
END WHILE;
RETURN result;
END'
Replicate_Ignore_Server_Ids:
Master_Server_Id: 40
Master_UUID: 3a077b03-38bb-11ed-9a96-0cda411d1419
Master_Info_File: mysql.slave_master_info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State:
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp: 221025 10:10:48
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set: 3a077b03-38bb-11ed-9a96-0cda411d1419:5-8139191
Executed_Gtid_Set: 35d26faf-38bb-11ed-9929-0cda411df25c:1-4,
3a077b03-38bb-11ed-9a96-0cda411d1419:1-818046
Auto_Position: 1
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
1 row in set (0.00 sec)
ERROR:
No query specified
mysql> show variables like ' log_bin_trust_function_creators';
Empty set (0.00 sec)
mysql> show variables like 'log_bin_trust_function_creators';
+---------------------------------+-------+
| Variable_name | Value |
+---------------------------------+-------+
| log_bin_trust_function_creators | OFF |
+---------------------------------+-------+
1 row in set (0.00 sec)
mysql> set global log_bin_trust_function_creators=1;
Query OK, 0 rows affected (0.00 sec)
mysql> stop slave;
Query OK, 0 rows affected (0.01 sec)
mysql> start slave;
Query OK, 0 rows affected (0.00 sec)
mysql> show slave status\G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 172.6.2.1
Master_User: slave3
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000423
Read_Master_Log_Pos: 95536598
Relay_Log_File: mysql-relay-bin.001260
Relay_Log_Pos: 972250501
Relay_Master_Log_File: mysql-bin.000422
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 972250338
Relay_Log_Space: 1169284268
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 10902
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0