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

By monitoring the callback information of the database and utilizing the Entity Callback mechanism of the Spring Data MongoDB module, high real-time synchronization between the database and the search engine is achieved, solving the problems of poor synchronization real-time performance and high architectural complexity in the existing technology, and reducing resource consumption and technical barriers.

CN120744007APending Publication Date: 2025-10-03RENLIJIA NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510829114.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-19
Publication Date
2025-10-03

AI Technical Summary

Technical Problem

In the prior art, data synchronization between databases and search engines has problems such as poor real-time performance, high system resource consumption, high architectural complexity, and high technical barriers.

Method used

By monitoring database callback information, changing data can be synchronized to the search engine in real time. The Entity Callback mechanism of the Spring Data MongoDB module can be used to simplify the architecture and reduce development difficulty and learning costs.

Benefits of technology

It achieves high real-time synchronization between the database and the search engine, simplifies the system architecture, and reduces resource consumption and technical barriers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120744007A_ABST
    Figure CN120744007A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of data synchronization, in particular to a data synchronization method, device and equipment and a computer readable storage medium. The data synchronization method comprises the following steps: monitoring a database; determining changed data corresponding to the callback information under the condition that the callback information of the change operation on the data in the database is monitored; and synchronizing the changed data into the search engine.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of data synchronization, and in particular to a data synchronization method, apparatus, device, and computer-readable storage medium. Background Art

[0002] Due to different data processing requirements, different engines can be selected for processing. Databases (such as MongoDB) generally have flexible data storage structures and strong scalability, while search engines (such as ElasticSearch) have excellent search performance and real-time analysis capabilities.

[0003] However, since the database and the search engine are not interoperable, the search engine needs to be synchronized after the data in the database is changed.

[0004] Related technologies can capture data change information through database operation logs, and then use specialized tools or middleware to parse the logs to synchronize changes. This synchronization method is complex in architecture, requires additional middleware, is costly and complex, and has a high technical threshold and learning curve. Summary of the Invention

[0005] To overcome the problems existing in the related art, the present disclosure provides a data synchronization method, apparatus, device and computer-readable storage medium, which can solve the above problems.

[0006] According to a first aspect of an embodiment of the present disclosure, a data synchronization method is provided, comprising: monitoring a database; upon receiving callback information of an operation to change data in the database, determining the changed data corresponding to the callback information; and synchronizing the changed data to a search engine.

[0007] According to a second aspect of an embodiment of the present disclosure, a data synchronization device is provided, comprising: a monitoring unit configured to monitor a database; a determination unit configured to, upon monitoring callback information of a change operation on data in the database, determine the changed data corresponding to the callback information; and a synchronization unit configured to synchronize the changed data to a search engine.

[0008] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, comprising: a processor and a memory; the memory is used to store a computer program; and the processor is used to execute the data synchronization method as described in the first aspect by calling the computer program.

[0009] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the program is executed by a processor, the data synchronization method as described in the first aspect is implemented.

[0010] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the method as described in the first aspect is implemented.

[0011] The technical solutions provided by the embodiments of the present disclosure may have the following beneficial effects:

[0012] The present disclosure can monitor a database and, upon receiving callback information regarding a change operation to data in the database, can determine the corresponding changed data based on the callback information and synchronize the changed data to the search engine, thereby achieving synchronization between the search engine and the database. The present disclosure does not require obtaining operation logs, thus avoiding the need to identify changed data from the operation logs. Furthermore, the present disclosure does not require additional middleware to process the logs. Instead, synchronization is performed based on the callback information returned after the database change operation is implemented. This provides high real-time performance, a simple architecture, and ease of implementation.

[0013] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0015] Figure 1 It is a schematic flow chart of a data synchronization method according to an exemplary embodiment of the present disclosure.

[0016] Figure 2 It is a module diagram of a data synchronization method according to an exemplary embodiment of the present disclosure.

[0017] Figure 3 It is a structural diagram of a data synchronization system according to an exemplary embodiment of the present disclosure.

[0018] Figure 4 The present invention is a block diagram showing a data synchronization device according to an exemplary embodiment of the present invention.

[0019] Figure 5 It is a schematic block diagram of a data synchronization device according to an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION

[0020] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all possible embodiments consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.

[0021] The terms used in this disclosure are for the purpose of describing specific embodiments only and are not intended to limit the disclosure. As used in this disclosure and the appended claims, the singular forms "a," "an," "the," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and / or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.

[0022] It should be understood that although the terms first, second, third, etc. may be used in this disclosure to describe various information, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other. For example, without departing from the scope of this disclosure, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining."

[0023] Related technologies have proposed two solutions to solve the problem of data synchronization between databases and search engines.

[0024] Solution 1: Scheduled task synchronization.

[0025] This solution typically uses a scheduled task framework to query data from the database at preset intervals (e.g., 5 minutes). You can query the database for data that has changed since the last data synchronization and synchronize this data to the search engine. Alternatively, you can query the entire database, compare it with the last synchronized data, identify the changed data, and synchronize the changed data to the search engine.

[0026] The problem with solution 1 is that it lacks real-time performance. The scheduled task framework can only synchronize data at preset intervals and cannot synchronize data in real time after database data changes. In scenarios where data changes frequently, there will be a significant delay between the data in the search engine and the data in the database.

[0027] Solution 1 requires querying and comparing a large amount of data in the database each time a scheduled task is executed. Therefore, even if only a small amount of data changes, data synchronization will consume a large amount of system resources.

[0028] Solution 2: Data synchronization based on operation logs.

[0029] After a database modification is completed, it can record the modification in an operation log. Therefore, the modified data can be identified through the database operation log. This can be achieved by setting up specific tools or middleware to access the database operation log, further extract the data modification records recorded in the operation log, and then synchronize the identified data modification operations with the search engine.

[0030] Compared with Solution 1, Solution 2 solves the real-time synchronization problem to a certain extent. However, Solution 2 requires additional middleware to process database logs, resulting in a more complex architecture, which increases the system's architectural complexity and maintenance costs. Furthermore, for technical personnel, using Solution 2 requires mastering and configuring data synchronization methods based on operation logs. Relatively speaking, obtaining operation logs and determining changed data from them has a relatively high technical threshold and learning cost.

[0031] In order to solve the above technical problems, the present disclosure proposes a data synchronization method.

[0032] Figure 1 This is a schematic flow chart of a data synchronization method according to an embodiment of the present disclosure. The data synchronization method can be executed by a server or a terminal deployed with a server.

[0033] like Figure 1 As shown, the data synchronization method includes:

[0034] In step S101, the database is monitored;

[0035] In step S102, when a callback message of a change operation on data in the database is monitored, the data changed by the change operation corresponding to the callback message is determined;

[0036] In step S103, the changed data is synchronized to the search engine.

[0037] In some embodiments, the server may monitor the database.

[0038] The database can store business data, including structured data and / or semi-structured data. Based on the database, the stored business data can be modified.

[0039] According to this embodiment, when data needs to be modified, the database will receive a modification instruction, which is used to instruct the modification operation to be performed on the data to be modified. Therefore, the database can be monitored to determine whether the database has modified the data, and real-time data synchronization can be achieved by real-time monitoring of the database.

[0040] In some embodiments, the database may be built based on a data access framework.

[0041] The data access framework can provide a consistent programming model. The database is built based on the programming model provided by the data access framework, which can reduce the amount of code that database developers need to write to interact with the underlying data source.

[0042] Based on the data access framework, some data access frameworks include a monitoring mechanism, which can be used to monitor the database.

[0043] In some embodiments, when callback information of a change operation on data in the database is monitored, the data changed by the change operation corresponding to the callback information is determined.

[0044] After executing the change instruction and performing the change operation on the data to be changed, the database can return callback information (such as confirmation information) to the instruction sender to inform the instruction sender that the change operation is completed.

[0045] Therefore, the callback information can be monitored. When the callback information is monitored, it indicates that data in the database has been changed and needs to be synchronized to the search engine.

[0046] When the callback information is monitored, the change operation and the changed data corresponding to the change can be determined based on the callback information.

[0047] In some embodiments, the changed data is synchronized to a search engine.

[0048] After determining the changed data and the change operation, the changed data and the change operation can be synchronized to the search engine. For example, a synchronization instruction can be sent to the search engine to instruct the search engine to perform the change operation on the changed data, thereby achieving data synchronization for the changed data.

[0049] In some embodiments, the search engine may also be built based on the data access framework.

[0050] Search engines can also be built based on a data access framework. Furthermore, the same data access framework as the database can be used to make the underlying code of the database and the search engine communicate, making it easier to call both and synchronize the changed data to the search engine after determining the changed data in the database.

[0051] The present disclosure can monitor the database to synchronize data in real time when the database data changes. The callback information returned by the database after the change operation is completed can be monitored. When the callback information is determined, the changed data corresponding to the change operation can be determined based on the callback information, and the changed data can be synchronized to the search engine.

[0052] Since the database will immediately return callback information after completing the change operation, the real-time performance of data synchronization can be improved based on the monitoring of callback information. Compared with determining the changed data by identifying the operation log (Solution 2), the present invention determines the changed data based on callback information. There is no need to set up middleware to obtain the operation log, nor is there any need to identify and determine the changed data from the operation log. The architecture is simpler, the implementation is more convenient, and the development difficulty and learning cost are reduced.

[0053] In some embodiments, the method further includes: determining a change operation corresponding to the callback information, wherein the change operation includes at least one of the following: inserting data, updating data, and deleting data.

[0054] The callback information can be used to determine the corresponding changed data and the corresponding change operation. Change operations include inserting, updating, and deleting data. Therefore, the actual changes to the data in the database are inserts, updates, and deletes of the changed data.

[0055] In some embodiments, synchronizing the changed data to the search engine includes: synchronizing the changed data to the search engine according to the change operation corresponding to the callback information.

[0056] After the change operation is determined according to the callback information, a synchronization instruction may be generated according to the change operation and the changed data. The synchronization instruction is used to instruct the search engine to execute the change operation on the changed data.

[0057] In some embodiments, the search engine may also return synchronization callback information after completing the synchronization instruction.

[0058] Based on the returned synchronization callback information, it can be confirmed that the search engine has completed data synchronization.

[0059] If no synchronization callback information is received, it means that the synchronization has failed. You can further choose to send the synchronization instruction to the search engine again, or issue a prompt to check the reason for the search engine synchronization failure and troubleshoot it.

[0060] In some embodiments, performing the change operation on the data in the database through a data access framework, and synchronizing the changed data to the search engine includes: synchronizing the changed data to the search engine based on the data access framework.

[0061] Databases and search engines can be built on the same data access framework. The access framework can provide integrated support modules for databases and search engines to simplify the operations of technical personnel using databases and search engines through the data access framework.

[0062] The data access framework may not include a database or a search engine, but may be adapted as an intermediate layer.

[0063] Technicians can use the data access framework to issue change instructions to the database, instructing the database to perform the change operation on the data to be changed. After the database completes the change operation, it can return a callback message to the data access framework.

[0064] The data access framework can determine the changed data and the change operation based on the callback information, and synchronize the changed data to the search engine based on the interface between the data access framework and the search engine.

[0065] In some embodiments, the data access framework includes a callback interface, and the callback information of the data change operation monitored includes: monitoring the callback information based on the callback interface, wherein, after the database implements the data change operation, the callback information is returned to the data access framework through the callback interface.

[0066] The data access framework may include a callback interface, through which the database may return callback information to the data access framework. The data access framework may include a monitoring module to monitor the callback information.

[0067] In some embodiments, the method further includes: performing format conversion on the changed data to convert the format of the changed data into a data format corresponding to the search engine.

[0068] After the changed data is determined, since the data formats of the database and the search engine may be different, the changed data may be format converted to convert the format of the changed data from the data format corresponding to the database to the data format corresponding to the search engine.

[0069] When the database and search engine are adapted based on the same data access framework, the data access framework can convert the data format. After determining the changed data, the data access framework can implement the data format change based on the search engine's support module.

[0070] Figure 2 It is a module diagram showing a data synchronization method according to an embodiment of the present disclosure.

[0071] In some embodiments, the data access framework includes Spring Data, the database includes MongoDB, and the search engine includes ElasticSearch.

[0072] like Figure 2 As shown, the database MongoDB and the search engine ElasticSearch are both adapted to the data access framework Spring Data. The data access framework Spring Data includes a support module Spring Data MongoDB module corresponding to the MongoDB database.

[0073] The Spring Data MongoDB module provides Spring applications with MongoDB database integration and simplifies MongoDB data access operations. This module provides an Entity Callback mechanism, which enables the MongoDB database to return callback information to the Spring Data MongoDB module after performing an operation.

[0074] The Spring Data MongoDB module, based on the Entity Callback mechanism, can obtain callback information returned by the MongoDB database after completing a change operation on the changed data. The monitoring component of the data synchronization system proposed in this disclosure can monitor and obtain this callback information, and use it to monitor data insertion, update, and deletion operations in the MongoDB database.

[0075] After obtaining the callback information, the listening component can send the callback information to the data processing component. The data processing component can process the callback information to obtain the changed data and / or change operations, and then perform data conversion based on needs to convert the data format that conforms to MongoDB into a format acceptable to the ElasticSearch search engine, and send the converted data to the synchronization component.

[0076] The synchronization component can synchronize the received changed data (and / or change operations) to the ElasticSearch search engine.

[0077] This embodiment utilizes the Entity Callback mechanism of the Spring Data MongoDB module, so that data changes in MongoDB can be monitored in real time and the changed data can be synchronized to the ElasticSearch search engine, thereby improving the real-time performance of data synchronization.

[0078] Furthermore, since the callback information is returned only after the MongoDB database completes the data change operation, data synchronization can be guaranteed only after the data has changed, avoiding the query and comparison of large amounts of data caused by the scheduled triggering of synchronization tasks, and reducing resource consumption.

[0079] Since the system, database, and search engine corresponding to this method are all based on the Spring Data framework, no additional middleware is required to process the database operation log. The EntityCallback mechanism provided by the Spring Data MongoDB module is used to achieve data synchronization, which simplifies the system architecture and reduces maintenance costs.

[0080] Finally, technicians can easily implement the data synchronization method proposed in this disclosure based on the Spring Data MongoDB module and Spring program, reducing development difficulty and learning costs.

[0081] Figure 3 It is a structural diagram of a data synchronization system according to an embodiment of the present disclosure.

[0082] like Figure 3 As shown, in some embodiments, the data synchronization system includes:

[0083] The SrpingBoot application 310 may provide a relevant interface as an entry for initiating a change operation according to business needs; in an embodiment of the present disclosure, a change operation may be initiated through the entry provided by the SrpingBoot application 310, thereby changing the data in the database;

[0084] Spring Data MongoDB module 320. As part of the Spring framework, Spring Data MongoDB simplifies the integration process between Java applications and MongoDB and provides rich data access abstractions, allowing technicians to operate MongoDB databases in a simpler way, reducing the demand for technical personnel and manpower costs.

[0085] MongoDB database 330, which is a document-based database that stores BSON documents similar to JSON in a dynamic mode and can handle large amounts of unstructured data. In the embodiment of the present disclosure, MongoDB database 330 is used to store data. The data synchronization operation synchronizes the search engine based on the data change operations in MongoDB database 330;

[0086] The Entity Callback monitoring component 340A uses the Entity Callback mechanism of Spring Data MongoDB to monitor insert, update, and delete operations on data in MongoDB. In the embodiment of the present disclosure, the monitoring mechanism included in the SpringData MongoDB module 320 can be used to monitor data changes in the database.

[0087] AfterSaveCallback 350A, which inherits the interface of the Entity Callback listening component 340A and is mainly used in post-save processing scenarios;

[0088] Data converter 360A can convert the default input parameters of Entity Callback into a data format acceptable to the Elasticsearch search engine 380, thereby facilitating synchronization with the search engine;

[0089] In addition to monitoring the database based on the Entity Callback mechanism included in Spring Data MongoDB, you can also use AbstractMongoEventListener event monitoring. You can use either monitoring method to monitor the database, or you can use both monitoring methods to improve accuracy.

[0090] AbstractMongoEventListener 340B is an abstract class provided by Spring Data MongoDB that can be used to listen to MongoDB events. You can inherit from this class and rewrite or override its methods to listen to and process MongoDB operation events.

[0091] The MongoAfterDeleteListener deletion listener 350B can monitor the deletion operation by inheriting AbstractMongoEventListener and overriding the onAfterDelete method. Based on the AbstractMongoEventListener event listener 340B and the MongoAfterDeleteListener deletion listener 350B, the monitoring of the change operation in the database can be achieved.

[0092] Delete event parser 360B, which can parse the MongoDB collection and matching conditions in the event;

[0093] After completing the event monitoring, the change operation events captured by the monitoring module can be processed through the data converter to convert the changed data into a format acceptable to the ElasticSearch search engine; after completing the data conversion, the converted data is synchronized to the search engine through the synchronization component.

[0094] The ElasticSearch synchronization component 370 can call the ElasticSearch interface to synchronize the results of the data converter to the ElasticSearch search engine, and / or map the results of the delete event parser to the delete condition and call the ElasticSearch delete interface to synchronize the data change operation in the database to the search engine;

[0095] The search engine may include the ElasticSearch search engine 380, which is a distributed search and analysis engine that excels at quickly indexing and retrieving large amounts of data.

[0096] Corresponding to the embodiments of the data synchronization method of the present disclosure, the present disclosure also provides embodiments of corresponding data synchronization devices.

[0097] See Figure 4 , Figure 4 FIG is a block diagram of a data synchronization device according to an embodiment of the present disclosure. Figure 4 As shown, the data synchronization device includes:

[0098] A monitoring unit 410 is configured to monitor the database;

[0099] The determining unit 420 is configured to, upon monitoring callback information of an operation to change data in the database, determine the changed data corresponding to the callback information;

[0100] The synchronization unit 430 is configured to synchronize the changed data to the search engine.

[0101] In some embodiments, the data synchronization apparatus is further configured to: determine a change operation corresponding to the callback information, wherein the change operation includes at least one of the following: inserting data, updating data, and deleting data.

[0102] In some embodiments, synchronizing the changed data to the search engine includes: synchronizing the changed data to the search engine according to the change operation corresponding to the callback information.

[0103] In some embodiments, performing the change operation on the data in the database through a data access framework, and synchronizing the changed data to the search engine includes: synchronizing the changed data to the search engine based on the data access framework.

[0104] In some embodiments, the data access framework includes a callback interface, and the callback information of the data change operation monitored includes: monitoring the callback information based on the callback interface, wherein, after the database implements the data change operation, the callback information is returned to the data access framework through the callback interface.

[0105] In some embodiments, the data access framework includes Spring Data, the database includes MongoDB, and the search engine includes ElasticSearch.

[0106] In some embodiments, the data synchronization apparatus is further configured to: perform format conversion on the changed data, so as to convert the format of the changed data into a data format corresponding to the search engine.

[0107] The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.

[0108] An embodiment of the present disclosure further provides an electronic device, comprising: a processor and a memory; the memory is used to store a computer program; and the processor is used to execute the data synchronization method of any of the above embodiments by calling the computer program.

[0109] An embodiment of the present disclosure further provides a computer-readable storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the data synchronization method as described in any of the above embodiments.

[0110] An embodiment of the present disclosure further provides a computer program product, including a computer program, which implements the method described in any of the above embodiments when executed by a processor.

[0111] Figure 51 is a schematic block diagram of a data synchronization apparatus 500 according to an embodiment of the present disclosure. For example, the apparatus 500 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0112] Reference Figure 5 , the apparatus 500 may include one or more of the following components: a processing component 502 , a memory 504 , a power component 506 , a multimedia component 508 , an audio component 510 , an input / output (I / O) interface 512 , a sensor component 514 , and a communication component 516 .

[0113] The processing component 502 generally controls the overall operation of the device 500, such as operations associated with display, phone calls, data communications, camera operation, and recording operations. The processing component 502 may include one or more processors 520 to execute instructions to perform all or part of the steps of the data synchronization method described above. In addition, the processing component 502 may include one or more modules to facilitate interaction between the processing component 502 and other components. For example, the processing component 502 may include a multimedia module to facilitate interaction between the multimedia component 508 and the processing component 502.

[0114] The memory 504 is configured to store various types of data to support operations on the device 500. Examples of such data include instructions for any application or method operating on the device 500, contact data, phone book data, messages, pictures, videos, etc. The memory 504 can be implemented by any type of volatile or non-volatile storage device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, or optical disk.

[0115] The power supply component 506 provides power to the various components of the device 500. The power supply component 506 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device 500.

[0116] The multimedia component 508 includes a screen that provides an output interface between the device 500 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen can be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, slides, and gestures on the touch panel. The touch sensor can not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 508 includes a front camera and / or a rear camera. When the device 500 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera can receive external multimedia data. Each front camera and rear camera can be a fixed optical lens system or have focal length and optical zoom capabilities.

[0117] The audio component 510 is configured to output and / or input audio signals. For example, the audio component 510 includes a microphone (MIC), which is configured to receive external audio signals when the device 500 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal can be further stored in the memory 504 or transmitted via the communication component 516. In some embodiments, the audio component 510 also includes a speaker for outputting audio signals.

[0118] The I / O interface 512 provides an interface between the processing component 502 and peripheral interface modules, such as a keyboard, a click wheel, buttons, etc. These buttons may include, but are not limited to, a home button, a volume button, a start button, and a lock button.

[0119] The sensor assembly 514 includes one or more sensors for providing various aspects of the status assessment of the device 500. For example, the sensor assembly 514 can detect the open / closed state of the device 500, the relative positioning of components, such as the display and keypad of the device 500. The sensor assembly 514 can also detect changes in the position of the device 500 or a component of the device 500, the presence or absence of user contact with the device 500, the orientation or acceleration / deceleration of the device 500, and temperature changes of the device 500. The sensor assembly 514 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 514 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 514 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0120] The communication component 516 is configured to facilitate wired or wireless communication between the apparatus 500 and other devices. The apparatus 500 can access a wireless network based on a communication standard, such as WiFi, 2G, 3G, 4G LTE, 5G NR, or a combination thereof. In an exemplary embodiment, the communication component 516 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 516 further includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.

[0121] In an exemplary embodiment, the apparatus 500 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above-mentioned data synchronization method.

[0122] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is further provided, such as a memory 504 including instructions, and the instructions can be executed by the processor 520 of the apparatus 500 to perform the above-mentioned data synchronization method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0123] Other embodiments of the present disclosure will readily occur to those skilled in the art after considering the specification and practicing the disclosure herein. This disclosure is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, with the true scope and spirit of the present disclosure being indicated by the following claims.

[0124] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes can be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

[0125] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. The terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device that includes a series of elements includes not only those elements, but also other elements that are not explicitly listed, or also includes elements that are inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a..." does not exclude the presence of other identical elements in the process, method, article or device that includes the element.

[0126] The above is a detailed introduction to the methods and devices provided in the embodiments of the present disclosure. Specific examples are used herein to illustrate the principles and implementation methods of the present disclosure. The description of the above embodiments is only used to help understand the methods and core ideas of the present disclosure. At the same time, for those skilled in the art, according to the ideas of the present disclosure, there may be changes in the specific implementation methods and application scopes. In summary, the contents of this specification should not be understood as limiting the present disclosure.

Claims

1. A data synchronization method, characterized in that: The method comprises: Monitor the database; In the case of monitoring callback information of an operation to change data in the database, determining the data changed by the change operation corresponding to the callback information; Synchronize the changed data to the search engine.

2. The method according to claim 1, characterized in that The change operation includes at least one of the following: Insert data, update data, and delete data.

3. The method according to claim 1, characterized in that Synchronizing the changed data to the search engine includes: The changed data is synchronized to the search engine according to the change operation corresponding to the callback information.

4. The method according to claim 1, wherein Performing the change operation on the data in the database through a data access framework, and synchronizing the changed data to a search engine, includes: The changed data is synchronized to a search engine based on the data access framework.

5. The method according to claim 4, characterized in that The data access framework includes a callback interface, The callback information of the monitored change operation on the data in the database includes: The callback information is monitored based on the callback interface, wherein after the database implements the data change operation, the callback information is returned to the data access framework through the callback interface.

6. The method according to claim 4, characterized in that The data access framework includes Spring Data, the database includes MongoDB, and the search engine includes ElasticSearch.

7. The method according to claim 1, characterized in that The method further comprises: The changed data is formatted to convert the format of the changed data into a data format corresponding to the search engine.

8. A data synchronization device, characterized in that: The device comprises: A monitoring unit, configured to monitor the database; a determining unit configured to, upon monitoring callback information of an operation to change data in the database, determine the changed data corresponding to the callback information; The synchronization unit is configured to synchronize the changed data to the search engine.

9. An electronic device, characterized in that: include: Processor, memory; The memory is used to store computer programs; The processor is configured to execute the data synchronization method according to any one of claims 1 to 7 by calling the computer program.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the data synchronization method described in any one of claims 1 to 7 is implemented.