Data synchronization method and system for redundant device, and storage medium and electronic device
The data synchronization method for redundant devices synchronizes newly powered-on devices with a data source using initial and updated data, addressing lag and out-of-sync issues to maintain consistent operation.
Patent Information
- Application Number
- GB2025006913
- Authority / Receiving Office
- GB · GB
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-07-10
- Filing Date
- 2024-03-19
- Publication Date
- 2025-10-01
AI Technical Summary
In redundant device systems, newly powered-on devices lag behind in synchronization due to processing time, leading to out-of-sync states and inconsistent running states among devices.
A data synchronization method where a target device synchronizes with a data source by using initial and periodically updated running data, adjusting execution cycles to match the data source, and periodically updating key data to maintain synchronization.
Ensures synchronized operation of newly powered-on devices and timely resynchronization of out-of-sync devices, maintaining consistent running states across redundant systems.
Smart Images

Figure 00000000_0000_ABST
Abstract
Description
The present application relates to the technical field of device communication, and in particular to a data synchronization method and system for a redundant device, a storage medium, and an electronic device. BACKGROUND To guarantee safety and reliability of a device system, a multi-redundant system is generally used to correspondingly control the device system. In the redundant system, logic voting is used for implementing processing work related to the redundant system. However, to guarantee reasonableness of the logical voting, devices participating in the logical voting need to be in an equivalent running state. The equivalent running state of the devices can be implemented through power-on synchronization and running synchronization. For example, a redundant device that is subsequently powered on needs to keep running synchronization with other redundant devices during normal running, or the redundant devices need to keep running synchronization with each other during normal running. However, the inventor of the present application found that because a running state of the redundant device that is subsequently powered on lags behind that of other running devices at the beginning, and the redundant device that is subsequently powered on continues running independently after running data of the running devices are obtained during device synchronization. However, because a particular period of processing time is needed by a device to process the running data, and possibly exceeds an execution cycle of a user program, the running state of the running devices probably will be still faster than that of the device that is subsequently powered on. In addition, in a normal running process of the plurality of redundant devices, a problem that a device becomes an out-of-synchronization device and loses the equivalent running state when a running state of the device changes is also possible. In view of this, the inventor considers that there is still room for improvement in a current data synchronization method for a redundant device. SUMMARY Illustrative embodiments of the present application provide a data synchronization method and system for a redundant device, a storage medium, and an electronic device. An aspect of the present application provides a data synchronization method for a redundant device. The data synchronization method includes: transmitting, by a target device, a data synchronization request to a data source device; starting, according to first running data from the data source device, the target device; and controlling, according to second running data from the data source device, the target device to synchronously run with the data source device, where the first running data are generated by the data source device according to the data synchronization request, and the second running data are obtained by periodically updating the first running data by the data source device. In an embodiment, after the controlling, according to second running data from the data source device, the target device to synchronously run with the data source device, the data synchronization method further includes: determining whether key data of the target device are less than key data in the second running data of the data source device; and updating, in a case where the key data of the target device are less than the key data in the second running data of the data source device, the key data of the target device according to the key data in the second running data. In an embodiment, the starting the target device according to first running data from the data source device includes: restoring, by the target device, the first running data to obtain first key data; and updating, based on first execution cycle information of the data source device in the first key data, target device execution cycle information of the target device, so as to start the target device. In an embodiment, the controlling, according to second running data from the data source device, the target device to synchronously run with the data source device includes: restoring, by the target device, the second running data to obtain second key data; and updating, based on second execution cycle information of the data source device in the second key data, target device execution cycle information of the target device, so that the target device is synchronously ran with the data source device. A data synchronization system is disclosed in another aspect of the present application. The data synchronization system includes a data request unit, a device start unit, and a device synchronization unit. The data request unit is configured to transmit a data synchronization request to a data source device; the device start unit is configured to start a target device according to first running data from the data source device; and the device synchronization unit is configured to control, according to second running data from the data source device, the target device to synchronously run with the data source device, where the first running data are generated by the data source device according to the data synchronization request, and the second running data are obtained by periodically updating the first running data by the data source device. In an embodiment, the device synchronization unit is further configured to determine whether key data of the target device are less than key data in the second running data of the data source device; and update, in a case where the key data of the target device are less than the key data in the second running data of the data source device, the key data of the target device according to the key data in the second running data. In an embodiment, the device start unit is further configured to restore the first running data to obtain first key data; and the device start unit is further configured to update target device execution cycle information of the target device based on first execution cycle information of the data source device in the first key data, so as to start the target device. In an embodiment, the device synchronization unit is configured to restore the second running data to obtain second key data; and the device synchronization unit is configured to update target device execution cycle information of the target device based on second execution cycle information of the data source device in the second key data, so that the target device is synchronously ran with the data source device. According to yet another aspect of the present application, a nonvolatile computer-readable storage is provided. The storage medium stores a computer program, and the computer program may implement the data synchronization method described above. According to still another aspect of the present application, an electronic device is provided. The electronic device includes one or more processors and a storage apparatus. The storage apparatus is configured to store one or more programs. When the one or more programs are executed by the one or more processors, the data synchronization method described above is implemented by the one or more processors. The present application is used for solving a problem of data synchronization when the redundant device is powered on and a problem of resynchronization of an out-of-synchronization device. The target device may be caused to synchronously run the data source device by using the first running data of the data source device and the second running data that are periodically updated. Moreover, an out-of-synchronization device may further be resynchronized in time by using the second running data that are periodically updated by the data source device. BRIEF DESCRIPTION OF THE DRAWINGS To describe the technical solutions of the embodiments of this application more clearly, the following briefly introduces the accompanying drawings required for describing the embodiments. Apparently, the accompanying drawings in the following description show only some embodiments of this application, and a person of ordinary skill in the art may still derive other drawings from these accompanying drawings without creative efforts. FIG. lisa flowchart of a data synchronization method according to an embodiment of the present application; FIG. 2 is a schematic diagram of a redundant system according to an embodiment of the present application; FIG. 3 is another flowchart of a data synchronization method according to an embodiment of the present application; FIG. 4 is yet another flowchart of a data synchronization method according to an embodiment of the present application; FIG. 5 is still another flowchart of a data synchronization method according to an embodiment of the present application; FIG. 6 is a schematic diagram of a data synchronization structure according to an embodiment of the present application; FIG. 7 is a schematic structural diagram of a data synchronization system according to an embodiment of the present application; and FIG. 8 is a block diagram of an electronic device according to an illustrative embodiment of the present application. Description of reference numerals: data synchronization system 1; data request unit 10; device start unit 20; and device synchronization unit 30. DETAILED DESCRIPTION At present, the illustrative embodiments are described comprehensively with reference to the accompanying drawings. However, the illustrative embodiments can be implemented in a plurality of forms, and it should not be understood as being limited to the embodiments described herein. On the contrary, these embodiments are provided to make the present application comprehensive and complete and to fully convey the concept manifested therein to those skilled in the art. A same reference numeral in the accompanying drawings represents same or similar components, and therefore repeated descriptions of the components are appropriately omitted. Described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following descriptions, many specific details are provided to obtain a thorough understanding of the embodiments of the disclosure. However, those skilled in the art will recognize that the technical solutions of the disclosure can be practiced without one or more of the specific details, or with other manners, components, materials, apparatuses, etc. In these cases, well-known structures, method, apparatuses, implementations, materials, or operation will not be shown or described in detail. In addition, the terms "comprise", "include", "have", and their any variants are intended to cover a non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but further optionally includes a step or unit that is not listed, or further optionally includes another step or unit that is intrinsic to the process, method, product, or apparatus. The terms "first", "second", etc. in the description, claims, and accompanying drawings described above of the present application are used for distinguishing between different objects, instead of describing a particular order. The technical solutions of the present application are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present application. Apparently, the described embodiments are some rather than all of the embodiments of the present application. All other embodiments obtained by those skilled in the art based on the embodiments of the present application without creative efforts shall fall within the protection scope of the present application. In an embodiment, the present application provides a data synchronization method for a redundant device. Through the data synchronization method, the target device may be caused to synchronously run with the data source device by using the first running data of the data source device and the second running data that are periodically updated. Moreover, an out-of-synchronization device may further be resynchronized in time by using the second running data that are periodically updated by the data source device. The present application will be described in detail below in conjunction with the accompanying drawings of the description. FIG. 1 is a flowchart of a data synchronization method according to an illustrative embodiment of the present application. As shown in FIG. 1, the data synchronization method includes SI00 to S300. Illustratively, the data synchronization method may be performed by a target device. According to the illustrative embodiment, in SI00, the target device transmits a data synchronization request to a data source device. A redundant system includes a plurality of redundant devices that can synchronously run. A quantity of the redundant devices is not less than two. The data source device is a device in the redundant system that is already in a normal running state and has complete system running state data. The target device is a device that intends to be added to the redundant system and perform normal redundant running. The data source device and the target device may execute a same user program in a same sequence and at a same interval. FIG. 2 is a schematic diagram of a redundant system according to an illustrative embodiment of the present application. As shown in FIG. 2, the redundant system includes a plurality of redundant devices. The redundant devices are devices that periodically execute user programs according to I / O input to control result output. Data exchange is performed between the plurality of redundant devices through communication connection, such that an equivalent running state can be achieved. As shown in FIG. 2, a user program execution task is a program that is executed in the redundant device and that is preset by a user. The program may be periodically executed by the redundant device at fixed execution time intervals (for example, an execution cycle Tl, an execution cycle T2, ...). For example, the user programs executed by different redundant devices are the same. An execution moment is an execution start moment of the user program execution task in each execution cycle. For different redundant devices, the execution moments also need to be consistent. The redundant devices can achieve the same running state by executing the same user program execution task at the equivalent execution moment. For example, an execution cycle corresponding to the execution moment of the user program in the redundant device may be represented by using an execution cycle number. For example, when the target device is powered on for the first time and is to be incorporated into the redundant system, the target device transmits the data synchronization request to the data source device in a normal running state in the redundant system. The data source device may be determined by automatic detection of the target device, or may be determined by specific user specifying. This is not limited in the present application. Illustratively, user programs of the target device and the data source device needs to be the same. The target device checks the user program with the data source device. After a user program consistency check is completed, the target device initiates a cross-section data request communication message to the data source device, and transfers to a reception waiting state. In S200, the target device starts the target device according to first running data from the data source device. The first running data are generated by the data source device according to the data synchronization request. For example, after receiving the data synchronization request from the target device, the data source device checks validity of the received request communication message. In a case where the received request communication message is invalid, the data source device omits and does not respond to the request communication message. In a case where the message is valid, the data source device enters a data request processing procedure, and generates the first running data. Optionally, the first running data may be running cross-section data of the device. The running cross-section data may include general data and key data. The running cross-section data may be all data information representing the running state of the data source device. For example, the data information may be data information including I / O input and output of a current user program execution cycle, data information used for storing an execution result in a user program execution process, and execution cycle information (such as an execution cycle number) of the data source device. The key data are a subset of the running cross-section data, and are used for representing a state that cannot be directly obtained according to external input operation among device states, for example, a result obtained through calculation depending on a pre-order cycle state. In addition, the key data also include execution cycle information and I / O input information. The general data are running state data except for the key data. In idle time after completing a current user task, the data source device separately organizes the I / O input and output, and data used for storing an execution result in a user program execution process. The data are used for representing a running state of the current data source device, and have a fixed organization sequence. The target device receives the running cross-section data from the data source device, and starts running according to a running state corresponding to the running cross-section data as a starting point, so as to implement starting of the target device. In this way, the running state of the data source device can be obtained for the first time, and a running difference between the target device and the data source device can be narrowed. FIG. 3 is another flowchart of a data synchronization method according to an illustrative embodiment of the present application. Optionally, the first running data include first key data. As shown in FIG. 3, in S200, the target device starts the target device according to the first running data from the data source device. The process may include S210 to S220. In S210, the target device restores the first running data to obtain the first key data. In S220, the target device updates target device execution cycle information of the target device based on first execution cycle information of the data source device in the first key data, so as to start the target device. For example, the first key data of the data source device may be data that forms an intermediate state of the user program when the redundant device completes execution of the user program in a current running cycle, data information of I / O input and output of a current user program execution cycle, execution cycle information (for example, an execution cycle number) of the data source device, etc. Since the execution cycle information of the target device that is just powered on obviously lags behind the execution cycle information of the data source device, after receiving the running cross-section data of the data source device, the target device restores the running cross-section data, and obtains the first key data of the data source device. For example, the target device restores the running cross-section data one by one in an organization sequence of the running cross-section data of the data source device. The target device modifies the execution cycle information of the target device (for example, the execution cycle number of the target device) according to the first execution cycle information of the data source device (for example, the execution cycle number of the data source device). In this way, the target device and the data source device preliminarily run synchronously. Optionally, the target device starts timing when transferring to a reception waiting state after transmitting the data synchronization request. In a case where no running cross-section data from the data source device are received after first threshold time or the running crosssection data are determined to be invalid, the target device retransmits the data synchronization request. In a case where the running cross-section data are valid, the target device restores the running cross-section data. In S300, the target device controls, according to second running data from the data source device, the target device to synchronously run with the data source device. The second running data are obtained by periodically updating the first running data by the data source device. For example, the data source device periodically updates the first running data (for example, the running cross-section data) to obtain the second running data including a running state of a current running cycle of the data source device. When the target device obtains the first running data of the data source device for the first time, a particular period of processing time is needed when the target device receives and restores the first running data. In this period, the data source device may execute the user program for a cycle. In this way, an execution cycle deviation exists between the target device and the data source device. Consequently, the target device and the data source device cannot completely run synchronously. Accordingly, after transmitting the first running data, the data source device periodically updates the first running data within preset time, to obtain updated second running data, and periodically transmits the second running data to the target device. The target device receives and processes the second running data, such that the target device may continue to control the target device by using the updated second running data until the target device and the data source device may be in completely consistent equivalent running state. FIG. 4 is yet another flowchart of a data synchronization method according to an illustrative embodiment of the present application. Optionally, as shown in FIG. 4, in S300, the target device controls, according to second running data from the data source device, the target device to synchronously run with the data source device. Specifically, the process may include S310 to S320. In S310, the target device restores the second running data to obtain second key data. In S320, the target device updates target device execution cycle information of the target device based on second execution cycle information of the data source device in the second key data, so that the target device is synchronously ran with the data source device. For example, the data source device periodically updates the first running data to obtain the second running data. For example, the second running data include the second key data of the data source device. After the data source device completes an execution task in each execution cycle, the data source device updates and organizes transmission of the second key data. The second key data of the data source device may be data that forms an intermediate state of the user program when the redundant device completes execution of the user program in a current execution cycle, data information of I / O input and output of a current user program execution cycle, execution cycle information (for example, an execution cycle number) of the data source device, etc. The target device modifies the execution cycle information of the target device (for example, the execution cycle number of the target device) according to the second execution cycle information periodically updated by the data source device (for example, the execution cycle number of the data source device). In this way, the target device and the data source device may completely synchronously run. FIG. 5 is still another flowchart of a data synchronization method according to an illustrative embodiment of the present application. As shown in FIG. 5, the data synchronization method includes S100 to S500. For example, S100 to S300 are described in detail above, and details are not repeated herein. In S400, the target device determines whether key data of the target device are less than key data in the second running data of the data source device. In S500, the target device updates the key data of the target device according to the key data in the second running data. For example, as shown in FIG. 2, a plurality of redundant devices in the redundant system are communicatively connected to each other. The target device may receive second running data of other redundant devices. After the second running data are received and validity check of the data is passed, the target device determines the key data in the second running data. The key data of the target device include execution cycle information of the user program of the target device. The key data in the second running data of the data source device include execution cycle information of the data source device. The target device compares the execution cycle information of the target device with the execution cycle information of the data source device. In a case where the data source device execution cycle information is greater than the target device execution cycle information, the target device execution cycle information is updated according to the data source device execution cycle information, such that a running state of synchronous running of the target device and the data source device is guaranteed. For example, the data source device may also determine, through the foregoing synchronization method, whether the current device and another device are synchronous devices. This is not limited in the present application. It may be understood herein that at a running moment in the redundant system, a problem that a device becomes an out-of-synchronization device and loses the equivalent running state when a running state of the device changes is also possible. Execution cycle information of the out-of-synchronization device is slower than that of other redundant devices in a normal running state. Thus according to the foregoing illustrative embodiment, by determining the execution cycle information of the current device and the other devices, whether the current device is an out-of-synchronization device may be determined. When the current device is an out-of-synchronization device, the current device may be controlled in time to be resynchronized with other normally running devices. FIG. 6 is a schematic diagram of a data synchronization structure according to an illustrative embodiment of the present application. As shown in FIG. 6, execution cycle information (for example, an execution cycle number) is a step sequence reflecting a current user program execution cycle, and may be used for representing an execution moment of to-be-synchronized data in a current user program. Illustratively, in order to guarantee uniqueness of the execution cycle information within a life cycle of the device, an unsigned 64-bit integer may be used for representing the execution cycle information. Data location information may be used for representing a relative location of the to-be-synchronized data in the user program. The location information is related to a data organization layer of the user program. In a case of no layer, the location information may be an offset relative to a data area header address or a variable number. In a case of group-layer management, the information may be a group number, an intra-group relative offset, or an intragroup number. For example, no matter which form is used, a location of a variable can be quickly and accurately located by using the data location information, reading and updating are facilitated. A data state may be used for representing data attribute information. Attributes of the data include a quality of the data and a type of the data. The quality of the data reflects quality of the data, that is, whether the data are normal or abnormal. The type of the data is used for indicating a manner in which the data are accessed. For example, the data are accessed in a bit Boolean manner, in a two-byte reshaping manner, and in a four-byte floating point manner. A data value may be a representation of data quantization. A value range of the data matches the type of the data. Reading and writing of the data value need to be performed after a check according to the type of the data. By using the foregoing synchronization data structure, the redundant device may implement data synchronization processing between different devices according to the execution cycle information. According to another aspect of the present application, the present application provides a data synchronization system for a redundant device. Through the data synchronization system, the target device may be caused to synchronously run with the data source device by using the first running data of the data source device and the second running data that are periodically updated. Moreover, an out-of-synchronization device may further be resynchronized in time by using the second running data that are periodically updated by the data source device. FIG. 7 is a schematic structural diagram of a data synchronization system according to an illustrative embodiment of the present application. As shown in FIG. 7, the data synchronization system 1 includes a data request unit 10, a device start unit 20, and a device synchronization unit 30. According to an illustrative embodiment, the data request unit 10 transmits a data synchronization request to a data source device. A redundant system includes a plurality of redundant devices that can synchronously run. A quantity of the redundant devices is not less than two. The data source device is a device in the redundant system that is already in a normal running state and has complete system running state data. The target device is a device that intends to be added to the redundant system and perform normal redundant running. The data source device and the target device may execute a same user program in a same sequence and at a same interval. For example, when the target device is powered on for the first time and is to be incorporated into the redundant system, the data request unit 10 transmits the data synchronization request to the data source device in a normal running state in the redundant system. The data source device may be determined by automatic detection of the data request unit 10, or may be determined by specific user specifying. This is not limited in the present application. Illustratively, user programs of the target device and the data source device needs to be the same. The target device checks the user program with the data source device. After a user program consistency check is completed, the target device initiates a cross-section data request communication message to the data source device, and transfers to a reception waiting state. The device start unit 20 starts a target device according to first running data from the data source device. The first running data are generated by the data source device according to the data synchronization request. For example, after receiving the data synchronization request from the target device, the data source device checks validity of the received request communication message. In a case where the received request communication message is invalid, the data source device omits and does not respond to the request communication message. In a case where the message is valid, the data source device enters a request processing procedure, and generates the first running data. Optionally, the first running data may be running cross-section data of the device. The running cross-section data may include general data and key data. The running cross-section data may be all data information representing the running state of the data source device. For example, the data information may be data information including I / O input and output of a current user program execution cycle, data information used for storing an execution result in a user program execution process, and execution cycle information (such as an execution cycle number) of the data source device. The key data are a subset of the running cross-section data, and are used for representing a state that cannot be directly obtained according to external input operation among device states, for example, a result obtained through calculation depending on a pre-order cycle state. In addition, the key data also include execution cycle information and I / O input information. The general data are running state data except for the key data. In idle time after completing a current user task, the data source device separately organizes the I / O input and output, and data used for storing an execution result in a user program execution process. The data are used for representing a running state of the current data source device, and have a fixed organization sequence. The device start unit 20 receives the running cross-section data from the data source device, and starts running according to a running state corresponding to the running cross-section data as a starting point, so as to implement starting of the target device. In this way, the running state of the data source device can be obtained for the first time, and a running difference between the target device and the data source device can be narrowed. Optionally, the device start unit 20 restores the first running data to obtain the first key data. The device start unit 20 updates the target device execution cycle information of the target device based on the first execution cycle information of the data source device in the first key data, so as to start the target device. For example, the first key data of the data source device may be data that forms an intermediate state of the user program when the redundant device completes execution of the user program in a current running cycle, data information of I / O input and output of a current user program execution cycle, execution cycle information (for example, an execution cycle number) of the data source device, etc. Since the execution cycle information of the target device that is just powered on obviously lags behind the execution cycle information of the data source device, after receiving the running cross-section data of the data source device, the device start unit 20 restores the running cross-section data, and obtains the first key data of the data source device. For example, the device start unit 20 restores the running cross-section data one by one in an organization sequence of the running cross-section data of the data source device. The device start unit 20 modifies the execution cycle information of the target device (for example, the execution cycle number of the target device) according to the first execution cycle information of the data source device (for example, the execution cycle number of the data source device). In this way, the target device and the data source device preliminarily run synchronously. Optionally, the device start unit 20 starts timing when transferring to a reception waiting state after transmitting the data synchronization request. In a case where no running crosssection data from the data source device are received after first threshold time or the running cross-section data are determined to be invalid, the device start unit 20 retransmits the data synchronization request. In a case where the running cross-section data are valid, the target device restores the running cross-section data. The device synchronization unit 30 controls, according to second running data from the data source device, the target device to synchronously run with the data source device. The second running data are obtained by periodically updating the first running data by the data source device. For example, the data source device periodically updates the first running data (for example, the running cross-section data) to obtain the second running data including a running state of a current running cycle of the data source device. When the device start unit 20 obtains the first running data of the data source device for the first time, a particular period of processing time is needed when the target device receives and restores the first running data. In this period, the data source device may execute the user program for a cycle. In this way, an execution cycle deviation exists between the target device and the data source device. Consequently, the target device and the data source device cannot completely run synchronously. Accordingly, after transmitting the first running data, the data source device periodically updates the first running data within preset time, to obtain updated second running data, and periodically transmits the second running data to the device synchronization unit 30. The device synchronization unit 30 receives and processes the second running data, such that the target device may continue to control the target device by using the updated second running data until the target device and the data source device may be in a completely consistent equivalent running state. Optionally, the device synchronization unit 30 restores the second running data to obtain the second key data. The device synchronization unit 30 updates target device execution cycle information of the target device based on the second execution cycle information of the data source device in the second key data, so that the target device is synchronously ran with the data source device. For example, the data source device periodically updates the first running data to obtain the second running data. For example, the second running data include the second key data of the data source device. After the data source device completes an execution task in each execution cycle, the data source device updates and organizes transmission of the second key data. The second key data of the data source device may be data that forms an intermediate state of the user program when the redundant device completes execution of the user program in a current execution cycle, data information of I / O input and output of a current user program execution cycle, execution cycle information (for example, an execution cycle number) of the data source device, etc. The device synchronization unit 30 modifies the execution cycle information of the target device (for example, the execution cycle number of the target device) according to the second execution cycle information periodically updated by the data source device (for example, the execution cycle number of the data source device). In this way, the target device and the data source device may completely synchronously run. Optionally, the device synchronization unit 30 further determines whether key data of the target device are less than key data in the second running data of the data source device; and updates, if yes, the key data of the target device according to the key data in the second running data. For example, as shown in FIG. 2, a plurality of redundant devices in the redundant system are communicatively connected to each other. The target device may receive second running data of other redundant devices. After the second running data are received and validity check of the data is passed, the device synchronization unit 30 determines the key data in the second running data. The key data of the target device include execution cycle information of the user program of the target device. The key data in the second running data of the data source device include execution cycle information of the data source device. The device synchronization unit 30 compares the execution cycle information of the target device with the execution cycle information of the data source device. In a case where the data source device execution cycle information is greater than the target device execution cycle information, the target device execution cycle information is updated according to the data source device execution cycle information, such that a running state of synchronous running of the target device and the data source device is guaranteed. For example, the data source device may also determine, through the foregoing synchronization method, whether the current device and another device are synchronous devices. This is not limited in the present application. It may be understood herein that at a running moment in the redundant system, a problem that a device becomes an out-of-synchronization device and loses the equivalent running state when a running state of the device changes is also possible. Execution cycle information of the out-of-synchronization device is slower than that of other redundant devices in a normal running state. Thus according to the foregoing illustrative embodiment, by determining the execution cycle information of the current device and the other devices, the device synchronization unit 30 may determine whether the current device is an out-of-synchronization device. When the current device is an out-of-synchronization device, the current device may be controlled in time to be resynchronized with other normally running device. In the foregoing illustrative embodiment of the present application, the target device may be caused to synchronously run with the data source device by using the first running data of the data source device and the second running data that are periodically updated. Moreover, an out-of-synchronization device may further be resynchronized in time by using the second running data that are periodically updated by the data source device. According to yet another aspect of the present application, a nonvolatile computer-readable storage is provided. The storage medium stores a computer program, and the computer program may implement the data synchronization method described above. According to still another aspect of the present application, an electronic device is provided. The electronic device includes one or more processors and a storage apparatus. The storage apparatus is used for storing one or more programs. When the one or more programs are executed by the one or more processors, the data synchronization method described above is implemented by the one or more processors. FIG. 8 is a block diagram of an electronic device according to an illustrative embodiment of the present application. It should be understood that the electronic device 600 illustrated in FIG. 3 is merely an example and should not impose any limitation on the functions and scope of use of the examples of the present application. As shown in FIG. 3, the electronic device 600 is in a form of a general purpose computing device. Components of the electronic device 600 may include, but are not limited to: at least one processing unit 610, at least one memory 620, a bus 630 connecting different system components (including the memory 620 and the processing unit 610), a display unit 640, and the like. The memory stores program codes. The program codes may be executed by the processing unit 610, such that the processing unit 610 performs the method described in the specification according to various illustrative implementations of the present application. For example, the processing unit 610 may perform the method shown in FIG. 1. The processing unit at least includes a data request unit 10, a device start unit 20, and a device synchronization unit 30 that are described in the present application. The processing unit 610 shown in FIG. 8, when executing computer programs, may also implement control logic shown in FIG. 1 to FIG. 7. The memory 620 may include readable media in a form of volatile storage units, such as a random access memory (RAM) 6201 and / or a cache memory 6202, and may further include a read only memory (ROM) 6203. The memory 620 may also include a program / utility 6204 having a set (at least one) of program modules 6205. Such program module 6205 includes, but is not limited to: an operating system, one or more application programs, other program modules, and program data, and each or a combination of these examples may include implementation of a network environment. The bus 630 may indicate one or more of several types of bus structures, including a storage unit bus or storage unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a plurality of bus structures. The electronic device 600 may also communicate with one or more external devices 700 (for example, a keyboard, a pointing device, or a Bluetooth device), or may communicate with one or more devices that enable a user to interact with the electronic device 600, and / or may communicate with any device (for example, a router or a modem) that enables the electronic device 600 to communicate with one or more other computing devices. Such communication may be performed by using an input / output (I / O) interface 650. In addition, the electronic device 600 may further communicate with one or more networks (such as a local area network (LAN), a wide area network (WAN), and / or a public network (such as the Internet)) through a network adapter 660. The network adapter 660 may communicate with other modules of the electronic device 600 by using the bus 630. It should be appreciated that although not shown in the figures, other hardware and / or software modules may be used in conjunction with the electronic device 600, including but not limited to: microcodes, a device driver, a redundant processing unit, an external disk drive array, a RAID system, a tape driver, a data backup storage system, and the like. Through the description of the above implementations, it is easy for those skilled in the art to understand that the illustrative embodiments described herein may be implemented by software, or may be implemented by software in combination with necessary hardware. The technical solution according to the embodiments of the present application may be embodied in a form of a software product. The software product may be stored in a nonvolatile storage medium (which may be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which may be a personal computer, a server, a mobile terminal, or a network device, etc.) to perform the method according to the embodiments of the present application. The software product may take the form of any combination of one or more readable media. The readable medium may be a computer-readable signal medium or a computer-readable storage medium. The readable storage medium may be, for example, but is not limited to, an electric, magnetic, optical, electromagnetic, infrared, or semi-conductive system, apparatus, or device, or their any combination. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection based on 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. The computer-readable storage medium may include a data signal propagating in a baseband or as part of a carrier wave and carrying a readable program code. A data signal propagated in such a way may assume a plurality of forms, including, but not limited to, an electromagnetic signal, an optical signal, or their any appropriate combination. The readable storage medium may also be any readable medium other than the readable storage medium. The readable medium may send, propagate, or transmit a program configured to be used by or in combination with an instruction execution system, apparatus, or device. The program code embodied on the readable storage medium may be transmitted by using any suitable medium, including, but not limited to, wireless means, wired means, cables, radio frequency (RF), etc., or their any appropriate combination. A program code for performing operations of the present application may be written in one or any combination of more programming languages. The programming languages include target-oriented programming languages, such as Java and C++, and further include conventional procedural programming languages, such as the C programming language or similar programming languages. The program code may be completely executed on a user computing device, partially executed on a user device, executed as an independent software package, partially executed on a user computing device and partially executed on a remote computing device, or completely executed on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to a user computing device through any type of network including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (for example, through the Internet by using an Internet service provider). The computer-readable medium carries one or more programs. When the one or more programs are executed by the device, the computer-readable medium performs the aforementioned functions. Those skilled in the art may understand that the foregoing modules may be distributed in the apparatus according to the description of the embodiments, or may be correspondingly changed to be uniquely different from one or more apparatuses in the embodiments. The modules in the foregoing embodiments may be combined into one module, or may be further divided into a plurality of submodules. Finally, it should be noted that the foregoing is merely the preferred embodiments of the present application and is not intended to be limiting of the present application, although the present application has been described in detail with reference to the foregoing embodiments, for those of ordinary skill in the art, the technical solutions in the foregoing embodiments may be modified, or equivalents may be substituted for some technical features in the technical solutions. Any modifications, equivalent substitutions, improvements, etc. within the spirit and principles of the present application are intended to fall within the scope of protection of the present application.
Claims
What is claimed is:
1. A data synchronization method for a redundant device, characterized in that, the method includes:transmitting, by a target device, a data synchronization request to a data source device;starting, according to first running data from the data source device, the target device; and controlling, according to second running data from the data source device, the target device to synchronously run with the data source device, whereinthe first running data are generated by the data source device according to the data synchronization request, and the second running data are obtained by periodically updating the first running data by the data source device.
2. The data synchronization method according to claim 1, characterized in that, after the controlling, according to second running data from the data source device, the target device to synchronously run with the data source device, the data synchronization method further comprises:determining whether key data of the target device are less than key data in the second running data of the data source device; andupdating, in a case where the key data of the target device are less than the key data in the second running data of data of the data source device, the key data of the target device according to the key data in the second running data.
3. The data synchronization method according to claim 1, characterized in that, the starting, according to first running data from the data source device, the target device comprises:restoring, by the target device, the first running data to obtain first key data; andupdating, based on first execution cycle information of the data source device in the first key data, target device execution cycle information of the target device, so as to start the target device.
4. The data synchronization method according to claim 1, characterized in that, the controlling, according to second running data from the data source device, the target device to synchronously run with the data source device comprises:restoring, by the target device, the second running data to obtain second key data; andupdating, based on second execution cycle information of the data source device in the second key data, target device execution cycle information of the target device, so that the target device is synchronously ran with the data source device.
5. A data synchronization system for a redundant device, characterized in that, the system includes:a data request unit, configured to transmit a data synchronization request to a data source device;a device start unit, configured to start a target device according to first running data from the data source device; anda device synchronization unit, configured to control, according to second running data from the data source device, the target device to synchronously run with the data source device, whereinthe first running data are generated by the data source device according to the data synchronization request, and the second running data are obtained by periodically updating the first running data by the data source device.
6. The data synchronization system according to claim 5, characterized in that, the device synchronization unit is further configured to determine whether key data of the target device are less than key data in the second running data of the data source device; and update, in a case where the key data of the target device are less than the key data in the second running data of the data source device, the key data of the target device according to the key data in the second running data.
7. The data synchronization system according to claim 5, characterized in that, the device start unit is further configured to restore the first running data to obtain first key data; andthe device start unit is further configured to update target device execution cycle information of the target device based on first execution cycle information of the data source device in the first key data, so as to start the target device.
8. The data synchronization system according to claim 5, characterized in that, the device synchronization unit is configured to restore the second running data to obtain second key data; andthe device synchronization unit is configured to update target device execution cycle information of the target device based on second execution cycle information of the data source device in the second key data, so that the target device is synchronously ran with the data source device.
9. A nonvolatile computer-readable storage medium, storing a computer program, wherein the computer program implements the data synchronization method according to any one of claims 1 to 4.
10. An electronic device, characterized in that, the device comprises:one or more processors, anda storage apparatus, configured to store one or more programs, whereinwhen the one or more programs are executed by the one or more processors, the data synchronization method according to any one of claims 1 to 4 is implemented by the one or more processors.
Citation Information
Patent Citations
Data synchronizing method, device and system
CN104503868A
Method and device for newly adding nodes, node of distributed system, and storage medium
CN112732493A
Data synchronization method and system of redundant device, storage medium and electronic device
CN117112315A
Method and system for syncronization and distribution of configuration cross cluster without blocking
US20170222875A1