Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[checkpoint]: one-instance architecture #42

Open
3 tasks
sanam2405 opened this issue Apr 24, 2024 Discussed in #37 · 1 comment · Fixed by #45
Open
3 tasks

[checkpoint]: one-instance architecture #42

sanam2405 opened this issue Apr 24, 2024 Discussed in #37 · 1 comment · Fixed by #45
Assignees
Labels
enhancement New feature or request

Comments

@sanam2405
Copy link
Owner

sanam2405 commented Apr 24, 2024

keep the postgres SQL and mongoDB NoSQL database in synchronisation with each other

Discussed in #37

Originally posted by sanam2405 April 23, 2024
SITUATION - I have two databases (one Postgres and another MongoDB) storing data about my users (some data have intersections like email, name, age, etc.) and some data is exclusive to the two databases.

TASK - Now I wish to have my data in sync with each other. Basically the common fields in both the SQL and NoSQL should be in sync real time even after performing CRUD in any of the DBs or both the DBs.

I am thinking about implementing a Kafka CDC(change data capture) but I mostly find that people are syncing SQL-SQL or NoSQ-NoSQL DBs using Kafka.

What is a viable solution if i want the synchronisation to work in both ways?

To-Do

  • mongoDB user schema should have the postgres user id
  • seed the sql and nosql dbs with common data
  • add kafka change data capture to stream the CRUD data changes across the databases
@sanam2405 sanam2405 added the enhancement New feature or request label Apr 24, 2024
@sanam2405 sanam2405 self-assigned this Apr 24, 2024
@sanam2405
Copy link
Owner Author

A problem however exists in this solution that if the CRUD in loc server is successful but the CRUD in ts-backend server fails, then the loc server CRUD is not rolled back. Hence, consistency is not maintained across Postgres and mongoDB in case of a successful Postgres R/W followed by a failed mongoDB R/W

This can be resolved by using an event driven service which continuously checks for the DB read-writes and updates the states of the DBs to the latest committed one that was consistent.

@sanam2405 sanam2405 reopened this Apr 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant