为提高效率,提问时请提供以下信息,问题描述清晰可优先响应。
- 【TiDB 版本】:TiDB v4.0.8 DM v2.0.0 MySQL8.0.17
- 【问题描述】:
添加DM同步数据库任务时报错,提示 primary/unique key does not exist, please set primary/unique key for the table,其他的两个数据库正常,请问需要如何处理这个错误?
错误信息如下,
[root@localhost soft]# tiup dmctl --master-addr 192.168.137.135:8261 start-task ./dm-task-boss.yaml
Starting component dmctl
: /root/.tiup/components/dmctl/v2.0.0/dmctl/dmctl --master-addr 192.168.137.135:8261 start-task ./dm-task-boss.yaml
{
“result”: false,
“msg”: "[code=26005:class=dm-master:scope=internal:level=medium], Message: fail to check synchronization configuration with type: check was failed, please see detail
detail: {
“results”: [
{
“id”: 6,
“name”: “table structure compatibility check”,
“desc”: “check compatibility of table structure”,
“state”: “fail”,
“errorMsg”: "********** table boss
.tbl_birthday_gift
**********
statement: CREATE TABLE tbl_birthday_gift
(
site_id
int(11) NOT NULL,
product_id
int(11) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
---------- error messages ----------
information: primary/unique key does not exist
instruction: please set primary/unique key for the table
“,
“instruction”: “”,
“extra”: “address of db instance - 192.168.0.177:3306”
}
],
“summary”: {
“passed”: false,
“total”: 7,
“successful”: 6,
“failed”: 1,
“warning”: 0
}
}”,
“sources”: [
]
}
配置文件:dm-task-boss.yaml (1.6 KB)
报错的表结构语句:(空表,里面没有数据)
tbl_birthday_gift.sql (781 字节)