报错信息:
ERROR 1201 (HY000): Could not initialize connection metadata info structure; more error messages can be found in the MySQL error log
报错原因分析
1、从报错信息来看,是change master部分有问题
2、检查error.log日志,通过分析是通过rpm包安装,检查/etc/my.cnf配置文件,找到error.log位置
2024-01-10T06:49:36.908327Z 690 [ERROR] [MY-010584] [Repl] Replica SQL for channel '': Worker 1 failed executing transaction 'ANONYMOUS' at source log mysql-bin.000025, end_log_pos 1842; Could not execute Delete_rows event on table test.test; Can't find record in 'test', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's source log mysql-bin.000025, end_log_pos 1842, Error_code: MY-001032
2024-01-10T06:49:36.908555Z 689 [ERROR] [MY-010586] [Repl] Error running query, replica SQL thread aborted. Fix the problem, and restart the replica SQL thread with "START REPLICA". We stopped at log 'mysql-bin.000025' position 1468
2024-01-10T06:49:36.908964Z 688 [System] [MY-014001] [Repl] Replica receiver thread for channel '': connected to source 'mysync@1x2:3306' with server_uuid=47445d71-11e3-11eb-8f0e-0894efb70dde, server_id=202. Starting replication from file 'mysql-bin.000028', position '235888249'.
2024-01-17T02:19:49.957814Z 694 [Warning] [MY-013360] [Server] Plugin mysql_native_password reported: ''mysql_native_password' is deprecated and will be removed in a future release. Please use caching_sha2_password instead'
2024-01-17T02:45:26.464647Z 695 [Warning] [MY-010055] [Server] IP address '1x3' could not be resolved: Temporary failure in name resolution
2024-01-17T02:45:26.475274Z 695 [Warning] [MY-013360] [Server] Plugin mysql_native_password reported: ''mysql_native_password' is deprecated and will be removed in a future release. Please use caching_sha2_password instead'
2024-01-17T02:46:05.765501Z 695 [ERROR] [MY-010717] [Repl] Error reading replica worker configuration
2024-01-17T02:46:05.812408Z 695 [ERROR] [MY-010418] [Repl] Error creating applier metadata: Failed to initialize the worker info structure.
2024-01-17T03:15:07.097065Z 695 [ERROR] [MY-010717] [Repl] Error reading replica worker configuration
2024-01-17T03:15:07.097097Z 695 [ERROR] [MY-010418] [Repl] Error creating applier metadata: Failed to initialize the worker info structure.
从错误日志中,可以看到,执行到mysql-bin.000025 里的事件时候报错,而客户这边配置的是从mysql-bin.000028开始的并且从backup.sql中获取到起始位置,因此客户配置无问题,所以,怀疑之前有配置过slave信息,经过询问,的确存在
处理方法:
stop slave;
reset slave all;
重新配置change master …
start slave;
检查
show slave status\G;