Welcome to discuss a distributed data synchronization issue!

Source: Internet
Author: User
It is not just a database issue, but also a file synchronization issue.

Background: In a distributed system, a master station and multiple sub-stations need to synchronize the sub-station data to the master station. The sub-station data includes database records and a large number of files.

Both the master site and the sub-site have two tables A and B. The relationship between A and B is one-to-multiple.

The problem is that the distributed design was not taken into account when the system was designed, so no code was specified for the sub-station, therefore, the data ID of the sub-station is the same as that of the master station.
If the main station does not have any data from the sub-station, we can easily Insert the data from the sub-station into the main station by traversing the data exported from the sub-station,
However, if the child station edits the data, the data on the master station cannot be updated. For example, if the sub-site deletes a piece of data from Table B and the data is imported to the master site, it cannot be determined. because we do this, we traverse each piece of data from the sub-station. If the master station does not have one, we insert it.

Currently, the distributed system is not considered in our system, so many tables do not add device ID for the record.

My ideas are as follows:
Add a record ID in the master site and the slave site database, which is the unique ID and the ID of the slave site. Add a log table to the sub-site to record the addition, deletion, and update of data in each table, so that each data synchronization only needs to be exported from the log table. In this way, we can easily implement incremental export.

I don't know. Is there a problem?

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.