Home > Database > Mysql Tutorial > es拉取mysql的增量更新代码_MySQL

es拉取mysql的增量更新代码_MySQL

WBOY
Release: 2016-06-01 13:11:02
Original
1153 people have browsed it

基于开源插件。具体可参考http://my.oschina.net/qiangzigege/blog/220224

~~~~~~

目的:实现增量更新

原理

1)第一次全量更新,更新完毕后,删除这个任务。

2)发布增量更新任务即可。

~~~~~~~~~

增量更新任务的模板如下:

 curl -XPUT 'ip:9200/_river/my_jdbc_river/_meta' -d '{"type":"jdbc","jdbc":{"url":"jdbc:mysql://IP:3306/fastooth","user":"dewmobile","password":"dewmobile","sql":"select * from users where updated_at between UNIX_TIMESTAMP(now())*1000-60000 86400000 and UNIX_TIMESTAMP(now())*1000 or created_at between UNIX_TIMESTAMP(now())*1000-60000 86400000 and UNIX_TIMESTAMP(now())*1000","schedule":"0 0-59 0-23 * * ?","index":"ccc","type":"ddd"}}'
Copy after login

 

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