本文主要是介绍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脚本文件名称
这篇关于mysql数据同步到es的datax json脚本编写的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!