mysql数据同步到es的datax json脚本编写

{
	"job": {
		"setting": {
			"speed": {
				"channel": 32
			}
		},
		"content": [{
			"reader": {
				"name": "mysqlreader",
				"parameter": {
					"username": "数据库用户名",
					"password": "数据库密码",
					"column":[
						"id",
						"id",
						"列名1",
						"列名2",
						"列名n"
					],
					"connection": [{
							"table": [
								"表名1",
								"表名2",
								"表名n"
							],
							"jdbcUrl": [
									"jdbc:mysql://IP地址:端口号/数据库名称"
							]
					}]
				}
			},
			"writer": {
				"name": "elasticsearchwriter",
				"parameter": {
					"endpoint": "http://es地址:9200/",
					"index": "es索引名称",
					"accessId": "admin",
					"accessKey": "1111",
					"timeout": 3600000,
					"cleanup": false,
					"discovery": false,
					"batchSize": 4096,
					"splitter": ",",
					"column": [{
							"name": "_id",
							"type": "id"
						},
						{
							"name": "id",
							"type": "long"
						}, {
							"name": "es字段1",
							"type": "integer"
						}, {
							"name": "es字段2",
							"type": "keyword"
						}, {
							"name": "es字段n",
							"type": "keyword"
						}
					]
				}
			}
		}]
	}
}

datax命令:python datax/bin/datax.py  --jvm='-Xms10g -Xmx10g' json脚本文件名称
上一篇:datax-web在windows环境idea中模块化打包部署操作步骤


下一篇:用Datax 导入数据到 Clickhouse