Method, device, program product and storage medium for ensuring data consistency
By introducing the use of message queues and Redis in Elasticsearch data synchronization, the inconsistency caused by data synchronization delay is solved, and efficient and accurate data synchronization and stability improvement is achieved.
Patent Information
- Application Number
- CN202410808911.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-21
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2044-06-21
AI Technical Summary
During high concurrent writes or large data migration, data synchronization from the source system to Elasticsearch may experience delays, resulting in data inconsistency.
By receiving the data to be compared by delayed sending the message queue with delayed transmission function, Redis stores the summary information, and judges the data consistency by comparing the summary information. If it is inconsistent, the service data will be synchronized to Elasticsearch and the delay level will be reconfigured.
It significantly improves the immediacy and accuracy of data synchronization, reduces the risk of data inconsistency, enhances the stability and maintainability of the system, and improves data governance capabilities.
Smart Images

Figure CN118673083B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer application technology, and more specifically, to a method, device, program product and storage medium for ensuring data consistency between a business system and a search engine. Background Art
[0002] Elasticsearch is an open source distributed search engine built on the Apache Lucene library and designed for high-performance, real-time full-text search and data analysis. Elasticsearch achieves efficient data storage and fast retrieval through indexing, sharding, and replication mechanisms. It is often used in log analysis, real-time monitoring, e-commerce search, big data analysis, and other scenarios.
[0003] Although Elasticsearch provides near real-time data retrieval capabilities, when there is high concurrent writing or large amounts of data migration, data synchronization from the source system to Elasticsearch may be delayed, data may be overwritten or lost, and the final data may be inconsistent. Summary of the invention
[0004] In view of the above-mentioned data inconsistency problem, the present invention provides a method, device, program product and storage medium for ensuring data consistency between a business system and a search engine.
[0005] In one aspect, an embodiment of the present invention relates to a method for ensuring data consistency between a business system and a search engine, comprising:
[0006] receiving data to be compared that is delayed and sent by a message queue with a delayed sending function, wherein the data to be compared is provided with a predetermined delay level and a comparison count;
[0007] Query the first summary information of the received data to be compared according to the business ID;
[0008] The business type and business ID of the received data to be compared are used as a key, and Redis (Remote Dictionary Server) is queried through the key to obtain the second summary information;
[0009] Comparing the first summary information with the second summary information to see if they are consistent, and if they are consistent, obtaining third summary information from the Elasticsearch server;
[0010] comparing the first summary information with the third summary information to see whether they are consistent, and if they are inconsistent, determining whether the comparison count is greater than a predetermined value;
[0011] If the comparison count is not greater than a predetermined value, the business data corresponding to the first summary information is synchronized to the Elasticsearch server, and the comparison count of the data to be compared is increased by one, the delay level is reconfigured, and the reconfigured data to be compared is sent to the message queue.
[0012] In some embodiments, the method further includes the following data synchronization processing:
[0013] Receive business data generated by producers, and generate summary information for the received business data;
[0014] Encapsulating the data to be compared, and sending the encapsulated data to be compared to a message queue with a delayed sending function, wherein the data to be compared includes summary information generated from the service data to be received, the summary information included in the data to be compared serves as the first summary information, and is configured with the comparison count and the delay level;
[0015] The summary information generated from the received business data is stored in Redis, and the summary information in Redis is used as the second summary information;
[0016] The business data and the summary information generated from the received business data are synchronized to the Elasticsearch server, and the summary information in the Elasticsearch server is used as the third summary information, wherein the business data is operated by the Elasticsearch client, and the business data after the operation is also synchronized to the Elasticsearch server.
[0017] In some embodiments, the method further includes: ending the process if the first summary information is inconsistent with the second summary information.
[0018] In some embodiments, the method further includes: if the first summary information is consistent with the third summary information, deleting the second summary information in Redis and ending the process.
[0019] In some embodiments, the method further includes: if the comparison count is greater than a predetermined value, the comparison fails, the second summary information in Redis is deleted, and the business data that failed the comparison is saved in a database.
[0020] In some embodiments, the message queue with delayed sending function includes RocketMQ message queue. RocketMQ is a low-latency, high-concurrency, high-availability, and high-reliability distributed message middleware provided by Apache.
[0021] In some embodiments, receiving the business data generated by the producer includes:
[0022] The business data generated by the producer is sent to the RocketMQ message queue, and the business data sent through the RocketMQ message queue is received.
[0023] In some embodiments, the received business data is used to generate summary information using the MD5 information digest algorithm.
[0024] In some embodiments, as the comparison count increases, the delay level also increases.
[0025] In some embodiments, the method further comprises:
[0026] Query the database used to store the business data that failed the comparison;
[0027] If data exists, the user information table associated with each business is queried according to the business data grouping, and an early warning notification is sent according to the contact information in the user information table.
[0028] In some embodiments, a task scheduling center may be used to configure a scheduled task, trigger the scheduled task at a predetermined time, such as 1 hour, call a system warning API, and execute the query operation through the API.
[0029] On the other hand, an embodiment of the present invention relates to a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are executed by a processor to implement the method described in any one of the embodiments of the present invention.
[0030] In addition, an embodiment of the present invention relates to a computer device, which includes a memory and a processor.
[0031] The memory stores computer-executable instructions, and the processor executes the computer-executable instructions to implement the method described in any embodiment of the present invention.
[0032] In addition, an embodiment of the present invention provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the method described in any one of the embodiments of the present invention is implemented.
[0033] Compared with the prior art, the present invention has the following effects and advantages:
[0034] 1. Improve the immediacy and accuracy of data synchronization: By using RocketMQ message queue as an efficient synchronization mechanism for middleware, the time delay from data generation to indexing is significantly reduced, and the real-time nature of data is improved. At the same time, the order of messages and the retry mechanism ensure the accuracy of data synchronization. Even in the case of network fluctuations or short-term system failures, data consistency can be achieved, thereby improving the overall accuracy and reliability of business data.
[0035] 2. Enhanced system stability and maintainability: The introduction of the producer-consumer model effectively decouples the direct connection between the business system and Elasticsearch, allowing both to be upgraded and maintained independently, improving the stability and scalability of the system. In addition, this design reduces direct dependencies, making it easier to manage the complexity of the system and reducing maintenance costs.
[0036] 3. Reduce the risk of data inconsistency and improve data governance capabilities: The implementation of the triggered data comparison mechanism proactively discovers and repairs data inconsistencies, avoids decision-making errors or service quality degradation due to data differences, and enhances data quality management. The long-term operation of the comparison and repair process provides strong support for data governance and ensures the health and availability of data assets.
[0037] 4. Error handling and monitoring: Discover potential problems in advance and respond quickly, reduce the window period of data inconsistency, and improve the overall stability and reliability of the system.
[0038] In summary, the present invention not only significantly improves the efficiency and quality of data synchronization through innovative data synchronization mechanism and data comparison and repair strategy, but also enhances the stability and security of the system, reduces operating costs, and improves overall business continuity and user experience.
[0039] Various aspects, features, advantages, etc. of the embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings. According to the following detailed description in conjunction with the accompanying drawings, the above aspects, features, advantages, etc. of the present invention will become more clear. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 is a flow chart of a method for ensuring data consistency between a business system and a search engine according to an exemplary embodiment of the present invention.
[0041] Figure 2 is a timing diagram of a data synchronization mechanism according to an exemplary embodiment of the present invention.
[0042] Figure 3 is a flow chart of a method for ensuring data consistency between a business system and a search engine according to another exemplary embodiment of the present invention. DETAILED DESCRIPTION
[0043] Hereinafter, exemplary embodiments will be described in more detail with reference to the accompanying drawings. However, the present invention may be embodied in various different forms and should not be construed as being limited to the embodiments shown herein. On the contrary, these embodiments are provided as examples so that the present disclosure will be thorough and comprehensive, and will fully convey the various aspects and features of the present invention to those skilled in the art. Therefore, processes, elements, and techniques that are not necessary for a person of ordinary skill in the art to fully understand the various aspects and features of the present invention may not be described. Unless otherwise stated, similar reference numerals represent similar elements throughout the drawings and text descriptions, and therefore, their descriptions may not be repeated. In addition, the features or aspects within each exemplary embodiment should generally be considered to be other similar features or aspects that can be used in other exemplary embodiments.
[0044] The terms used herein are for the purpose of describing a specific embodiment, rather than for limiting the present invention. As used herein, "one" and "the" are intended to also include plural forms, unless the context clearly indicates otherwise. It should also be understood that the terms "comprising", "including" and "having" specify the existence of stated features, wholes, steps, operations, elements and / or parts when used in this specification, but do not exclude the existence or addition of one or more other features, wholes, steps, operations, elements, parts and / or their sets. As used herein, the term "and / or" includes any and all combinations of one or more of the associated listed items. Expressions such as "at least one of..." modify the entire list of elements when they are before the list of elements, rather than modifying the individual elements of the list. Similarly, unless the context clearly indicates, the terms "first", "second" and other such digital terms referring to structures do not mean order or sequence. Digital markings such as S101, S102, S201 are only used to correspond processing, steps or operations, etc. to the accompanying drawings, and do not necessarily represent the execution order of processing, operations or steps, etc.
[0045] Figure 1 An exemplary embodiment of the method for ensuring data consistency between a business system and a search engine of the present invention is shown. In the exemplary embodiment, Figure 1 As shown, the method includes:
[0046] S101, receiving data to be compared that is delayed and sent by a message queue with a delayed sending function, wherein the data to be compared is provided with a predetermined delay level and a comparison count;
[0047] S102, querying summary information of the received data to be compared according to the service ID as first summary information;
[0048] S103, using the received business type and business ID of the data to be compared as a KEY, querying Redis (Remote Dictionary Server) through the KEY to obtain summary information as second summary information;
[0049] S104, comparing the first summary information with the second summary information to see whether they are consistent;
[0050] S105, if the two are consistent, obtaining summary information from the Elasticsearch server as third summary information;
[0051] S106, comparing the first summary information with the third summary information to see whether they are consistent;
[0052] S107, if the two are inconsistent, determining whether the comparison count is greater than a predetermined value;
[0053] S108: If the comparison count is not greater than a predetermined value, the business data corresponding to the first summary information is synchronized to the Elasticsearch server again, and the comparison count of the data to be compared is increased by one, the delay level is reconfigured, and the reconfigured data to be compared is sent to the message queue.
[0054] In some embodiments, the message queue with delayed sending function includes a RocketMQ message queue.
[0055] In some embodiments, the data comparison process is performed by configuring a contrast compensation system, which may be a computer or a server, or a program or software running on the computer or the server.
[0056] In some embodiments, before performing the above-mentioned data comparison processing, the business data generated by the producer is synchronized to RocketMQ, Redis and Elasticsearch, and then the above-mentioned data comparison processing is performed to actively discover and repair data inconsistency problems.
[0057] In some embodiments, Figure 2 As shown, the data synchronization includes:
[0058] The business data generated by the producer (such as the client) is sent to the RocketMQ message queue, and the comparison compensation system receives the business data sent through the RocketMQ message queue;
[0059] The comparison compensation system generates summary information from the received business data through the MD5 information summary algorithm;
[0060] Encapsulate the data to be compared, and send the encapsulated data to be compared to the message queue with delayed sending function, wherein the data to be compared includes summary information and is configured with the comparison count and the delay level; RocketMQ supports 18 levels of delayed messages, each level represents a different delay time range (the 18 levels correspond to delay durations of 1s, 5s, 10s, 30s, 1m, 2m, 3m, 4m, 5m, 6m, 7m, 8m, 9m, 10m, 20m, 30m, 1h, 2h, respectively). For example, if the delay level is set to 3, it means that the first data comparison will be performed after 10 seconds;
[0061] Storing the summary information in Redis;
[0062] The business data and the summary information are synchronized to the Elasticsearch server, wherein the business data is operated through the Elasticsearch client, and the operated business data is also synchronized to the Elasticsearch server.
[0063] In some embodiments, the operations performed on business data by the client of the Elasticsearch include adding, modifying, and deleting. The newly added and modified business data include the generated summary information. If it is a deletion operation and no summary information is found from Elasticsearch when performing the data comparison process, the data in Elasticsearch has been deleted, indicating that the data comparison is consistent, otherwise it is inconsistent.
[0064] By using RocketMQ message queue as an efficient synchronization mechanism for middleware, the time delay from data generation to indexing is significantly reduced, and the real-time nature of data is improved. At the same time, the order of messages and the retry mechanism ensure accurate data synchronization, and even in the case of network fluctuations or short-term system failures, data consistency can be achieved, thereby improving the overall accuracy and reliability of business data.
[0065] In some embodiments, in process S104, if the first summary information is inconsistent with the second summary information, the process ends.
[0066] In some embodiments, in process S106, if the first summary information is consistent with the third summary information, the second summary information in Redis is deleted and the process ends.
[0067] In some embodiments, in process S108, if the comparison count is greater than a predetermined value, the comparison fails, the second summary information in Redis is deleted, and the business data that failed the comparison is saved in the database.
[0068] In some embodiments, as the comparison count increases, the delay level also increases. For example, in process S108, a delay level with a longer delay time is reconfigured.
[0069] In some embodiments, the method further comprises:
[0070] Query the database used to store the business data that failed the comparison;
[0071] If data exists, the user information table associated with each business is queried according to the business data grouping, and an early warning notification is sent according to the contact information in the user information table.
[0072] In some embodiments, a task scheduling center may be used to configure a scheduled task, trigger the scheduled task at a predetermined time, such as 1 hour, call a system warning API, and execute the query operation through the API.
[0073] The implementation of this triggered data comparison mechanism proactively discovers and repairs data inconsistencies, avoids decision-making errors or service quality degradation caused by data differences, and enhances data quality management. The long-term operation of the comparison and repair process provides strong support for data governance and ensures the health and availability of data assets.
[0074] Now turn to Figure 3 , which shows another exemplary embodiment of the method for ensuring data consistency between a business system and a search engine of the present invention.
[0075] In this exemplary embodiment, Figure 3 As shown, the method for ensuring data consistency between the business system and the search engine includes:
[0076] S201, receiving a comparison message carrying business data to be compared from a RocketMQ message queue, and querying summary information of the business data, that is, a message summary (first summary information), according to the business primary key ID.
[0077] S202, querying the business data summary information in Redis according to the KEY, that is, the Redis summary (second summary information), wherein the KEY is generated according to the business type and the business ID.
[0078] S203, compare the message digest and the redis digest. If they are inconsistent, it means that an updated message has entered Redis, and this comparison is ignored and the comparison ends; if they are consistent, enter S204.
[0079] S204, obtaining summary information from ES (Elasticsearch), that is, ES summary (third summary information).
[0080] S205, compare the message digest and the ES digest, if they are consistent, execute S206, otherwise go to S207
[0081] If the deletion operation of the business data is performed through the Elasticsearch client, no summary is found from the Elasticsearch in process S204, indicating that the data in the Elasticsearch has been deleted, and the comparison result is consistent, otherwise it is inconsistent.
[0082] If the business data is added or modified through the Elasticsearch client, and the comparison result of S205 is consistent, it means that the business data is consistent, otherwise it is inconsistent.
[0083] S206, deleting the summary information in Redis, and the comparison ends.
[0084] S207, determining whether the comparison count is greater than a predetermined number (for example, whether the comparison count is greater than 3 times).
[0085] S208, if the number of comparisons is greater than 3, the summary information in Redis is deleted, and the business data message that failed the comparison is saved to the database (DB), and the comparison ends.
[0086] S209: If the number of comparisons is not greater than 3 times, the business data is synchronized to the Elasticsearch server again.
[0087] S210, adding 1 to the comparison times, setting the delay level of the message of the business data that failed the comparison according to the comparison times, and sending the message to the RocketMQ message queue to wait for the second comparison.
[0088] In some embodiments, the delay level increases with the number of comparisons. For example, if the delay level is 4, the delay level of the third comparison is 5.
[0089] In an optional embodiment, a scheduled task is configured using a task scheduling center, the scheduled task is triggered every hour, the system warning API is called, and the information of the business data message database table that failed the comparison is queried through the API. If there is no data, it means that there is no inconsistent data for comparison, and no manual intervention is required. If there is data, the user information table associated with each business is queried according to the business data grouping, and the warning email, SMS and other notifications are sent according to the contact information in the user information table. Through manual intervention, it is ensured that the problem can be solved in a timely manner to avoid data loss or error accumulation in the data processing link.
[0090] The above adopts a more efficient and reliable synchronization mechanism, using RocketMQ message queue as middleware to realize data transmission in producer-consumer mode. This not only decouples the direct dependency between the data generation system and Elasticsearch, but also provides message persistence, order guarantee and retry mechanism. Establish a triggered data comparison mechanism to identify and repair data inconsistencies and maintain data accuracy in the long term.
[0091] The present invention fundamentally improves the efficiency and reliability of synchronization between Elasticsearch and business data, and effectively alleviates the problem of data inconsistency. It not only shortens the time window of data asynchrony, but also ensures the long-term accuracy and reliability of data through active identification and repair mechanisms, providing a solid foundation for applications that rely on real-time data, thereby comprehensively improving the business value and user satisfaction of the system.
[0092] In order to facilitate those skilled in the art to understand the present invention, the following takes the client sending order information data as an example, assuming that the delay time of the delay comparison message is 10 seconds (that is, the RocketMQ delay level is 3), to illustrate the data comparison method of the present invention.
[0093] 08:00:00 The client sends business data, order number: A, status: 01, summary: A-01;
[0094] The comparison compensation system encapsulates the delay comparison message A1 according to the business data. The comparison time of the delay comparison message A1 is 08:00:10. The delay comparison message A1 is delivered to the RocketMQ message queue, and Redis and Elasticsearch are added successfully. At this time, the summaries in Redis and Elasticsearch are both A-01.
[0095] At 08:00:02, the client sends business data again, with order number: A, status: 02, and summary A-02; the comparison compensation system delivers the delay comparison message to the RocketMQ message queue, with message A2, successfully updates the Redis summary, but fails to update the Elasticsearch summary. At this time, the summary in Redis is A-02, and the summary in Elasticsearch is A-01. Assume that the comparison time of the delay comparison message A2 is 08:00:12.
[0096] 08:00:10 The comparison compensation system receives the comparison message A1 sent by the RocketMQ message queue. The digest obtained in the comparison message A1 is A-01, and the Redis digest obtained is A-02. The comparison finds that the digests are different, indicating that new data has been updated and this comparison is ignored.
[0097] At 08:00:12, the comparison compensation system receives the comparison message A2 sent by the RocketMQ message queue, obtains the summary in the comparison message A2 as A-02, obtains the Redis summary as A-02, and the summaries are the same. Then, the summary obtained from Elasticsearch is A-01, which is inconsistent. The Elasticsearch summary is updated to A-02, and it succeeds. The comparison count is increased by 1, and the delay comparison message A3 is delivered to RocketMQ again. The comparison time of delay comparison message A3 is 08:00:22.
[0098] 08:00:22 The comparison compensation system receives the comparison message A3 sent by the RocketMQ message queue, obtains the summary of the comparison message A3 as A-02, obtains the Redis summary as A-02, and the summaries are the same. Then, the summary obtained from Elasticsearch is A-02, which is consistent. The summary information in Redis is deleted, and the comparison ends.
[0099] As can be seen from the above, when the comparison finds that the summary of the message is inconsistent with the summary in Elasticsearch, the data in Elasticsearch is updated and waits for the next comparison to ensure that the business data is consistent with the data in the search engine (Elasticsearch).
[0100] The methods, steps, processing, operations, etc. involved in the above embodiments can be stored on a computer-readable storage medium through computer-executable instructions, and the computer-executable instructions are executed by a processor to implement the methods, steps, processing, operations, etc. described in any embodiment of the present invention.
[0101] In addition, the methods, steps, processing, operations, etc. involved in the above embodiments can be executed by a computer device. For example, the contrast compensation system can be or be installed on the computer device, which includes a memory and a processor. The memory stores computer executable instructions, and the processor executes the computer executable instructions to implement the method described in any embodiment of the present invention.
[0102] Furthermore, the methods, steps, processing, operations, etc. involved in the above embodiments may be implemented through a computer program. The computer program may be included in a computer program product. When the computer program is executed by a processor, the method described in any embodiment of the present invention is implemented.
[0103] The hardware and data processing components for performing various processes, operations, example logic, logic blocks, program blocks, modules and circuits related to the embodiments disclosed herein may be implemented or executed using a general purpose single-chip or multi-chip processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination thereof to perform the functions described herein. A general purpose processor may be a microprocessor, or any conventional processor, controller, microcontroller or state machine. The processor may also be implemented as a combination of computing devices, such as a combination of a DSP and a microprocessor, a plurality of microprocessors, a combination of one or more microprocessors and a DSP core, or any other such configuration. In some embodiments, specific processes and methods may be performed by circuits dedicated to specific functions. A memory (e.g., memory, storage unit, storage device) may include one or more devices (e.g., RAM, ROM, flash memory, hard disk storage) for storing data and / or computer code to complete or facilitate the various processes, layers and modules described in the disclosure herein. The memory may be or include volatile memory or non-volatile memory and may include a database component, an object code component, a script component, or any other type of information structure to support the various activities and information structures described herein. According to an exemplary embodiment, the memory is communicatively connected to the processor via a processing circuit and includes computer code for executing (e.g., by a processing circuit or processor) one or more processes described herein.
[0104] The methods, systems and program products of the embodiments of the present invention can perform various operations on any machine-readable medium. The embodiments of the present invention can be implemented using an existing computer processor, or implemented by a dedicated computer processor for an appropriate system (incorporated for this purpose or another purpose), or implemented by a hard-wired system. The embodiments disclosed herein include a program product, which includes a machine-readable medium for carrying or having a machine-executable instruction or data structure stored thereon. Such a machine-readable medium can be any available medium that can be accessed by a general or special-purpose computer or other machine with a processor. For example, such a machine-readable medium can include RAM, ROM, EPROM, EEPROM or other optical disk storage device, magnetic disk storage device or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of a machine-executable instruction or data structure (the medium can be accessed by a general or special-purpose computer or other machine with a processor). The above combination is also included in the scope of the machine-readable medium. Machine executable instructions include, for example, instructions and data that cause a general-purpose computer, a special-purpose computer or a special-purpose processing machine to perform a specific function or function group.
[0105] Although the drawings and description may show method steps in a particular order, the order of these steps may be different from that shown and described, unless otherwise specified above. In addition, two or more steps may be performed simultaneously or partially simultaneously, unless otherwise specified above. Such variations may depend on, for example, the selected software and hardware systems and the designer's choice. All of these variations are within the scope of this disclosure. Similarly, software implementations of the described methods can be accomplished using standard programming techniques with rule-based logic and other logic to implement various connection steps, processing steps, comparison steps, and decision steps.
[0106] Those skilled in the art should understand that what is disclosed above is only an implementation mode of the present invention, and it certainly cannot be used to limit the scope of rights for which the present invention is requested for patent protection. Equivalent changes made according to the implementation mode of the present invention are still within the scope covered by the claims of the present invention.
Claims
1. A method for ensuring data consistency between a business system and a search engine, comprising: receiving data to be compared that is delayed and sent by a message queue with a delayed sending function, wherein the data to be compared is provided with a predetermined delay level and a comparison count; Query the first summary information of the received data to be compared according to the business ID; The business type and business ID of the received data to be compared are used as a KEY, Redis is queried through the KEY, and the second summary information is obtained from Redis; Comparing the first summary information with the second summary information to see if they are consistent, and if they are consistent, obtaining third summary information from the Elasticsearch server; comparing the first summary information with the third summary information to see whether they are consistent, and if they are inconsistent, determining whether the comparison count is greater than a predetermined value; If the comparison count is not greater than a predetermined value, the business data corresponding to the first summary information is synchronized to the Elasticsearch server, and the comparison count of the data to be compared is increased by one, the delay level is reconfigured, and the reconfigured data to be compared is sent to the message queue.
2. The method according to claim 1, characterized in that Also includes: Receive business data generated by producers, and generate summary information for the received business data; Encapsulating the data to be compared, and sending the encapsulated data to be compared to a message queue with a delayed sending function, wherein the data to be compared includes summary information generated from the service data to be received, the summary information included in the data to be compared serves as the first summary information, and is configured with the comparison count and the delay level; The summary information generated from the received business data is stored in Redis, and the summary information in Redis is used as the second summary information; The business data and the summary information generated from the received business data are synchronized to the Elasticsearch server, and the summary information in the Elasticsearch server is used as the third summary information, wherein the business data is operated by the Elasticsearch client, and the business data after the operation is also synchronized to the Elasticsearch server.
3. The method according to claim 1 or 2, characterized in that Also includes: If the first summary information is inconsistent with the second summary information, the process ends.
4. The method according to claim 1 or 2, characterized in that: Also includes: If the first summary information is consistent with the third summary information, the second summary information in Redis is deleted and the process ends.
5. The method according to claim 1 or 2, characterized in that: Also includes: If the comparison count is greater than a predetermined value, the comparison fails, the second summary information in Redis is deleted, and the business data that failed the comparison is saved in the database.
6. The method according to claim 1, characterized in that The message queue with delayed sending function includes a RocketMQ message queue.
7. The method according to claim 2, characterized in that The receiving business data generated by the producer includes: The business data generated by the producer is sent to the RocketMQ message queue, and the business data sent through the RocketMQ message queue is received.
8. The method according to claim 2, characterized in that The received business data is generated into summary information through the MD5 information digest algorithm.
9. The method according to claim 1, characterized in that As the comparison count increases, the delay level also increases.
10. The method according to claim 1, characterized in that Also includes: Query the database used to store the business data that failed the comparison; If data exists, the user information table associated with each business is queried according to the business data grouping, and an early warning notification is sent according to the contact information in the user information table.
11. A computer-readable storage medium storing computer-executable instructions, characterized in that: The computer executable instructions are executed by a processor to implement the method according to any one of claims 1 to 10.
12. A computer device comprising a memory and a processor, The memory stores computer executable instructions, characterized in that: The processor executes the computer executable instructions to implement the method of any one of claims 1 to 10.
13. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 10 is implemented.
Citation Information
Patent Citations
Picture synchronization method and device, electronic equipment and readable storage medium
CN113656618A
Service data synchronization method and device, electronic equipment and storage medium
CN117874126A