datax

数据同步的一个工具datax,安装包比较大1.68G.

地址:https://github.com/alibaba/DataX/blob/master/userGuid.md

使用比较简单,比如mysql到mysql,一个配置文件加一行命令就搞定了。

配置(用户名、密码、ip都脱敏了):

{

    "job": {

        "content": [

            {

                "reader": {

                    "name": "mysqlreader", 

                    "parameter": {

                        "username": "xx",

                        "password": "xx",

                        "column": ["*"],

                        "splitPk": "ID",

                        "connection": [

                            {

                                "jdbcUrl": [

                                    "jdbc:mysql://xx:3306/xx?useUnicode=true&characterEncoding=UTF-8&tinyInt1isBit=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&useSSL=false&rewriteBatchedStatements=true"

                                ], 

                                "table": ["anon_url"]

                            }

                        ]

                    }

                }, 

                "writer": {

                    "name": "mysqlwriter", 

                    "parameter": {

                        "column": ["*"], 

                        "connection": [

                            {

                                "jdbcUrl": "jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8",

                                "table": ["anon_url"]

                            }

                        ], 

                        "password": "xx",

                        "preSql": [

                            "truncate anon_url"

                        ], 

                        "session": [

                            "set session sql_mode='ANSI'"

                        ], 

                        "username": "xx", 

                        "writeMode": "insert"

                    }

                }

            }

        ], 

        "setting": {

            "speed": {

                "channel": "5"

            }

        }

    }

}


一行全集,比如上面文件为job.json,则:

python datax.py  job.json

文/程忠 浏览次数:0次   2023-12-19 21:14:47

相关阅读


评论:
点击刷新

↓ 广告开始-头部带绿为生活 ↓
↑ 广告结束-尾部支持多点击 ↑