时间:2021-07-01 10:21:17 帮助过:30人阅读
使用jdbcriver 连接mysql,同步数据,同步已有的,新增的,修改的,可以同步数据但是报错
我用java程序jdbc查询数据的时候并不报错,
这是建立索引的代码:
创建索引
curl -XPUT 'http://localhost:9200/profile'
创建数据表与索引映射
curl -XPUT 'http://localhost:9200/profile/user/_mapping' -d '
{
"user": {
"properties": {
"id": {
"type": "string",
"store": "yes"
},
"name": {
"type": "string",
"store": "yes"
},
"login_name": {
"type": "string",
"store": "yes"
}
}
}
}'
curl -XPUT 'http://localhost:9200/_river/who_jdbc_river/_meta' -d '{
"type": "jdbc",
"jdbc": {
"driver": "com.mysql.jdbc.Driver",
"url": "jdbc:mysql://localhost:3306/profile",
"user": "root",
"password": "root",
"sql": "select id as _id,name,login_name from user",
"index": "profile",
"type": "user",
"bulk_size": 100,
"max_bulk_requests": 30,
"bulk_timeout": "10s",
"flush_interval": "5s",
"schedule": "0 0-59 0-23 ? * *"
}
}' 经过三个步骤后,可以同步我本地数据库中的数据了,只是报错,想解决一下,各位帮帮忙