ETL dataX

作者: 十二找十三 | 来源:发表于2020-04-02 10:05 被阅读0次

    mysql 连接jar包请自己更换

    #!/bin/bash
    JAVA_HOME=/data/java/jdk1.8.0_77
    export PATH=$PATH:$JAVA_HOME/bin
    
    sdatatime=$(date -d "-1 minute" "+%Y-%m-%d %H:%M:%S")
    edatatime=$(date "+%Y-%m-%d %H:%M:%S")
    
    w="\"where\":\"createtime >= \\\"${sdatatime}\\\" and createtime < \\\"${edatatime}\\\"\""
    
    str='{
        "job": {
            "content": [
                {
                    "reader": {
                        "name": "mysqlreader", 
                        "parameter": {
                            "column": [
                                "aaa",
                                "bbb"
                            ], 
                            '${w}',
                            "connection": [
                                {
                                    "jdbcUrl": ["jdbc:mysql://127.0.0.1:3306/aaa?characterEncoding=UTF-8&serverTimezone=GMT%2B8"], 
                                    "table": ["aaa"]
                                }
                            ], 
                            "password": "aaa", 
                            "username": "aaa"
                        }
                    }, 
                    "writer": {
                        "name": "mysqlwriter", 
                        "parameter": {
                            "column": [
                                "flag",
                                "personid",
                                "carext4"
                            ], 
                            "connection": [
                                {
                                    "jdbcUrl": "jdbc:mysql://11.11.11.11:3306/aaa?characterEncoding=UTF-8&serverTimezone=GMT%2B8", 
                                    "table": ["aaa"]
                                }
                            ], 
                            "password": "aaa", 
                            "username": "aaa"
                        }
                    }
                }
            ], 
            "setting": {
                "speed": {
                    "channel": "1"
                }
            }
        }
    }'
    
    echo $str > /temp/person.json
    
    python /temp/datax.py /temp/person.json
    ```:

    相关文章

      网友评论

          本文标题:ETL dataX

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