Home > Database > Mysql Tutorial > Elastic Search 与 mysql数据库实时同步的问题

Elastic Search 与 mysql数据库实时同步的问题

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 09:35:14
Original
1580 people have browsed it

同步mysqlelastic search

我知道有一个工具叫ElasticSearch-jdbc,也看了官方文档,根据官方文档写了个测试(命令见最下),但是不能实时同步,它会隔差不多1分钟左右再更新。不知道是什么地方出问题了。还请路过大神不吝赐教!
命令:
{
"type" : "jdbc",
"jdbc" : {
"url" : "jdbc:mysql://xxx.xxx.xxx.xxx:3306/world",
"user" : "root",
"password" : "xxxxxx",
"schedule":"*/5 * * * * ?",
"locale" : "en_US",
"sql" : [
{
"statement":"select \"world\" as _index, \"city\" as _type, ID as _id, Name as \"Name\", CountryCode as \"CountryCode\", District as \"District\", Population as \"Population\" from city where \"mytimestamp\" > ?",
"parameter": [ "$metrics.lastexecutionstart" ]
},
{
"statement" : "delete from city where \"_job\" = ?",
"parameter" : [ "$job" ]
}
],
"statefile":"statefile.json",
"elasticsearch" : {
"cluster" : "my_cluster_name1",
"host" : "localhost",
"port" : 9300
},
"index" : "world",
"type" : "city",
"index_settings" : {
"index" : {
"number_of_shards" : 1
}
}
}
}

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template