开发者社区> 问答> 正文

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

cctv531529 2016-06-15 19:08:21 3973

环境和配置说明:
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

关系型数据库 MySQL Java 数据库连接 DataX
分享到
取消 提交回答
全部回答(2)
  • 木洛
    2019-07-17 19:40:04

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

    0 0
  • cctv531529
    2019-07-17 19:40:04

    补充:本来准备用datax将青岛的ECS上mysql迁移到我的ADS上的,所以用datax做了mysql到mysql的初步测试,可是...


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


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

    0 0
添加回答
+ 订阅

分享数据库前沿,解构实战干货,推动数据库技术变革

推荐文章
相似问题