• 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

    datax使用_第1张图片

   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字段插入,而不是更新操作