开发者社区> 问答> 正文

使用datax做mysql到mysql的数据迁移 报错Field 'body' doesn't have a default value和其它 求解决思路或具体方法

环境和配置说明:
1、2台mysql之间做迁移
2、在mysqlreader端部署了datax,然后希望能迁移到writer端。
3、2台服务器上mysql已经互相开放权限且网络正常,能连接成功。
4、reader端是lamp环境 ,writer端为wamp环境 。
5、datax配置信息如下:
{

"job": {
    "content": [
        {
            "reader": {
                "name": "mysqlreader",
                "parameter": {
                    "username": "root",
                    "password": "123",
                    "column": ["id","name","body","url","listurl","detailurl","demo","status","listbegin","listend","listitempat","musthave","listurlpat","listurlreplace","nohave","listtype","curlPost","pagename","detailmust","detailno","ifhandleadd","ifallok","updatezq","daarea","area","province","city","qu","money","zhuti","lxglf","time_duan","is_fenduan","tel_to","dizhi","re_dizhi","start_line_time","end_line_time","end_for","is_tongji"],
                    "splitPk": "id",
                    "connection": [
                        {
                            "jdbcUrl": ["jdbc:mysql://192.168.1.124:3306/dla"],
                            "table": ["lzh_sitelist"]
                        }
                    ],
                    "where": "id<3000"
                }
            },
            "writer": {
                "name": "mysqlwriter",
                "parameter": {
                    "writeMode": "insert",
                    "username": "root",
                    "password": "123",
                    "column": ["id","name","body","url","listurl","detailurl","demo","status","listbegin","listend","listitempat","musthave","listurlpat","listurlreplace","nohave","listtype","curlPost","pagename","detailmust","detailno","ifhandleadd","ifallok","updatezq","daarea","area","province","city","qu","money","zhuti","lxglf","time_duan","is_fenduan","tel_to","dizhi","re_dizhi","start_line_time","end_line_time","end_for","is_tongji"],
                    "connection": [
                        {
                            "jdbcUrl": "jdbc:mysql://192.168.1.128:3306/dla",
                            "table": ["lzh_sitelist"]
                        }
                    ],  
                }
            }
        }
    ],
    "setting": {
        "speed": {
            "channel": "2"
        }
    }
}

}
故障报错:
1、中途有报错 Field 'body' doesn't have a default value 。
2、之后插入时部分数据插入成功 还有部分数据报错 脏数据... 报错截图如下
1

展开
收起
cctv531529 2016-06-15 19:08:21 8576 0
2 条回答
写回答
取消 提交回答
  • 表格存储(TableStore)技术负责人,专注结构化数据存储领域技术和解决方案。

    这个错误是「duplicate entry」,也就是说通过DataX写mysql表的时候,mysql报了这个错误,原因是有重复的primary key。
    具体如何解决的话,可以google下duplicate entry when insert data into mysql.

    2019-07-17 19:40:04
    赞同 展开评论 打赏
  • 补充:本来准备用datax将青岛的ECS上mysql迁移到我的ADS上的,所以用datax做了mysql到mysql的初步测试,可是...


    论坛admin管理员,这不是阿里的技术讨论社区么?怎么一个question抛出去一点回应都没有,还不如工单来得实在....


    社区管理员,这社区提问有什么规则或者要求么?为何我的问题无人回答?

    2019-07-17 19:40:04
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
搭建电商项目架构连接MySQL 立即下载
搭建4层电商项目架构,实战连接MySQL 立即下载
PolarDB MySQL引擎重磅功能及产品能力盛大发布 立即下载

相关镜像