Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best way to sync Postgres and ElasticSearch?

I have the choice to Sync ES with latest changes on my Postgres DB

1- Postgres Listen / Notify :

I should create a trigger -> use pg_notify -> and create listener in a separated service.

2- Async queries to ES :

I can update ElasticSearch asynchronously after a change on DB. ie:

model.save().then(() => {model.saveES() }).catch()

Which one will scale best ?

PS: We tried zombodb in production but it doesn’t goes well, it slows down the production.

like image 755
SOufiane Fadil Avatar asked Jul 25 '17 16:07

SOufiane Fadil


1 Answers

as you are asking for the ways, I assume you want to know the possibilities to apply the better architecture, I would like you to propose an advice given by confluent:

enter image description here

enter image description here

here https://www.confluent.io/blog/bottled-water-real-time-integration-of-postgresql-and-kafka/

like image 184
panchicore Avatar answered Sep 29 '22 16:09

panchicore