gpt4 book ai didi

mysql - GTID 复制失败错误 1062

转载 作者:行者123 更新时间:2023-11-29 19:22:06 24 4
gpt4 key购买 nike

我在设置从属复制时遇到问题。两者都使用 mysql 5.6 并开启了 GTID。 Master位于rackspace的云数据库HA实例上

我包含的转储上有一个 GTID 和主服务器。

我通过将以下内容添加到从属设备上启用了 GTID(我没有打开它)。然后我删除了所有数据库,所以它是新鲜的。

gtid_mode=ON
enforce_gtid_consistency=true
log_bin=/Library/Application Support/appsolute/MAMP PRO/db/mysql56/log
log_slave_updates=true
binlog_format=mixed

我运行的命令:

mysqldump  --tz-utc=false -u root -pPASSWORD --host=HOST --all-databases > dump.sql

mysql>CHANGE MASTER TO MASTER_HOST = 'MASTER_HOST', MASTER_PORT = 3306, MASTER_USER = 'repl_user', MASTER_PASSWORD = 'PASSWORD', MASTER_AUTO_POSITION = 1;
mysql>reset master;
mysql>source dump.sql;
mysql>start slave;


mysql> show slave status \G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: IP
Master_User: repl_user
Master_Port: 3307
Connect_Retry: 60
Master_Log_File: replica-2053073453-bin.000026
Read_Master_Log_Pos: 1022001275
Relay_Log_File: mysql-relay-bin.000002
Relay_Log_Pos: 7600
Relay_Master_Log_File: replica-2053073453-bin.000026
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: 1062
Last_Error: Error 'Duplicate entry '0db833be2a27f7fac7fa3ee1165256a398b7065f' for key 'PRIMARY'' on query. Default database: 'phppoint_demo2'. Query: 'INSERT INTO `phppos_sessions` (`id`, `ip_address`, `timestamp`, `data`) VALUES ('0db833be2a27f7fac7fa3ee1165256a398b7065f', 'IP', 1487705858, '')'
Skip_Counter: 0
Exec_Master_Log_Pos: 1018575999
Relay_Log_Space: 3433080
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: Error 'Duplicate entry '0db833be2a27f7fac7fa3ee1165256a398b7065f' for key 'PRIMARY'' on query. Default database: 'phppoint_demo2'. Query: 'INSERT INTO `phppos_sessions` (`id`, `ip_address`, `timestamp`, `data`) VALUES ('0db833be2a27f7fac7fa3ee1165256a398b7065f', 'IP', 1487705858, '')'
Replicate_Ignore_Server_Ids:
Master_Server_Id: 2053073453
Master_UUID: 979f153e-2d80-11e6-bb91-00185119e861
Master_Info_File: /Library/Application Support/appsolute/MAMP PRO/db/mysql56/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: 170221 14:55:55
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set: d2ce9c03-2d7f-11e6-bb8c-001851fe939d:10115103-10119980
Executed_Gtid_Set: 979f153e-2d80-11e6-bb91-00185119e861:1-17,
d2ce9c03-2d7f-11e6-bb8c-001851fe939d:1-10115113
Auto_Position: 1

我按照以下步骤操作:(如何以良好而缓慢的方式恢复从站)

https://www.percona.com/blog/2013/02/08/how-to-createrestore-a-slave-using-gtid-replication-in-mysql-5-6/

最佳答案

通常这意味着主站和从站上的数据集不同。我们通常做的是使用 xtrabackup 创建二进制备份,将其传输到从属服务器,然后使用 MASTER_AUTO_POSITION=1 开始复制。在您的特定示例中,您首先需要加载转储,然后然后执行CHANGE MASTER命令。

事实上,在与 OP 交谈后,他发现问题出在创建部分 mysqldump,而不是转储所有信息。

关于mysql - GTID 复制失败错误 1062,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42377128/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com