一、问题描述
代码语言:javascript复制[root@mysql-slave ~]# mysql -uroot -pXXX
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 44883881
Server version: 5.7.23-log MySQL Community Server (GPL)
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
45: root@localhost:[(none)]> show slave statusG;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 172.16.161.102
Master_User: slave115
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000460
Read_Master_Log_Pos: 332071142
Relay_Log_File: mysql-slave-relay-bin.000467
Relay_Log_Pos: 62605418
Relay_Master_Log_File: mysql-bin.000460
Slave_IO_Running: Yes
Slave_SQL_Running: No
Replicate_Do_DB: LinuxYunwei
Replicate_Ignore_DB: mysql,information_schema,performance_schema,sys
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table: LinuxYunwei.%
Replicate_Wild_Ignore_Table:
Last_Errno: 1677
Last_Error: Coordinator stopped because there were error(s) in the worker(s). The most recent failure being: Worker 1 failed executing transaction 'ANONYMOUS' at master log mysql-bin.000460, end_log_pos 331041034. See error log and/or performance_schema.replication_applier_status_by_worker table for more details about this failure or others, if any.
Skip_Counter: 0
Exec_Master_Log_Pos: 331040734
Relay_Log_Space: 332071706
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: 1677
Last_SQL_Error: Coordinator stopped because there were error(s) in the worker(s). The most recent failure being: Worker 1 failed executing transaction 'ANONYMOUS' at master log mysql-bin.000460, end_log_pos 331041034. See error log and/or performance_schema.replication_applier_status_by_worker table for more details about this failure or others, if any.
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1
Master_UUID: b575c55f-3071-11e7-86a6-000c2987deeb
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: 210608 17:43:16
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set:
Auto_Position: 0
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
1 row in set (0.00 sec)
ERROR:
No query specified
具体细节
代码语言:javascript复制45: root@localhost:[(none)]> select * from performance_schema.replication_applier_status_by_worker;
-------------- ----------- ----------- --------------- ----------------------- ------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------
| CHANNEL_NAME | WORKER_ID | THREAD_ID | SERVICE_STATE | LAST_SEEN_TRANSACTION | LAST_ERROR_NUMBER | LAST_ERROR_MESSAGE | LAST_ERROR_TIMESTAMP |
-------------- ----------- ----------- --------------- ----------------------- ------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------
| | 1 | NULL | OFF | ANONYMOUS | 1677 | Worker 1 failed executing transaction 'ANONYMOUS' at master log mysql-bin.000460, end_log_pos 331041034; Column 1 of table 'LinuxYunwei.DWH_TRADER_FEATURE_DF' cannot be converted from type 'varchar(255(bytes))' to type 'varchar(765(bytes) utf8)' | 2021-06-08 17:43:16 |
| | 2 | NULL | OFF | ANONYMOUS | 0 | | 0000-00-00 00:00:00 |
| | 3 | NULL | OFF | ANONYMOUS | 0 | | 0000-00-00 00:00:00 |
| | 4 | NULL | OFF | ANONYMOUS | 0 | | 0000-00-00 00:00:00 |
| | 5 | NULL | OFF | ANONYMOUS | 0 | | 0000-00-00 00:00:00 |
| | 6 | NULL | OFF | ANONYMOUS | 0 | | 0000-00-00 00:00:00 |
| | 7 | NULL | OFF | ANONYMOUS | 0 | | 0000-00-00 00:00:00 |
| | 8 | NULL | OFF | ANONYMOUS | 0 | | 0000-00-00 00:00:00 |
-------------- ----------- ----------- --------------- ----------------------- ------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------
二、解决方法
- 快速处理
stop slave;
set global slave_type_conversions=ALL_NON_LOSSY;
start slave;
- 展示信息
46: root@localhost:[(none)]> stop slave;
Query OK, 0 rows affected (0.00 sec)
53: root@localhost:[(none)]> set global slave_type_conversions=ALL_NON_LOSSY;
Query OK, 0 rows affected (0.00 sec)
53: root@localhost:[(none)]> start slave;
Query OK, 0 rows affected (0.02 sec)
53: root@localhost:[(none)]> show slave statusG;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 172.16.161.102
Master_User: slave115
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000460
Read_Master_Log_Pos: 334851277
Relay_Log_File: mysql-slave-relay-bin.000467
Relay_Log_Pos: 64378307
Relay_Master_Log_File: mysql-bin.000460
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB: LinuxYunwei
Replicate_Ignore_DB: mysql,information_schema,performance_schema,sys
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table: LinuxYunwei.%
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 332813623
Relay_Log_Space: 334852239
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: 274
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1
Master_UUID: b575c55f-3071-11e7-86a6-000c2987deeb
Master_Info_File: mysql.slave_master_info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Waiting for dependent transaction to commit
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set:
Auto_Position: 0
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
1 row in set (0.00 sec)
ERROR:
No query specified
- 总结:ALL_NON_LOSSY(无损转换) 该模式下,不会导致数据丢失和截断,因为该值只允许同类的小数据类型转换为大数据类型,其他模式的转换都会发生1677错误。生产环境建议设置该值