欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

同步-elasticseach jdbc-river read only

程序员文章站 2024-04-03 22:28:16
...
同步jdbcriver数据elsaticsearchmysql

使用jdbcriver 连接mysql,同步数据,同步已有的,新增的,修改的,可以同步数据但是报错同步-elasticseach  jdbc-river read only
我用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"
}
}
}
}'

  • 运行river同步数据

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 ? * *"
}
}' 经过三个步骤后,可以同步我本地数据库中的数据了,只是报错,想解决一下,各位帮帮忙