Data integrity across Microservices databases

Let's say I use relational databases for my microservices. I have CustomersMServiceone that has its own database with a table Customer, then I have OrdersMServiceone that also has its own database, but with a table Order, and this table has a column CustomerId. My question is, how can I ensure data integrity between databases so that the table Orderswill not point to non-existent clients?

+4
source share
1 answer

My question is, how can I ensure data integrity between databases, so that the Orders table will not point to non-existent customers?

This is a great question. However, it lacks an important dimension, which refers to the period of time during which you want to establish referential integrity.

If you ask: “How can I guarantee that all my data is 100% constant?”, Well, you cannot answer. If you want you to force it either by using foreign key restrictions (which are not available in databases), or by ensuring that you never write to one database, and not to another database outside of which or a distributed transaction (which is absurd and will lead to the defeat of the goal of using career orientation).

: " , 100% ?", , . , eventing . , , , . , , - , .

, , , .

, , , . , . , , . 5 9 (99,999%).

, 9, . , , ? 100 , , , , , , .

+5

Source: https://habr.com/ru/post/1677524/


All Articles