datax 同步本地csv到mysql

csv 文件

/root/tempdata/us_population.csv

NY,New York,8143197
CA,Los Angeles,3844829
IL,Chicago,2842518
TX,Houston,2016582
PA,Philadelphia,1463281
AZ,Phoenix,1461575
TX,San Antonio,1256509
CA,San Diego,1255540
TX,Dallas,1213825
CA,San Jose,912332

csv2mysql.json

{
    "setting": {},
    "job": {
        "setting": {
            "speed": {
                "channel": 1
            }
        },
        "content": [
            {
                "reader": {
                    "name": "txtfilereader",
                    "parameter": {
                        "path": ["/root/tempdata/us_population.csv"],
                        "encoding": "UTF-8",
                        "column": [
                            {
                                "index": 0,
                                "type": "string"
                            },
                            {
                                "index": 1,
                                "type": "string"
                            },
                            {
                                "index": 2,
                                "type": "long"
                            }
                        ],
                        "fieldDelimiter": ","
                    }
                },
		"writer": {
                    "name": "mysqlwriter",
                    "parameter": {
                        "writeMode": "insert",
                        "username": "root",
                        "password": "root",
                        "column": [
                            "state",
                            "city",
                            "population"
                        ],
                        "session": [
                        	"set session sql_mode='ANSI'"
                        ],
                        "connection": [
                            {
                                "jdbcUrl": "jdbc:mysql://node01:3306/test_db?useUnicode=true&characterEncoding=utf8",
                                "table": [
                                    "us_population"
                                ]
                            }
                        ]
                    }
                }
            }
        ]
    }
}

你可能感兴趣的:(bigData,数据同步,大数据,mysql)