从库报错,错误号为1062,违反唯一性约束
-
mysql> show slave status \G;
-
*************************** 1. row ***************************
-
Slave_IO_State: Waiting for master to send event
-
Master_Host: 192.168.56.92
-
Master_User: repl
-
Master_Port: 3306
-
Connect_Retry: 60
-
Master_Log_File: binlog.000066
-
Read_Master_Log_Pos: 554
-
Relay_Log_File: relaylog.000214
-
Relay_Log_Pos: 317
-
Relay_Master_Log_File: binlog.000063
-
Slave_IO_Running: Yes
-
Slave_SQL_Running: No
-
Replicate_Do_DB:
-
Replicate_Ignore_DB: information_schema,performance_schema
-
Replicate_Do_Table:
-
Replicate_Ignore_Table:
-
Replicate_Wild_Do_Table:
-
Replicate_Wild_Ignore_Table:
-
Last_Errno: 1062
-
Last_Error: Coordinator stopped because there were error(s) in the worker(s). The most recent failure being: Worker 1 failed executing transaction 'cec9239c-4aa7-11e8-80b8-080027e9c966:13000740' at master log binlog.000063, end_log_pos 3625. 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: 2744
-
Relay_Log_Space: 3625921578
-
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: 1062
-
Last_SQL_Error: Coordinator stopped because there were error(s) in the worker(s). The most recent failure being: Worker 1 failed executing transaction 'cec9239c-4aa7-11e8-80b8-080027e9c966:13000740' at master log binlog.000063, end_log_pos 3625. 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: 2
-
Master_UUID: cec9239c-4aa7-11e8-80b8-080027e9c966
-
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: 180518 19:40:14
-
Master_SSL_Crl:
-
Master_SSL_Crlpath:
-
Retrieved_Gtid_Set: cec9239c-4aa7-11e8-80b8-080027e9c966:13000738-13100742
-
Executed_Gtid_Set: 4873eeea-4114-11e8-a25a-080027aeb704:1-4,
-
cec9239c-4aa7-11e8-80b8-080027e9c966:7000683-13000739
-
Auto_Position: 0
-
Replicate_Rewrite_DB:
-
Channel_Name:
-
Master_TLS_Version:
-
1 row in set (0.00 sec)
-
-
-
ERROR:
-
No query specified
尝试用
pt-slave-restart跳过该错误
[root@pxc01 percona-toolkit-3.0.3]# pt-slave-restart --error-numbers=1062 -h localhost -uroot -pmysql
Can't locate Digest/MD5.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /usr/local/bin/pt-slave-restart line 4261.
BEGIN failed--compilation aborted at /usr/local/bin/pt-slave-restart line 4261.
|
缺少安装了包,安装之。
yum -y install perl-Digest-MD5
再次执行
[root@pxc01 /]# pt-slave-restart --error-numbers=1062 -h localhost -uroot -pmysql -S /tmp/mysql.sock
Cannot skip transactions properly because GTID is enabled and slave_parallel_workers > 0. See 'GLOBAL TRANSACTION IDS' in the tool's documentation.
|
报错误,因为
slave_parallel_workers 大于0,查看当前slave_parallel_workers=8
mysql> show variables like '%slave_parallel_workers%';
+------------------------+-------+
| Variable_name | Value |
+------------------------+-------+
| slave_parallel_workers | 8 |
+------------------------+-------+
1 row in set (0.00 sec)
|
先设置0,设置slave_parallel_workers=0
mysql> set global slave_parallel_workers=0;
[root@pxc01 /]# pt-slave-restart --error-numbers=1062 -h localhost -uroot -pmysql -S /tmp/mysql.sock
2018-05-18T20:54:55 S=/tmp/mysql.sock,h=localhost,p=...,u=root relaylog.000214 317 1062
2018-05-18T20:54:56 S=/tmp/mysql.sock,h=localhost,p=...,u=root relaylog.000214 1229 1062
|
执行成功,查看复制情况:
-
mysql> show slave status \G;
-
*************************** 1. row ***************************
-
Slave_IO_State: Waiting for master to send event
-
Master_Host: 192.168.56.92
-
Master_User: repl
-
Master_Port: 3306
-
Connect_Retry: 60
-
Master_Log_File: binlog.000066
-
Read_Master_Log_Pos: 554
-
Relay_Log_File: relaylog.000219
-
Relay_Log_Pos: 761
-
Relay_Master_Log_File: binlog.000066
-
Slave_IO_Running: Yes
-
Slave_SQL_Running: Yes
-
Replicate_Do_DB:
-
Replicate_Ignore_DB: information_schema,performance_schema
-
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: 554
-
Relay_Log_Space: 3625921578
-
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: 0
-
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: 2
-
Master_UUID: cec9239c-4aa7-11e8-80b8-080027e9c966
-
Master_Info_File: mysql.slave_master_info
-
SQL_Delay: 0
-
SQL_Remaining_Delay: NULL
-
Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
-
Master_Retry_Count: 86400
-
Master_Bind:
-
Last_IO_Error_Timestamp:
-
Last_SQL_Error_Timestamp:
-
Master_SSL_Crl:
-
Master_SSL_Crlpath:
-
Retrieved_Gtid_Set: cec9239c-4aa7-11e8-80b8-080027e9c966:13000738-13100742
-
Executed_Gtid_Set: 4873eeea-4114-11e8-a25a-080027aeb704:1-4,
-
cec9239c-4aa7-11e8-80b8-080027e9c966:7000683-13100742
-
Auto_Position: 0
-
Replicate_Rewrite_DB:
-
Channel_Name:
-
Master_TLS_Version:
-
1 row in set (0.01 sec)
-
-
-
ERROR:
-
No query specified
已经恢复正常了,将
slave_parallel_workers恢复回原来的值.
mysql> set global slave_parallel_workers=8;
Query OK, 0 rows affected (0.00 sec)
-- The End --
阅读(5539) | 评论(0) | 转发(0) |