Briefly in the previous article about the ES synchronization data script roughly, but the actual situation is certainly not as simple as the script in the previous article. For example, I now have three tables, two entity tables, and an association table. The approximate implementation is as follows:
The bin directory establishes a Statefile.json file:
{ ' type ': ' JDBC ', "Statefile": "Statefile.json", "JDBC": { "url": "jdbc:mysql://", "User": "", "Password": "", ' Type ': ' Actor ', "Index": "Test", "Schedule": "0 * * * *?", "Metrics" : { "Lastexecutionstart": "0", "Lastexecutionend": "0", "Counter": "1" }, "SQL" : [ { "Statement": "Select a.actor_id as _id, A.*,group_concat (b.tag_name) as Tag_name from ((Gd_actor_info as a LEFT join Gd_actor_tag as AB on a.actor_id = ab.actor_id) left join Gd_tag_actor as B on ab.tag_id = b.tag_id) where A.update_tim e;? or Ab.update_time >? GROUP BY a.actor_id ", "Parameter": ["$metrics. Lastexecutionstart", "$metrics. Lastexecutionstart" ] } ] }}
The main lastexecutionstart is set to 0, in order for the first execution to be able to perform a full-scale backup.
In fact, the SH script information is on the top, and then write a good
Elasticsearch MySQL incremental sync three-table federated script