美文网首页
dataX 从MySQL到oracle 从postgresql到

dataX 从MySQL到oracle 从postgresql到

作者: spark孙 | 来源:发表于2019-12-18 13:37 被阅读0次

dataX 作为ETL的一个重要工具,经常用到的数据库json文件稍有差异,把MySQL和postgreSQL两种方式总结一下,为了以后使用方便

dataX 从mysql同步数据到oracle

json文件如下:

{
    "job": {
        "setting": {
            "speed": {
                "channel": 4
            }
        },
        "content": [{
            "reader": {
                "name": "mysqlreader",
                "parameter": {
                    "username": "test",
                    "password": "****",
                    "where": "",
                    "connection": [{
                        "querySql": [
                            "select UniqueID,BatchID,'$IP' as IP,Title,TestTimeDate,BIN,BIN_Comment,Comment,Insol,Eta,Isc,Uoc,FF,Rs,Rsh,Tcell,IRev2 from result where str_to_date(TestTimeDate,'%d.%m.%Y -%H:%i:%S
')>=str_to_date('$presec','%Y%m%d%H%i%S') and str_to_date(TestTimeDate,'%d.%m.%Y -%H:%i:%S')<str_to_date('$nowsec','%Y%m%d%H%i%S') and BatchID >= 1;"
                        ],
                        "jdbcUrl": [
                            "jdbc:mysql://$IP:3306/halm_tables"
                        ]
                    }]
                }
            },
            "writer": {
                "name": "oraclewriter",
                "parameter": {
                    "column": [
                        "UNIQUE_ID",
                        "BATCH_ID",
                        "MACHINE_IP",
                        "TITLE",
                        "TESTTIMEDATE",
                        "BIN",
                        "BIN_COMMENT",
                        "X_COMMENT",
                        "INSOL",
                        "ETA",
                        "ISC",
                        "UOC",
                        "FF",
                        "RS",
                        "RSH",
                        "TCELL",
                        "IREV2"
                    ],
                    "connection": [{
                        "jdbcUrl": "jdbc:oracle:thin:@$IP:1521/test",
                        "table": ["tz_iv_details"]
                    }],
                    "username": "test",
                    "password": "******"

                }
            }

        }]
    }
}

dataX 从postgresql到oracle

json文件如下:

{
    "job": {
        "setting": {
             "speed": {
                "channel":"4"
            }
        },
        "content": [
            {
                "reader": {
                    "name": "postgresqlreader",
                    "parameter": {
                        "username": "postgres",
                        "password": "******",
                        "where": "",
                        "connection": [
                            {
                                "querySql": [
                                    "select UniqueID,BatchID,'$IP' as IP,Title,TestTimeDate,BIN,BIN_Comment,Comment,Insol,Eta,Isc,Uoc,FF,Rs,Rsh,Tcell,IRev2 from result where str_to_date(TestTimeDate,'%d.%m.%Y -%H:%i:%S
')>=str_to_date('$presec','%Y%m%d%H%i%S') and str_to_date(TestTimeDate,'%d.%m.%Y -%H:%i:%S')<str_to_date('$nowsec','%Y%m%d%H%i%S') and BatchID >= 1;"
                                ],
                                "jdbcUrl": [
                                    "jdbc:postgresql://$IP:5432/postgres"
                                ]
                            }
                        ]
                    }
                },
                "writer": {
                "name": "oraclewriter",
                "parameter": {
                    "column": [
                        "UNIQUE_ID",
                        "BATCH_ID",
                        "MACHINE_IP",
                        "TITLE",
                        "TESTTIMEDATE",
                        "BIN",
                        "BIN_COMMENT",
                        "X_COMMENT",
                        "INSOL",
                        "ETA",
                        "ISC",
                        "UOC",
                        "FF",
                        "RS",
                        "RSH",
                        "TCELL",
                        "IREV2"
                    ],
                    "connection": [{
                        "jdbcUrl": "jdbc:oracle:thin:@$IP:1521/test",
                        "table": ["tz_iv_details"]
                    }],
                    "username": "test",
                    "password": "******"

                }
            }
        }]
    }
}

相关文章

网友评论

      本文标题:dataX 从MySQL到oracle 从postgresql到

      本文链接:https://www.haomeiwen.com/subject/yyiynctx.html