Datax使用

参考文档

datax 安装包

安装包

安装java

sudo yum install java-1.8.0-openjdk
sudo yum install java-1.8.0-openjdk-devel

vim  /etc/profile

export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.372.b07-1.el7_9.x86_64
export PATH=$JAVA_HOME/bin:$PATH

 source  /etc/profile

执行文件

python /usr/local/datax/bin/datax.py install.json

文件解释

install.json

{
    "job": {
        "content": [
            {
                "reader": {
                    "name": "mysqlreader", 
                    "parameter": {
                        "username": "root",
                        "password": "",
                        "column": ["*"],
                        "splitPk": "ID",
                        "where": "ID <= 1888",
## 选一个辨识度高的字段,然后where是增量
                        "connection": [
                            {
                                "jdbcUrl": [
                                    "jdbc:mysql://43.137.19.134:3306/ods?useUnicode=true&characterEncoding=utf8"
                                ], 
                                "table": ["t_member"]
                            }
                        ]
                    }
                }, 
                "writer": {
                    "name": "mysqlwriter", 
                    "parameter": {
                        "column": ["*"], 
                        "connection": [
                            {
                                "jdbcUrl": "jdbc:mysql://43.137.19.134:3306/dds?useUnicode=true&characterEncoding=utf8",
                                "table": ["t_member"]
                            }
                        ], 
                        "password": "",
                        "preSql": [
                            ""
                            ## 前置SQL执行
                        ], 
                        "session": [
                            "set session sql_mode='ANSI'"
                        ], 
                        "username": "root", 
                        "writeMode": "insert"
                    }
                }
            }
        ], 
        "setting": {
            "speed": {
                "channel": "5"
            }
        }
    }
}


你可能感兴趣的:(big,data)