Some ways of database communication

In the past few days, I discovered a very interesting thing:
there are two ways of communicating data between databases, one is to actively report and the other is to receive passively.

A simple example:
A certain database A will update data regularly, but the database B in another network segment needs to be synchronized with A.
One way is: A broadcasts to the corresponding network segment and tells B: I have updated, and you receive the information in sync with me. The information is: XXXXX.
Or lazier: B, I have received new information, and you receive the information in sync with me.

The second type: passive reception. Every time, B will ask database A: Please tell me have you updated? After the update, B will automatically read the data.
……………………………………………………………………………………………… ............................................................................................................
my thoughts, then (I am not very professional), usually There is a timestamp. Each time the B database finishes reading data, a timestamp is written in the database. Then, when polling next time, get the data after the timestamp of this database.
Or use an auto-increment primary key to query data whose auto-increment primary key is greater than the field.

There are several hidden dangers: how to deal with weak network conditions?
If any database is stuck, active stability is not as good as passive...

For data, the time interval of passive polling is not very short, generally it is updated every few seconds and tens of seconds.
If you go to the full table, database A will definitely not be able to connect. So it must take time as the primary key of the data.

Guess you like

Origin blog.csdn.net/weixin_45642669/article/details/113684492