Business data synchronization method and device, equipment, storage medium and program product

By monitoring message queues at the target service node and selecting target databases from multiple databases according to business mapping rules for cross-technology stack data synchronization, the problems of data format incompatibility and synchronization lag between cross-technology stack databases are solved, achieving efficient and accurate data synchronization.

CN121786102APending Publication Date: 2026-04-03CHINA CONSTRUCTION BANK +1
View PDF 0 Cites 1 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-02
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

Existing business data synchronization methods cannot match the heterogeneous characteristics and dynamic adaptation requirements of cross-technology stack databases, resulting in problems such as data format incompatibility and synchronization lag.

Method used

By monitoring the message queue at the target service node, extracting the business data to be synchronized, and selecting the target database from multiple second databases for synchronization according to the business mapping rules, combined with data timeliness detection and format conversion, cross-technology stack database data synchronization is achieved.

Benefits of technology

It improves the synchronization of business data between databases across different technology stacks, ensuring data consistency and synchronization efficiency, and adapting to the syntax and format characteristics of different technology stacks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121786102A_ABST
    Figure CN121786102A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, and discloses a business data synchronization method and device, equipment, a storage medium and a program product. The method comprises the steps that under the condition that it is detected that a service message corresponding to an associated service node exists in a message queue, to-be-synchronized service data is extracted from the service message, the to-be-synchronized service data is stored in a first database bound with the associated service node, and the service message is generated by the associated service node based on the to-be-synchronized service data; according to a business mapping rule between the target service node and the associated service node, a target database used for storing business data to be synchronized is selected from a plurality of second databases bound to the target service node, and the first database and any second database belong to different technology stacks; and synchronizing the to-be-synchronized service data to the target database. By adopting the method, the synchronization effect of performing data synchronization on the business data between the cross-technology stack databases can be improved.
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 in particular to a business data synchronization method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Technology

[0002] With the continuous development of computer technology, business systems are gradually moving towards a complex architecture that involves collaboration across multiple technology stacks. Applications of different technology stacks usually need to rely on their respective technology stack databases to achieve data storage and interaction. Therefore, in the process of business data processing, the need for business data synchronization between databases across technology stacks is unavoidable.

[0003] In traditional technologies, business data synchronization is usually achieved by directly connecting to databases across technology stacks or by relying on data synchronization tools. Specifically, programmers read business data from the source database by writing business code, then convert the business data format and write it to the target database, or they use data synchronization tools to export business data from the source database and import business data into the target database.

[0004] However, current business data synchronization methods cannot match the heterogeneous characteristics and dynamic adaptation requirements of cross-technology stack databases, which leads to data format incompatibility or data synchronization delays during the data synchronization process. Therefore, the current data synchronization effect for business data between cross-technology stack databases is poor. Summary of the Invention

[0005] Therefore, it is necessary to provide a business data synchronization method, apparatus, computer equipment, computer-readable storage medium, and computer program product that can improve the synchronization effect of business data synchronization between databases across technology stacks, in order to address the above-mentioned technical problems.

[0006] Firstly, this application provides a business data synchronization method, applied to a target service node, including:

[0007] If a business message corresponding to an associated service node is detected in the message queue, business data to be synchronized is extracted from the business message. The business data to be synchronized is stored in the first database bound to the associated service node, and the business message is generated by the associated service node based on the business data to be synchronized.

[0008] According to the business mapping rules between the target service node and the associated service node, a target database for storing the business data to be synchronized is selected from multiple second databases bound to the target service node, wherein the first database and any second database belong to different technology stacks;

[0009] The business data to be synchronized is synchronized to the target database.

[0010] In one embodiment, extracting the business data to be synchronized from the business message includes:

[0011] Extract initial business data, data identification information of the initial business data, and first data timeliness information of the business object to which the initial business data belongs from the business message;

[0012] Based on the data identification information, extract the second data timeliness information of the business object from the first database;

[0013] Based on the first data timeliness information and the second data timeliness information, the initial business data is subjected to timeliness detection.

[0014] If the initial business data is detected to meet the preset timeliness standard, then the initial business data is determined as the business data to be synchronized;

[0015] If the initial business data is detected to not meet the preset timeliness standard, the associated service node is triggered to push the updated business message to the message queue and extract the business data to be synchronized from the updated business message.

[0016] In one embodiment, the first data timeliness information includes a first timestamp of the initial business data, and the second data timeliness information includes a second timestamp of the latest business data of the business object; the step of performing timeliness detection on the initial business data based on the first data timeliness information and the second data timeliness information includes:

[0017] Obtain the push cycle for the associated service node to push business messages to the message queue;

[0018] The data interval time of the business object is obtained by subtracting the first timestamp and the second timestamp.

[0019] If the data interval is greater than or equal to the push period, it is determined that the initial business data does not meet the preset timeliness standard; if the data interval is less than the push period, it is determined that the initial business data meets the preset timeliness standard.

[0020] In one embodiment, selecting a target database for storing the business data to be synchronized from a plurality of second databases bound to the target service node, based on the business mapping rules between the target service node and the associated service node, includes:

[0021] According to the business mapping rules, at least one candidate database that matches the data type of the business data to be synchronized is selected from the plurality of second databases;

[0022] Based on the storage feature information of each candidate database, the candidate databases are prioritized and sorted to obtain the database sorting result;

[0023] Based on the database sorting results, the target database is selected from each of the candidate databases.

[0024] In one embodiment, the storage feature information includes storage adaptation information, storage performance information, and storage cycle information; the step of prioritizing each candidate database based on its storage feature information to obtain a database ranking result includes:

[0025] Assign a first preset weight to the storage adaptation information, assign a second preset weight to the storage performance information, and assign a third preset weight to the storage cycle information;

[0026] By integrating the storage adaptation information, the storage performance information, the storage cycle information, the first preset weight, the second preset weight, and the third preset weight, a storage matching score for each candidate database is obtained.

[0027] Based on all storage matching scores and preset sorting rules, all candidate databases are prioritized and sorted to obtain the database sorting result.

[0028] In one embodiment, the target database includes a first target database and a second target database; synchronizing the business data to be synchronized to the target database includes:

[0029] Extract the database sharding rule information from the business messages;

[0030] According to the database sharding rules, the business data to be synchronized is split to obtain the first business data to be synchronized stored in the first target database and the second business data to be synchronized stored in the second target database.

[0031] The first business data to be synchronized is stored after being converted to the data format of the first target database, and the second business data to be synchronized is stored after being converted to the data format of the second target database.

[0032] If both the first target database and the second target database return a successful storage result, it is determined that the synchronization of the business data to be synchronized is complete.

[0033] In one embodiment, the method further includes:

[0034] If the first database is detected to be offline, a data migration request is sent to the associated service node;

[0035] Upon detecting the presence of a migration message for the associated service node in the message queue, extract all business data from the business message, wherein the migration message is generated by the associated service node in response to the data migration request;

[0036] The target database cluster for storing the full amount of business data is determined from the multiple second databases bound to the target service node;

[0037] The full volume of business data will be migrated to the target database cluster.

[0038] Secondly, this application also provides a business data synchronization device, applied to a target service node, comprising:

[0039] The first extraction module is used to extract business data to be synchronized from the business message when a business message corresponding to an associated service node is detected in the message queue. The business data to be synchronized is stored in the first database bound to the associated service node, and the business message is generated by the associated service node based on the business data to be synchronized.

[0040] The selection module is used to select a target database for storing the business data to be synchronized from multiple second databases bound to the target service node according to the business mapping rules between the target service node and the associated service node, wherein the first database and any second database belong to different technology stacks;

[0041] The synchronization module is used to synchronize the business data to be synchronized to the target database.

[0042] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:

[0043] If a business message corresponding to an associated service node is detected in the message queue, business data to be synchronized is extracted from the business message. The business data to be synchronized is stored in a first database bound to the associated service node, and the business message is generated by the associated service node based on the business data to be synchronized. According to the business mapping rules between the target service node and the associated service node, a target database for storing the business data to be synchronized is selected from multiple second databases bound to the target service node. The first database and any second database belong to different technology stacks. The business data to be synchronized is then synchronized to the target database.

[0044] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the following steps:

[0045] If a business message corresponding to an associated service node is detected in the message queue, business data to be synchronized is extracted from the business message. The business data to be synchronized is stored in a first database bound to the associated service node, and the business message is generated by the associated service node based on the business data to be synchronized. According to the business mapping rules between the target service node and the associated service node, a target database for storing the business data to be synchronized is selected from multiple second databases bound to the target service node. The first database and any second database belong to different technology stacks. The business data to be synchronized is then synchronized to the target database.

[0046] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, performs the following steps:

[0047] If a business message corresponding to an associated service node is detected in the message queue, business data to be synchronized is extracted from the business message. The business data to be synchronized is stored in a first database bound to the associated service node, and the business message is generated by the associated service node based on the business data to be synchronized. According to the business mapping rules between the target service node and the associated service node, a target database for storing the business data to be synchronized is selected from multiple second databases bound to the target service node. The first database and any second database belong to different technology stacks. The business data to be synchronized is then synchronized to the target database.

[0048] The aforementioned business data synchronization method, apparatus, computer equipment, computer-readable storage medium, and computer program product, by actively monitoring the presence of business messages corresponding to associated service nodes of the target service node in the message queue, extracts the business data to be synchronized from the business messages. The business messages are generated by the associated service nodes based on the business data to be synchronized stored in their bound first database. Then, through the business mapping relationship between the target service node and the associated service nodes, a target database for storing the business data to be synchronized is selected from multiple second databases bound to the target service node. The first database and any second database belong to different technology stacks. Finally, the business data to be synchronized is synchronized to the target database, thus achieving [the desired synchronization]. The purpose of synchronizing business data between databases across different technology stacks is achieved by relying on message queues. Because message queues can decouple data synchronization logic from business code, and the business mapping relationship between target service nodes and related service nodes can flexibly match the syntax differences and format characteristics of databases with different technology stacks, the above-mentioned business data synchronization mechanism can fully match the heterogeneous characteristics and dynamic adaptation requirements of cross-technology stacks. This overcomes the technical defects of current business data synchronization methods, which cannot match the heterogeneous characteristics and dynamic adaptation requirements of cross-technology stack databases, leading to data format incompatibility or data synchronization lag during the data synchronization process. Therefore, it improves the synchronization effect of business data synchronization between databases with different technology stacks. Attached Figure Description

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

[0050] Figure 1 This is an application environment diagram of a business data synchronization method in one embodiment;

[0051] Figure 2 This is a flowchart illustrating a business data synchronization method in another embodiment;

[0052] Figure 3 This is a structural block diagram of a business data synchronization device in one embodiment;

[0053] Figure 4 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0054] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application. It should be noted that existing industry solutions such as software, components, and models may be mentioned in the embodiments of this application. These should be considered exemplary and are intended only to illustrate the feasibility of implementing the technical solutions of this application, but do not imply that the applicant has already used or necessarily used such solutions.

[0055] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of related data must comply with relevant regulations. The acquisition, storage, use and processing of data in the technical solution of this application all comply with the relevant provisions of national laws and regulations.

[0056] The terms "first," "second," etc., used in this application may be used to describe various elements, but these elements are not limited by these terms. These terms are used only to distinguish the first element from the second element. The terms "comprising" and "having," and any variations thereof, used in this application, are intended to cover non-exclusive inclusion. The term "multiple" used in this application refers to two or more.

[0057] First, it should be understood that traditional technologies employ corresponding business data synchronization mechanisms to address the need for business data synchronization across databases in different technology stacks. For example, in small business scenarios, the source and target databases are directly connected at the application layer. In large business scenarios, in addition to using scripts such as Shell and Python, or data synchronization tools for MySQL and MongoDB to periodically export and import business data files, triggers can be created in the source database to automatically write change records to an intermediate table when data changes. The intermediate table is then polled by the program to extract the changed data and synchronize it to the target database. However, none of these traditional technologies fundamentally match the heterogeneous characteristics and dynamic adaptation requirements of databases across different technology stacks, which can easily lead to data format incompatibility or data synchronization delays. Therefore, there is an urgent need for a business data synchronization method that improves the synchronization effect of business data between databases in different technology stacks.

[0058] In one embodiment, such as Figure 1As shown, a business data synchronization method is provided. This embodiment uses the application of this method to a target service node as an example. The target service node refers to a functional module with cross-technology stack data synchronization capabilities, specifically an order node, storage node, or cache node, etc. For example, when processing order business, the order node faces the business data synchronization requirement of synchronizing business data to heterogeneous databases; the storage node faces the business data synchronization requirement of synchronizing business data to databases with different technology stacks; and the cache update node faces the business data synchronization requirement of synchronizing structured data to a non-relational database. The target service node is deployed on a terminal, which includes, but is not limited to, personal computers, laptops, smartphones, and tablets. The target service node includes a first extraction module, a selection module, and a synchronization module. The first extraction module is used to extract the business data to be synchronized from the business message when a business message corresponding to an associated service node is detected in the message queue. The business data to be synchronized is stored in the associated service node bound to the relevant service node. The first database is defined, and business messages are generated by associated service nodes based on the business data to be synchronized. The selection module is used to select a target database from multiple second databases bound to the target service node to store the business data to be synchronized, according to the business mapping rules between the target service node and the associated service node. The first database and any second database belong to different technology stacks. The synchronization module is used to synchronize the business data to be synchronized to the target database. Through information interaction between the first extraction module, the selection module, and the synchronization module, the data synchronization logic and business code can be decoupled through a message queue during the data synchronization process. Furthermore, the business mapping relationship between the target service node and the associated service node can flexibly match the syntax differences and format characteristics of databases in different technology stacks. Therefore, this data synchronization mechanism can fully match the heterogeneous characteristics and dynamic adaptation requirements across technology stacks, thus achieving the technical effect of improving the synchronization effect of business data between databases in different technology stacks. It is understood that this method can also be applied to servers, and can also be applied to systems including terminals and servers, and implemented through the interaction between terminals and servers. In this embodiment, the method includes the following steps 202 to 206. Wherein:

[0059] Step 202: If a business message corresponding to an associated service node is detected in the message queue, extract the business data to be synchronized from the business message. The business data to be synchronized is stored in the first database bound to the associated service node, and the business message is generated by the associated service node based on the business data to be synchronized.

[0060] It's important to note that a message queue is a middleware operating on a "producer-consumer" model, used to asynchronously transmit messages between different service nodes. Specifically, it can be Kafka or RabbitMQ. For example, in one feasible implementation, assuming the message queue is Kafka, in an e-commerce system, the order service node pushes generated business messages to Kafka, which are then consumed and processed by the inventory service node and logistics service node, respectively. Associated service nodes represent service nodes that are business-related to the target service node. For example, in a "place an order - deduct inventory" scenario, where the inventory node is the target service node, the order node can be considered an associated service node. Business messages are structured information carriers containing business data, generated by associated service nodes, used to transmit business content that needs to be synchronized across different technology stack databases. For example, if a business message includes fields such as "order ID, user ID, product ID, and order time," then this business message is used to notify other service nodes to process the order.

[0061] It should be noted that the associated service node actively generates business messages in the message queue based on the business data that needs to be transmitted between different service nodes, so that the relevant service nodes can retrieve the business messages from the message queue for synchronization. The business data to be synchronized represents the business data that needs to be synchronized from the first database bound to the associated service node to the target database of the target service node, which can be understood as synchronizing from the source database to the target database. The first database bound to the associated service node represents the database directly associated with the associated service node and storing the business data generated by it. For example, in one feasible approach, assuming the associated service node is an order placement node, after the order placement node generates a new order in MySQL, it will retrieve the business data to be synchronized from the new order and encapsulate the business data to be synchronized into a JSON format business message, so that the service nodes associated with the order placement service node can retrieve the business messages from the message queue to complete the data synchronization.

[0062] As an example, step 202 includes: if a message corresponding to the node identifier of an associated service node is detected in the message queue, determining that a business message corresponding to the associated service node exists in the message queue, extracting a specified data field from the business message to obtain business data to be synchronized, wherein the business data to be synchronized is stored in the first database bound to the associated service node, and the business message is generated by the associated service node based on the business data to be synchronized.

[0063] In one feasible approach, before detecting the presence of a business message corresponding to the associated service node in the message queue, the associated service node extracts the business data to be synchronized from its own bound first database, encapsulates the business data to be synchronized into a business message, and pushes the business message to the message queue.

[0064] Step 204: Based on the business mapping rules between the target service node and the associated service node, select the target database from the multiple second databases bound to the target service node to store the business data to be synchronized. The first database and any second database belong to different technology stacks.

[0065] It should be noted that business mapping rules are used to indicate the synchronization rules for business data between target service nodes and associated service nodes across technology stack databases. Business mapping rules can be pre-set by operators. For example, in an e-commerce business scenario, the order node is the associated service node, and the inventory node is the target service node. The business mapping rule can be business data such as "product ID and inventory quantity" in the order message, which needs to be stored in the Redis database bound to the inventory node. Then, by extracting the data fields associated with the database in the business mapping rule, the target database can be queried. The target service node is bound to multiple second databases. The second databases refer to multiple databases associated with the target service node and used to store synchronized data. It can be understood that the database types of different second databases can be the same or different based on business needs. The multiple second databases can specifically be Redis databases, MySQL databases, and Elasticsearch databases, etc. The target database representation depends on the database selected by the business mapping rules to take over the data to be synchronized. The first database and any second database belong to different technology stacks.

[0066] As an example, step 204 includes: extracting the database index field from the business mapping rules between the target service node and the associated service node; and determining the target database for storing the business data to be synchronized from among the multiple second databases based on the matching relationship between the database index field and the database identifiers of the multiple second databases bound to the target service node, wherein the first database and any second database belong to different technology stacks.

[0067] Step 206: Synchronize the business data to be synchronized to the target database.

[0068] It should be noted that, since the first database and the target database belong to different technology stacks, the business data to be synchronized needs to be formatted during the synchronization process.

[0069] As an example, step 206 includes converting the format of the business data to be synchronized according to the data conversion rules of the target database to obtain the converted business data, and storing the converted business data in the target database.

[0070] The aforementioned business data synchronization method, by actively monitoring the presence of business messages corresponding to associated service nodes of the target service node in the message queue, extracts the business data to be synchronized from these messages. These business messages are generated by the associated service node based on the business data to be synchronized stored in its bound first database. Then, through the business mapping relationship between the target service node and associated service nodes, a target database for storing the business data to be synchronized is selected from multiple second databases bound to the target service node. The first database and any second database belong to different technology stacks. Finally, the business data to be synchronized is synchronized to the target database, thus achieving cross-technology stack data synchronization relying on message queues. The purpose of business data synchronization between databases is to achieve the decoupling of data synchronization logic and business code through message queues. Furthermore, the business mapping relationship between the target service node and related service nodes can flexibly match the syntax differences and format characteristics of databases across different technology stacks. Therefore, the aforementioned business data synchronization mechanism can fully match the heterogeneous characteristics and dynamic adaptation requirements across technology stacks. This overcomes the technical shortcomings of current business data synchronization methods, which cannot match the heterogeneous characteristics and dynamic adaptation requirements of databases across technology stacks, leading to data format incompatibility or data synchronization delays during the data synchronization process. Thus, it improves the synchronization effect of business data synchronization between databases across technology stacks.

[0071] In one exemplary embodiment, such as Figure 2 As shown, the business data to be synchronized is extracted from the business messages, including:

[0072] Step 302: Extract the initial business data, the data identification information of the initial business data, and the first data timeliness information of the business object to which the initial business data belongs from the business message.

[0073] It should be noted that in cross-technology stack database data synchronization scenarios, business messages in the message queue may become inconsistent with existing business data in the target database due to delays, data staleness, or other reasons. If data synchronization is always based on business messages in the message queue, it may lead to inconsistencies between the business data stored in the source database and the target database. Therefore, this embodiment verifies the timeliness of business data by collecting the data timeliness information of business objects. Here, a business object represents a data subject with clear meaning and independent attributes in the business process and is the core carrier to which the business data belongs. For example, a business object can be a "user," "order," or "payment record." Data identification information is used to identify the mark of the business object to which the initial business data belongs. The first data timeliness information represents the timeliness mark of the initial business data, which can be the timestamp of data generation, version number, or status update time, etc.

[0074] As an example, step 302 includes extracting initial business data from the business message, extracting data identification information of the initial business data from the business message, and extracting first data timeliness information of the business object to which the initial business data belongs from the business message.

[0075] Step 304: Extract the second data timeliness information of the business object from the first database based on the data identification information.

[0076] It should be noted that, through data identification information, business objects can be located in the first database, and then the second data timeliness information of the business objects can be extracted from the first database.

[0077] As an example, step 304 includes querying and indexing the second data timeliness information of the business object from the first database, using the data identification information as an index.

[0078] Step 306: Based on the first data timeliness information and the second data timeliness information, perform timeliness detection on the initial business data.

[0079] It should be noted that after obtaining the first data timeliness information and the second data timeliness information, the timeliness of the initial business data can be checked based on the consistency between the first data timeliness information and the second data timeliness information.

[0080] As an example, step 306 includes performing a timeliness check on the initial business data by comparing the first data timeliness information and the second data timeliness information.

[0081] In one feasible approach, assuming the first data timeliness information is a first version number and the second data timeliness information is a second version number, if the first version number and the second version number are the same, it is determined that the initial business data meets the preset timeliness standard; if the first version number and the second version number are different, it is determined that the initial business data does not meet the preset timeliness standard.

[0082] Step 308: If the initial business data is detected to meet the preset timeliness standard, then the initial business data is determined as business data to be synchronized.

[0083] It should be noted that the preset timeliness standard is set by the operations personnel according to business needs. If the initial business data meets the preset timeliness standard, it means that the initial business data in the current business message is the latest business data in the first database, and the initial business data can be directly identified as the business data to be synchronized. If the initial business data does not meet the preset timeliness standard, it means that the initial business data in the current business message is not the latest business data in the first database, and the initial business data needs to be updated.

[0084] As an example, step 308 includes: if it is detected that the initial business data does not meet the preset timeliness standard, then the initial business data is used as business data to be synchronized.

[0085] Step 310: If it is detected that the initial business data does not meet the preset timeliness standard, the associated service node is triggered to push the updated business message to the message queue and extract the business data to be synchronized from the updated business message.

[0086] It should be noted that if the initial business data is not the latest business data in the first database, the associated service node will actively update the business message, and then the associated service node will push the updated business message to the message queue. During the process of the associated service node actively updating the business message, the associated service node will stop pushing business messages to the message queue.

[0087] As an example, step 310 includes: if it is detected that the initial business data does not meet the preset timeliness standard, the associated node is triggered to generate and push the updated business message to the message queue, and the business data to be synchronized is extracted from the updated business message.

[0088] In this embodiment, during the process of extracting business data to be synchronized from business messages, the first data timeliness information and the second data timeliness information are compared to ensure that the extracted business data to be synchronized is consistent with the latest business data in the first database bound to the associated service node. This allows for the filtering out of expired or invalid initial business data, avoids storing incorrect information in the target database, and ensures that business data across technology stack databases remains consistent after synchronization. Therefore, this lays the foundation for improving the synchronization effect of business data synchronization between cross-technology stack databases and improves the synchronization accuracy of business data synchronization between cross-technology stack databases.

[0089] In an exemplary embodiment, the first data timeliness information includes a first timestamp of the initial business data, and the second data timeliness information includes a second timestamp of the latest business data of the business object; based on the first data timeliness information and the second data timeliness information, the initial business data is subjected to timeliness detection, including:

[0090] Obtain the push cycle of the associated service node pushing business messages to the message queue; calculate the difference between the first timestamp and the second timestamp to obtain the data interval time of the business object; if the data interval time is greater than or equal to the push cycle, determine that the initial business data does not meet the preset timeliness standard, and if the data interval time is less than the push cycle, determine that the initial business data meets the preset timeliness standard.

[0091] It should be noted that in certain specific business scenarios, short-term delays in data synchronization are acceptable, and minor, high-frequency changes will not have a substantial impact on core business processes. Therefore, a certain degree of data synchronization delay is permissible, but system interaction costs are also considered. For example, in scenarios involving changes to non-critical user data or adjustments to non-core product attributes, the timeliness of data and system stability can be balanced by comparing the relationship between the push cycle and the data interval. The push cycle represents the fixed time interval at which associated service nodes push business messages to the message queue, specifically every 10 minutes or every 20 minutes. The first and second timestamps are specific time identifiers, accurate to the second. The data interval represents the degree of data lag in the business message. The preset timeliness standard is that if the data interval is less than the push cycle, it indicates that the initial business data in the business message is not outdated; if the data interval is greater than or equal to the push cycle, it indicates that the initial business data in the business message has expired.

[0092] As an example, based on a preset query statement, the push cycle for related service nodes to push services to the message queue is obtained; the difference between the timestamps of the first and second timestamps is used as the data interval time of the business object; if the data interval time is greater than or equal to the push cycle, it is determined that the initial business data does not meet the preset timeliness standard, and if the data interval time is less than the push cycle, it is determined that the initial business data meets the preset timeliness standard.

[0093] This embodiment obtains two quantitative features, the push cycle and the data time interval, and determines whether the initial business data meets the preset timeliness standard based on the relationship between the push cycle and the data time interval. This avoids redundant message interaction and data processing flow caused by high-frequency minor changes, thus achieving the goal of minimizing system resource consumption and making data lag risk controllable. Therefore, while laying the foundation for improving the synchronization effect of business data synchronization between cross-technology stack databases, it also improves the scenario adaptability of business data synchronization between cross-technology stack databases.

[0094] In an exemplary embodiment, based on the business mapping rules between the target service node and associated service nodes, a target database for storing the business data to be synchronized is selected from multiple second databases bound to the target service node, including:

[0095] Based on the business mapping rules, at least one candidate database matching the data type of the business data to be synchronized is selected from multiple second databases; based on the storage characteristics of each candidate database, the candidate databases are prioritized and sorted to obtain the database sorting result; based on the database sorting result, the target database is selected from each candidate database.

[0096] It should be noted that the business mapping rules can include database types and their correspondences, thereby allowing at least one candidate database to be queried. For example, if the business data to be synchronized is "the user's payment amount and payment time in an order," then the data type is "core transaction data." If the business data to be synchronized is "the user's click records for viewing order details," then the data type is "user behavior log." Candidate databases are selected from multiple second databases that match the data type of the data to be synchronized, serving as a shortlist for target databases. Storage feature information is used to describe the technical characteristics and adaptability of candidate databases. For example, in one feasible approach, the storage feature information of database X can specifically be "dedicated transaction database," "supports transactions," and "read / write latency <10ms."

[0097] As an example, the data type index field is extracted from the storage feature information of each candidate database. Based on the data type index field, at least one candidate database matching the data type of the business data to be synchronized is selected from multiple second databases. Based on the storage feature information of each candidate database, the candidate databases are prioritized and sorted to obtain the database sorting result. The candidate database with the highest sorting priority in the database sorting result is determined as the target database.

[0098] This embodiment employs a dual filtering mechanism of business mapping rules and storage feature sorting to select the second database with the highest priority that conforms to the business mapping rules from among multiple second databases bound to the target service node. This ensures that the business data to be synchronized can be stored in a database that matches its type and business requirements, avoiding data loss or business anomalies due to mismatched data storage scenarios. Therefore, while laying the foundation for improving the synchronization effect of business data between cross-technology stack databases, it also simultaneously improves the synchronization efficiency of business data between cross-technology stack databases.

[0099] In an exemplary embodiment, the storage feature information includes storage adaptation information, storage performance information, and storage cycle information; based on the storage feature information of each candidate database, the candidate databases are prioritized to obtain a database ranking result, including:

[0100] A first preset weight is assigned to storage adaptation information, a second preset weight is assigned to storage performance information, and a third preset weight is assigned to storage cycle information. By integrating storage adaptation information, storage performance information, storage cycle information, the first preset weight, the second preset weight, and the third preset weight, a storage matching score for each candidate database is obtained. Based on all storage matching scores and preset sorting rules, all candidate databases are prioritized to obtain the database sorting result.

[0101] It should be noted that in multi-candidate database scenarios, the importance of different storage features to the business often varies. For example, core business data prioritizes adaptability, while high-frequency access data focuses more on performance. Therefore, by quantifying the importance of different storage feature information, we can comprehensively consider multiple dimensions of storage features and prioritize all candidate databases using the obtained quantitative indicators. Among them, storage adaptability information reflects the degree of adaptability between the database and business data, specifically as a matching identifier such as "high match," "moderate match," or "low match." Storage performance information reflects the technical performance indicators of the database, specifically as concurrent processing capacity, current load status, or read / write response speed. Storage lifecycle information reflects the database's data lifecycle management capabilities, specifically as data retention duration, archiving strategy, and support for hot and cold data tiering. The first, second, and third preset weights can be set by operators based on requirements. The first, second, and third preset weights can be the same or different. The storage matching score is used to comprehensively evaluate the overall matching degree between candidate databases and business requirements.

[0102] As an example, storage adaptation information, storage performance information, and storage cycle information are assigned a first preset weight, a second preset weight, and a third preset weight in sequence, wherein the sum of the first preset weight, the second preset weight, and the third preset weight is 1. The first matching score, the second matching score, and the third matching score mapped from the storage adaptation information, storage performance information, and storage cycle information are obtained respectively. Based on the first preset weight, the first matching score, the second matching score, and the third matching score are weighted and calculated to obtain the storage matching score of each candidate database. All candidate databases are prioritized and sorted according to the storage matching scores from high to low to obtain the database sorting result.

[0103] In one feasible approach, the first matching score, the second matching score, and the third matching score are weighted and calculated according to the first preset weight, the second preset weight, and the third preset weight, resulting in the following expression for the stored matching score of each candidate database:

[0104]

[0105] Where R is the storage matching score, As the first preset weight, As the second preset weight, As the third preset weight, The first matching score, The second matching score, This is the third matching score.

[0106] This embodiment distinguishes the importance of different storage features by setting corresponding weights, so that the storage features under each dimension are adapted to specific business needs. Then, by quantifying all storage feature information, a storage matching score is calculated to reflect the overall matching degree between candidate databases and business needs. Finally, based on the storage matching score, the priority ranking of all candidate databases is completed, thereby achieving the goal of quantifying the matching degree between each candidate database and business needs under the business requirements. This ensures that different business data can be stored in the most suitable target database. Therefore, while laying the foundation for improving the synchronization effect of business data between cross-technology stack databases, it also improves the overall operating efficiency of the terminal.

[0107] In an exemplary embodiment, the target database includes a first target database and a second target database; synchronizing the business data to be synchronized to the target database includes:

[0108] Extract sharding rule information from business messages; based on the sharding rule information, split the business data to be synchronized to obtain first business data to be synchronized stored in the first target database and second business data to be synchronized stored in the second target database; convert the first business data to be synchronized according to the data format of the first target database and then store it, and convert the second business data to be synchronized according to the data format of the second target database and then store it; if both the first target database and the second target database return a successful storage result, determine that the synchronization of the business data to be synchronized is complete.

[0109] It should be noted that in distributed systems, the business data to be synchronized often includes data from multiple dimensions, and different types of data have significantly different storage requirements. If the business data to be synchronized is stored entirely in a single target database, it may lead to storage requirement conflicts and complex database maintenance. Therefore, two databases, a first target database and a second target database, can be set up to store different types of data, thus splitting the business data to be synchronized for storage. The database sharding rule information describes the rules for splitting the business data to be synchronized. Specifically, the database sharding rule information can be "store core order fields in a relational database and non-core fields in a document database".

[0110] As an example, the system extracts the first data attribute information of the first target database and the second data attribute information of the second target database from the database sharding rule information. It then splits the business data to be synchronized into first business data to be synchronized according to the first data attribute information, and splits it into second business data to be synchronized according to the second data attribute information. The first business data to be synchronized is then converted to the data format of the first target database and stored, and the second business data to be synchronized is then converted to the data format of the second target database and stored. If the system detects that the first target database returns a successful storage result for the first business data to be synchronized, and detects that the second target database returns a failed storage result for the second business data to be synchronized, the system determines that the synchronization of the business data to be synchronized is complete.

[0111] This embodiment uses database sharding rules to split the business data to be synchronized, resulting in first and second data to be synchronized. The first and second data are then allocated to their respective most suitable databases, avoiding the situation where all business data to be synchronized is stored in the same target database. This prevents a single database from becoming a bottleneck due to excessive data volume or frequent read / write operations. Therefore, it lays the foundation for improving the synchronization effect of business data between databases across different technology stacks, while simultaneously enhancing the targeted nature of business data storage.

[0112] In one exemplary embodiment, the method further includes:

[0113] If the first database is detected to be offline, a data migration request is sent to the associated service node; if a migration message of the associated service node is detected in the message queue, the full amount of business data is extracted from the business message, wherein the migration message is generated by the associated service node in response to the data migration request; the target database cluster for storing the full amount of business data is determined from the multiple second databases bound to the target service node; and the full amount of business data is migrated to the target database cluster.

[0114] It should be noted that applications using the same technology stack only directly connect to databases within the same technology stack. The new service operates the database, service A operates the database of technology stack B, and service B operates the database of technology stack A. If the database of technology stack A goes offline, only service B needs to be stopped; applications using technology stack B do not send business data to the message queue. To avoid situations such as business data synchronization failures, historical data loss, or service interruptions, a data migration mechanism can be triggered to migrate all business data originally dependent on the first database to a backup database cluster of the target service node, ensuring the availability of the business system. It is understood that the specific steps for determining the target database cluster and migrating all business data to the target database cluster can be referred to the steps for selecting the target database and data synchronization in the above embodiment, and will not be repeated here.

[0115] As an example, when the first database is detected to be offline, a data migration request is sent to the associated service node. Upon detecting a migration message from the associated service node in the message queue, all business data is extracted from the business messages (the migration messages are generated by the associated service node in response to the data migration request). A target database cluster for storing the full business data is determined from multiple second databases bound to the target service node. The full business data is then migrated to the target database cluster. In this way, even when the first database is offline, the data migration mechanism can still migrate all business data from the first database to the target database cluster via the message queue, thus laying the foundation for further improving the synchronization effect of business data between databases across different technology stacks.

[0116] In one feasible approach, during data synchronization between databases across different technology stacks, if all databases are running normally, the target service node, upon detecting a business message corresponding to an associated service node in the message queue, extracts initial business data, data identification information of the initial business data, and first data timeliness information of the business object to which the initial business data belongs from the business message. Based on the data identification information, it extracts second data timeliness information of the business object from the first database. Based on the first and second data timeliness information, it performs a timeliness check on the initial business data. If the initial business data meets a preset timeliness standard, it is identified as business data to be synchronized. If the initial business data does not meet the preset timeliness standard, the associated service node is triggered to push an updated business message to the message queue and extracts the business data to be synchronized from the updated business message. Then, based on business mapping rules, at least one candidate database matching the data type of the business data to be synchronized is selected from multiple second databases. The storage characteristic information includes storage adaptation information, storage performance information, and... Storage cycle information is used to assign a first preset weight to storage adaptation information, a second preset weight to storage performance information, and a third preset weight to storage cycle information. By fusing storage adaptation information, storage performance information, storage cycle information, the first preset weight, the second preset weight, and the third preset weight, a storage matching score is obtained for each candidate database. Based on all storage matching scores and preset sorting rules, all candidate databases are prioritized and sorted to obtain a database sorting result. Based on the database sorting result, a target database is selected from each candidate database. Finally, based on the database sharding rule information, the business data to be synchronized is split into first business data to be synchronized stored in the first target database and second business data to be synchronized stored in the second target database. The first business data to be synchronized is stored after format conversion according to the data format of the first target database, and the second business data to be synchronized is stored after format conversion according to the data format of the second target database. If both the first target database and the second target database return a successful storage result, it is determined that the synchronization of the business data to be synchronized is completed.

[0117] This achieves the goal of synchronizing business data between databases across different technology stacks by relying on message queues. Since message queues can decouple data synchronization logic from business code, and the business mapping relationship between target service nodes and related service nodes can flexibly match the syntax differences and format characteristics of databases in different technology stacks, the above-mentioned business data synchronization mechanism can fully match the heterogeneous characteristics and dynamic adaptation requirements of cross-technology stacks. This overcomes the technical defects of current business data synchronization methods, which cannot match the heterogeneous characteristics and dynamic adaptation requirements of cross-technology stack databases, leading to data format incompatibility or data synchronization lag during the data synchronization process. Therefore, it improves the synchronization effect of business data synchronization between databases across different technology stacks.

[0118] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps. It is understood that the steps in different embodiments can be freely combined as needed, and all non-contradictory solutions formed by such combinations are within the scope of protection of this application.

[0119] Based on the same inventive concept, this application also provides a business data synchronization apparatus for implementing the business data synchronization method described above. The solution provided by this apparatus is similar to the implementation described in the above method; therefore, the specific limitations in one or more business data synchronization apparatus embodiments provided below can be found in the limitations of the business data synchronization method described above, and will not be repeated here.

[0120] In one exemplary embodiment, such as Figure 3 As shown, a business data synchronization device is provided, applied to a target service node, including: a first extraction module, a selection module, and a synchronization module, wherein:

[0121] The first extraction module is used to extract business data to be synchronized from the business message when a business message corresponding to an associated service node is detected in the message queue. The business data to be synchronized is stored in the first database bound to the associated service node, and the business message is generated by the associated service node based on the business data to be synchronized.

[0122] The selection module is used to select a target database for storing business data to be synchronized from multiple second databases bound to the target service node, based on the business mapping rules between the target service node and the associated service node. The first database and any second database belong to different technology stacks.

[0123] The synchronization module is used to synchronize business data to the target database.

[0124] In one embodiment, the first extraction module includes:

[0125] The first extraction unit is used to extract initial business data, data identification information of the initial business data, and first data timeliness information of the business object to which the initial business data belongs from the business message.

[0126] The second extraction unit is used to extract the second data timeliness information of the business object from the first database based on the data identification information;

[0127] The detection unit is used to perform timeliness detection on the initial business data based on the first data timeliness information and the second data timeliness information;

[0128] The first determining unit is used to determine the initial business data as business data to be synchronized if the initial business data is detected to meet the preset timeliness standard.

[0129] The third extraction unit is used to trigger the associated service node to push the updated business message to the message queue if the initial business data is detected to not meet the preset timeliness standard, and to extract the business data to be synchronized from the updated business message.

[0130] In one embodiment, the first data timeliness information includes a first timestamp of the initial business data, and the second data timeliness information includes a second timestamp of the latest business data of the business object; the detection unit is specifically used for:

[0131] Obtain the push cycle of the associated service node pushing business messages to the message queue; calculate the difference between the first timestamp and the second timestamp to obtain the data interval time of the business object; if the data interval time is greater than or equal to the push cycle, determine that the initial business data does not meet the preset timeliness standard, and if the data interval time is less than the push cycle, determine that the initial business data meets the preset timeliness standard.

[0132] In one embodiment, the selection module includes:

[0133] The filtering unit is used to filter at least one candidate database from multiple second databases according to business mapping rules, which matches the data type of the business data to be synchronized.

[0134] The sorting unit is used to prioritize and sort the candidate databases according to their storage characteristics to obtain the database sorting results.

[0135] The selection unit is used to select the target database from the candidate databases based on the database sorting results.

[0136] In one embodiment, the storage feature information includes storage adaptation information, storage performance information, and storage cycle information; the sorting unit is specifically used for:

[0137] A first preset weight is assigned to storage adaptation information, a second preset weight is assigned to storage performance information, and a third preset weight is assigned to storage cycle information. By integrating storage adaptation information, storage performance information, storage cycle information, the first preset weight, the second preset weight, and the third preset weight, a storage matching score for each candidate database is obtained. Based on all storage matching scores and preset sorting rules, all candidate databases are prioritized to obtain the database sorting result.

[0138] In one embodiment, the target database includes a first target database and a second target database; the selection module includes:

[0139] The fourth extraction unit is used to extract database sharding rule information from business messages;

[0140] The splitting unit is used to split the business data to be synchronized according to the database splitting rule information, so as to obtain the first business data to be synchronized stored in the first target database and the second business data to be synchronized stored in the second target database.

[0141] The storage unit is used to store the first business data to be synchronized after converting it according to the data format of the first target database, and to store the second business data to be synchronized after converting it according to the data format of the second target database.

[0142] The second determining unit is used to determine that the synchronization of the business data to be synchronized is complete when both the first target database and the second target database return a successful storage result.

[0143] In one embodiment, the device further includes:

[0144] The sending module is used to send a data migration request to the associated service node when the first database is detected to be offline.

[0145] The second extraction module is used to extract full business data from the business message when a migration message of an associated service node is detected in the message queue. The migration message is generated by the associated service node in response to the data migration request.

[0146] The determination module is used to determine the target database cluster for storing all business data from multiple secondary databases bound to the target service node;

[0147] The migration module is used to migrate all business data to the target database cluster.

[0148] Each module in the aforementioned business data synchronization device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.

[0149] In one exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 4 As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, Near Field Communication (NFC), or other technologies. When the computer program is executed by the processor, it implements a business data synchronization method. The display unit is used to form a visually visible image and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.

[0150] Those skilled in the art will understand that Figure 4 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0151] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.

[0152] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.

[0153] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0154] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.

[0155] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0156] The above embodiments are merely illustrative of several implementation methods of this application, and their descriptions are relatively specific and detailed. However, they should not be construed as limiting the scope of this application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A method for synchronizing business data, characterized in that, Applied to the target service node, the method includes: If a business message corresponding to an associated service node is detected in the message queue, business data to be synchronized is extracted from the business message. The business data to be synchronized is stored in the first database bound to the associated service node, and the business message is generated by the associated service node based on the business data to be synchronized. According to the business mapping rules between the target service node and the associated service node, a target database for storing the business data to be synchronized is selected from multiple second databases bound to the target service node, wherein the first database and any second database belong to different technology stacks; The business data to be synchronized is synchronized to the target database.

2. The method according to claim 1, characterized in that, The step of extracting the business data to be synchronized from the business message includes: Extract initial business data, data identification information of the initial business data, and first data timeliness information of the business object to which the initial business data belongs from the business message; Based on the data identification information, extract the second data timeliness information of the business object from the first database; Based on the first data timeliness information and the second data timeliness information, the initial business data is subjected to timeliness detection. If the initial business data is detected to meet the preset timeliness standard, then the initial business data is determined as the business data to be synchronized; If the initial business data is detected to not meet the preset timeliness standard, the associated service node is triggered to push the updated business message to the message queue and extract the business data to be synchronized from the updated business message.

3. The method according to claim 2, characterized in that, The first data timeliness information includes the first timestamp of the initial business data, and the second data timeliness information includes the second timestamp of the latest business data of the business object; The step of performing timeliness detection on the initial business data based on the first data timeliness information and the second data timeliness information includes: Obtain the push cycle for the associated service node to push business messages to the message queue; The data interval time of the business object is obtained by subtracting the first timestamp and the second timestamp. If the data interval is greater than or equal to the push period, it is determined that the initial business data does not meet the preset timeliness standard; if the data interval is less than the push period, it is determined that the initial business data meets the preset timeliness standard.

4. The method according to claim 1, characterized in that, The step of selecting a target database for storing the business data to be synchronized from multiple second databases bound to the target service node according to the business mapping rules between the target service node and the associated service node includes: According to the business mapping rules, at least one candidate database that matches the data type of the business data to be synchronized is selected from the plurality of second databases; Based on the storage feature information of each candidate database, the candidate databases are prioritized and sorted to obtain the database sorting result; Based on the database sorting results, the target database is selected from each of the candidate databases.

5. The method according to claim 4, characterized in that, The storage feature information includes storage adaptation information, storage performance information, and storage cycle information; the step of prioritizing and ranking the candidate databases based on their storage feature information to obtain a database ranking result includes: Assign a first preset weight to the storage adaptation information, assign a second preset weight to the storage performance information, and assign a third preset weight to the storage cycle information; By integrating the storage adaptation information, the storage performance information, the storage cycle information, the first preset weight, the second preset weight, and the third preset weight, a storage matching score for each candidate database is obtained. Based on all storage matching scores and preset sorting rules, all candidate databases are prioritized and sorted to obtain the database sorting result.

6. The method according to claim 1, characterized in that, The target database includes a first target database and a second target database; Synchronizing the business data to be synchronized to the target database includes: Extract the database sharding rule information from the business messages; According to the database sharding rules, the business data to be synchronized is split to obtain the first business data to be synchronized stored in the first target database and the second business data to be synchronized stored in the second target database. The first business data to be synchronized is stored after being converted to the data format of the first target database, and the second business data to be synchronized is stored after being converted to the data format of the second target database. If both the first target database and the second target database return a successful storage result, it is determined that the synchronization of the business data to be synchronized is complete.

7. The method according to claim 1, characterized in that, The method further includes: If the first database is detected to be offline, a data migration request is sent to the associated service node; Upon detecting the presence of a migration message for the associated service node in the message queue, extract all business data from the business message, wherein the migration message is generated by the associated service node in response to the data migration request; The target database cluster for storing the full amount of business data is determined from the multiple second databases bound to the target service node; The full volume of business data will be migrated to the target database cluster.

8. A business data synchronization device, characterized in that, Applied to a target service node, the device includes: The first extraction module is used to extract business data to be synchronized from the business message when a business message corresponding to an associated service node is detected in the message queue. The business data to be synchronized is stored in the first database bound to the associated service node, and the business message is generated by the associated service node based on the business data to be synchronized. The selection module is used to select a target database for storing the business data to be synchronized from multiple second databases bound to the target service node according to the business mapping rules between the target service node and the associated service node, wherein the first database and any second database belong to different technology stacks; The synchronization module is used to synchronize the business data to be synchronized to the target database.

9. The apparatus according to claim 8, characterized in that, The first extraction module includes: The first extraction unit is used to extract initial business data, data identification information of the initial business data, and first data timeliness information of the business object to which the initial business data belongs from the business message; The second extraction unit is used to extract the second data timeliness information of the business object from the first database based on the data identification information; The detection unit is used to perform timeliness detection on the initial business data based on the first data timeliness information and the second data timeliness information; The first determining unit is configured to determine the initial business data as the business data to be synchronized if it is detected that the initial business data meets the preset timeliness standard. The third extraction unit is used to trigger the associated service node to push the updated business message to the message queue if the initial business data is detected to not meet the preset timeliness standard, and to extract the business data to be synchronized from the updated business message.

10. The apparatus according to claim 9, characterized in that, The first data timeliness information includes a first timestamp of the initial business data, and the second data timeliness information includes a second timestamp of the latest business data of the business object; the detection unit is specifically used for: Obtain the push cycle of the associated service node pushing business messages to the message queue; calculate the difference between the first timestamp and the second timestamp to obtain the data interval time of the business object; if the data interval time is greater than or equal to the push cycle, determine that the initial business data does not meet the preset timeliness standard, and if the data interval time is less than the push cycle, determine that the initial business data meets the preset timeliness standard.

11. The apparatus according to claim 8, characterized in that, The selection module includes: The filtering unit is used to filter at least one candidate database from the plurality of second databases according to the business mapping rules, which matches the data type of the business data to be synchronized. The sorting unit is used to sort the candidate databases according to their storage feature information to obtain a database sorting result. The selection unit is used to select the target database from each of the candidate databases based on the database sorting results.

12. The apparatus according to claim 11, characterized in that, The storage feature information includes storage adaptation information, storage performance information, and storage cycle information; the sorting unit is specifically used for: Assign a first preset weight to the storage adaptation information, assign a second preset weight to the storage performance information, and assign a third preset weight to the storage cycle information; By integrating the storage adaptation information, the storage performance information, the storage cycle information, the first preset weight, the second preset weight, and the third preset weight, a storage matching score for each candidate database is obtained. Based on all storage matching scores and preset sorting rules, all candidate databases are prioritized and sorted to obtain the database sorting result.

13. The apparatus according to claim 8, characterized in that, The target database includes a first target database and a second target database; the selection module includes: The fourth extraction unit is used to extract database sharding rule information from the business message; The splitting unit is used to split the business data to be synchronized according to the database splitting rule information to obtain the first business data to be synchronized stored in the first target database and the second business data to be synchronized stored in the second target database. The storage unit is used to store the first business data to be synchronized after converting it according to the data format of the first target database, and to store the second business data to be synchronized after converting it according to the data format of the second target database. The second determining unit is used to determine that the synchronization of the business data to be synchronized is completed when both the first target database and the second target database return a successful storage result.

14. The apparatus according to claim 8, characterized in that, The device further includes: The sending module is used to send a data migration request to the associated service node when the first database is detected to be offline. The second extraction module is used to extract full business data from the business message when a migration message of the associated service node is detected in the message queue, wherein the migration message is generated by the associated service node in response to the data migration request; The determination module is used to determine the target database cluster for storing the full amount of business data from the multiple second databases bound to the target service node; The migration module is used to migrate the full amount of business data to the target database cluster.

15. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.

16. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.

17. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.

Citation Information

Cited By

  • Multi-target library real-time data synchronization method and system for electric power measurement

    CN122087013A