CN114238507A - Data synchronization method and device based on multiple databases - Google Patents

Data synchronization method and device based on multiple databases Download PDF

Info

Publication number
CN114238507A
CN114238507A CN202111539663.7A CN202111539663A CN114238507A CN 114238507 A CN114238507 A CN 114238507A CN 202111539663 A CN202111539663 A CN 202111539663A CN 114238507 A CN114238507 A CN 114238507A
Authority
CN
China
Prior art keywords
data
synchronized
priority
database
time
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111539663.7A
Other languages
Chinese (zh)
Inventor
陈斌
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Topsec Technology Co Ltd
Beijing Topsec Network Security Technology Co Ltd
Beijing Topsec Software Co Ltd
Hubei Topsec Network Security Technology Co Ltd
Original Assignee
Beijing Topsec Technology Co Ltd
Beijing Topsec Network Security Technology Co Ltd
Beijing Topsec Software Co Ltd
Hubei Topsec Network Security Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Topsec Technology Co Ltd, Beijing Topsec Network Security Technology Co Ltd, Beijing Topsec Software Co Ltd, Hubei Topsec Network Security Technology Co Ltd filed Critical Beijing Topsec Technology Co Ltd
Priority to CN202111539663.7A priority Critical patent/CN114238507A/en
Publication of CN114238507A publication Critical patent/CN114238507A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2458Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
    • G06F16/2474Sequence data queries, e.g. querying versioned data

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Computing Systems (AREA)
  • Fuzzy Systems (AREA)
  • Mathematical Physics (AREA)
  • Probability & Statistics with Applications (AREA)
  • Software Systems (AREA)
  • Computational Linguistics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application provides a data synchronization method and a data synchronization device based on a plurality of databases, wherein the data synchronization method based on the plurality of databases comprises the following steps: acquiring first to-be-synchronized data in a first database; judging whether second data to be synchronized corresponding to the first data to be synchronized exists in a second database; if so, acquiring first data operation time of the first data to be synchronized and second data operation time of the second data to be synchronized; judging whether the time difference value between the two operation times is greater than a preset time difference threshold value or not; if so, acquiring the operation time of the newer data, and acquiring specific data to be synchronized corresponding to the operation time of the newer data; and carrying out data synchronization according to the specific data to be synchronized. Therefore, by implementing the implementation mode, the situation of data conflict can be judged and synchronized based on objective factors such as time and the like, so that the accuracy of the data is well guaranteed, and the synchronized data can be effectively used for other works.

Description

Data synchronization method and device based on multiple databases
Technical Field
The present application relates to the field of data synchronization, and in particular, to a data synchronization method and apparatus based on multiple databases.
Background
Most of the current working units are using the internet to carry out their own work, and the intranet and extranet technology is beginning to be commonly used for the purpose of confidentiality and other requirements. However, in practice, it is found that a large amount of data exchange is generally performed between the intranet and the extranet to complete data synchronization. However, in the data synchronization process, both the intranet data and the extranet data change, and thus the synchronization process is actually a bidirectional synchronization process. In the process of the bidirectional synchronization, the situation that the internal network and the external network of the same data are changed simultaneously is likely to occur, and the situation is usually that the synchronization is carried out first and then the synchronization is carried out later. Therefore, the synchronization mode easily causes abnormal data synchronization, thereby causing data errors in the internal and external networks and influencing the progress of other work.
Disclosure of Invention
An object of the embodiments of the present application is to provide a data synchronization method and apparatus based on multiple databases, which can determine and synchronize the situation of data conflict based on objective factors such as time, thereby well ensuring the accuracy of data, and further ensuring that the synchronized data can be effectively used in other work.
A first aspect of embodiments of the present application provides a data synchronization method based on multiple databases, where the multiple databases include first data and a second database, and the method is applied in a data synchronization apparatus that stores the second database, and the method includes:
acquiring first data to be synchronized in the first database;
judging whether second data to be synchronized corresponding to the first data to be synchronized exists in the second database;
when the second database comprises the second data to be synchronized, acquiring first data operation time of the first data to be synchronized and second data operation time of the second data to be synchronized;
judging whether the time difference value between the first data operation time and the second data operation time is greater than a preset time difference threshold value or not;
when the time difference value is larger than the preset time difference threshold value, acquiring newer data operation time in the first data operation time and the second data operation time, and acquiring specific data to be synchronized corresponding to the newer data operation time;
and carrying out data synchronization according to the specific data to be synchronized.
In the implementation process, the method can preferentially judge whether the data in the two databases conflict, select the data to be synchronized of the update operation according to the data operation time to update the data when the data in the two databases conflict, and complete the process of synchronizing the data by the second database. Therefore, by implementing the implementation mode, when the second database judges that the data conflict, the conflicting data can be objectively and accurately synchronized according to the actual situation, so that the accuracy of the data is guaranteed; on the other hand, the data synchronization device in the method can be an intranet device or an extranet device, so that the method can be deployed in both an intranet and an extranet, and accurate data synchronization can be realized by both the intranet device and the extranet device, even by the method.
Further, the method further comprises:
when the time difference value is not larger than the preset time difference threshold value, acquiring a first operation type of the first data to be synchronized and a second operation type of the second data to be synchronized;
determining a first operation priority of the first operation type and a second operation priority of the second operation type;
judging whether the first operation priority and the second operation priority are the same priority or not;
when the first operation priority and the second operation priority are not the same priority, acquiring a higher operation priority of the first operation priority and the second operation priority, and acquiring specific data to be synchronized corresponding to the higher operation priority;
and carrying out data synchronization according to the specific data to be synchronized.
Further, the method further comprises:
when the first operation priority and the second operation priority are the same priority, determining a first network priority corresponding to the first data to be synchronized and a second network priority corresponding to the second data to be synchronized;
acquiring a higher network priority of the first network priority and the second network priority, and acquiring specific data to be synchronized corresponding to the higher network priority;
and carrying out data synchronization according to the specific data to be synchronized.
Further, the step of acquiring the first data to be synchronized in the first database includes:
receiving first data to be synchronized in the first database forwarded by a security isolation device.
Further, before the step of acquiring the first data to be synchronized in the first database, the method includes:
time synchronizing a first system time of the first database and a second system time of the second database.
A second aspect of the embodiments of the present application provides a data synchronization apparatus based on multiple databases, where the multiple databases include a first data and a second database, and the second database is stored in the data synchronization apparatus, and the data synchronization apparatus includes:
the first acquisition unit is used for acquiring first data to be synchronized in the first database;
the first judging unit is used for judging whether second data to be synchronized corresponding to the first data to be synchronized exists in the second database;
a second obtaining unit, configured to obtain a first data operation time of the first data to be synchronized and a second data operation time of the second data to be synchronized when the second database includes the second data to be synchronized;
the second judging unit is used for judging whether a time difference value between the first data operation time and the second data operation time is larger than a preset time difference threshold value or not;
a third obtaining unit, configured to obtain a newer data operation time of the first data operation time and the second data operation time when the time difference is greater than the preset time difference threshold, and obtain specific data to be synchronized corresponding to the newer data operation time;
and the synchronization unit is used for carrying out data synchronization according to the specific data to be synchronized.
In the implementation process, the device can automatically judge the data conflict and objectively synchronize the conflicting data when the data conflict exists, so that the effect of guaranteeing the data accuracy is realized, and the synchronized data can be effectively used for other works.
Further, the data synchronization apparatus further includes:
a fourth obtaining unit, configured to obtain a first operation type of the first data to be synchronized and a second operation type of the second data to be synchronized when the time difference value is not greater than the preset time difference threshold;
a first determination unit configured to determine a first operation priority of the first operation type and a second operation priority of the second operation type;
a third judging unit, configured to judge whether the first operation priority and the second operation priority are the same priority;
a fifth obtaining unit, configured to, when the first operation priority and the second operation priority are not the same priority, obtain a higher operation priority of the first operation priority and the second operation priority, and obtain specific data to be synchronized corresponding to the higher operation priority.
Further, the data synchronization apparatus further includes:
a second determining unit, configured to determine a first network priority corresponding to the first data to be synchronized and a second network priority corresponding to the second data to be synchronized when the first operation priority and the second operation priority are the same priority;
a sixth obtaining unit, configured to obtain a higher network priority of the first network priority and the second network priority, and obtain specific data to be synchronized corresponding to the higher network priority.
A third aspect of the embodiments of the present application provides an electronic device, including a memory and a processor, where the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to execute the method for data synchronization based on multiple databases according to any one of the first aspect of the embodiments of the present application.
A fourth aspect of the embodiments of the present application provides a computer-readable storage medium, which stores computer program instructions, and when the computer program instructions are read and executed by a processor, the computer program instructions perform the method for synchronizing data based on multiple databases according to any one of the first aspect of the embodiments of the present application.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and that those skilled in the art can also obtain other related drawings based on the drawings without inventive efforts.
Fig. 1 is a schematic flowchart of a data synchronization method based on multiple databases according to an embodiment of the present disclosure;
fig. 2 is a schematic structural diagram of a data synchronization apparatus based on multiple databases according to an embodiment of the present disclosure;
fig. 3 is a schematic diagram illustrating a modularization of a data synchronization method based on multiple databases according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures. Meanwhile, in the description of the present application, the terms "first", "second", and the like are used only for distinguishing the description, and are not to be construed as indicating or implying relative importance.
Example 1
Referring to fig. 1, fig. 1 is a schematic flowchart illustrating a data synchronization method based on multiple databases according to an embodiment of the present disclosure. The data synchronization method based on the multiple databases is applied to a data synchronization device for storing the second database. Specifically, the method comprises the following steps:
s101, time synchronization is carried out on the first system time of the first database and the second system time of the second database.
In this embodiment, only after time synchronization, all timestamps in the first database and the second database may be unified, and only then, objectivity and accuracy of data operation time comparison may be ensured.
S102, receiving first data to be synchronized in a first database forwarded by the safety isolation equipment.
In this embodiment, the first database and the second database may be stored in the intranet server and the extranet server, respectively. The first database can be stored in an intranet server or an extranet server, and the second database is opposite to the intranet server or the extranet server.
In this embodiment, the security isolation device is a bridge for intranet and extranet communication.
Referring to fig. 3, fig. 3 illustrates a modular exemplary diagram of intranet and extranet communication.
In this embodiment, the first data to be synchronized is data to be synchronized obtained after the user operates the original data.
In this embodiment, the second data to be synchronized is data to be synchronized obtained after the user operates the original data.
In this embodiment, the first data to be synchronized is in the first database, and the second data to be synchronized is in the second database. The original data is previously synchronized data, so that the original data in the first database and the original data in the second database are the same.
S103, judging whether second data to be synchronized corresponding to the first data to be synchronized exists in a second database, and if so, executing steps S104-S105; if not, the flow is ended.
In this embodiment, if the second database has the second data to be synchronized, it indicates that both databases have changed for the same data.
In this embodiment, the original data corresponding to the first data to be synchronized is the original data corresponding to the second data to be synchronized, wherein the original data are stored in duplicate in the first database and the second database, respectively.
S104, acquiring first data operation time of the first data to be synchronized and second data operation time of the second data to be synchronized.
In this embodiment, the first data operation time and the second data operation time are both used to refer to the operated time of the data in the database, and the time exists objectively and is recorded, so that the time is not changed due to the data transmission process.
S105, judging whether a time difference value between the first data operation time and the second data operation time is larger than a preset time difference threshold value, if so, executing steps S106 and S113; if not, steps S107 to S109 are executed.
S106, obtaining the newer data operation time in the first data operation time and the second data operation time, and obtaining the specific data to be synchronized corresponding to the newer data operation time.
In this embodiment, this step is referred to as a time priority policy.
In this embodiment, although it is possible to roughly determine whether the times at which the collision operations occur are the same or not by this means, there is always a certain clock error for the exact same. Therefore, the method uses the operation time difference as a judgment condition of the conflict operation, and objectively reflects the precedence of the operation time through the judgment, thereby facilitating the subsequent processing of conflict data.
S107, a first operation type of the first data to be synchronized and a second operation type of the second data to be synchronized are obtained.
In this embodiment, the operation types include an addition operation, a modification operation, a deletion operation, and the like.
And S108, determining a first operation priority of the first operation type and a second operation priority of the second operation type.
In this embodiment, each type of operation has its own operation priority, and each operation priority is different from each other. Such as a delete operation having a higher priority than a modify operation.
S109, judging whether the first operation priority and the second operation priority are the same, if so, executing the steps S111-S113; if not, steps S110 and S113 are executed.
And S110, acquiring a higher operation priority of the first operation priority and the second operation priority, and acquiring specific data to be synchronized corresponding to the higher operation priority.
In this embodiment, it is considered that the conflicting data are generated substantially simultaneously, and therefore, the step further determines whether the operation types of the conflicting data are consistent, and if the operation types of the conflicting data are different, for example, a new piece of data is added to the first database and the second database modifies the new piece of data simultaneously, or the first database modifies a piece of data and the second database deletes the new piece of data simultaneously, the data operation priority determination is performed at this time, and the data synchronization operation is performed according to the data operation priority.
For example, in order to reduce the time and resource overhead, the first database may merge a plurality of operations on the same data in a short time into one operation, and send the operation to the second database, for example, if a modification operation is performed immediately after the addition, the first database may finally extract a modification operation; for example, if a deletion operation is performed immediately after a new addition and modification, a deletion operation is finally extracted from the first database. For the small-probability event, the priority of deletion operation is determined to be the highest, the priority of addition operation is determined to be the lowest, and therefore the accuracy of data synchronization is guaranteed. At this time, the first database only needs to synchronize the data with high operation type priority to the second database. For the second database, after receiving the data with high priority of the operation type, the same judgment is carried out according to the data operation type in the second database, and then effective data synchronization is carried out, so that the accuracy of the data can be ensured.
In this embodiment, after the second database completes the data synchronization, an accurate data synchronization result is sent to the first database to change the first database. Because the data operation has a precedence relationship and the data operated later is valid, the second data only needs to send normal data. In some cases, the second database may also add a label of a final exact version to the data, so that the first database accurately knows that the data is the final version, and the first database and the second database are unified.
In this embodiment, the above steps are referred to as operation type priority policy.
And S111, determining a first network priority corresponding to the first data to be synchronized and a second network priority corresponding to the second data to be synchronized.
And S112, acquiring the higher network priority of the first network priority and the second network priority, and acquiring the specific data to be synchronized corresponding to the higher network priority.
In this embodiment, when a piece of data is inserted into the first database and the second database at the same time, or a piece of data is modified at the same time, the above method cannot be performed. Then that data is determined to be used for synchronization at this point based on the system network priority of the first database and the system network priority of the second database. Wherein, the network priority is configured by the service administrator in advance.
In this embodiment, the above steps are referred to as a network priority policy.
And S113, carrying out data synchronization according to the specific data to be synchronized.
By implementing the implementation mode, the synchronization of the conflict data of the multiple databases across the network can be carried out by combining multiple conflict strategies (namely the time priority strategy, the operation type priority strategy and the network priority strategy), so that the synchronization of the conflict data is more reasonable, the data synchronization accuracy can be improved, and the consistency of the data of the internal network and the external network is ensured.
In the embodiment of the present application, the execution subject of the method may be a computing device such as a computer and a server, and is not limited in this embodiment.
In this embodiment, an execution subject of the method may also be an intelligent device such as a smart phone and a tablet computer, which is not limited in this embodiment.
It can be seen that, with the data synchronization method based on multiple databases described in this embodiment, it can be preferentially determined whether data in two databases conflict, and when data in two databases conflict, data to be synchronized of a refresh operation is selected according to data operation time to perform data refresh, and a process of synchronizing data by a second database is completed. Therefore, by implementing the implementation mode, when the second database judges that the data conflict, the conflicting data can be objectively and accurately synchronized according to the actual situation, so that the accuracy of the data is guaranteed; on the other hand, the data synchronization device in the method can be an intranet device or an extranet device, so that the method can be deployed in both an intranet and an extranet, and accurate data synchronization can be realized by both the intranet device and the extranet device, even by the method.
Example 2
Referring to fig. 2, fig. 2 is a schematic structural diagram of a data synchronization apparatus based on multiple databases according to an embodiment of the present application. As shown in fig. 2, the plurality of databases include a first database and a second database, and the data synchronization apparatus stores the second database therein, and the data synchronization apparatus based on the plurality of databases includes:
a first obtaining unit 210, configured to obtain first data to be synchronized in a first database;
a first judging unit 220, configured to judge whether there is second data to be synchronized corresponding to the first data to be synchronized in the second database;
a second obtaining unit 230, configured to obtain a first data operation time of the first data to be synchronized and a second data operation time of the second data to be synchronized when the second database includes the second data to be synchronized;
a second judging unit 240, configured to judge whether a time difference between the first data operation time and the second data operation time is greater than a preset time difference threshold;
a third obtaining unit 250, configured to obtain a newer data operation time of the first data operation time and the second data operation time when the time difference value is greater than the preset time difference threshold, and obtain specific data to be synchronized corresponding to the newer data operation time;
a synchronization unit 260 for performing data synchronization according to the specific data to be synchronized.
As an optional implementation manner, the data synchronization apparatus further includes:
a fourth obtaining unit 270, configured to obtain a first operation type of the first data to be synchronized and a second operation type of the second data to be synchronized when the time difference value is not greater than the preset time difference threshold;
a first determining unit 280 for determining a first operation priority of the first operation type and a second operation priority of the second operation type;
a third determining unit 290, configured to determine whether the first operation priority and the second operation priority are the same priority;
a fifth obtaining unit 300, configured to, when the first operation priority and the second operation priority are not the same priority, obtain a higher operation priority of the first operation priority and the second operation priority, and obtain specific data to be synchronized corresponding to the higher operation priority.
As an optional implementation manner, the data synchronization apparatus further includes:
a second determining unit 310, configured to determine a first network priority corresponding to the first data to be synchronized and a second network priority corresponding to the second data to be synchronized when the first operation priority and the second operation priority are the same priority;
a sixth obtaining unit 320, configured to obtain a higher network priority of the first network priority and the second network priority, and obtain specific data to be synchronized corresponding to the higher network priority.
As an optional implementation manner, the first obtaining unit 210 is specifically configured to receive the first data to be synchronized in the first database forwarded by the security isolation device.
As an optional implementation, the synchronization unit 260 is further configured to perform time synchronization on the first system time of the first database and the second system time of the second database.
In the embodiment of the present application, for the explanation of the data synchronization apparatus based on multiple databases, reference may be made to the description in embodiment 1, and details are not repeated in this embodiment.
It can be seen that, by implementing the data synchronization device based on multiple databases described in this embodiment, it is possible to automatically complete the judgment of data collision, and objectively synchronize the data that is in collision when there is data collision, thereby achieving the effect of guaranteeing the accuracy of the data, and further ensuring that the synchronized data can be effectively used in other work.
An embodiment of the present application provides an electronic device, including a memory and a processor, where the memory is used to store a computer program, and the processor runs the computer program to make the electronic device execute the data synchronization method based on multiple databases in embodiment 1 of the present application.
The embodiment of the present application provides a computer-readable storage medium, which stores computer program instructions, and when the computer program instructions are read and executed by a processor, the method for synchronizing data based on multiple databases in embodiment 1 of the present application is performed.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented in other ways. The apparatus embodiments described above are merely illustrative, and for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only an example of the present application and is not intended to limit the scope of the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application. It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.

Claims (10)

1. A data synchronization method based on a plurality of databases, wherein the plurality of databases include a first data and a second database, the method is applied to a data synchronization device storing the second database, and the method comprises:
acquiring first data to be synchronized in the first database;
judging whether second data to be synchronized corresponding to the first data to be synchronized exists in the second database;
when the second database comprises the second data to be synchronized, acquiring first data operation time of the first data to be synchronized and second data operation time of the second data to be synchronized;
judging whether the time difference value between the first data operation time and the second data operation time is greater than a preset time difference threshold value or not;
when the time difference value is larger than the preset time difference threshold value, acquiring newer data operation time in the first data operation time and the second data operation time, and acquiring specific data to be synchronized corresponding to the newer data operation time;
and carrying out data synchronization according to the specific data to be synchronized.
2. The method for synchronizing data based on multiple databases as recited in claim 1, further comprising:
when the time difference value is not larger than the preset time difference threshold value, acquiring a first operation type of the first data to be synchronized and a second operation type of the second data to be synchronized;
determining a first operation priority of the first operation type and a second operation priority of the second operation type;
judging whether the first operation priority and the second operation priority are the same priority or not;
when the first operation priority and the second operation priority are not the same priority, acquiring a higher operation priority of the first operation priority and the second operation priority, and acquiring specific data to be synchronized corresponding to the higher operation priority;
and carrying out data synchronization according to the specific data to be synchronized.
3. The method for synchronizing data based on multiple databases as claimed in claim 2, wherein the method further comprises:
when the first operation priority and the second operation priority are the same priority, determining a first network priority corresponding to the first data to be synchronized and a second network priority corresponding to the second data to be synchronized;
acquiring a higher network priority of the first network priority and the second network priority, and acquiring specific data to be synchronized corresponding to the higher network priority;
and carrying out data synchronization according to the specific data to be synchronized.
4. The method for synchronizing data based on multiple databases according to claim 1, wherein the step of obtaining the first data to be synchronized in the first database comprises:
receiving first data to be synchronized in the first database forwarded by a security isolation device.
5. The method for synchronizing data based on multiple databases according to claim 1, wherein the step of obtaining the first data to be synchronized in the first database is preceded by the method comprising:
time synchronizing a first system time of the first database and a second system time of the second database.
6. A data synchronization apparatus based on a plurality of databases, wherein the plurality of databases include a first data and a second database, the data synchronization apparatus stores the second database therein, the data synchronization apparatus includes:
the first acquisition unit is used for acquiring first data to be synchronized in the first database;
the first judging unit is used for judging whether second data to be synchronized corresponding to the first data to be synchronized exists in the second database;
a second obtaining unit, configured to obtain a first data operation time of the first data to be synchronized and a second data operation time of the second data to be synchronized when the second database includes the second data to be synchronized;
the second judging unit is used for judging whether a time difference value between the first data operation time and the second data operation time is larger than a preset time difference threshold value or not;
a third obtaining unit, configured to obtain a newer data operation time of the first data operation time and the second data operation time when the time difference is greater than the preset time difference threshold, and obtain specific data to be synchronized corresponding to the newer data operation time;
and the synchronization unit is used for carrying out data synchronization according to the specific data to be synchronized.
7. The multiple database-based data synchronization device of claim 6, further comprising:
a fourth obtaining unit, configured to obtain a first operation type of the first data to be synchronized and a second operation type of the second data to be synchronized when the time difference value is not greater than the preset time difference threshold;
a first determination unit configured to determine a first operation priority of the first operation type and a second operation priority of the second operation type;
a third judging unit, configured to judge whether the first operation priority and the second operation priority are the same priority;
a fifth obtaining unit, configured to, when the first operation priority and the second operation priority are not the same priority, obtain a higher operation priority of the first operation priority and the second operation priority, and obtain specific data to be synchronized corresponding to the higher operation priority.
8. The multiple database-based data synchronization device of claim 7, further comprising:
a second determining unit, configured to determine a first network priority corresponding to the first data to be synchronized and a second network priority corresponding to the second data to be synchronized when the first operation priority and the second operation priority are the same priority;
a sixth obtaining unit, configured to obtain a higher network priority of the first network priority and the second network priority, and obtain specific data to be synchronized corresponding to the higher network priority.
9. An electronic device, comprising a memory for storing a computer program and a processor for executing the computer program to cause the electronic device to perform the method of data synchronization based on multiple databases of any of claims 1 to 5.
10. A readable storage medium, wherein computer program instructions are stored, and when read and executed by a processor, perform the method for data synchronization based on multiple databases according to any one of claims 1 to 5.
CN202111539663.7A 2021-12-15 2021-12-15 Data synchronization method and device based on multiple databases Pending CN114238507A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111539663.7A CN114238507A (en) 2021-12-15 2021-12-15 Data synchronization method and device based on multiple databases

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111539663.7A CN114238507A (en) 2021-12-15 2021-12-15 Data synchronization method and device based on multiple databases

Publications (1)

Publication Number Publication Date
CN114238507A true CN114238507A (en) 2022-03-25

Family

ID=80756834

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111539663.7A Pending CN114238507A (en) 2021-12-15 2021-12-15 Data synchronization method and device based on multiple databases

Country Status (1)

Country Link
CN (1) CN114238507A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023124431A1 (en) * 2021-12-31 2023-07-06 华为技术有限公司 Database processing method and related device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023124431A1 (en) * 2021-12-31 2023-07-06 华为技术有限公司 Database processing method and related device

Similar Documents

Publication Publication Date Title
CN107220142B (en) Method and device for executing data recovery operation
US11347933B1 (en) Distributed collaborative storage with operational transformation
CN101136783A (en) Backup, recovery method and apparatus for network management system to configure data
CN109165121B (en) Method and system for recovering misoperation data
CN108647357A (en) The method and device of data query
CN106874281A (en) Realize the method and apparatus that data base read-write is separate
CN114238507A (en) Data synchronization method and device based on multiple databases
CN111355802B (en) Information pushing method and device
CN113672692B (en) Data processing method, data processing device, computer equipment and storage medium
CN114328566A (en) Relationship graph updating method, device, medium, equipment and generating method
CN111241198B (en) Data synchronization method and device and data processing equipment
CN105808559A (en) Data conflict processing method and apparatus
CN106575254A (en) Log analysis device, log analysis system, log analysis method, and computer program
CN106878365A (en) A kind of method of data synchronization and equipment
CN107368569B (en) Data difference comparison method and device, storage medium and processor
CN109885555B (en) User information management method and device
CN106569986B (en) Character string replacing method and device
CN116932649A (en) Database synchronization method, database synchronization device, and readable storage medium
CN113342647A (en) Test data generation method and device
CN108228226B (en) Hard link differential method and device and corresponding terminal
CN106708521B (en) Method and device for storing page metadata
CN114297214B (en) Data synchronization method and device, computer storage medium and electronic equipment
CN111694887B (en) Data adaptive storage scheduling system and method
CN111178044B (en) Method and device for determining target text elements
CN114153830B (en) Data verification method and device, computer storage medium and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination