Orchestrator主從切換後 若有兩組GTID時 DM無法切換上游MySQL

为提高效率,请提供以下信息,问题描述清晰能够更快得到解决:
【 TiDB 使用环境】
TiDB版本: v5.2.2 DM版本: v2.0.7

【概述】 场景 + 问题概述
場景: 經過Orchestrator切換過後 若有兩組GTID時 DM是否無法正常切換上游MySQL

原DM上游MySQL: 10.224.3.42
預計切換至MySQL: 10.224.3.44

【背景】 做过哪些操作
task_sbk_event_log_replication

gtid-S=2eec5a68-3255-11ec-a5f1-42010ae00329:1-27777:28154-41673052,f74edd73-4361-11ec-91a8-42010ae0032b:1-259

task_sbk_main_replication

gtid-S=2eec5a68-3255-11ec-a5f1-42010ae00329:1-27777:28154-41673055,f74edd73-4361-11ec-91a8-42010ae0032b:1-259

gtid-P=2eec5a68-3255-11ec-a5f1-42010ae00329:1-41542656,f74edd73-4361-11ec-91a8-42010ae0032b:1-259

gtid-E=2eec5a68-3255-11ec-a5f1-42010ae00329:1-41673778,f74edd73-4361-11ec-91a8-42010ae0032b:1-259

有滿足官網所說的條件:

  • gtid-S 包含 gtid-Pgtid-P 可以为空)
  • gtid-E 包含 gtid-S

切換步驟:

**一.**
tiup dmctl --master-addr=10.224.3.61:8261 stop-task task_sbk_main_replication

tiup dmctl --master-addr=10.224.3.61:8261 stop-task task_sbk_event_log_replication

**二.**
tiup dmctl --master-addr=10.224.3.61:8261 operate-source stop /usr/local/DBA/source/tidb/uat-sbk-dmcluster/dm-source.sbk-main.yaml

tiup dmctl --master-addr=10.224.3.61:8261 operate-source stop /usr/local/DBA/source/tidb/uat-sbk-dmcluster/dm-source.sbk-event-log.yaml

**三.**
修改ip 10.224.3.42 => 10.224.3.44

**四.**
tiup dmctl --master-addr=10.224.3.61:8261 operate-source create /usr/local/DBA/source/tidb/uat-sbk-dmcluster/dm-source.sbk-main.yaml

tiup dmctl --master-addr=10.224.3.61:8261 operate-source create /usr/local/DBA/source/tidb/uat-sbk-dmcluster/dm-source.sbk-event-log.yaml

**五.**
tiup dmctl --master-addr=10.224.3.61:8261 start-task /usr/local/DBA/source/tidb/uat-sbk-dmcluster/dm-task.sbk-main.yaml

tiup dmctl --master-addr=10.224.3.61:8261 start-task /usr/local/DBA/source/tidb/uat-sbk-dmcluster/dm-task.sbk-event_log.yaml

**六.**
tiup dmctl --master-addr=10.224.3.61:8261 query-status task_sbk_main_replication

tiup dmctl --master-addr=10.224.3.61:8261 query-status task_sbk_event_log_replication

**七. 兩個task皆顯示以下錯誤訊息**
**"Message": "get binlog event error: ERROR 1236 (HY000): The slave is connecting using CHANGE MASTER TO MASTER_AUTO_POSITION = 1, but the master has purged binary logs containing GTIDs that the slave requires."**
Starting component `dmctl`: /home/dba_tw/.tiup/components/dmctl/v5.3.0/dmctl/dmctl --master-addr=10.224.3.61:8261 query-status task_sbk_event_log_replication
{
    "result": true,
    "msg": "",
    "sources": [
        {
            "result": true,
            "msg": "",
            "sourceStatus": {
                "source": "uat-sbk-event-log",
                "worker": "dm-10.224.3.62-8262",
                "result": null,
                "relayStatus": null
            },
            "subTaskStatus": [
                {
                    "name": "task_sbk_event_log_replication",
                    "stage": "Paused",
                    "unit": "Sync",
                    "result": {
                        "isCanceled": false,
                        "errors": [
                            {
                                "ErrCode": 36069,
                                "ErrClass": "sync-unit",
                                "ErrScope": "upstream",
                                "ErrLevel": "high",
                                "Message": "get binlog event error: ERROR 1236 (HY000): The slave is connecting using CHANGE MASTER TO MASTER_AUTO_POSITION = 1, but the master has purged binary logs containing GTIDs that the slave requires.",
                                "RawCause": "",
                                "Workaround": "Please check if the binlog file could be parsed by `mysqlbinlog`."
                            }
                        ],
                        "detail": null
                    },
                    "unresolvedDDLLockID": "",
                    "sync": {
                        "totalEvents": "0",
                        "totalTps": "0",
                        "recentTps": "0",
                        "masterBinlog": "(uat-sbk-mysql-4-bin.000002, 348314396)",
                        "masterBinlogGtid": "2eec5a68-3255-11ec-a5f1-42010ae00329:1-41674439,f74edd73-4361-11ec-91a8-42010ae0032b:1-259",
                        "syncerBinlog": "(uat-sbk-mysql-2-bin.000687, 50183033)",
                        "syncerBinlogGtid": "2eec5a68-3255-11ec-a5f1-42010ae00329:1-27777:28154-41674115,f74edd73-4361-11ec-91a8-42010ae0032b:1-259",
                        "blockingDDLs": [
                        ],
                        "unresolvedGroups": [
                        ],
                        "synced": false,
                        "binlogType": "remote",
                        "secondsBehindMaster": "0"
                    }
                }
            ]
        }
    ]
}
Starting component `dmctl`: /home/dba_tw/.tiup/components/dmctl/v5.3.0/dmctl/dmctl --master-addr=10.224.3.61:8261 query-status task_sbk_main_replication
{
    "result": true,
    "msg": "",
    "sources": [
        {
            "result": true,
            "msg": "",
            "sourceStatus": {
                "source": "uat-sbk-main",
                "worker": "dm-10.224.3.63-8262",
                "result": null,
                "relayStatus": null
            },
            "subTaskStatus": [
                {
                    "name": "task_sbk_main_replication",
                    "stage": "Paused",
                    "unit": "Sync",
                    "result": {
                        "isCanceled": false,
                        "errors": [
                            {
                                "ErrCode": 36069,
                                "ErrClass": "sync-unit",
                                "ErrScope": "upstream",
                                "ErrLevel": "high",
                                "Message": "get binlog event error: ERROR 1236 (HY000): The slave is connecting using CHANGE MASTER TO MASTER_AUTO_POSITION = 1, but the master has purged binary logs containing GTIDs that the slave requires.",
                                "RawCause": "",
                                "Workaround": "Please check if the binlog file could be parsed by `mysqlbinlog`."
                            }
                        ],
                        "detail": null
                    },
                    "unresolvedDDLLockID": "",
                    "sync": {
                        "totalEvents": "0",
                        "totalTps": "0",
                        "recentTps": "0",
                        "masterBinlog": "(uat-sbk-mysql-4-bin.000002, 355186325)",
                        "masterBinlogGtid": "2eec5a68-3255-11ec-a5f1-42010ae00329:1-41674504,f74edd73-4361-11ec-91a8-42010ae0032b:1-259",
                        "syncerBinlog": "(uat-sbk-mysql-2-bin.000687, 50127543)",
                        "syncerBinlogGtid": "2eec5a68-3255-11ec-a5f1-42010ae00329:1-27777:28154-41674114,f74edd73-4361-11ec-91a8-42010ae0032b:1-259",
                        "blockingDDLs": [
                        ],
                        "unresolvedGroups": [
                        ],
                        "synced": false,
                        "binlogType": "remote",
                        "secondsBehindMaster": "0"
                    }
                }
            ]
        }
    ]
}

【附件】


  1. dmctl --master-addr <master-addr> get-config source <source-id> 看看对应的 uat-sbk-event-log 以及 uat-sbk-main 两个 source 的配置。
  2. 10.224.3.44 以及 10.224.3.42 的 show global variables like '%gtid%'\G 辛苦也查询一下。
1 个赞

没有满足这个。因为 gtid-S 是断开的,没有包含 2eec5a68-3255-11ec-a5f1-42010ae00329:27778-28153 这一部分

2 个赞

感謝大神回覆!!!

此话题已在最后回复的 1 分钟后被自动关闭。不再允许新回复。