CN112256714A - Data synchronization method and device, electronic equipment and computer readable medium - Google Patents

Data synchronization method and device, electronic equipment and computer readable medium Download PDF

Info

Publication number
CN112256714A
CN112256714A CN202011241643.7A CN202011241643A CN112256714A CN 112256714 A CN112256714 A CN 112256714A CN 202011241643 A CN202011241643 A CN 202011241643A CN 112256714 A CN112256714 A CN 112256714A
Authority
CN
China
Prior art keywords
data
database
update
updating
updated
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011241643.7A
Other languages
Chinese (zh)
Inventor
常银桥
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN202011241643.7A priority Critical patent/CN112256714A/en
Publication of CN112256714A publication Critical patent/CN112256714A/en
Pending legal-status Critical Current

Links

Images

Classifications

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

Abstract

The embodiment of the disclosure discloses a data synchronization method, a data synchronization device, an electronic device and a computer readable medium. One embodiment of the method comprises: responding to the detected data updating signal of the database of the server, and inquiring updating data corresponding to the data updating signal in the database; and constructing an update message based on the update data, and sending the update message to at least one distributed node connected with the server, wherein the database is stored in a memory of the distributed node. The implementation mode realizes timely synchronization of the database on the server and the database on the node in the distributed system, ensures the consistency of the databases on the distributed system, and is beneficial to improving the timeliness and effectiveness of data processing of the distributed system.

Description

Data synchronization method and device, electronic equipment and computer readable medium
Technical Field
Embodiments of the present disclosure relate to the field of computer technologies, and in particular, to a data synchronization method, apparatus, electronic device, and computer-readable medium.
Background
With the development of science and technology, various data can be transmitted through a network, and the working efficiency of a user is greatly improved. The read speed differs for different memories. Generally, the data reading speed of the memory is higher than that of the cache, and the data reading speed of the cache is higher than that of the hard disk. Therefore, the database of the distributed system can be imported into the memory of the node of the distributed system, so that the data reading speed is increased, and the data processing efficiency is improved. In practice, data in the database may change at any time, and the databases in the memory of the node may not be synchronized in time, so that a data processing fault occurs.
Disclosure of Invention
This summary is provided to introduce a selection of concepts in a simplified form that are further described below in the detailed description. This summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
Some embodiments of the present disclosure propose data synchronization methods, apparatuses, electronic devices and computer readable media to solve the technical problems mentioned in the background section above.
In a first aspect, some embodiments of the present disclosure provide a data synchronization method, including: responding to the detected data updating signal of the database of the server, and inquiring updating data corresponding to the data updating signal in the database; and constructing an update message based on the update data, and sending the update message to at least one distributed node connected with the server, wherein the database is stored in a memory of the distributed node.
In a second aspect, some embodiments of the present disclosure provide a data synchronization method, including: analyzing the update data from the update message in response to receiving the update message; and updating the database in the memory through the updating data.
In a third aspect, some embodiments of the present disclosure provide a data synchronization apparatus, including: the updating data query unit is used for responding to the detection of a data updating signal of a database of the server and querying updating data corresponding to the data updating signal in the database; and the update data sending unit is configured to construct an update message based on the update data, and send the update message to at least one distributed node connected to the server, wherein the database is stored in a memory of the distributed node.
In a fourth aspect, some embodiments of the present disclosure provide a data synchronization apparatus, including: an update data acquisition unit configured to, in response to receiving an update message, parse out update data from the update message; and the database updating unit is configured to update the database in the memory through the updating data.
In a fifth aspect, some embodiments of the present disclosure provide an electronic device, comprising: one or more processors; a memory on which one or more programs are stored, the one or more programs, when executed by the one or more processors, causing the one or more processors to perform the data synchronization method of the first aspect or the data synchronization method of the second aspect.
In a sixth aspect, some embodiments of the present disclosure provide a computer readable medium, on which a computer program is stored, wherein the program, when executed by a processor, implements the data synchronization method of the first aspect or the data synchronization method of the second aspect.
The above embodiments of the present disclosure have the following beneficial effects: by the data synchronization method of some embodiments of the present disclosure, timely synchronization of databases in a distributed system is achieved. Specifically, the inventors found that the reason for the failure to synchronize the databases in the distributed system is: the database is put into the memory of the distributed system node, so that the data processing efficiency of the node is improved, but the database on the distributed system server is not easy to be synchronized to the database on the node in time, basically synchronized to the database on the node, and not easy to be synchronized to the database in the content in time. Based on this, the data synchronization method of some embodiments of the present disclosure may detect a data update signal of the data in time, and query the corresponding update data after detecting the data update signal. And then constructing an update message according to the update data, and sending the update message to the distributed nodes. And finally, the distributed nodes update the database in the memory. Therefore, the change of the database in the distributed system can be detected in time, and the data can be updated to the distributed nodes in time, so that the memory of the distributed nodes can be updated in time. Therefore, the timeliness and effectiveness of data processing of the distributed system are greatly improved.
Drawings
The above and other features, advantages and aspects of various embodiments of the present disclosure will become more apparent by referring to the following detailed description when taken in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numbers refer to the same or similar elements. It should be understood that the drawings are schematic and that elements and elements are not necessarily drawn to scale.
Fig. 1 is a schematic diagram of an application scenario of a data synchronization method of some embodiments of the present disclosure;
FIG. 2 is a flow diagram of some embodiments of a data synchronization method according to the present disclosure;
FIG. 3 is a flow diagram of further embodiments of a data synchronization method according to the present disclosure;
FIG. 4 is a flow diagram of still further embodiments of a data synchronization method according to the present disclosure;
FIG. 5 is a flow diagram of still further embodiments of a data synchronization method according to the present disclosure;
FIG. 6 is a schematic block diagram of some embodiments of a data synchronization apparatus corresponding to FIG. 2, in accordance with the present disclosure;
FIG. 7 is a schematic block diagram representation of further embodiments of the data synchronization apparatus according to FIG. 4 in accordance with the present disclosure;
FIG. 8 is a schematic structural diagram of an electronic device suitable for use in implementing some embodiments of the present disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it is to be understood that the disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the disclosure.
It should be noted that, for convenience of description, only the portions related to the related invention are shown in the drawings. The embodiments and features of the embodiments in the present disclosure may be combined with each other without conflict.
It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing different devices, modules or units, and are not used for limiting the order or interdependence relationship of the functions performed by the devices, modules or units.
It is noted that references to "a", "an", and "the" modifications in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will recognize that "one or more" may be used unless the context clearly dictates otherwise.
The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.
The present disclosure will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
Fig. 1 is a schematic diagram of one application scenario of a data synchronization method according to some embodiments of the present disclosure.
The database server 101 is a database storage device of the distributed system, on which a database is stored. The plurality of nodes 102 are devices in a distributed system connected to the database server 101, on which the database on the database server 101 is stored. During normal operation, the node 102 imports the database into the memory so as to quickly query the data in the database. The monitoring server 103 establishes data connections with the database server 101 and the node 102, respectively, for monitoring whether data in the database on the database server 101 changes. When data in the database on the database server 101 changes, the monitoring server 103 may trigger a data update operation to control the plurality of nodes 102 to update the database in time, so as to implement timely unification of the database server 101 and the database of the nodes 102. The monitoring server 103 may be implemented by a distributed coordination system (for example, zookeeper, Chubby, etc.). Therefore, the processing efficiency of data is improved through a distributed system, the reading speed of the data can be increased by putting the database into the memory, the database synchronization of the database server 101 and the node 102 is realized through the monitoring server 103, the effectiveness of the data is improved, and the processing efficiency of the data is further improved.
It should be understood that the number of database servers 101, nodes 102 and monitoring servers 103 in fig. 1 is merely illustrative. There may be any number of database servers 101, nodes 102, and monitoring servers 103, as desired for implementation.
With continued reference to fig. 2, fig. 2 illustrates a flow 200 of some embodiments of a data synchronization method according to the present disclosure. The data synchronization method comprises the following steps:
step 201, in response to detecting a data update signal of a database of a server, querying update data corresponding to the data update signal in the database.
In some embodiments, the executing agent of the data synchronization method (e.g., the monitoring server 103 shown in fig. 1) may establish a connection with the database server 101 and the node 102 through a wired connection or a wireless connection. It should be noted that the wireless connection means may include, but is not limited to, a 3G/4G/5G connection, a WiFi connection, a bluetooth connection, a WiMAX connection, a Zigbee connection, a uwb (ultra wideband) connection, and other wireless connection means now known or developed in the future.
After the execution agent establishes a connection with a server (i.e., database server 101 in fig. 1), it may detect whether data in a database on the server has changed. Wherein, the data change can be data deletion, data update, data addition, etc. After the execution subject detects the data update signal corresponding to the data change, it can query which data in the database have changed according to the data update signal, and mark the changed data as the update data.
Step 202, constructing an update message based on the update data, and sending the update message to at least one distributed node connected to the server.
The execution body may construct an update message from the update data. For example, the execution body may combine the update data and the corresponding time information to constitute the update message after acquiring the update data. The executing agent may then send the update message to a plurality of distributed nodes (i.e., nodes 102 in fig. 1) connected to the server. Therefore, the database on the server and the database on the node in the distributed system can be synchronized in time, the consistency of the databases on the distributed system is ensured, and the timeliness and the effectiveness of data processing of the distributed system are improved.
The data synchronization method disclosed by some embodiments of the present disclosure realizes timely synchronization of databases in a distributed system through the data synchronization method of some embodiments of the present disclosure. Specifically, the inventors found that the reason for the failure to synchronize the databases in the distributed system is: the database is put into the memory of the distributed system node, so that the data processing efficiency of the node is improved, but the database on the distributed system server is not easy to be synchronized to the database on the node in time, basically synchronized to the database on the node, and not easy to be synchronized to the database in the content in time. Based on this, the data synchronization method of some embodiments of the present disclosure may detect a data update signal of the data in time, and query the corresponding update data after detecting the data update signal. And then constructing an update message according to the update data, and sending the update message to the distributed nodes. And finally, the distributed nodes update the database in the memory. Therefore, the change of the database in the distributed system can be detected in time, and the data can be updated to the distributed nodes in time, so that the memory of the distributed nodes can be updated in time. Therefore, the timeliness and effectiveness of data processing of the distributed system are greatly improved.
With continued reference to fig. 3, fig. 3 illustrates a flow 300 of some embodiments of a data synchronization method according to the present disclosure. The data synchronization method comprises the following steps:
step 301, setting a monitoring node for the database.
In some embodiments, the executing agent of the data synchronization method (e.g., the monitoring server 103 shown in fig. 1) may set a listening node for the database on the database server 101. The monitoring node may be configured to detect a data change of the database, and generate a data update signal according to the data change. Therefore, the monitoring node can find the change of the data in the database in time, and is favorable for updating the database on the node in time, so that the accuracy and the effectiveness of data processing of the distributed system are improved.
Step 302, in response to detecting a data update signal of the database of the server, obtaining update data from the database according to the data identifier.
The data update signal may include a data identification of the changed data in order to mark the changed data. The data identifier may be information such as a number and a name of the data. The execution subject may obtain the update data from the database according to the data identification. The accuracy and the effectiveness of obtaining the updated data are improved.
In some alternative implementations of some embodiments, the data in the database includes a timestamp; the querying update data corresponding to the data update signal in the database may include: and for the data in the database, when the time difference between the timestamp of the data and the current time is detected to be smaller than a set time difference threshold value, marking the data as the updated data.
There may be multiple data with the same name or number in the database, so that it is not easy to determine the corresponding update data. To this end, the execution body may also determine the update data from the time stamp. For example, when the execution subject detects a data update signal, the data in the database may be queried according to the timestamp. When data with the time difference between the time stamp and the current time being smaller than the set time difference threshold exists in the database, the data is just changed. At this point, the executing agent may mark the data as update data. Thus, the effectiveness and robustness of obtaining the update data are improved.
For the case of deleting data from the database, the executing entity will not be able to query the deleted data with the timestamp. At this time, the execution body may query a log of the database to determine deleted data, and determine updated data (i.e., deleted data) based on the log. The accuracy of obtaining the updated data is improved.
Step 303, obtaining the path information of the updated data in the database.
The data in the database can have different paths, and the data of different paths can have the same name, the same data number, or the same data number. In order to facilitate the nodes to correctly update the database, the executing body may obtain the path information of the update data in the database. The path information may be used to mark a location of the updated data in the database. Therefore, the accuracy and the effectiveness of the node in updating the data are improved.
And step 304, constructing an updating message based on the path information and the updating data.
The execution body may encapsulate the path information and the update data to construct an update message. The updating message can be realized in the form of a data compression packet, and a password can be set when necessary, so that the safety of the updating message is improved.
Step 305, sending the update message to at least one distributed node connected to the server.
After obtaining the update message, the execution agent may send the update message to each distributed node in the distributed system that is connected to the server.
With further reference to fig. 4, a flow 400 of further embodiments of a data synchronization method is shown. The process 400 of the data synchronization method includes the following steps:
step 401, in response to receiving the update message, parsing the update data from the update message.
In some embodiments, the execution agent (e.g., node 102 shown in fig. 1) on which the web page generation method operates may receive the update message from the database server 101 through a wired connection or a wireless connection.
As can be seen from the above description, the update message contains the update data. Therefore, the execution subject can parse the update message to obtain the update data.
Step 402, updating the database in the memory according to the update data.
In some embodiments, the execution agent may update the corresponding data in the database in the memory by updating the data so that the database in the memory is synchronized with the database on the database server 101. Therefore, the timely synchronization of the data in the distributed system is improved, and the database is stored in the memory, so that accurate and effective data can be timely provided, and the accuracy and effectiveness of executing the main data processing are improved.
With further reference to fig. 5, a flow 500 of further embodiments of a data synchronization method is illustrated. The process 500 of the data synchronization method includes the following steps:
step 501, in response to receiving the update message, parsing the update data from the update message.
In some embodiments, the execution agent (e.g., node 102 shown in fig. 1) on which the web page generation method operates may receive the update message from the database server 101 through a wired connection or a wireless connection. The update data received by the execution principal may include a data identification.
Step 502, determining the data to be updated in the local database according to the data identifier.
The update data received by the execution principal may include a data identification. The data identification may be information such as the number, name, etc. of the data. The execution subject may query a database local to the execution subject (for example, a hard disk of the execution subject) through the data identification, and may determine data to be updated corresponding to the updated data.
In some optional implementations of some embodiments, the update message includes path information, and the path information is used to mark a location of the update data in the database; and, the determining the data to be updated in the local database by the data identifier may include the following steps:
first, determining an initial position of the updated data in the local database according to the path information.
As can be seen from the above description, the data in the database may have different paths, and the data in different paths may have the same name, the same data number, or may be completely the same. To this end, the executing entity may determine an initial location of the update data in a database local to the executing entity based on the path information. The initial location may be a folder or sub-directory or the like in which the data to be updated is located.
And secondly, inquiring the data to be updated corresponding to the data identification based on the initial position.
After the initial position is determined, the data to be updated corresponding to the data identification is inquired at the initial position, so that the interference of other data which are the same as the data identification of the data to be updated can be avoided, the condition of data updating error is prevented, and the accuracy and the reliability of data updating are improved.
And 503, replacing the data to be updated with the updated data to obtain an updated database.
The execution subject can directly replace the data to be updated through the updating data to obtain the updated database.
Step 504, importing the updated database into a memory.
After the execution agent updates the local database, the updated database may be imported into the memory to update the original database in the memory. Therefore, when the execution main body needs the database in the memory to provide data processing externally, accurate and effective data can be provided, and the effectiveness of data processing is improved.
With further reference to fig. 6, as an implementation of the methods shown in the above figures, the present disclosure provides some embodiments of a data synchronization apparatus, which correspond to those shown in fig. 2, and which may be applied in various electronic devices in particular.
As shown in fig. 6, the data synchronization apparatus 600 of some embodiments includes: an update data querying unit 601 and an update data transmitting unit 602. The update data query unit 601, in response to detecting a data update signal of a database of a server, is configured to query update data corresponding to the data update signal in the database; an update data sending unit 602, configured to construct an update message based on the update data, and send the update message to at least one distributed node connected to the server, where a memory of the distributed node stores the database.
In some optional implementations of some embodiments, the data synchronization apparatus 600 may include: and a listening node setting unit (not shown) configured to set a listening node for the database, the listening node being configured to detect a data change of the database and generate a data update signal according to the data change.
In some optional implementations of some embodiments, the data update signal includes a data identifier of the change data; and, the update data querying unit 601 may include: and a first update data query subunit (not shown in the figure) configured to obtain the update data from the database according to the data identifier.
In some alternative implementations of some embodiments, the data in the database includes a timestamp; and, the update data querying unit 601 may include: and a second update data query subunit (not shown in the figure), configured to, for data in the database, mark the data as update data when detecting that the time difference between the timestamp of the data and the current time is less than a set time difference threshold.
In some optional implementations of some embodiments, the update data sending unit 602 may include: a path information acquisition sub-unit (not shown in the figure) and an update message construction sub-unit (not shown in the figure). A path information acquiring subunit configured to acquire path information of the update data in the database, the path information being used to mark a position of the update data in the database; and an update message construction subunit configured to construct an update message based on the path information and the update data.
With further reference to fig. 7, as an implementation of the methods shown in the above figures, the present disclosure provides some embodiments of a data synchronization apparatus, which correspond to those shown in fig. 4, and which may be applied in various electronic devices in particular.
As shown in fig. 7, a data synchronization apparatus 700 of some embodiments may include: an update data acquisition unit 701 and a database update unit 702. The update data acquisition unit 701, in response to receiving the update message, is configured to parse the update data from the update message; the database updating unit 702 is configured to update the database in the memory by the above-mentioned update data.
In some optional implementations of some embodiments, the update data includes a data identifier; and, the database updating unit 702 may include: a data to be updated determining subunit (not shown), a local database updating subunit (not shown), and an in-memory database updating subunit (not shown). The data to be updated determining subunit is configured to determine the data to be updated in the local database through the data identifier; the local database updating subunit is configured to replace the data to be updated by the updating data to obtain an updated database; and the memory database updating subunit is configured to import the updated database into the memory.
In some optional implementations of some embodiments, the update message includes path information, and the path information is used to mark a location of the update data in the database; and, the data to be updated determining subunit may include: an initial position determination module (not shown in the figures) and a data to be updated determination module (not shown in the figures). The initial position determining module is configured to determine an initial position of the updated data in the local database according to the path information; and the data to be updated determining module is configured to query the data to be updated corresponding to the data identification based on the initial position.
In some optional implementations of some embodiments, the data synchronization apparatus 700 may include: a memory database import unit (not shown) configured to import the database into memory in response to detecting a system start signal.
In some optional implementations of some embodiments, the data synchronization apparatus 700 may include: and a data query unit (not shown in the figure) configured to query the database of the memory for query result information corresponding to the query request in response to receiving the query request corresponding to the database.
As shown in fig. 8, an electronic device 800 may include a processing means (e.g., central processing unit, graphics processor, etc.) 801 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)802 or a program loaded from a storage means 808 into a Random Access Memory (RAM) 803. In the RAM 803, various programs and data necessary for the operation of the electronic apparatus 800 are also stored. The processing apparatus 801, the ROM 802, and the RAM 803 are connected to each other by a bus 804. An input/output (I/O) interface 805 is also connected to bus 804.
Generally, the following devices may be connected to the I/O interface 805: input devices 806 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 807 including, for example, a Liquid Crystal Display (LCD), speakers, vibrators, and the like; storage 808 including, for example, magnetic tape, hard disk, etc.; and a communication device 809. The communication means 809 may allow the electronic device 800 to communicate wirelessly or by wire with other devices to exchange data. While fig. 8 illustrates an electronic device 800 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided. Each block shown in fig. 8 may represent one device or may represent multiple devices as desired.
In particular, according to some embodiments of the present disclosure, the processes described above with reference to the flow diagrams may be implemented as computer software programs. For example, some embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In some such embodiments, the computer program may be downloaded and installed from a network through communications device 809, or installed from storage device 808, or installed from ROM 802. The computer program, when executed by the processing apparatus 801, performs the above-described functions defined in the methods of some embodiments of the present disclosure.
It should be noted that the computer readable medium described above in some embodiments of the present disclosure may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In some embodiments of the disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In some embodiments of the present disclosure, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network Protocol, such as HTTP (HyperText Transfer Protocol), and may interconnect with any form or medium of digital data communication (e.g., a communications network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the Internet (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device. The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: responding to the detected data updating signal of the database of the server, and inquiring updating data corresponding to the data updating signal in the database; and constructing an update message based on the update data, and sending the update message to at least one distributed node connected with the server, wherein the database is stored in a memory of the distributed node.
Computer program code for carrying out operations for embodiments of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in some embodiments of the present disclosure may be implemented by software, and may also be implemented by hardware. The described units may also be provided in a processor, and may be described as: a processor includes an update data query unit and an update data transmission unit. The names of these units do not in some cases constitute a limitation on the units themselves, and for example, the update data transmission unit may also be described as a "unit for updating a database on a distributed node of a distributed system".
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), systems on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), and the like.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention in the embodiments of the present disclosure is not limited to the specific combination of the above-mentioned features, but also encompasses other embodiments in which any combination of the above-mentioned features or their equivalents is made without departing from the inventive concept as defined above. For example, the above features and (but not limited to) technical features with similar functions disclosed in the embodiments of the present disclosure are mutually replaced to form the technical solution.

Claims (14)

1. A method of data synchronization, comprising:
responding to the detected data updating signal of the database of the server, and inquiring updating data corresponding to the data updating signal in the database;
and constructing an update message based on the update data, and sending the update message to at least one distributed node connected with the server, wherein the database is stored in a memory of the distributed node.
2. The method of claim 1, wherein the method comprises:
and setting a monitoring node for the database, wherein the monitoring node is used for detecting the data change of the database and generating a data updating signal according to the data change.
3. The method of claim 1, wherein the data update signal comprises a data identification of change data; and
the querying update data corresponding to the data update signal in the database includes:
and acquiring updated data from the database according to the data identifier.
4. The method of claim 1, wherein the data within the database contains a timestamp; and
the querying update data corresponding to the data update signal in the database includes:
and for the data in the database, when the time difference between the timestamp of the data and the current time is detected to be smaller than a set time difference threshold value, marking the data as the updated data.
5. The method of any of claims 1 to 4, wherein said constructing an update message based on said update data comprises:
acquiring path information of the updated data in the database, wherein the path information is used for marking the position of the updated data in the database;
an update message is constructed based on the path information and the update data.
6. A method of data synchronization, comprising:
in response to receiving an update message, parsing update data from the update message;
and updating the database in the memory through the updating data.
7. The method of claim 6, wherein the update data comprises a data identification; and
the updating the database in the memory by the update data includes:
determining data to be updated in the local database through the data identification;
replacing the data to be updated by the updating data to obtain an updated database;
and importing the updated database into a memory.
8. The method of claim 7, wherein the update message includes path information for marking a location of the update data in the database; and
the determining the data to be updated in the local database through the data identifier includes:
determining the initial position of the updated data in the local database according to the path information;
and inquiring the data to be updated corresponding to the data identification based on the initial position.
9. The method of claim 6, wherein the method comprises:
and in response to detecting a system start signal, importing the database into a memory.
10. The method according to any one of claims 6 to 9, wherein the method comprises:
and responding to the received query request corresponding to the database, and querying the query result information corresponding to the query request from the database of the memory.
11. A data synchronization apparatus, comprising:
the updating data query unit is used for responding to the detection of a data updating signal of a database of the server and querying updating data corresponding to the data updating signal in the database;
and the updating data sending unit is configured to construct an updating message based on the updating data, and send the updating message to at least one distributed node connected with the server, and the memory of the distributed node stores the database.
12. A data synchronization apparatus, comprising:
an update data acquisition unit configured to parse update data from an update message in response to receiving the update message;
and the database updating unit is configured to update the database in the memory through the updating data.
13. An electronic device, comprising:
one or more processors;
a storage device having one or more programs stored thereon,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-5 or 6-10.
14. A computer readable medium having a computer program stored thereon, wherein the program when executed by a processor implements the method of any of claims 1 to 5 or claims 6 to 10.
CN202011241643.7A 2020-11-09 2020-11-09 Data synchronization method and device, electronic equipment and computer readable medium Pending CN112256714A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011241643.7A CN112256714A (en) 2020-11-09 2020-11-09 Data synchronization method and device, electronic equipment and computer readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011241643.7A CN112256714A (en) 2020-11-09 2020-11-09 Data synchronization method and device, electronic equipment and computer readable medium

Publications (1)

Publication Number Publication Date
CN112256714A true CN112256714A (en) 2021-01-22

Family

ID=74266632

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011241643.7A Pending CN112256714A (en) 2020-11-09 2020-11-09 Data synchronization method and device, electronic equipment and computer readable medium

Country Status (1)

Country Link
CN (1) CN112256714A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114666389A (en) * 2022-03-14 2022-06-24 京东科技信息技术有限公司 Method and device for detecting node state in distributed system and computer equipment

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114666389A (en) * 2022-03-14 2022-06-24 京东科技信息技术有限公司 Method and device for detecting node state in distributed system and computer equipment

Similar Documents

Publication Publication Date Title
CN110753089B (en) Method, device, medium and electronic equipment for managing client
CN110909521B (en) Online document information synchronous processing method and device and electronic equipment
CN111930709A (en) Data storage method and device, electronic equipment and computer readable medium
CN112256733A (en) Data caching method and device, electronic equipment and computer readable storage medium
CN113760536A (en) Data caching method and device, electronic equipment and computer readable medium
CN112256714A (en) Data synchronization method and device, electronic equipment and computer readable medium
CN112506968A (en) Information aggregation method and device, electronic equipment and computer readable medium
CN113590986B (en) Page link configuration method and device, electronic equipment and computer readable medium
CN112507676B (en) Method and device for generating energy report, electronic equipment and computer readable medium
CN113360348B (en) Abnormal request processing method and device, electronic equipment and storage medium
CN112732457B (en) Image transmission method, image transmission device, electronic equipment and computer readable medium
CN114827967A (en) Software updating method, Bluetooth device and storage medium
CN114035861A (en) Cluster configuration method and device, electronic equipment and computer readable medium
CN112612806A (en) House resource information processing method and device, electronic equipment and computer readable medium
CN113094272A (en) Application testing method and device, electronic equipment and computer readable medium
CN112464039A (en) Data display method and device of tree structure, electronic equipment and medium
CN111628913A (en) Online time length determining method and device, readable medium and electronic equipment
CN112311894A (en) Method, apparatus, electronic device, and computer-readable medium for generating information
CN113672567B (en) File construction method, device, electronic equipment and computer readable medium
CN111787107B (en) Message processing method and device, readable medium and electronic equipment
CN112559087A (en) Information generation method and device, electronic equipment and computer readable medium
WO2024077937A1 (en) Data generation method and apparatus, electronic device, and storage medium
CN113779139A (en) Information synchronization method and device, electronic equipment and computer readable medium
CN114844741A (en) CAN bus data storage method and device, electronic equipment and computer readable medium
CN115277362A (en) Fault diagnosis method, fault diagnosis device, electronic equipment and computer readable medium

Legal Events

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