Background technology
Along with development of internet technology, the network equipment progressively develops into distributed treatment by initial centralized processing.The network equipment of distributed structure/architecture generally is made of a master control borad and a plurality of business board.Wherein master control borad is used to finish the management of the whole network equipment and the processing of procotol, and business board is used to finish the data forwarding processing of miscellaneous service.
In order to make each business board can both normally transmit business datum, the data sync such as some basic port link informations of the business board of need will whenever determining are to other business boards and master control borad.Simultaneously, in some high-end network equipments, also come the different port kind of supporting business plate onlinely to change, so just require port configuration information that the network equipment can the real-time update subcard to overall by the form of subcard for the flexible configuration service port.
For the data that guarantee business board can be synchronized to all veneers, the general employing sends affirmation mechanism, be that business board at first sends to master control borad with the data of self, forward the data to other whole business boards then by master control borad, confirm by the affirmation packet of responding whether data sync is successful then, adopt overtime retransmission mechanism to guarantee finally success synchronously of data simultaneously.
Fig. 1 is that available technology adopting sends the flow chart that affirmation mechanism realizes the method for data sync.As shown in Figure 1, may further comprise the steps:
Step 101, business board 1 change at the subcard that detects self after (insert or extract as subcard), and the relevant information (as subcard model, port configuration information etc.) of subcard is sent to master control borad as synchrodata.
Step 102, master control borad be according to the configuring condition of business, and the synchrodata that is received is sent to every other business board except that business board 1.
Step 103 receives the every other business board of master control borad synchrodata, received synchrodata is synchronized to this locality after, send confirmation of synchronization message to master control borad.
Step 104, master control borad after receiving the confirmation of synchronization message of every other business board, sends confirmation of synchronization message to business board 1.
Send in the method flow of affirmation mechanism realization data sync in above-mentioned employing, because packet may be lost in the process that transmits, therefore adopt overtime retransmission mechanism, just after packet sends out, enable overtime timer, if also do not receive confirmation at this timer expiry, then resend packet, generally after repeatedly sending failure, think no longer to retransmit fault.If there is new business board to insert in the system, then master control borad can send to whole configuration informations of preserving the business board of this new insertion.
But, above-mentioned in conjunction with the method for data synchronization that sends affirmation mechanism and overtime retransmission mechanism, need master control borad to safeguard independently timer and accepting state for each business board, handle more complicated, particularly when the daughter card configuration that a plurality of business boards are arranged changes simultaneously, it is corresponding to that business board daughter card configuration change in information that master control borad must be able to identify received confirmation of synchronization message, so need identify each synchronizing process respectively, combine with the number of business board again, handle very complexity, make mistakes easily.In addition, the data that in a single day said method is preserved at master control borad have an accident when destroying, and will cause master control borad to give business board with the data sync of mistake, thereby cause the data forwarding of whole system to go wrong, and can only solve problem by restarting systems.
In sum, existing method of data synchronization is realized more complicated, and can not self-healing when data have an accident destruction.
Summary of the invention
The invention provides a kind of method of data synchronization, this method realizes easily and has an accident when destroying in data, can self-healing.
The present invention also provides a kind of data synchronization unit, and this device realizes easily and have an accident when destroying in data, can self-healing.
For achieving the above object, technical scheme of the present invention specifically is achieved in that
The invention discloses a kind of method of data synchronization, this method comprises:
When pre-conditioned being satisfied, master control borad sends to each business board and verifies message; Carry the global synchronization data that described master control borad is preserved in the described verification message;
Each business board compares the global synchronization data of the global synchronization data in the verification message that is received and self preservation, find when inconsistent, judge whether described inconsistent data are synchrodatas of this business board, be then to send the verification failed message carry self synchrodata to master control borad, otherwise the global synchronization data of preserving according to the global synchronization Data Update in the described verification message self;
Master control borad upgrades the global synchronization data of self preserving according to the synchrodata in the described verification failed message when the verification failed message that receives from business board.
The invention also discloses a kind of data synchronization unit, this device comprises: master control borad and more than one business board, wherein,
Master control borad is used for whenever pre-conditioned being satisfied the time, sends the verification message of carrying the global synchronization data of self preserving to each business board; Be used for when the verification failed message that receives from business board, upgrading the global synchronization data of self preserving according to described verification failed message;
Each business board, the global synchronization data that are used for the global synchronization data of the verification message that will be received and self preserve compare, find when inconsistent, judge whether described inconsistent data are synchrodatas of this business board, be then to send the verification failed message carry self synchrodata to master control borad, otherwise the global synchronization data of preserving according to the global synchronization Data Update in the described verification message self.
As seen from the above technical solution, the present invention is this when pre-conditioned being satisfied, and master control borad sends the verification message of carrying the global synchronization data of self preserving to each business board; And the global synchronization data that each business board is preserved the global synchronization data in the verification message that is received and self compare, find when inconsistent, judge whether described inconsistent data are synchrodatas of this business board, be then to send the verification failed message carry self synchrodata to master control borad, thereby make master control borad upgrade the global synchronization data of self preserving according to the synchrodata in the described verification failed message, otherwise the technical scheme of the global synchronization data of preserving according to the global synchronization Data Update in the described verification message self, the state that does not need the recording and tracking complexity, do not need to distinguish the state of synchronous event each time yet, therefore realize easily.In addition, when the global synchronization data of master control borad have an accident destruction, during with self the corresponding synchrodata mistake of corresponding service plate by knowing relatively that master control preserves, send the verification failed message carry self correct synchrodata to master control borad, make the synchrodata that master control borad can be righted the wrong, and when pre-conditioned being satisfied next time, the global synchronization data after each business board sends corrigendum reach the purpose of self-healing.
Embodiment
Fig. 2 is the flow chart of a kind of method of data synchronization of the embodiment of the invention.As shown in Figure 2, may further comprise the steps:
Step 201, when pre-conditioned being satisfied, master control borad sends to each business board and verifies message; Carry the global synchronization data that described master control borad is preserved in the described verification message.
Step 202, each business board compares the global synchronization data of the global synchronization data in the verification message that is received and self preservation, find when inconsistent, judge whether described inconsistent data are synchrodatas of this business board, be then to send the verification failed message carry self synchrodata to master control borad, otherwise the global synchronization data of preserving according to the global synchronization Data Update in the described verification message self;
Step 203, master control borad upgrades the global synchronization data of self preserving according to the synchrodata in the described verification failed message when the verification failed message that receives from business board.
Above-mentioned method of data synchronization shown in Figure 2 is compared with existing method of data synchronization shown in Figure 1, does not need the state of recording and tracking complexity, does not also need to distinguish the state of synchronous event each time, therefore realizes easily.In addition, in method of data synchronization shown in Figure 2, when the global synchronization data of master control borad have an accident destruction, the corresponding service plate can be known the synchrodata mistake corresponding with self that master control is preserved by relatively verifying global synchronization data in the message and that self preserve, and send the verification failed message carry self correct synchrodata to master control borad, make the synchrodata that master control borad can be righted the wrong, and when pre-conditioned being satisfied next time, the global synchronization data after each business board sends corrigendum.So just, can reach the purpose of self-healing.
As seen, at method of data synchronization shown in Figure 2, it or not simple data calibration from the master control borad to the business board, but selectively between master control borad and business board, carry out two-way data calibration, finally guarantee all to preserve on the every veneer the same a correct global data that comprises whole veneer synchrodatas.
For making purpose of the present invention, technical scheme and advantage clearer, with the daughter card configuration data instance of business board, the present invention is described in more detail below.Promptly in following specific embodiment, the synchrodata of each business board is the daughter card configuration data of this business board itself, and the global synchronization data are set of the daughter card configuration data of all business boards.
Specific embodiment one
In this specific embodiment one, pre-conditioned described in the step 201 is the loop start timer expiry of presetting, and described loop start timer is can automatically actuated once more timer after once regularly overtime.In this external present embodiment one, master control borad also is provided with a synchronization status marker, is used for the global synchronization data synchronization state that mark self is preserved.Need to prove, the setting of synchronization status marker is not the essential features of technical solution problem of the present invention, just under some specific situations, system may use this information, for example, under the relatively strict situation of system requirements, after the daughter card configuration data of each business board need being synchronized to each business board and master control borad entirely truely, each business board could begin to carry out business datum and transmit, can know according to each business board of synchronization status marker whether the daughter card configuration data are good synchronously this moment, so in following examples, consider master control borad setting and maintain synchronization Status Flag, and to each professional synchronization status marker that sends.Present embodiment one also comprises following key problem in technology point:
When 1, each business board changes (subcard insert or extract etc.) in daughter card configuration, send to master control borad immediately and verify failed message, the daughter card configuration data that changed of carrying this business board in this verification failed message.Master control borad receives verifies the global synchronization data of preserving according to Data Update self wherein behind the failed message, promptly upgrades the daughter card configuration data of this business board in the global synchronization data, and the state that synchronization status marker is set simultaneously is " asynchronous ".
2, will start a loop start timer during master control board starting, whenever described loop start timer expiry, master control borad will be carried at the global synchronization data of self preserving and synchronization status marker to verify in the message and send to each business board.
3, each business receive verify verify after the message local global synchronization data whether with the global synchronization data consistent of verifying in the message, be then to return the verification success message, otherwise judge further whether inconsistent data are synchrodatas of this plate to master control borad; If inconsistent data are not the synchrodatas of this plate, then need according to the global synchronization data of verifying the global synchronization Data Update this locality in the message, reply to master control borad then and verify success message; If inconsistent data are synchrodatas of this plate, think that then the synchrodata of this plate is correct, in the verification failed message of the accurate synchronization data carry of this plate, return to master control borad.
4, master control borad is after sending verification message to each business board, if all business boards all return the verification success message, the state that synchronization status marker then is set is " synchronously "; If have at least a business board to return the verification failed message, synchronization status marker then is set is " asynchronous ".
5, the synchronization status marker in the verification message that receives of business board is " synchronously ", and verifies global synchronization data and local global synchronization data consistent in the message, shows that then the last data sync of this business board is successful.
For example, establish 4 business boards that comprise 1 master control borad in the network equipment and be numbered 0-3, business board 0 has disposed subcard A and B, and business board 1 has disposed subcard C and D, and business board 2 has disposed subcard A and C, and business board 3 has disposed subcard E and F.Master control borad and each business board are all preserved the global synchronization data of the daughter card configuration data that comprise each business board under the normal condition.After the subcard A of business board 0 extracted, business board 0 was checked through subcard and extracts, and sent to master control borad and verified failed message, the daughter card configuration data of carrying business board 0 in this verification failed message; Master control borad is according to upgrading local business board 1 pairing daughter card configuration data of preserving in the global synchronization data from the verification failed message of business board 0, and synchronization status marker is set is " asynchronous ".When the loop start timer expiry, master control board starting data check flow process sends the verification message of carrying global synchronization data and synchronization status marker to business board 0-3.Business board 0-3 compares with the global synchronization data of self preserving after receiving and verifying message, wherein, business board 1,2 and 3 finds that the daughter card configuration data of the business board 0 in the global synchronization data are inconsistent, according to the daughter card configuration data of the receive local business board of preserving 0 of renewal of verifying content in the message, return the verification success message to master control borad; Business board 0 finds that the global synchronization data are in full accord, returns the verification success message to master control borad.After master control borad is received whole verification success messages, the state that upgrades synchronization status marker is " synchronously ", then in the verification message that master control borad sends during the loop start timer expiry next time with regard to carrier state for the synchronization status marker of " synchronously ", business board 0 can know that the daughter card configuration data (subcard A extracts) of last-chance have been synchronized to whole system according to this synchronization status marker at this moment.
Self-healing repair process when mistake occurring for subcard configuration data in the system is as follows: if because program exception, the daughter card configuration data that cause the business board 1 preserved on the master control borad are by the modification of mistake, master control borad is at timer expiry, can trigger data verify flow process, send the verification message of carrying global synchronization data and synchronization status marker to whole business boards; Wherein, after business board 1 is received and is verified message, find that master control borad is verified the daughter card configuration data of the business board 1 in the message and the daughter card configuration data of this plate are not inconsistent, daughter card configuration data for business board 1 oneself are correct, so return the verification failed message to master control borad, carry the daughter card configuration data of correct business board 1 in this verification failed message; Master control borad upgrades the daughter card configuration data of the corresponding business board 1 in the local global synchronization data after receiving the verification failed message that business board 1 sends, and the state that synchronization status marker is set is " asynchronous "; Next time during timer expiry, master control borad trigger data is once more verified flow process, the correct daughter card configuration data sync of business board 1 will be arrived other business board, be that master control borad sends the verification message of carrying the global synchronization data to each business board, business board 0,2,3 will be found the own business board of preserving 1 when verifying daughter card configuration data with verify inconsistent in the message, just use the daughter card configuration data of the business board 1 in the global synchronization data of daughter card configuration Data Update oneself preservation of verifying the business board 1 in the data.Cuo Wu data just can be repaired automatically like this, thereby reach the purpose of self-healing.
Specific embodiment two
This specific embodiment two only is pre-conditioned the comprising described in the step 201 with the difference of specific embodiment one: default loop start timer expiry and master control borad receive the verification failed message from business board.Promptly can trigger data verify the flow process except the loop start timer expiry, the verification failed message that business board sends also can log-on data be verified flow process.The verification failed message here promptly comprises when the daughter card configuration data of business board self change the verification failed message that sends, and comprises that also business board is at the verification failed message that receives the verification message that master control borad sends and find to send when inconsistent.This scheme is fit to real-time is required than higher occasion.Present embodiment two comprises following key problem in technology point:
When 1, each business board changes (subcard insert or extract etc.) in daughter card configuration, send to master control borad immediately and verify failed message, the daughter card configuration data that changed of carrying this business board in this verification failed message.Master control borad receives verifies the global synchronization data of preserving according to Data Update self wherein behind the failed message, promptly upgrade the daughter card configuration data of this business board in the global synchronization data, the state that synchronization status marker is set simultaneously is " asynchronous ", and initiate the data check flow process immediately, global synchronization data that self is preserved and synchronization status marker are carried to verify in the message and send to each business board.
2, will start a loop start timer during master control board starting, whenever described loop start timer expiry, master control borad will be carried at the global synchronization data of self preserving and synchronization status marker to verify in the message and send to each business board.
3, each business receive verify verify after the message local global synchronization data whether with the global synchronization data consistent of verifying in the message, be then to return the verification success message, otherwise judge further whether inconsistent data are synchrodatas of this plate to master control borad; If inconsistent data are not the synchrodatas of this plate, then need according to the global synchronization data of verifying the global synchronization Data Update this locality in the message, reply to master control borad then and verify success message; If inconsistent data are synchrodatas of this plate, think that then the synchrodata of this plate is correct, in the verification failed message of the accurate synchronization data carry of this plate, return to master control borad.
4, master control borad is after sending verification message to each business board, if all business boards all return the verification success message, the state that synchronization status marker then is set is " synchronously "; If have at least a business board to return the verification failed message, synchronization status marker then is set is " asynchronous ", and trigger data is verified flow process once more.
5, the synchronization status marker in the verification message that receives of business board is " synchronously ", and verifies global synchronization data and local global synchronization data consistent in the message, shows that then the data sync of this business board is successful.
For example, still establish 4 business boards that comprise 1 master control borad in the network equipment and be numbered 0-3, business board 0 has disposed subcard A and B, and business board 1 has disposed subcard C and D, and business board 2 has disposed subcard A and C, and business board 3 has disposed subcard E and F.Master control borad and each business board are all preserved the global synchronization data of the daughter card configuration data that comprise each business board under the normal condition.After the subcard A of business board 0 extracted, business board 0 was checked through subcard and extracts, and sent to master control borad and verified failed message, the daughter card configuration data of carrying business board 0 in this verification failed message; Master control borad upgrades local business board 1 pairing daughter card configuration data of preserving in the global synchronization data according to the verification failed message from business board 0, and synchronization status marker is set for " asynchronous ", and trigger data is verified flow process and is sent the verification message of carrying global synchronization data and synchronization status marker to business board 0-3 immediately.Business board 0-3 compares with the global synchronization data of self preserving after receiving and verifying message, wherein, business board 1,2 and 3 finds that the daughter card configuration data of the business board 0 in the global synchronization data are inconsistent, according to the daughter card configuration data of the receive local business board of preserving 0 of renewal of verifying content in the message, return the verification success message to master control borad; Business board 0 finds that the global synchronization data are in full accord, returns the verification success message to master control borad.After master control borad is received whole verification success messages, the state that upgrades synchronization status marker is " synchronously ", then in the verification message that master control borad sends during the loop start timer expiry next time with regard to carrier state for the synchronization status marker of " synchronously ", business board 0 can know that the daughter card configuration data (subcard A extracts) of last-chance have been synchronized to whole system according to this synchronization status marker at this moment.In addition, the overtime master control borad trigger data that also can make of timer is verified flow process, no longer repeats here.
Self-healing repair process when mistake occurring for subcard configuration data in the system is as follows: if because program exception, the daughter card configuration data that cause the business board 1 preserved on the master control borad are by the modification of mistake, then master control borad is at timer expiry, can trigger data verify flow process, send the verification message of carrying the global synchronization data to whole business boards; Wherein, after business board 1 is received and is verified message, find that master control borad is verified the daughter card configuration data of the business board 1 in the message and the daughter card configuration data of this plate are not inconsistent, daughter card configuration data for business board 1 oneself are correct, so return the verification failed message to master control borad, carry the daughter card configuration data of correct business board 1 in this verification failed message; Master control borad receives the daughter card configuration data of upgrading the corresponding business board 1 in the local global synchronization data behind the verification failed message that business board 1 sends, the state that synchronization status marker is set is " asynchronous ", and immediately once more trigger data verify flow process, the correct daughter card configuration data sync of business board 1 is arrived other business board, be that master control borad sends the verification message of carrying the global synchronization data to each business board, business board 0,2, the 3 daughter card configuration data that when verifying, will find the own business board of preserving 1 with verify inconsistent in the message, just use the daughter card configuration data of the business board 1 in the global synchronization data of daughter card configuration Data Update oneself preservation of verifying the business board 1 in the data.
Also need to prove, the above embodiment of the present invention illustrates technical scheme of the present invention with the daughter card configuration data of business board as the needs data in synchronization, but it will be appreciated by those skilled in the art that for other needs data in synchronization, can use technical scheme of the present invention equally.
Next provide the composition structure of a kind of data synchronization unit of the present invention and the function of each part.
Fig. 3 is the composition structured flowchart of a kind of data synchronization unit of the embodiment of the invention.As shown in Figure 3, this device comprises: master control borad 301 and more than one business board 302, wherein:
Master control borad 301 is used for whenever pre-conditioned being satisfied the time, sends the verification message of carrying the global synchronization data of self preserving to each business board 302; Be used for when the verification failed message that receives from business board, upgrading the global synchronization data of self preserving according to described verification failed message.
Each business board 302, the global synchronization data that are used for the global synchronization data of the verification message that will be received and self preserve compare, find when inconsistent, judge whether described inconsistent data are synchrodatas of this business board, be then to send the verification failed message that carries self synchrodata to master control borad 301, otherwise the global synchronization data of preserving according to the global synchronization Data Update in the described verification message self.
In Fig. 3, master control borad 301 is used at the loop start timer expiry, and/or, when receiving the verification failed message of business board 302 transmissions, send described verification message to each business board 302.
In Fig. 3, each business board 302 is further used for when the synchrodata of self changes, and the synchrodata that has changed is carried to verify in the failed message send to described master control borad 301.Master control borad 301 is used for after receiving described verification failed message, upgrades the global synchronization data of self preserving according to the synchrodata in the described verification failed message; Master control borad 301, when cycle timer starts, and/or, when receiving the verification failed message that business board sends when judging the synchrodata that described inconsistent data are these business boards, and/or, when receiving the verification failed message that business board sends when the synchrodata of self changes, send to each business board and to verify message.
In Fig. 3, business board 302 is used for comparing in the global synchronization data of the verification message that will be received and the global synchronization data of self preserving, and when finding unanimity, further returns the verification success message to master control borad 301; Be used for comparing in the global synchronization data of the verification message that will be received and the global synchronization data of self preserving, when finding that inconsistent and inconsistent data are not the synchrodata of this business board, after the global synchronization data of preserving, also return the verification success message to master control borad 301 according to the global synchronization Data Update in the described verification message self.
In Fig. 3, master control borad 301 also is used to be provided with synchronization status marker; After sending verification message to each business board 302, if all business board returns the verification acknowledge message, then described synchronization status marker is set to " synchronously "; When receiving that having at least a business board to return verifies failed message, described synchronization status marker is set to " asynchronous "; When sending verification message, each business board 302 sends described synchronization status marker.
As seen from the above technical solution, technical scheme of the present invention does not need the state of recording and tracking complexity, does not need to distinguish the state of synchronous event each time yet, therefore realizes easily.In addition, when the global synchronization data of master control borad have an accident destruction, during with self the corresponding synchrodata mistake of corresponding service plate by knowing relatively that master control preserves, send the verification failed message carry self correct synchrodata to master control borad, make the synchrodata that master control borad can be righted the wrong, and when pre-conditioned being satisfied next time, the global synchronization data after each business board sends corrigendum reach the purpose of self-healing.
The above is preferred embodiment of the present invention only, is not to be used to limit protection scope of the present invention, all any modifications of being made within the spirit and principles in the present invention, is equal to replacement, improvement etc., all should be included within protection scope of the present invention.