3
votes

Create a single database for different microservices is anti-pattern, then the correct way is to create a database for each microservice. But when the database is a relational type, I will duplicate tables that have relationships between the microservices, but how can I have two different databases sync with each other? Thinking an application in Node with database postgres where I have products, clients and sales, three microservices, sales need clients and products then how I maintain my databases sync?

Regards!

1

1 Answers

3
votes

This is one of the main problems in the micro service architecture that is being addressed using the pattern:

Also associated with this pattern are:

But this solves only part of the problem.

Building a micro service architecture is a very complex and extensive task, and it is associated with many problems and design patterns that allow you to minimize these problems. I recommend reading a book "Microservices patterns" that looks at various patterns of micro-service architecture design.