CN1756108A - Master/backup system data synchronizing method - Google Patents
Master/backup system data synchronizing method Download PDFInfo
- Publication number
- CN1756108A CN1756108A CN 200410080629 CN200410080629A CN1756108A CN 1756108 A CN1756108 A CN 1756108A CN 200410080629 CN200410080629 CN 200410080629 CN 200410080629 A CN200410080629 A CN 200410080629A CN 1756108 A CN1756108 A CN 1756108A
- Authority
- CN
- China
- Prior art keywords
- data
- synchronization
- backup
- data block
- master
- 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
Links
Images
Landscapes
- Multi Processors (AREA)
- Hardware Redundancy (AREA)
Abstract
一种主备系统数据同步方法,该方法包括:主系统根据需同步的数据特性将需要同步的数据划分为若干数据块;主系统判断数据块的内容是否发生改变,若是,则主系统发起增量同步;否则,主系统根据触发条件(如定时同步周期,系统复位,主备系统通讯异常中断等可能导致数据不一致的因素)发起批量同步;批量同步,增量同步都按照划分的数据块优先级进行同步,高优先级的数据块先进行同步。该方法减少了主用、备用系统数据同步中不必要的同步数据量,从而减轻主备用系统间的数据同步量;同时采用优先级高的数据先同步的方法,较一般方式提高了系统的可靠性。
A method for synchronizing data between master and backup systems, the method comprising: the master system divides the data to be synchronized into several data blocks according to the characteristics of the data to be synchronized; volume synchronization; otherwise, the main system initiates batch synchronization according to the trigger conditions (such as timing synchronization period, system reset, abnormal communication interruption of the main and standby systems, etc. that may cause data inconsistency); batch synchronization and incremental synchronization are prioritized according to the divided data blocks The data blocks with high priority are synchronized first. This method reduces the amount of unnecessary synchronization data in the data synchronization of the main and backup systems, thereby reducing the amount of data synchronization between the main and backup systems; at the same time, the method of synchronizing data with high priority improves the reliability of the system compared with the general method sex.
Description
技术领域technical field
本发明涉及数据同步方法,尤其是涉及主用、备用系统间的数据同步方法。The invention relates to a data synchronization method, in particular to a data synchronization method between main and standby systems.
背景技术Background technique
数据通信系统通常要求系统具有很高的可靠性,而冗余是提高可靠性的一种基本方法。冗余系统中,对处于核心地位的系统一般采用1+1备份或N+1备份,一旦正在工作的主用系统发生故障时,备用系统能很快接管主用系统的工作而成为主用,使整个系统能继续正常工作。在主备倒换系统中,可能涉及到较多的动态数据以及配置数据等操作,要实现使主用、备用系统的切换不会对系统正常的运行造成影响,必然涉及到主用、备用系统之间数据的同步问题。Data communication systems usually require the system to have high reliability, and redundancy is a basic method to improve reliability. In the redundant system, 1+1 backup or N+1 backup is generally used for the core system. Once the working main system fails, the backup system can quickly take over the work of the main system and become the main one. so that the entire system can continue to work normally. In the active/standby switchover system, many operations such as dynamic data and configuration data may be involved. To ensure that the switchover between the active and standby systems will not affect the normal operation of the system, it must involve the relationship between the active and standby systems. data synchronization problem.
为了提高系统可靠性,对于系统中的关键系统通常采用主备热备份机制加以保护。正常工作状态下,主用系统处于工作状态,完成系统所必须的功能,备用系统对主用系统保持实时数据同步,当主用系统出现问题无法胜任工作时,备用系统能够及时完全地替换主用系统工作,以提高系统的可靠性。In order to improve system reliability, the key systems in the system are usually protected by active and standby hot backup mechanisms. Under normal working conditions, the main system is in working condition and completes the necessary functions of the system. The backup system keeps real-time data synchronization with the main system. When the main system has problems and cannot work, the backup system can completely replace the main system in time. work to improve system reliability.
现有技术中采用对需同步的数据在主用系统进行压缩,用滑动窗口协议传送到备用系统后进行解压缩的方法,保证主用、备用系统的数据同步。In the prior art, the data to be synchronized is compressed in the primary system, and then decompressed after being transmitted to the backup system using a sliding window protocol to ensure data synchronization between the primary and backup systems.
从现有技术中可以分析其存在以下不足:Can analyze its existence following deficiency from prior art:
采用压缩算法加大了系统的运算复杂度,同时该方案中的同步方法每次需同步所有的数据,不管需同步的数据是否在备用系统中已经存在,这样当主用、备用系统中的大量数据已经一致时,就会在周期性的同步中传送很多不必要的同步数据,从而加大主用、备用系统通讯的负担;同时,如果在同步过程中发生主用、备用系统倒换,由于数据采用压缩的方法传送,导致备用系统收到的压缩数据可能不全,不能进行正确的解压缩,这时备用系统就不能起到保护主用系统的功能,从而降低系统的可靠性。The use of compression algorithm increases the computational complexity of the system. At the same time, the synchronization method in this scheme needs to synchronize all the data every time, regardless of whether the data to be synchronized already exists in the backup system, so when a large amount of data in the main and backup systems When they are already consistent, a lot of unnecessary synchronization data will be transmitted during periodic synchronization, thereby increasing the communication burden of the active and standby systems; at the same time, if the active and standby systems are switched during the The compression method is used to transmit, resulting in incomplete compressed data received by the backup system, which cannot be decompressed correctly. At this time, the backup system cannot protect the main system, thereby reducing the reliability of the system.
发明内容Contents of the invention
本发明解决的问题是提供一种主备系统数据同步方法,该方法避免同步不必要的同步数据;同时能最大限度地保证备用系统中数据的可用性、完备性,从而从总体上提高整个系统的可靠性。The problem solved by the present invention is to provide a method for synchronizing the data of the main and backup systems, which avoids synchronizing unnecessary synchronization data; at the same time, it can ensure the availability and completeness of the data in the backup system to the greatest extent, thereby improving the overall system efficiency. reliability.
为解决上述问题,本发明提供一种主备系统数据同步方法,该方法包括,In order to solve the above problems, the present invention provides a method for synchronizing the data of the main and backup systems, the method comprising:
A、主系统将需同步的数据划分为若干数据块;A. The main system divides the data to be synchronized into several data blocks;
B、判断数据块的内容是否发生改变,若是,则发起增量同步;否则,根据触发条件发起批量同步。B. Determine whether the content of the data block has changed, and if so, initiate incremental synchronization; otherwise, initiate batch synchronization according to the trigger condition.
其中,所述将需要同步的数据划分为若干数据块的过程具体包括:Wherein, the process of dividing the data to be synchronized into several data blocks specifically includes:
21)、根据系统中需同步数据的数据特性、数据类别及系统的运算速度确定数据块的大小;21), according to the data characteristics of the data to be synchronized in the system, the data category and the operating speed of the system to determine the size of the data block;
22)、根据数据块的大小将需同步的数据划分为若干数据块。22). Divide the data to be synchronized into several data blocks according to the size of the data blocks.
其中,所述增量同步的过程具体包括:将该数据块同步到备系统;结束增量同步过程;Wherein, the process of the incremental synchronization specifically includes: synchronizing the data block to the backup system; ending the incremental synchronization process;
其中,所述批量同步的过程具体包括:Wherein, the process of batch synchronization specifically includes:
31)、备系统上传数据块给主系统;31), the backup system uploads the data block to the main system;
32)、主系统判断备系统传送的数据块内容与主系统对应的数据块内容是否一致,如不一致,则将该数据块同步到备系统,结束批量同步过程,继续执行步骤B;如一致,则结束批量同步过程,继续执行步骤B。32), the master system judges whether the content of the data block transmitted by the backup system is consistent with the content of the data block corresponding to the master system, if inconsistent, then synchronize the data block to the backup system, end the batch synchronization process, and continue to perform step B; if consistent, Then the batch synchronization process is ended, and step B is continued.
其中,所述将需要同步的数据划分为若干数据块的过程还包括:根据数据块的大小及系统的运算速度为若干数据块选取相应类型的校验码。Wherein, the process of dividing the data to be synchronized into several data blocks further includes: selecting corresponding types of check codes for the several data blocks according to the size of the data blocks and the operation speed of the system.
其中,在所述步骤A与B之间还包括:主备系统根据每个数据块的数据计算其对应的校验码。Wherein, between the steps A and B, it further includes: the master and backup systems calculate their corresponding check codes according to the data of each data block.
其中,所述批量同步的过程具体包括:Wherein, the process of batch synchronization specifically includes:
41)、备系统将计算后的校验码上报给主系统;41), the standby system reports the calculated check code to the main system;
42)、主系统判断接收到的校验码与自己计算出的校验码是否相同,若不同,则将该数据块同步到备系统,结束批量同步过程,继续执行步骤B;若相同,则结束批量同步过程,继续执行步骤B。42), the main system judges whether the received check code is the same as the check code calculated by itself, if not, then synchronize the data block to the backup system, end the batch synchronization process, and continue to execute step B; if they are the same, then End the batch sync process and proceed to step B.
其中,在所述步骤A与步骤B之间包括:根据数据的重要性对需同步的数据块进行优先级排序。Wherein, between step A and step B includes: prioritizing the data blocks to be synchronized according to the importance of the data.
其中,在增量同步的过程中及在步骤32)中所述将该数据块同步到备系统的过程具体为:将该数据块按照数据块的优先级从高到低的顺序先后同步到备系统。Wherein, the process of synchronizing the data block to the backup system in the process of incremental synchronization and in step 32) is specifically: synchronizing the data block to the backup system successively according to the priority of the data block from high to low system.
其中,在步骤42)中所述将该数据块同步到备系统的过程具体为:将数据块按照数据块的优先级从高到低的顺序先后同步到备系统。Wherein, the process of synchronizing the data blocks to the backup system in step 42) is specifically: synchronizing the data blocks to the backup system successively according to the priority of the data blocks from high to low.
其中,所述触发条件包括:周期同步、系统复位、主备系统通讯异常中断。Wherein, the trigger conditions include: cycle synchronization, system reset, and communication interruption of the master and backup systems.
与现有技术相比,本发明具有以下优点:由于采用了数据分块,减少了主用、备用系统数据同步中不必要的同步数据量,从而减轻主备用系统通讯的负担。另外,通过数据分块且通过校验码判断数据块是否一致的方式,更进一步减少了主备用系统数据同步过程中不必要的同步数据量,从而能进一步减轻主用、备用系统通讯的负担;同时,通过数据分块且用校验码校验数据块是否一致的方式以及划分优先级的方式,使本发明较一般方式提高了系统的可靠性。Compared with the prior art, the present invention has the following advantages: due to the adoption of data blocks, the unnecessary amount of synchronous data in the data synchronization of the main and backup systems is reduced, thereby reducing the communication burden of the main and backup systems. In addition, by dividing the data into blocks and judging whether the data blocks are consistent through the check code, the unnecessary synchronization data volume in the data synchronization process of the main and backup systems is further reduced, thereby further reducing the communication burden of the main and backup systems; At the same time, by dividing the data into blocks and checking whether the data blocks are consistent with a check code and dividing the priority, the present invention improves the reliability of the system compared with the general method.
附图说明Description of drawings
图1是本发明第一实施例的流程图;Fig. 1 is the flowchart of the first embodiment of the present invention;
图2是本发明第一实施例中增量同步的流程图;Fig. 2 is the flowchart of incremental synchronization in the first embodiment of the present invention;
图3是本发明第一实施例中批量同步的流程图(不采用校验码);Fig. 3 is the flow chart of batch synchronization in the first embodiment of the present invention (do not adopt verification code);
图4是本发明第二实施例中批量同步的流程图(采用校验码);Fig. 4 is the flowchart of batch synchronization in the second embodiment of the present invention (using check code);
图5是为主用系统中将数据块划分及优先级分配并同步到备用系统的示意图;Fig. 5 is a schematic diagram of dividing and prioritizing data blocks in the active system and synchronizing them to the standby system;
图6是本发明第三实施例中增量同步的流程图;Fig. 6 is the flowchart of incremental synchronization in the third embodiment of the present invention;
图7是本发明第三实施例中批量同步的流程图(不采用校验码及按数据块优先级顺序同步);Fig. 7 is the flow chart of batch synchronization in the third embodiment of the present invention (not adopting check code and synchronizing by data block priority order);
图8是本发明第四实施例中批量同步的流程图(采用校验码及按数据块优先级顺序同步)。Fig. 8 is a flow chart of batch synchronization in the fourth embodiment of the present invention (using check code and synchronizing according to the order of priority of data blocks).
具体实施方式Detailed ways
数据同步是指主备热备份系统中备用系统实时保持与主用系统数据一致的过程。分两种情况,一种是批量同步,一种是增量同步。Data synchronization refers to the process in which the backup system in the active/standby hot backup system maintains data consistency with the active system in real time. There are two situations, one is batch synchronization and the other is incremental synchronization.
所述批量同步是指备用系统对主用系统所有数据尝试进行数据同步的方式,用于主用、备用系统通讯中断/系统复位等异常情况,也用于周期性的同步,以保证备用系统与主用系统间的数据同步。The batch synchronization refers to the way that the backup system tries to synchronize all the data of the main system. It is used for abnormal situations such as communication interruption/system reset of the main and backup systems, and is also used for periodic synchronization to ensure that the backup system and Data synchronization between primary and active systems.
所述增量同步是指当主用系统工作正常时,主用系统由于自身数据改变(如用户下发配置命令导致主系统配置数据发生改变),将发生改变的数据块内容同步到备系统的过程。The incremental synchronization refers to the process of synchronizing the changed data block content to the standby system due to its own data changes (such as changes in the configuration data of the primary system caused by the configuration command sent by the user) when the primary system is working normally. .
本方法公开了一种优化的主备系统数据同步的方法,该方法采用N+1(N>=1)的主备热备份保护方式。The method discloses an optimized data synchronization method of the master and backup systems. The method adopts an N+1 (N>=1) master and backup hot backup protection mode.
下面结合图1对本发明的第一实施例作详细的描述。The first embodiment of the present invention will be described in detail below with reference to FIG. 1 .
在本发明中,首先执行步骤S101,对主用系统中需要同步的数据划分为若干数据块。具体操作为:步骤1,根据需同步数据的数据特性、数据类别及系统的运算速度等综合因素确定数据块的大小,例如,当系统中需同步的配置数据中每条配置命令为定长M,划分配置数据块时,选择M的整数倍N作为数据块的大小(M*N);如果CPU的运算速度较快,将数据块适当确定大一些;数据的类别,也称为数据间的耦合性,划分数据块时,将耦合性较强的数据划分到同一个数据块中,耦合性较弱的数据划分到不同的数据块中。例如将业务配置数据划分到一个数据块,将保护类数据划分到一个数据块,将维护类数据划分到一个数据块。步骤2,根据数据块的大小将需同步的数据划分为若干数据块;例如,需同步的配置数据总量为:T,则可将配置数据划分为(T/(M*N)+1)个数据块。In the present invention, step S101 is first performed to divide the data to be synchronized in the active system into several data blocks. The specific operation is: Step 1. Determine the size of the data block according to comprehensive factors such as the data characteristics of the data to be synchronized, the data type, and the operating speed of the system. For example, when each configuration command in the configuration data to be synchronized in the system is a fixed-length M , when dividing the configuration data block, select the integer multiple N of M as the size of the data block (M*N); if the operation speed of the CPU is fast, the data block should be appropriately determined to be larger; the type of data is also called the inter-data Coupling, when dividing data blocks, divide the data with strong coupling into the same data block, and divide the data with weak coupling into different data blocks. For example, the service configuration data is divided into one data block, the protection type data is divided into one data block, and the maintenance type data is divided into one data block. Step 2, divide the data to be synchronized into several data blocks according to the size of the data block; for example, the total amount of configuration data to be synchronized is: T, then the configuration data can be divided into (T/(M*N)+1) data blocks.
将同步数据划分为数据块后,则每次备份操作的最小单位为一个数据块。在一个系统中将数据划分成若干个数据块,这样划分可以使大多数的修改操作一次仅涉及一个数据块,因此仅需要同步一个数据块的内容,而且若经划分后的数据块容量足够小,就能够加速同步的进程。After the synchronization data is divided into data blocks, the minimum unit of each backup operation is a data block. In a system, the data is divided into several data blocks, so that most modification operations only involve one data block at a time, so only the content of one data block needs to be synchronized, and if the capacity of the divided data block is small enough , which can speed up the synchronization process.
接着,执行步骤S102,主系统判断数据块的内容是否发生改变(通常用户下发配置命令等情况导致主系统配置数据发生改变),如是则执行步骤S103进行增量同步;如果数据块的内容未发生改变,则执行步骤S104,主系统根据触发条件(如通讯中断、系统复位或周期性的同步等)发起批量同步。Then, step S102 is executed, and the main system judges whether the content of the data block changes (generally, the configuration data of the main system is changed due to the configuration command sent by the user), and if so, step S103 is executed for incremental synchronization; if the content of the data block has not If there is a change, step S104 is executed, and the main system initiates batch synchronization according to trigger conditions (such as communication interruption, system reset, or periodic synchronization, etc.).
下面结合图2详细说明增量同步的过程。The incremental synchronization process will be described in detail below in conjunction with FIG. 2 .
首先,主系统执行步骤S201,检测到某些数据块的内容发生改变,需进行增量同步,接着主系统执行步骤S202,得到需进行增量同步的数据块编号,然后执行步骤S203,将编号对应的数据块同步到备系统,然后结束增量同步过程。First, the main system executes step S201, detects that the content of some data blocks has changed, and incremental synchronization is required, then the main system executes step S202, obtains the number of the data block that needs to be incrementally synchronized, and then executes step S203, the The corresponding data blocks are synchronized to the standby system, and then the incremental synchronization process ends.
下面结合图3对本发明批量同步的过程作详细说明。The batch synchronization process of the present invention will be described in detail below in conjunction with FIG. 3 .
当主系统检测到符合批量同步条件时,首先执行步骤S301,向备系统发起批量同步命令;备系统收到该命令后,执行步骤S302,将备系统上各数据块内容传送给主系统;接着执行步骤S303,主系统接收到备系统传送过来的数据块后,判断这些数据块内容与主系统上相应数据块的内容是否一致,如果一致则结束本次批量同步过程,否则主系统执行步骤S304,即记录不一致的数据块编号;接着执行步骤S305,即将这些数据块编号对应的数据块同步到备系统,结束批量同步过程。When the primary system detects that the batch synchronization conditions are met, it first executes step S301, and initiates a batch synchronization command to the backup system; after receiving the command, the backup system executes step S302, and transmits the contents of each data block on the backup system to the primary system; then executes Step S303, after the primary system receives the data blocks sent by the standby system, it judges whether the content of these data blocks is consistent with the content of the corresponding data blocks on the primary system. That is, the inconsistent data block numbers are recorded; then step S305 is executed, that is, the data blocks corresponding to these data block numbers are synchronized to the backup system, and the batch synchronization process ends.
下面是本发明的第二实施例。The following is the second embodiment of the present invention.
首先主系统将需同步的数据划分为若干数据块,具体操作为:步骤1,根据需同步数据的数据特性、数据类别及系统的运算速度等综合因素确定数据块的大小;例如,当系统中需同步的配置数据中每条配置命令为定长M,划分配置数据块时,选择M的整数倍N作为数据块的大小(M*N);如果CPU的运算速度较快的化,可将数据块的大小适当确定大一些;数据类别,也称为数据间的耦合性,划分数据块时,将耦合性较强的数据划分到同一个数据块中,耦合性较弱的数据划分到不同的数据块中。例如将业务配置数据划分到一个数据块,将保护类数据划分到一个数据块,将维护类数据划分到一个数据块。步骤2,根据数据块的大小将需同步的数据划分为若干数据块;例如,需同步的配置数据总量为:T,则可将配置数据划分为(T/(M*N)+1)个数据块。步骤3,根据数据块的大小及系统的运算速度为若干数据块选取相应类型的校验码;例如当划分的数据块大小为1K,如果CPU的速度较快,可选择MD5等可用于数字签名的校验码类型;否则可选择CRC-16等传输过程中经常用来保证接收端与发送端数据一致性的校验码类型。First, the main system divides the data to be synchronized into several data blocks. The specific operation is: Step 1. Determine the size of the data block according to comprehensive factors such as the data characteristics of the data to be synchronized, the data type, and the operating speed of the system; for example, when the system Each configuration command in the configuration data to be synchronized is a fixed length M. When dividing the configuration data block, select an integer multiple N of M as the size of the data block (M*N); if the operation speed of the CPU is faster, the The size of the data block is properly determined to be larger; the data category, also known as the coupling between data, when dividing the data block, the data with strong coupling is divided into the same data block, and the data with weak coupling is divided into different in the data block. For example, the service configuration data is divided into one data block, the protection type data is divided into one data block, and the maintenance type data is divided into one data block. Step 2, divide the data to be synchronized into several data blocks according to the size of the data block; for example, the total amount of configuration data to be synchronized is: T, then the configuration data can be divided into (T/(M*N)+1) data blocks. Step 3, according to the size of the data block and the operation speed of the system, select the corresponding type of check code for several data blocks; for example, when the size of the divided data block is 1K, if the speed of the CPU is faster, you can choose MD5, etc., which can be used for digital signatures Check code type; otherwise, you can choose the check code type that is often used to ensure data consistency between the receiving end and the sending end during transmission such as CRC-16.
其次,主用、备用系统根据每个数据块的数据计算其对应的校验码。Secondly, the active and standby systems calculate their corresponding check codes according to the data of each data block.
接着,如果主系统判断数据块的内容发生了改变(通常用户下发配置命令等情况导致主系统配置数据发生改变),则进行增量同步;如果数据块的内容未发生改变,则主系统将根据触发条件(如通讯中断、系统复位或周期性的同步等)发起批量同步。Then, if the main system determines that the content of the data block has changed (usually the configuration data of the main system changes due to the configuration command issued by the user), it will perform incremental synchronization; if the content of the data block has not changed, the main system will Initiate batch synchronization according to trigger conditions (such as communication interruption, system reset or periodic synchronization, etc.).
增量同步的过程如图2所示,具体描述同第一实施例。The process of incremental synchronization is shown in FIG. 2 , and the specific description is the same as that in the first embodiment.
下面结合图4对本发明采用校验码的数据批量同步过程作详细的描述。The data batch synchronization process using check codes in the present invention will be described in detail below in conjunction with FIG. 4 .
当主系统检测到符合批量同步条件时,首先执行步骤S401,即向备系统发起批量同步命令;备系统收到该命令后,执行步骤S402,计算备系统各数据块校验码,并上报给主系统;主系统接收到备系统上报的校验码后执行步骤S403计算其上的各数据块校验码;主系统计算完其上各数据块校验码后,执行步骤S404,判断其计算出的校验码与备系统上报的校验码是否一致;如一致,则结束本次批量同步过程,如不一致,执行步骤S405,记录校验码不一致的数据块编号;然后执行步骤S406,将这些编号对应的数据块同步到备系统,结束本次批量同步过程。When the primary system detects that the batch synchronization conditions are met, it first executes step S401, that is, initiates a batch synchronization command to the backup system; after receiving the command, the backup system executes step S402, calculates the check code of each data block in the backup system, and reports it to the master system; the primary system executes step S403 to calculate the check codes of each data block on it after receiving the check code reported by the standby system; Check whether the check code is consistent with the check code reported by the backup system; if they are consistent, the batch synchronization process will end, if they are not consistent, perform step S405 to record the number of data blocks whose check codes are inconsistent; then perform step S406 to convert these The data block corresponding to the number is synchronized to the standby system, and the batch synchronization process ends.
采用校验码的方式能进一步减少主备系统间的数据同步量,但需增加主备系统的计算量,相当于软件设计中常用到的用时间换取空间策略。具体应用时,可根据需同步数据量的多少确定是否采用校验码的方式。如果需同步的数据量不大,建议不采用该方式,而采用上一实施例方式。Using the check code method can further reduce the amount of data synchronization between the primary and backup systems, but it needs to increase the amount of calculation of the primary and backup systems, which is equivalent to the strategy of exchanging time for space commonly used in software design. In specific applications, it can be determined whether to use the check code method according to the amount of data to be synchronized. If the amount of data to be synchronized is not large, it is recommended not to use this method, but to use the method in the previous embodiment.
下面是本发明的第三实施例,这是一种更优化的主备系统数据同步方法。The following is the third embodiment of the present invention, which is a more optimized method for synchronizing data between the master and backup systems.
首先主用系统将需要同步的数据划分若干数据块;具体操作过程同第一First, the main system divides the data to be synchronized into several data blocks; the specific operation process is the same as that of the first
实施例。Example.
当需要对多个数据块进行同步的时候,需要在划分完数据块后根据数据块对系统运行的重要性,对各数据块确定优先级,制定同步顺序,例如:在有配置数据块,保护数据块,维护数据块三种数据块的情况下,可将配置数据的优先级定位最高,保护类数据优先级次之,维护类优先级最低;如图5所示,为主用系统中将数据块划分,及优先级分配并同步到备用系统的示例。业务配置的数据优先级最高,标记为数据块A110;其次为保护类数据,标记为数据块B120;再其次为维护类数据,标记为数据块C130,以此类推,按照优先级A>B>C>D>E>…进行排列。When multiple data blocks need to be synchronized, after dividing the data blocks, it is necessary to determine the priority of each data block and formulate the synchronization order according to the importance of the data blocks to the system operation, for example: when there are configuration data blocks, the protection In the case of data blocks and maintenance data blocks, the priority of the configuration data can be positioned the highest, the priority of the protection data is second, and the priority of the maintenance data is the lowest; as shown in Figure 5, the main system will Example of data block partitioning, and priority assignment and synchronization to the standby system. The data of business configuration has the highest priority, which is marked as data block A110; the second is protection data, which is marked as data block B120; the second is maintenance data, which is marked as data block C130, and so on, according to the priority A>B> C>D>E>... to arrange.
接着执行下一步骤,当用户下发配置命令等情况导致主系统配置数据发生改变时,主系统判断出数据块的内容发生了改变,于是进行增量同步;如果数据块的内容未发生改变,则主系统将根据触发条件(如通讯中断、系统复位或周期性的同步等)发起批量同步。Then execute the next step. When the configuration data of the main system changes due to the configuration command issued by the user, the main system judges that the content of the data block has changed, and then performs incremental synchronization; if the content of the data block does not change, Then the main system will initiate batch synchronization according to trigger conditions (such as communication interruption, system reset or periodic synchronization, etc.).
下面结合图6详细说明增量同步的过程。The process of incremental synchronization will be described in detail below in conjunction with FIG. 6 .
首先,主系统执行步骤S601,检测到某些数据块的内容发生改变,需进行增量同步,接着主系统执行步骤S602,得到需进行增量同步的数据块编号,然后执行步骤S603,将遍号对应的数据块按照数据块的优先级顺序从高到低先后同步到备系统,优先级高的先同步,然后结束增量同步过程。First, the main system executes step S601, detects that the content of some data blocks has changed, and incremental synchronization is required, then the main system executes step S602, obtains the number of data blocks that need to be incrementally synchronized, and then executes step S603, which will The data blocks corresponding to the number are synchronized to the standby system in descending order of the priority of the data blocks, and the ones with higher priorities are synchronized first, and then the incremental synchronization process ends.
下面结合图7对本发明批量同步的过程作详细说明。当主系统检测到符合批量同步条件时,首先执行步骤S701向备系统发起批量同步命令;备系统收到该命令后,执行步骤S702,将备系统将各数据块内容传送给主系统;接着执行步骤S703,主系统接收到备系统传送过来的数据块后,判断这些数据块内容与主系统上相应数据块的内容是否一致,如果一致则结束本次批量同步过程,否则主系统执行步骤S704,即记录不一致的数据块编号;接着执行步骤S705,即将这些数据块编号对应的数据块按照数据块的优先级顺序从高到低先后同步到备系统,优先级高的先同步,然后结束批量同步过程。The batch synchronization process of the present invention will be described in detail below in conjunction with FIG. 7 . When the primary system detects that the batch synchronization conditions are met, it first executes step S701 to initiate a batch synchronization command to the backup system; after receiving the command, the backup system executes step S702, and the backup system transmits the contents of each data block to the primary system; then executes the steps S703. After the primary system receives the data blocks sent by the standby system, it judges whether the content of these data blocks is consistent with the content of the corresponding data blocks on the primary system. Record the inconsistent data block numbers; then execute step S705, that is, the data blocks corresponding to these data block numbers are synchronized to the backup system in sequence from high to low according to the priority order of the data blocks, and the high priority is synchronized first, and then the batch synchronization process is ended .
下面是本发明的第四实施例,这是另一种更优化的主备系统数据同步方法。The following is the fourth embodiment of the present invention, which is another more optimized method for synchronizing data between master and backup systems.
首先主用系统将需要同步的数据划分若干数据块;具体操作过程同第二First, the main system divides the data to be synchronized into several data blocks; the specific operation process is the same as that of the second
实施例。Example.
其次根据数据块对系统运行的重要性,对多个数据块数据块确定优先级,制定同步顺序,例如:在有配置数据块,保护数据块,维护数据块三种数据块的情况下,可将配置数据的优先级定位最高,保护类数据优先级次之,维护类优先级最低;如图5所示,为主用系统中一个数据块划分,及优先级分配并同步到备用系统的示例。业务配置的数据优先级最高,标记为数据块A110;其次为保护类数据,标记为数据块B 120;再其次为维护类数据,标记为数据块C130,以此类推,按照优先级A>B>C>D>E>…进行排列。Secondly, according to the importance of the data blocks to the system operation, determine the priority of multiple data blocks and formulate the synchronization order. For example: in the case of configuration data blocks, protection data blocks, and maintenance data blocks, three data blocks can be used. The priority of the configuration data is the highest, the priority of the protection data is second, and the priority of the maintenance data is the lowest; as shown in Figure 5, it is an example of dividing a data block in the active system, and assigning priority and synchronizing to the backup system . The data of business configuration has the highest priority, which is marked as data block A110; the second is protection data, which is marked as
接着,主用、备用系统根据每个数据块的数据计算其对应的校验码。Then, the active and standby systems calculate their corresponding check codes according to the data of each data block.
如主系统判断出数据块的内容发生了改变(通常用户下发配置命令等情况导致主系统配置数据会发生改变),则进行增量同步,具体过程同第三实施例中所描述;如果数据块的内容未发生改变,则主系统将根据触发条件(如通讯中断、系统复位或周期性的同步等)定时发起批量同步。If the main system judges that the content of the data block has changed (usually the configuration data of the main system will change due to the configuration command issued by the user), it will perform incremental synchronization. The specific process is the same as that described in the third embodiment; If the content of the block does not change, the main system will regularly initiate batch synchronization according to trigger conditions (such as communication interruption, system reset or periodic synchronization, etc.).
下面结合图8对本实施例中批量同步过程作详细的描述。The batch synchronization process in this embodiment will be described in detail below with reference to FIG. 8 .
当主系统检测到符合批量同步条件时,首先执行步骤S801,即向备系统发起批量同步命令;备系统收到该命令后,执行步骤S802,计算备系统各数据块校验码,并上报给主系统;主系统接收到备系统上报的校验码后执行步骤S803计算其上的各数据块校验码;主系统计算完其上各数据块校验码后,执行步骤S804,判断其计算出的校验码与备系统上报的校验码是否一致;如一致,则结束本次批量同步过程,如不一致,执行步骤S805,记录校验码不一致的数据块编号;然后执行步骤S806,将这些编号对应的数据块按照数据块的优先级顺序从高到低先后同步到备系统,优先级高的先同步,然后结束批量同步过程。When the primary system detects that the batch synchronization conditions are met, it first executes step S801, that is, initiates a batch synchronization command to the backup system; after receiving the command, the backup system executes step S802, calculates the check code of each data block in the backup system, and reports it to the master system; the main system executes step S803 to calculate the check code of each data block on it after receiving the check code reported by the standby system; check code is consistent with the check code reported by the standby system; if consistent, then end the batch synchronization process, if inconsistent, execute step S805, record the number of data blocks whose check codes are inconsistent; then execute step S806, and copy these The data blocks corresponding to the numbers are synchronized to the standby system in descending order of the priority of the data blocks, and the ones with higher priorities are synchronized first, and then the batch synchronization process ends.
上述第三及第四实施例中,由于主用系统按优先级的高低进行数据同步,即对优先级高的数据优先同步,对优先级较低的数据随后同步,这样即使在同步过程中出现意外,如,通讯中断、同步意外中止等,备用系统可以使用已经优先同步的数据完成基本的功能,这样大大增加了系统的可靠性。In the above-mentioned third and fourth embodiments, since the main system performs data synchronization according to the priority level, that is, the data with high priority is synchronized first, and the data with lower priority is synchronized later, so even if there is a problem during the synchronization process In case of accidents, such as communication interruption, unexpected suspension of synchronization, etc., the backup system can use the data that has been synchronized to complete the basic functions, which greatly increases the reliability of the system.
以上所述,仅为本发明较佳的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明公开的技术范围内,可轻易想到的变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应该以权利要求书的保护范围为准。The above is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto, any changes or variations that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention Replacement should be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention should be determined by the protection scope of the claims.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN 200410080629 CN1756108A (en) | 2004-09-29 | 2004-09-29 | Master/backup system data synchronizing method |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN 200410080629 CN1756108A (en) | 2004-09-29 | 2004-09-29 | Master/backup system data synchronizing method |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN1756108A true CN1756108A (en) | 2006-04-05 |
Family
ID=36689105
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN 200410080629 Pending CN1756108A (en) | 2004-09-29 | 2004-09-29 | Master/backup system data synchronizing method |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN1756108A (en) |
Cited By (23)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101937435A (en) * | 2009-07-01 | 2011-01-05 | 北京科东电力控制系统有限责任公司 | Online Synchronization Method of Distributed Real-time Database for Power System |
| CN101110608B (en) * | 2007-08-23 | 2011-02-09 | 华为技术有限公司 | Method, system and device for data detection of main and spare plate |
| CN102064932A (en) * | 2010-12-30 | 2011-05-18 | 上海顶竹通讯技术有限公司 | Method and device for synchronizing data between different equipment |
| CN103092840A (en) * | 2011-10-28 | 2013-05-08 | 上海邮电设计咨询研究院有限公司 | Method for acquiring self-increment mass data files from multiple sources |
| CN103500130A (en) * | 2013-09-11 | 2014-01-08 | 上海爱数软件有限公司 | Method for backing up dual-computer hot standby data in real time |
| WO2014053089A1 (en) * | 2012-10-01 | 2014-04-10 | Huawei Technologies Co., Ltd. | Controlling data synchronization and backup services |
| CN103905397A (en) * | 2012-12-28 | 2014-07-02 | 腾讯科技(深圳)有限公司 | Data synchronization method and system |
| CN104272649A (en) * | 2011-11-04 | 2015-01-07 | 达索系统加拿大软件股份有限公司 | System and method for data communication over a network |
| CN104299065A (en) * | 2014-07-30 | 2015-01-21 | 国家电网公司 | Dispatching automation host and backup model correctness checking method |
| CN104618434A (en) * | 2014-12-23 | 2015-05-13 | 上海斐讯数据通信技术有限公司 | Synchronization method and system for mPortal system data |
| CN105224418A (en) * | 2015-09-06 | 2016-01-06 | 福建三元达通讯股份有限公司 | A kind of data back up method and device |
| CN105474250A (en) * | 2013-07-12 | 2016-04-06 | 贸易技术国际公司 | tailor-made messaging |
| CN106357703A (en) * | 2015-07-13 | 2017-01-25 | 阿里巴巴集团控股有限公司 | Cluster switching method and cluster switching equipment |
| CN106936940A (en) * | 2017-02-10 | 2017-07-07 | 福建三元达网络技术有限公司 | Lease information backup method and system in a kind of Dynamic Host Configuration Protocol server |
| CN108259227A (en) * | 2017-12-22 | 2018-07-06 | 合肥工大高科信息科技股份有限公司 | A kind of method of data synchronization of two-node cluster hot backup interlock system |
| CN105323289B (en) * | 2014-08-01 | 2019-02-05 | 上海博达数据通信有限公司 | One kind being based on distributed method of data synchronization |
| CN110781032A (en) * | 2019-09-26 | 2020-02-11 | 北京大米科技有限公司 | Data transmission method, device, electronic equipment and medium |
| CN110958171A (en) * | 2019-11-29 | 2020-04-03 | 盛科网络(苏州)有限公司 | Data synchronization method and system based on main and standby equipment |
| CN112839067A (en) * | 2019-11-22 | 2021-05-25 | 腾讯科技(深圳)有限公司 | Data synchronization method and device |
| CN113830134A (en) * | 2021-08-25 | 2021-12-24 | 通号城市轨道交通技术有限公司 | Vehicle-mounted ATP (automatic train protection) dual-system switching method and logic unit of vehicle-mounted ATP |
| CN114398443A (en) * | 2021-12-09 | 2022-04-26 | 浙江蓝卓工业互联网信息技术有限公司 | A master-slave library synchronization method, device, system and medium for a time series database |
| CN114584574A (en) * | 2022-04-28 | 2022-06-03 | 武汉四通信息服务有限公司 | Data synchronization method and device, computer equipment and storage medium |
| CN115599866A (en) * | 2022-11-03 | 2023-01-13 | 深圳市汇川技术股份有限公司(Cn) | Data synchronization method, device and equipment of controller and storage medium thereof |
-
2004
- 2004-09-29 CN CN 200410080629 patent/CN1756108A/en active Pending
Cited By (38)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101110608B (en) * | 2007-08-23 | 2011-02-09 | 华为技术有限公司 | Method, system and device for data detection of main and spare plate |
| CN101937435A (en) * | 2009-07-01 | 2011-01-05 | 北京科东电力控制系统有限责任公司 | Online Synchronization Method of Distributed Real-time Database for Power System |
| CN102064932A (en) * | 2010-12-30 | 2011-05-18 | 上海顶竹通讯技术有限公司 | Method and device for synchronizing data between different equipment |
| CN103092840B (en) * | 2011-10-28 | 2015-09-16 | 上海邮电设计咨询研究院有限公司 | Multi-source is from increasing massive data files real-time collecting method |
| CN103092840A (en) * | 2011-10-28 | 2013-05-08 | 上海邮电设计咨询研究院有限公司 | Method for acquiring self-increment mass data files from multiple sources |
| CN104272649A (en) * | 2011-11-04 | 2015-01-07 | 达索系统加拿大软件股份有限公司 | System and method for data communication over a network |
| CN103947124A (en) * | 2012-10-01 | 2014-07-23 | 华为技术有限公司 | Controlling data synchronization and backup services |
| WO2014053089A1 (en) * | 2012-10-01 | 2014-04-10 | Huawei Technologies Co., Ltd. | Controlling data synchronization and backup services |
| CN103947124B (en) * | 2012-10-01 | 2016-03-09 | 华为技术有限公司 | Control data synchronization and backup services |
| CN103905397A (en) * | 2012-12-28 | 2014-07-02 | 腾讯科技(深圳)有限公司 | Data synchronization method and system |
| WO2014101684A1 (en) * | 2012-12-28 | 2014-07-03 | 腾讯科技(深圳)有限公司 | Data synchronizing method, apparatus and system |
| US9753656B2 (en) | 2012-12-28 | 2017-09-05 | Tencent Technology (Shenzhen) Company Limited | Data synchronization method, apparatus and system |
| CN103905397B (en) * | 2012-12-28 | 2015-05-13 | 腾讯科技(深圳)有限公司 | Data synchronization method and system |
| CN111581551A (en) * | 2013-07-12 | 2020-08-25 | 贸易技术国际公司 | Customized messaging |
| CN105474250A (en) * | 2013-07-12 | 2016-04-06 | 贸易技术国际公司 | tailor-made messaging |
| CN105474250B (en) * | 2013-07-12 | 2020-04-24 | 贸易技术国际公司 | Customized messaging |
| CN103500130B (en) * | 2013-09-11 | 2015-07-29 | 上海爱数软件有限公司 | A kind of method that two-node cluster hot backup data are backed up in realtime |
| CN103500130A (en) * | 2013-09-11 | 2014-01-08 | 上海爱数软件有限公司 | Method for backing up dual-computer hot standby data in real time |
| CN104299065A (en) * | 2014-07-30 | 2015-01-21 | 国家电网公司 | Dispatching automation host and backup model correctness checking method |
| CN104299065B (en) * | 2014-07-30 | 2017-08-22 | 国家电网公司 | A kind of method that Correctness of model is verified between dispatching automation main preparation system |
| CN105323289B (en) * | 2014-08-01 | 2019-02-05 | 上海博达数据通信有限公司 | One kind being based on distributed method of data synchronization |
| CN104618434A (en) * | 2014-12-23 | 2015-05-13 | 上海斐讯数据通信技术有限公司 | Synchronization method and system for mPortal system data |
| CN106357703A (en) * | 2015-07-13 | 2017-01-25 | 阿里巴巴集团控股有限公司 | Cluster switching method and cluster switching equipment |
| CN106357703B (en) * | 2015-07-13 | 2020-03-10 | 阿里巴巴集团控股有限公司 | Cluster switching method and device |
| US10609141B2 (en) | 2015-07-13 | 2020-03-31 | Alibaba Group Holding Limited | Methods and apparatuses for cluster switching |
| CN105224418A (en) * | 2015-09-06 | 2016-01-06 | 福建三元达通讯股份有限公司 | A kind of data back up method and device |
| CN106936940A (en) * | 2017-02-10 | 2017-07-07 | 福建三元达网络技术有限公司 | Lease information backup method and system in a kind of Dynamic Host Configuration Protocol server |
| CN106936940B (en) * | 2017-02-10 | 2019-11-08 | 安科讯(福建)科技有限公司 | Lease information backup method and system in a kind of Dynamic Host Configuration Protocol server |
| CN108259227A (en) * | 2017-12-22 | 2018-07-06 | 合肥工大高科信息科技股份有限公司 | A kind of method of data synchronization of two-node cluster hot backup interlock system |
| CN108259227B (en) * | 2017-12-22 | 2021-01-08 | 合肥工大高科信息科技股份有限公司 | Data synchronization method of dual-computer hot standby interlocking system |
| CN110781032A (en) * | 2019-09-26 | 2020-02-11 | 北京大米科技有限公司 | Data transmission method, device, electronic equipment and medium |
| CN112839067A (en) * | 2019-11-22 | 2021-05-25 | 腾讯科技(深圳)有限公司 | Data synchronization method and device |
| CN110958171A (en) * | 2019-11-29 | 2020-04-03 | 盛科网络(苏州)有限公司 | Data synchronization method and system based on main and standby equipment |
| CN113830134A (en) * | 2021-08-25 | 2021-12-24 | 通号城市轨道交通技术有限公司 | Vehicle-mounted ATP (automatic train protection) dual-system switching method and logic unit of vehicle-mounted ATP |
| CN113830134B (en) * | 2021-08-25 | 2024-03-15 | 通号城市轨道交通技术有限公司 | Vehicle-mounted ATP double-system switching method and logic unit of vehicle-mounted ATP |
| CN114398443A (en) * | 2021-12-09 | 2022-04-26 | 浙江蓝卓工业互联网信息技术有限公司 | A master-slave library synchronization method, device, system and medium for a time series database |
| CN114584574A (en) * | 2022-04-28 | 2022-06-03 | 武汉四通信息服务有限公司 | Data synchronization method and device, computer equipment and storage medium |
| CN115599866A (en) * | 2022-11-03 | 2023-01-13 | 深圳市汇川技术股份有限公司(Cn) | Data synchronization method, device and equipment of controller and storage medium thereof |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN1756108A (en) | Master/backup system data synchronizing method | |
| US10078460B2 (en) | Memory controller utilizing scatter gather list techniques | |
| CN1110173C (en) | Redundant method for ethernet communication | |
| JP5667210B2 (en) | Distributed video transcoding system with adaptive file processing | |
| CN107480150B (en) | File loading method and device | |
| CN101064724A (en) | Method and device for dividing and numbering service data units in wireless communication system | |
| CN1236134A (en) | Peripheral equipment and its control method | |
| CN1910555A (en) | Geographically distributed clusters | |
| CN1681248A (en) | Method and system for transmitting data for data synchronization between server and client | |
| WO2011140991A1 (en) | Method and device for processing files of distributed file system | |
| CN1283063C (en) | Method and device for configuring data in communication equipment | |
| CN101382916A (en) | Methods of Memory Management in Embedded Systems | |
| EP2437178B1 (en) | Method, apparatus, and system for processing memory dump | |
| CN1333507A (en) | Non-interrupt migration for coordination unit service in distrubted computer system | |
| WO2021151294A1 (en) | Document transcoding method and apparatus, and scheduling server and storage medium | |
| CN1365564A (en) | Communication control device and control method | |
| CN108924008A (en) | A kind of dual controller data communications method, device, equipment and readable storage medium storing program for executing | |
| CN1881934A (en) | Microprocessor, network system, and communication method | |
| CN1295903C (en) | A safe system starting method | |
| CN114140115A (en) | Block chain transaction pool fragmentation method, system, storage medium and computer system | |
| CN104794155A (en) | Data loading method, device and system | |
| CN103577337B (en) | Space allocation method and device for storage system | |
| CN1317747A (en) | ATAPI instruct receiving way | |
| CN1852455A (en) | Data disaster-tolerance system and method | |
| CN1859204A (en) | Method and device for realizing synchronous data in double machine heat backup |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| C12 | Rejection of a patent application after its publication | ||
| RJ01 | Rejection of invention patent application after publication |