datax使用

妖精的绣舞 提交于 2020-08-09 12:40:09
  • 1.dataX安装二进制 下载就可以用


下载DataXwget http://datax-opensource.oss-cn-hangzhou.aliyuncs.com/datax.tar.gz
解压DataXtar zxvf datax.tar.gz
修改权限chmod R 755 datax

    2.数据库配置

     data  datax

    11.png

   3.job

{
    "job": {
        "content": [
            {
                "reader": {
                    "name": "mysqlreader",
                    "parameter": {
                        "column": [              
                            "id",
                            "name"
"age"
                        ],
                        "connection": [
                            {
                                "jdbcUrl": ["jdbc:mysql://192.168.31.129:3306/data"],    
                                "table": ["stu"]
                            }
                        ],
                        "password": "123456",
                        "username": "data"
                    }
                },
                "writer": {
                    "name": "mysqlwriter",
                    "parameter": {
                        "column": [
                            "id",
                            "name"
"age"
                        ],
                        "connection": [
                            {
                                "jdbcUrl": "jdbc:mysql://192.168.31.129:3306/datax",
                                "table": ["stu"]
                            }
                        ],
                        "password": "123456",
                        "username": "data"
                    }
                }
            }
        ],
        "setting": {
            "speed": {
                "channel": 1
           }
        }
    }
}

4.执行job

cd   /root/datax/datax/bin

 python datax.py   ../job/mysql.json 


5.结果 按照json字段插入,而不是更新操作


易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!