Data synchronization methods, apparatus, devices and storage media

By intercepting and segmenting database operation statements and generating data synchronization logs, data synchronization of the non-intrusive system is achieved, which solves the impact on system stability in existing technologies, reduces costs, and improves the stability of data synchronization.

CN115080593BActive Publication Date: 2026-03-13PING AN BANK CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-25
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

Existing data synchronization methods require intrusion into the system database, which affects the stable operation of the system.

Method used

By intercepting data operation statements in the target database, performing word segmentation, recognition, and filtering, obtaining operation identification information, generating data synchronization logs, and transmitting them to a preset database, data synchronization can be achieved without intruding into the system.

Benefits of technology

It reduces data synchronization costs, improves data stability, and avoids interference with the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115080593B_ABST
    Figure CN115080593B_ABST
Patent Text Reader

Abstract

This application provides a data synchronization method, apparatus, device, and storage medium. The method includes: receiving a data synchronization request; determining a target database to be synchronized based on a database identifier corresponding to the data synchronization request; intercepting data operation statements in the target database; performing word segmentation and recognition on the data operation statements to obtain operation identifier information of the data operation statements; filtering the data operation statements based on the operation identifier information to obtain target operation statements; determining target update data to be synchronized based on the target operation statements; and synchronizing the target update data to a preset database. The technical solution of this application enables data synchronization of databases across various systems without intruding into the corresponding system, reducing data synchronization costs and improving data stability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and specifically to a data synchronization method, apparatus, device, and storage medium. Background Technology

[0002] Currently, with the development of computer technology and banking and financial enterprises, many banking or financial business scenarios require multiple subsystems to work together and interact. These subsystems have dependent data, and in specific application scenarios, it is necessary to synchronize the dependent data in real time or not in real time. The existing synchronization method is based on the binary log of the database to realize data synchronization. However, this method of realizing data synchronization requires intruding into the system's database to obtain logs, which can easily affect the stable operation of the system. Summary of the Invention

[0003] This application provides a data synchronization method, apparatus, device, and storage medium, aiming to solve the technical problem in the prior art that data synchronization requires intrusion into the system database, affecting the stable operation of the system.

[0004] On the one hand, embodiments of this application provide a data synchronization method, which includes the following steps:

[0005] Receive a data synchronization request and determine the target database to be synchronized based on the database identifier corresponding to the data synchronization request;

[0006] Intercept the data operation statements of the target database, perform word segmentation and recognition on the data operation statements, and obtain the operation identification information of the data operation statements;

[0007] The data operation statements are filtered based on their operation identifier information to obtain the target operation statement;

[0008] The target update data to be synchronized is determined according to the target operation statement, and the target update data is synchronized to the preset database.

[0009] In one possible implementation of this application, intercepting the data manipulation statements of the target database includes:

[0010] Obtain the database identifier of the target database, configure a preset data interceptor based on the database identifier, and obtain the operation statement interceptor;

[0011] The operation statement interceptor is invoked to capture data packets from the target database and the data packets are parsed.

[0012] If the data packet is a data manipulation statement of the target database, then the data manipulation statement is intercepted.

[0013] In one possible implementation of this application, the step of performing word segmentation and recognition on the data operation statement to obtain the operation identifier information of the data operation statement includes:

[0014] The data operation statement is input into a preset recognition model for word segmentation and recognition to obtain each word in the data operation statement;

[0015] Obtain the target word segment with the part of speech of a verb from the word segmentation, compare the word segmentation text features of the target word segment with the operation identifier features in the preset sentence database, and obtain the feature similarity between the word segmentation text features and the operation identifier features;

[0016] Obtain operation identifier features whose feature similarity exceeds a preset similarity threshold, and determine the operation identifier information of the data operation statement based on the operation identifier features.

[0017] In one possible implementation of this application, the step of filtering the data operation statements based on the operation identifier information of the data operation statements to obtain the target operation statement includes:

[0018] Obtain the configuration data from the data synchronization request, query the filtering rule database, and obtain the preset filtering rule corresponding to the configuration data;

[0019] Obtain the target operation identifier from the preset filtering rules, compare the target operation identifier with the operation identifier information in the data operation statement, and obtain the filtering operation statement carrying the target operation identifier;

[0020] Obtain the synchronization data type in the data synchronization request, perform secondary filtering on the filtering operation statement based on the synchronization data type, and set the filtering operation statement that matches the incremental data type as the target operation statement.

[0021] In one possible implementation of this application, the step of determining the target update data to be synchronized according to the target operation statement and synchronizing the target update data to a preset database includes:

[0022] Obtain the data retrieval logic of the target operation statement, query the stored data in the target database, and obtain the stored data in the target database corresponding to the data retrieval logic;

[0023] The stored data is updated according to the operation identifier information to obtain the target updated data;

[0024] A data synchronization log is generated based on the target operation statement and the target update data, and the data synchronization log is transmitted to a preset database for data synchronization.

[0025] In one possible implementation of this application, the step of generating a data synchronization log based on the target operation statement and the target update data, and transmitting the data synchronization log to a preset database for data synchronization, includes:

[0026] Obtain the first database identifier of the target database and the second database identifier of the preset database, and configure the preset log template according to the first database identifier and the second database identifier;

[0027] According to the configured data synchronization strategy, the target update data and target operation statements are written into the preset log template to generate a data synchronization log.

[0028] The data synchronization log is transmitted to the preset database for data synchronization.

[0029] In one possible implementation of this application, after generating a data synchronization log based on the target operation statement and the target update data, and transmitting the data synchronization log to a preset database for data synchronization, the method further includes:

[0030] Obtain the target update data adjusted by the target operation statement in the target database, and the target synchronization data corresponding to the target update data in the preset database;

[0031] Compare the target updated data and the target synchronized data to determine the data synchronization result;

[0032] The corresponding data synchronization identifier is output based on the data synchronization result, wherein the data synchronization identifier includes a synchronization success identifier and a synchronization failure identifier.

[0033] On the other hand, this application provides a data synchronization device, the data synchronization device comprising:

[0034] The receiving module is configured to receive data synchronization requests and determine the target database to be synchronized based on the database identifier corresponding to the data synchronization request.

[0035] The operation determination module is configured to intercept data operation statements in the target database, perform word segmentation and recognition on the data operation statements, and obtain the operation identification information of the data operation statements.

[0036] The operation filtering module is configured to filter the data operation statements based on the operation identifier information of the data operation statements to obtain the target operation statement;

[0037] The data synchronization module is configured to determine the target update data to be synchronized based on the target operation statement, and synchronize the target update data to a preset database.

[0038] On the other hand, this application also provides a data synchronization device, the data synchronization device comprising:

[0039] One or more processors;

[0040] Memory; and

[0041] One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to implement the data synchronization method.

[0042] On the other hand, this application also provides a computer-readable storage medium having a computer program stored thereon, the computer program being loaded by a processor to perform the steps in the data synchronization method.

[0043] This application achieves data synchronization of various system databases without requiring intrusion into the corresponding system, reducing data synchronization costs and improving data stability. It receives data synchronization requests, determines the target database to be synchronized based on the database identifier corresponding to the synchronization request, intercepts data operation statements in the target database, performs word segmentation and recognition on the data operation statements to obtain operation identifier information, filters the data operation statements based on the operation identifier information to obtain target operation statements, determines the target update data to be synchronized based on the target operation statements, and synchronizes the target update data to a preset database. Attached Figure Description

[0044] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0045] Figure 1 This is a schematic diagram illustrating a scenario of the data synchronization method in an embodiment of this application.

[0046] Figure 2 This is a flowchart illustrating one embodiment of the data synchronization method in this application.

[0047] Figure 3 This is a flowchart illustrating an embodiment of the data synchronization method provided in this application, which performs data synchronization based on a target operation statement.

[0048] Figure 4 This is a flowchart illustrating one embodiment of the data synchronization method provided in this application for determining the data synchronization result.

[0049] Figure 5 This is a schematic diagram of an embodiment of the data synchronization device provided in this application.

[0050] Figure 6 This is a schematic diagram of one embodiment of the data synchronization device provided in this application. Detailed Implementation

[0051] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0052] In the description of this invention, it should be understood that the terms "center," "longitudinal," "lateral," "length," "width," "thickness," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," and "outer," etc., indicating orientation or positional relationships based on the orientation or positional relationships shown in the accompanying drawings, are only for the convenience of describing the invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the invention. Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, features defined with "first" and "second" may explicitly or implicitly include one or more of the stated features. In the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.

[0053] In this application, the term "exemplary" is used to mean "serving as an example, illustration, or description." Any embodiment described as "exemplary" in this application is not necessarily to be construed as being more preferred or advantageous than other embodiments. The following description is provided to enable any person skilled in the art to make and use the invention. Details are set forth in the following description for purposes of explanation. It should be understood that those skilled in the art will recognize that the invention can be made without using these specific details. In other instances, well-known structures and processes will not be described in detail to avoid obscuring the description of the invention with unnecessary detail. Therefore, the invention is not intended to be limited to the embodiments shown, but is consistent with the broadest scope of the principles and features disclosed in this application.

[0054] Currently, with the development of computer technology and banking and financial enterprises, many banking or financial business scenarios require multiple subsystems to work together and interact. These subsystems have dependent data, and in specific application scenarios, it is necessary to synchronize the dependent data in real time or not in real time. The existing synchronization method is based on the binary log of the database to realize data synchronization. However, this method of realizing data synchronization requires intruding into the system's database to obtain logs, which can easily affect the stable operation of the system.

[0055] Based on this, this application proposes a data synchronization method, apparatus, device, and computer-readable storage medium to solve the technical problem in the prior art that data synchronization requires intrusion into the system database, affecting the stable operation of the system.

[0056] The data synchronization method in this embodiment of the invention is applied to a data synchronization device, which is configured in a data synchronization equipment. The data synchronization equipment includes one or more processors, a memory, and one or more application programs. The one or more application programs are stored in the memory and configured to be executed by the processor to implement the data synchronization method. The data synchronization equipment can be a smart terminal, such as a mobile phone, tablet computer, smart TV, network device, and smart computer. Optionally, the data synchronization equipment can also be a server or a service cluster composed of multiple servers.

[0057] like Figure 1 As shown, Figure 1 This is a schematic diagram of a data synchronization method according to an embodiment of the present application. The data synchronization scenario in this embodiment includes multiple data synchronization devices 100 (each data synchronization device 100 integrates a data synchronization apparatus). Each data synchronization device 100 has a computer-readable storage medium corresponding to the data synchronization method running in it to execute the steps of the data synchronization method.

[0058] Understandable, Figure 1 The data synchronization device in the data synchronization method scenario shown, or the device included in the data synchronization device, does not constitute a limitation on the embodiments of the present invention. That is, the number or type of data synchronization device in the data synchronization method scenario, or the number or type of device included in each device, does not affect the overall implementation of the technical solution in the embodiments of the present invention, and can all be considered as equivalent substitutions or derivatives of the technical solutions claimed in the embodiments of the present invention.

[0059] In this embodiment of the invention, the data synchronization device 100 is mainly used for: receiving a data synchronization request; determining the target database to be synchronized based on the database identifier corresponding to the data synchronization request; intercepting data operation statements of the target database; performing word segmentation and recognition on the data operation statements to obtain operation identifier information of the data operation statements; filtering the data operation statements based on the operation identifier information of the data operation statements to obtain target operation statements; determining the target update data to be synchronized based on the target operation statements; and synchronizing the target update data to a preset database.

[0060] In this embodiment of the invention, the data synchronization device 100 can be multiple independent data synchronization devices, such as mobile phones, tablets, smart TVs, network devices, servers, and smart computers, or a data synchronization network or data synchronization cluster composed of multiple data synchronization devices.

[0061] This application provides a data synchronization method, apparatus, device, and computer-readable storage medium, which will be described in detail below.

[0062] It will be understood by those skilled in the art that Figure 1 The application environment shown is only one application scenario related to the solution of this application and does not constitute a limitation on the application scenario of this application. Other application environments may include more than one application scenario. Figure 1 The number of more or fewer data synchronization devices shown, or the data synchronization network connection relationships, for example Figure 1 Only one data synchronization device is shown in the figure. It can be understood that the scenario of this data synchronization method may also include one or more data synchronization devices, which are not limited here; the data synchronization device may also include a memory for storing database data and other data.

[0063] It should be noted that, Figure 1 The schematic diagram of the data synchronization method shown is merely an example. The scenarios of the data synchronization method described in the embodiments of the present invention are intended to more clearly illustrate the technical solutions of the embodiments of the present invention and do not constitute a limitation on the technical solutions provided in the embodiments of the present invention.

[0064] Based on the scenarios described above for the data synchronization method, various embodiments of the data synchronization method disclosed in this invention are proposed.

[0065] like Figure 2 As shown, Figure 2 This is a flowchart illustrating one embodiment of the data synchronization method in this application. The data synchronization method includes the following steps 201 to 204:

[0066] 201. Obtain a data synchronization request, and determine the target database corresponding to the data synchronization request based on the database identifier carried in the data synchronization request;

[0067] The data synchronization method in this embodiment is applied to a data synchronization device. The type and number of data synchronization devices are not specifically limited. That is, the data synchronization device can be one or more smart terminals equipped with cameras. In a specific embodiment, the data synchronization device is a smart computer.

[0068] Specifically, the data synchronization device is configured to detect the update frequency information of the target database statements and perform data synchronization based on this update frequency information and the target database statements. When the data synchronization device is running, it acquires a data synchronization request, which is an operation instruction that drives the data synchronization device to synchronize the target database with a preset database. The triggering method for this data synchronization request is not specifically limited here; that is, the data synchronization request can be actively triggered by the user. For example, when processing related business, if a user needs to synchronize data between different databases in various systems, they can actively trigger the data synchronization request by clicking the data synchronization button on the data synchronization device. In addition, the data synchronization request can also be automatically triggered by the data synchronization device. For example, the data synchronization device may have a pre-set automatic synchronization process that synchronizes the database within a preset time, automatically triggering the data synchronization request.

[0069] Specifically, upon receiving a data synchronization request, the data synchronization device reads the request and obtains the database identifier carried within it, thereby determining the target database corresponding to the data synchronization request. This database identifier includes the database name and address link information of the database to be synchronized. After obtaining the database identifier, the data synchronization device matches it with each preset database identifier stored in a preset database list to determine the target database corresponding to that database identifier.

[0070] 202. Intercept the data operation statements of the target database, perform word segmentation and recognition on the data operation statements, and obtain the operation identifier information of the data operation statements;

[0071] After determining the target database based on the database identifier, the data synchronization device configures an operation statement interceptor for the target database, calls the operation statement interceptor to intercept statements in the target database, and thus obtains the data operation statements of the database.

[0072] Specifically, after obtaining the database identifier of the target database, the database synchronization device configures a preset data interceptor based on the database identifier. The interceptor's interception rule is defined as intercepting data manipulation statements, thus obtaining the manipulation statement interceptor. Data manipulation statements (DML) are programming statements used for database operations, performing access operations on objects and data within the database.

[0073] The data synchronization device calls the operation statement interceptor to capture the data packets of the target database and parses the data packets. If the data packet is a data operation statement of the target database, the data operation statement is intercepted to obtain the data operation statement of the target database.

[0074] After acquiring the data operation statements of the target database, the data synchronization device also performs word segmentation and recognition on the database operation statements to obtain the operation identifier information of the data operation table statements.

[0075] Specifically, the data synchronization device pre-sets a recognition model to perform word segmentation and recognition on the data operation statement, thereby obtaining the word segmentation text features of the data operation statement and the part-of-speech tag of each word segmentation text feature. It then extracts the word segmentation text features with the part-of-speech tag of verbs and compares them with the operation identifier features in a pre-set database to obtain the feature similarity between the word segmentation text features and the operation identifier features.

[0076] The data synchronization device compares the acquired feature similarity with a preset similarity threshold to obtain the feature comparison result, and determines the operation identifier information of the data operation statement based on the feature comparison result.

[0077] Optionally, if the feature comparison result indicates that the feature similarity exceeds a preset similarity threshold, then it is determined that the operation identifier information of the data operation statement is the same as the operation identifier feature, and the operation identifier information of the data operation statement is determined based on the operation identifier feature. Here, the operation identifier information is the identifier information representing the specific operation performed by the data operation statement on specific database data. The operation identifier information includes any one of UPDATE, DELETE, and INSERT.

[0078] 203. Filter the data operation statements according to the operation identifier information of the data operation statements to obtain the target operation statement;

[0079] After obtaining the operation identifier information of each data operation statement, the data synchronization device further filters the data operation statements based on the operation identifier information to obtain the target operation statement.

[0080] Specifically, the data synchronization device obtains the configuration data from the data synchronization request and queries the filtering rule database based on the configuration data to obtain the preset filtering rules for the configuration data pair. Optionally, the configuration data is configuration information representing the acquisition of specific operation identifier information. Optionally, the data synchronization request can synchronize database data for a specific operation and generate corresponding configuration information, for example, synchronizing database data that has been modified and generating corresponding configuration information, and / or synchronizing database data that has been deleted and generating corresponding configuration information, and / or synchronizing database data that has been added and generating corresponding configuration information.

[0081] After acquiring the configuration information, the data synchronization device generates a preset filtering rule corresponding to the configuration information. That is, when the configuration information is to retrieve database data that has been modified, the target operation identifier is determined to be a data modification identifier. The data synchronization device compares the target operation identifier with the operation identifier information to obtain the filtering operation statement corresponding to the target operation identifier.

[0082] Optionally, the data synchronization request can also pre-define the data type to be synchronized, and perform secondary filtering on the implementation operation statement based on the data type to obtain a filtered operation statement that matches the data type, and set it as the target operation statement.

[0083] 204. Determine the target update data to be synchronized according to the target operation statement, and synchronize the target update data to the preset database.

[0084] After determining the target operation statement for the target database, the data synchronization device determines the target update data to be synchronized based on the target statement, generates a corresponding data synchronization log, and transmits the data synchronization log to the preset database for data synchronization. This data synchronization log is a custom-configured binlog file. Optionally, in one specific embodiment, the custom configuration of the data synchronization log includes: a number, a preset database identifier, a target database identifier, data retrieval logic, a filename, and a time.

[0085] After generating the data synchronization log, the data synchronization device transmits the data synchronization log to the preset database for data synchronization and checks the data synchronization status of the preset database to determine the data synchronization status.

[0086] In this embodiment, the data synchronization device receives a data synchronization request and determines the target database to be synchronized based on the database identifier corresponding to the data synchronization request; it intercepts data operation statements in the target database, performs word segmentation and recognition on the data operation statements to obtain operation identifier information of the data operation statements; it filters the data operation statements based on the operation identifier information to obtain target operation statements; it determines the target update data to be synchronized based on the target operation statements, and synchronizes the target update data to a preset database. This achieves data synchronization of databases in various systems without intruding into the corresponding systems, reducing data synchronization costs and improving data stability.

[0087] like Figure 3 As shown, Figure 3 This is a flowchart illustrating an embodiment of the data synchronization method provided in this application, specifically including steps 301 to 303:

[0088] 301. Obtain the data retrieval logic of the target operation statement, query the stored data in the target database, and obtain the stored data in the target database corresponding to the data retrieval logic;

[0089] 302. Update the stored data according to the operation identifier information to obtain the target updated data;

[0090] 303. Generate a data synchronization log based on the target operation statement and the target update data, and transmit the data synchronization log to a preset database for data synchronization.

[0091] In this embodiment, after filtering database operation statements and obtaining target operation statements, the data synchronization device obtains the data retrieval logic of the target operation statement, and queries the stored data in the target database through the data retrieval logic to obtain the stored data pointed to by the data retrieval logic in the target database. The data retrieval logic is a parameter for determining the adjustment object of the target operation statement.

[0092] The data synchronization device transmits the target operation statement to the target database, updates the stored data pointed to by the data retrieval logic using the operation identification information, and obtains the target updated data. After obtaining the target updated data, the data synchronization device enters the target operation statement and the target updated data into a preset personalized data synchronization template, generates a data synchronization log, and transmits the data synchronization log to the preset database for data synchronization.

[0093] Specifically, after the data synchronization device transmits the data synchronization log to the preset database, it drives the preset database to parse the data synchronization log to obtain the target operation statement and the target update data. Based on the target operation statement, it determines the data to be synchronized corresponding to the target update data, replaces the data to be synchronized with the target update data, and realizes data synchronization of the preset database.

[0094] Optionally, the data synchronization device can also input the data retrieval logic and the corresponding target operation statement into a preset data synchronization template, generate a data synchronization log, and transmit the data synchronization log to a preset database for data synchronization. After transmitting the data synchronization log to the preset database, the data synchronization device drives the preset database to parse the data synchronization log, obtain the target operation statement and data retrieval logic, determine the data to be synchronized corresponding to the target update data based on the data retrieval logic of the template operation statement, and update the data to be synchronized according to the target operation statement. In this embodiment, the data synchronization device obtains the data retrieval logic of the target operation statement, queries the stored data in the target database, obtains the stored data in the target database corresponding to the data retrieval logic; updates the stored data according to the operation identification information to obtain the target update data; generates a data synchronization log based on the target operation statement and the target update data, and transmits the data synchronization log to the preset database for data synchronization. This achieves data synchronization of databases in various systems without intruding into the corresponding system, reducing data synchronization costs and improving data stability.

[0095] like Figure 4 As shown, Figure 4 This is a flowchart illustrating an embodiment of the data synchronization method provided in this application for determining the data synchronization result, specifically including steps 401 to 403:

[0096] 401. Obtain the target update data adjusted by the target operation statement in the target database, and the target synchronization data corresponding to the target update data in the preset database;

[0097] 402. Compare the target updated data and the target synchronized data to determine the data synchronization result;

[0098] 403. Output the corresponding data synchronization identifier based on the data synchronization result, wherein the data synchronization identifier includes a synchronization success identifier and a synchronization failure identifier.

[0099] In this embodiment, after synchronizing the preset database through the data synchronization log, the data synchronization device also obtains the target update data of the target database statement adjustment in the target database, as well as the target synchronization data corresponding to the target update data stored in the preset database, and compares whether the target update data and the target synchronization data are the same, thereby determining the data synchronization result.

[0100] Optionally, if the target update data and the target synchronization data are the same, the data synchronization result is determined to be successful, and a synchronization success flag is output based on the data synchronization result.

[0101] Optionally, if the target updated data and the target synchronized data are different, the data synchronization result is determined to be a synchronization failure, and a synchronization failure flag is output based on the data synchronization result.

[0102] After transmitting the low-frequency data synchronization log to the preset database, the data synchronization device also receives the data synchronization identifier of the preset database and determines whether the data synchronization of the preset database is successful based on the data synchronization identifier.

[0103] Optionally, if the data synchronization identifier is a synchronization success identifier, the data synchronization device determines that the synchronization result of the preset database performing data synchronization based on the low-frequency synchronization log is successful.

[0104] Optionally, if the data synchronization flag is a synchronization failure flag, the data synchronization device switches to another data synchronization strategy to synchronize the preset database until the data synchronization flag becomes a synchronization success flag. For example, if the data synchronization flag corresponding to the data synchronization method that generates data synchronization logs through target operation statements and target update statements is a synchronization failure flag, then the data synchronization method that generates data synchronization logs through target operation statements and data retrieval logic is switched to synchronize the preset database.

[0105] In this embodiment, the data synchronization device acquires the target update data adjusted by the target database statement in the target database, and the target synchronization data corresponding to the target update data in the preset database; compares the target update data and the target synchronization data to determine the data synchronization result; and outputs a corresponding data synchronization identifier based on the data synchronization result, wherein the data synchronization identifier includes a synchronization success identifier and a synchronization failure identifier. This enables accurate determination of the database synchronization status and execution of corresponding operations based on the database synchronization status, thereby improving the effectiveness of data synchronization.

[0106] To better implement the data synchronization method in the embodiments of this application, a data synchronization device is also provided in the embodiments of this application, such as... Figure 5 As shown, Figure 5This is a schematic diagram of an embodiment of the data synchronization device 500 in this application. The data synchronization device 500 includes:

[0107] The receiving module 501 is configured to receive a data synchronization request and determine the target database to be synchronized based on the database identifier corresponding to the data synchronization request.

[0108] The operation determination module 502 is configured to intercept data operation statements in the target database, perform word segmentation and recognition on the data operation statements, and obtain operation identification information of the data operation statements.

[0109] The operation filtering module 503 is configured to filter the data operation statement according to the operation identifier information of the data operation statement to obtain the target operation statement;

[0110] The data synchronization module 504 is configured to determine the target update data to be synchronized according to the target operation statement, and synchronize the target update data to a preset database.

[0111] In some embodiments of this application, the data synchronization device 500 intercepts data operation statements of the target database, including:

[0112] Obtain the database identifier of the target database, configure a preset data interceptor based on the database identifier, and obtain the operation statement interceptor;

[0113] The operation statement interceptor is invoked to capture data packets from the target database and the data packets are parsed.

[0114] If the data packet is a data manipulation statement of the target database, then the data manipulation statement is intercepted.

[0115] In some embodiments of this application, the data synchronization device 500 performs word segmentation and recognition on the data operation statement to obtain operation identifier information of the data operation statement, including:

[0116] The data operation statement is input into a preset recognition model for word segmentation and recognition to obtain each word in the data operation statement;

[0117] Obtain the target word segment with the part of speech of a verb from the word segmentation, compare the word segmentation text features of the target word segment with the operation identifier features in the preset sentence database, and obtain the feature similarity between the word segmentation text features and the operation identifier features;

[0118] Obtain operation identifier features whose feature similarity exceeds a preset similarity threshold, and determine the operation identifier information of the data operation statement based on the operation identifier features.

[0119] In some embodiments of this application, the data synchronization device 500 filters the data operation statements based on the operation identifier information of the data operation statements to obtain target operation statements, including:

[0120] Obtain the configuration data from the data synchronization request, query the filtering rule database, and obtain the preset filtering rule corresponding to the configuration data;

[0121] Obtain the target operation identifier from the preset filtering rules, compare the target operation identifier with the operation identifier information, and obtain the filtering operation statement carrying the target operation identifier;

[0122] Obtain the synchronization data type in the data synchronization request, perform secondary filtering on the filtering operation statement based on the synchronization data type, and set the filtering operation statement that matches the incremental data type as the target operation statement.

[0123] In some embodiments of this application, the data synchronization device 500 determines the target update data to be synchronized according to the target operation statement, and synchronizes the target update data to a preset database, including:

[0124] Obtain the data retrieval logic of the target operation statement, query the stored data in the target database, and obtain the stored data in the target database corresponding to the data retrieval logic;

[0125] The stored data is updated according to the operation identifier information to obtain the target updated data;

[0126] A data synchronization log is generated based on the target operation statement and the target update data, and the data synchronization log is transmitted to a preset database for data synchronization.

[0127] In some embodiments of this application, the data synchronization device 500 generates a data synchronization log based on the target operation statement and the target update data, and transmits the data synchronization log to a preset database for data synchronization, including:

[0128] Obtain the first database identifier of the target database and the second database identifier of the preset database, and configure the preset log template according to the first database identifier and the second database identifier;

[0129] According to the configured data synchronization strategy, the target update data and target operation statements are written into the preset log template to generate a data synchronization log.

[0130] The data synchronization log is transmitted to the preset database for data synchronization.

[0131] In some embodiments of this application, after the data synchronization device 500 generates a data synchronization log based on the target operation statement and the target update data, and transmits the data synchronization log to a preset database for data synchronization, it further includes:

[0132] Obtain the target update data adjusted by the target operation statement in the target database, and the target synchronization data corresponding to the target update data in the preset database;

[0133] Compare the target updated data and the target synchronized data to determine the data synchronization result;

[0134] The corresponding data synchronization identifier is output based on the data synchronization result, wherein the data synchronization identifier includes a synchronization success identifier and a synchronization failure identifier.

[0135] In this embodiment, the data synchronization device receives a data synchronization request and determines the target database to be synchronized based on the database identifier corresponding to the data synchronization request; it intercepts data operation statements in the target database, performs word segmentation and recognition on the data operation statements to obtain operation identifier information of the data operation statements; it filters the data operation statements based on the operation identifier information to obtain target operation statements; it determines the target update data to be synchronized based on the target operation statements, and synchronizes the target update data to a preset database. This achieves data synchronization of databases in various systems without intruding into the corresponding systems, reducing data synchronization costs and improving data stability.

[0136] This invention also provides a data synchronization device, such as... Figure 6 As shown, Figure 6 This is a schematic diagram of one embodiment of the data synchronization device provided in this application.

[0137] The data synchronization device integrates any of the data synchronization apparatuses provided in the embodiments of the present invention, and the data synchronization device includes:

[0138] One or more processors;

[0139] Memory; and

[0140] One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor in the steps of the data synchronization method described in any of the embodiments of the above data synchronization method.

[0141] Specifically, a data synchronization device may include components such as a processor 601 with one or more processing cores, a memory 602 with one or more computer-readable storage media, a power supply 603, and an input unit 604. Those skilled in the art will understand that... Figure 6 The data synchronization device structure shown does not constitute a limitation on the data synchronization device. It may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein:

[0142] The processor 601 is the control center of the data synchronization device. It connects various parts of the data synchronization device via various interfaces and lines. By running or executing software programs and / or modules stored in the memory 602, and by calling data stored in the memory 602, it performs various functions and processes data, thereby providing overall monitoring of the data synchronization device. Optionally, the processor 601 may include one or more processing cores; preferably, the processor 601 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, while the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 601.

[0143] The memory 602 can be used to store software programs and modules. The processor 601 executes various functional applications and data processing by running the software programs and modules stored in the memory 602. The memory 602 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created based on the use of data synchronization devices, etc. In addition, the memory 602 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 602 may also include a memory controller to provide the processor 601 with access to the memory 602.

[0144] The data synchronization device also includes a power supply 603 that supplies power to the various components. Preferably, the power supply 603 can be logically connected to the processor 601 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 603 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0145] The data synchronization device may also include an input unit 604, which can be used to receive input digital or character information, and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.

[0146] Although not shown, the data synchronization device may also include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 601 in the data synchronization device loads the executable files corresponding to the processes of one or more applications into the memory 602 according to the following instructions, and the processor 601 runs the applications stored in the memory 602 to realize various functions, as follows:

[0147] Receive a data synchronization request and determine the target database to be synchronized based on the database identifier corresponding to the data synchronization request;

[0148] Intercept the data operation statements of the target database, perform word segmentation and recognition on the data operation statements, and obtain the operation identification information of the data operation statements;

[0149] The data operation statements are filtered based on their operation identifier information to obtain the target operation statement;

[0150] The target update data to be synchronized is determined according to the target operation statement, and the target update data is synchronized to the preset database.

[0151] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the detailed descriptions of other embodiments above, which will not be repeated here.

[0152] In practice, each of the above units or structures can be implemented as an independent entity or can be arbitrarily combined to be implemented as the same or several entities. For the specific implementation of each of the above units or structures, please refer to the previous method embodiments, which will not be repeated here.

[0153] Therefore, embodiments of the present invention provide a computer-readable storage medium, which may include: read-only memory (ROM), random access memory (RAM), a magnetic disk, or an optical disk, etc. A computer program is stored thereon, which is loaded by a processor to execute the steps in any of the data synchronization methods provided in the embodiments of the present invention. For example, the computer program loaded by the processor can execute the following steps:

[0154] Receive a data synchronization request and determine the target database to be synchronized based on the database identifier corresponding to the data synchronization request;

[0155] Intercept the data operation statements of the target database, perform word segmentation and recognition on the data operation statements, and obtain the operation identification information of the data operation statements;

[0156] The data operation statements are filtered based on their operation identifier information to obtain the target operation statement;

[0157] The target update data to be synchronized is determined according to the target operation statement, and the target update data is synchronized to the preset database.

[0158] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.

[0159] The data synchronization method provided by the embodiments of this application has been described in detail above. Specific embodiments have been used to illustrate the principle and implementation of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core idea of ​​the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation and application scope based on the idea of ​​the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A data synchronization method, characterized in that, The data synchronization method includes: Receive a data synchronization request and determine the target database to be synchronized based on the database identifier corresponding to the data synchronization request; Intercept the data operation statements of the target database, perform word segmentation and recognition on the data operation statements, and obtain the operation identification information of the data operation statements; the operation identification information is the identification information that represents the specific operation performed by the data operation statement on specific database data; Filtering the data operation statements according to their operation identifier information to obtain target operation statements; the filtering of the data operation statements according to their operation identifier information to obtain target operation statements includes: Obtain the configuration data from the data synchronization request, query the filtering rule database, and obtain the preset filtering rule corresponding to the configuration data; Obtain the target operation identifier from the preset filtering rules, compare the target operation identifier with the operation identifier information in the data operation statement, and obtain the filtering operation statement carrying the target operation identifier; Obtain the synchronization data type in the data synchronization request, perform secondary filtering on the filtering operation statement based on the synchronization data type, and set the filtering operation statement that matches the synchronization data type as the target operation statement; The target update data to be synchronized is determined according to the target operation statement, and the target update data is synchronized to the preset database.

2. The data synchronization method as described in claim 1, characterized in that, The interception of data manipulation statements in the target database includes: Obtain the database identifier of the target database, configure a preset data interceptor based on the database identifier, and obtain the operation statement interceptor; The operation statement interceptor is invoked to capture data packets from the target database and the data packets are parsed. If the data packet is a data manipulation statement of the target database, then the data manipulation statement is intercepted.

3. The data synchronization method as described in claim 1, characterized in that, The step of segmenting and recognizing the data operation statement to obtain the operation identifier information of the data operation statement includes: The data operation statement is input into a preset recognition model for word segmentation and recognition to obtain each word in the data operation statement; Obtain the target word segment with the part of speech of a verb from the word segmentation, compare the word segmentation text features of the target word segment with the operation identifier features in the preset sentence database, and obtain the feature similarity between the word segmentation text features and the operation identifier features; Obtain operation identifier features whose feature similarity exceeds a preset similarity threshold, and determine the operation identifier information of the data operation statement based on the operation identifier features.

4. The data synchronization method as described in claim 1, characterized in that, The step of determining the target update data to be synchronized according to the target operation statement and synchronizing the target update data to the preset database includes: Obtain the data retrieval logic of the target operation statement, and query the stored data in the target database corresponding to the data retrieval logic; The stored data is updated according to the operation identifier information to obtain the target updated data; A data synchronization log is generated based on the target operation statement and the target update data, and the data synchronization log is transmitted to a preset database for data synchronization.

5. The data synchronization method as described in claim 4, characterized in that, The step of generating a data synchronization log based on the target operation statement and the target update data, and transmitting the data synchronization log to a preset database for data synchronization, includes: Obtain the first database identifier of the target database and the second database identifier of the preset database, and configure the preset log template according to the first database identifier and the second database identifier; According to the configured data synchronization strategy, the target update data and target operation statements are written into the preset log template to generate a data synchronization log. The data synchronization log is transmitted to the preset database for data synchronization.

6. The data synchronization method according to any one of claims 1 to 5, characterized in that, After generating a data synchronization log based on the target operation statement and the target update data, and transmitting the data synchronization log to a preset database for data synchronization, the process further includes: Obtain the target update data adjusted by the target operation statement in the target database, and the target synchronization data corresponding to the target update data in the preset database; Compare the target updated data and the target synchronized data to determine the data synchronization result; The corresponding data synchronization identifier is output based on the data synchronization result, wherein the data synchronization identifier includes a synchronization success identifier and a synchronization failure identifier.

7. A data synchronization device, characterized in that, The data synchronization device includes: The receiving module is configured to receive data synchronization requests and determine the target database to be synchronized based on the database identifier corresponding to the data synchronization request. The operation determination module is configured to intercept data operation statements in the target database, perform word segmentation and recognition on the data operation statements, and obtain operation identification information of the data operation statements; the operation identification information is identification information that represents the specific operation performed by the data operation statement on specific database data; An operation filtering module is configured to filter data operation statements based on operation identifier information to obtain target operation statements; the step of filtering data operation statements based on operation identifier information to obtain target operation statements includes: Obtain the configuration data from the data synchronization request, query the filtering rule database, and obtain the preset filtering rule corresponding to the configuration data; Obtain the target operation identifier from the preset filtering rules, compare the target operation identifier with the operation identifier information in the data operation statement, and obtain the filtering operation statement carrying the target operation identifier; Obtain the synchronization data type in the data synchronization request, perform secondary filtering on the filtering operation statement based on the synchronization data type, and set the filtering operation statement that matches the synchronization data type as the target operation statement; The data synchronization module is configured to determine the target update data to be synchronized based on the target operation statement, and synchronize the target update data to a preset database.

8. A data synchronization device, characterized in that, The data synchronization device includes: One or more processors; Memory; and One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to implement the data synchronization method of any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, It stores a computer program, which is loaded by a processor to perform the steps of the data synchronization method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Method and device for synchronizing databases of master network management system and standby network management system

    CN102081611A

  • Data bidirectional synchronization method and device for heterogeneous database

    CN112905613A

  • Data synchronization method and device, terminal equipment and computer readable storage medium

    CN112948491A