A master-slave synchronization method and system based on Ethernet
Through the Ethernet-based master-slip synchronization method, the high transmission efficiency of Ethernet and the advantages of not requiring link establishment are used to solve the problems of low primary and secondary synchronization efficiency and unreliable synchronization in the existing technology, and the rapid and accurate synchronization of the main and secondary control board information is achieved, and the reliability and stability of the equipment are improved.
Patent Information
- Application Number
- CN202211361268.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-02
- Publication Date
- 2025-03-21
- Estimated Expiration
- 2042-11-02
AI Technical Summary
When using UDP and TCP protocols, existing master-slip synchronization solutions have problems such as low efficiency and unreliable synchronization. Especially after the stability of Ethernet hardware transmission is improved, the packet length limit and long connection establishment time of TCP and UDP protocols are particularly prominent.
The Ethernet-based master-support synchronization method is adopted to achieve fast and accurate synchronization between the main and spare master control boards through the high transmission efficiency of Ethernet and the advantages of not requiring link establishment. The specific steps include sending configuration files and module information synchronization request messages to the main control board, responding and syncing the main control board, and receiving and processing synchronization messages for synchronization operations.
It realizes fast and accurate synchronization of main and backup main control board information, improves the reliability and stability of the device, reduces the probability of error messages, and ensures the reliability of the synchronization process by configuring the comparison of verification synchronization messages and verification confirmation messages.
Smart Images

Figure CN115695177B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of communication technology, and in particular relates to an Ethernet-based master-slave synchronization method and system. Background Art
[0002] With the large-scale deployment of 5G networks, the requirements for the stability and reliability of equipment are getting higher and higher. At present, the 1+1 master-slave synchronization solution is generally used to achieve equipment reliability and stability. The master-slave synchronization solution means that the software and hardware of the two boards are the same and can work at the same time. One is the main control board and the other is the backup control board. Under normal circumstances, the main control board is in normal working state and the backup control board is in backup working state. When the main control board fails or other conditions are triggered, the backup control board becomes the main control board, and the original main control board becomes the backup control board. The main and backup switching is performed to ensure the reliable operation of the equipment.
[0003] At present, the main master-slave synchronization solutions are synchronized through UDP, TCP, and HDLC protocols. Compared with the HDLC protocol, UDP and TCP have higher synchronization efficiency, but UDP and TCP also have problems of low efficiency or unreliable synchronization. UDP is more efficient than TCP, but there is a problem of message loss; although TCP does not have the problem of message loss compared to UDP, the establishment time is too long, resulting in low efficiency.
[0004] Since the early Ethernet hardware transmission had poor stability, the master-slave synchronization solution used TCP and UDP. Today, Ethernet hardware transmission is increasingly stable, and Ethernet messages are very long, while TCP and UDP protocol messages are still subject to MTU limitations. Ethernet messages are forwarded through MAC learning, and do not need to establish a route before sending like the UDP protocol, nor do they need to establish a TCP connection before sending messages like the TCP protocol. They do not need to be fragmented when the length exceeds the MTU and then reassembled like UDP and TCP. As Ethernet hardware transmission becomes increasingly stable, packet loss almost never occurs, and retransmission never occurs. Therefore, Ethernet messages have great advantages over TCP / IP protocol family messages in the transmission process. Summary of the invention
[0005] In order to overcome the above technical defects, the present invention provides an Ethernet-based master-slave synchronization method and system, which utilizes the transmission advantages of Ethernet to achieve fast and accurate synchronization of information between the master and standby main control boards.
[0006] In order to solve the above problems, the present invention is implemented according to the following technical solutions:
[0007] A master-slave synchronization method based on Ethernet, comprising the following steps:
[0008] After power-on, the standby main control board sends a configuration file synchronization request message to the active main control board to synchronize the configuration files;
[0009] The standby main control board sends a module information synchronization request message to the active main control board to synchronize the module information;
[0010] The active main control board sends a configuration command synchronization message to the standby main control board;
[0011] The standby main control board receives and performs command line synchronization according to the configuration command synchronization message.
[0012] Further, the standby main control board sends a configuration file synchronization request message to the active main control board to synchronize the configuration file, including:
[0013] The standby main control board sends a configuration file synchronization request message to the active main control board;
[0014] After receiving the configuration file synchronization request message, the active main control board encapsulates the configuration file content into the configuration file synchronization message, and sends the configuration file synchronization message to the standby main control board;
[0015] The standby main control board receives and synchronizes the configuration file according to the configuration file synchronization message.
[0016] Further, the step of the standby main control board receiving and synchronizing the configuration file according to the configuration file synchronization message includes:
[0017] The standby main control board receives the configuration file synchronization message and the configuration file synchronization request end message;
[0018] The standby main control board parses and updates and loads the configuration file according to the content of the configuration file synchronization message.
[0019] Further, the standby main control board sends a module information synchronization request message to the active main control board to synchronize the module information, including:
[0020] The standby main control board sends a module information synchronization request message to the active main control board;
[0021] After receiving the module information synchronization request message, the active main control board encapsulates the state information to be synchronized into the module information synchronization message, and sends the module information synchronization message to the standby main control board;
[0022] The standby main control board receives and synchronizes the module information according to the module information synchronization message.
[0023] Further, the step of the standby main control board receiving and synchronizing the module information according to the module information synchronization message includes:
[0024] The standby main control board receives the module information synchronization message and the module information synchronization request end message;
[0025] The standby main control board parses and updates the module information according to the module information synchronization message content.
[0026] Further, the step of the standby main control board receiving and performing command line synchronization according to the configuration command synchronization message includes:
[0027] The standby main control board receives and parses the configuration command synchronization message;
[0028] The standby main control board calls the API for configuration based on the analysis results.
[0029] Further, after the standby main control board receives and performs command line synchronization according to the configuration command synchronization message, the step further includes:
[0030] The standby main control board sends a configuration verification synchronization message to the active main control board;
[0031] The main control board receives and compares it with the configuration verification synchronization message;
[0032] The active main control board sends a verification confirmation message to the standby main control board according to the comparison result;
[0033] The standby main control board receives the verification and determines whether the verification is successful based on the verification confirmation message.
[0034] Furthermore, the module information synchronization message includes a new state of the protocol state machine of the active main control board and a new state variable of the protocol state machine.
[0035] Compared with the prior art, the present invention has the following beneficial effects:
[0036] The present invention discloses a master-slave synchronization method based on Ethernet, which can enable the master main control board to actively send synchronization information to the backup main control board, and the backup main control board to actively send synchronization information to the master main control board, and utilizes the high transmission efficiency of Ethernet and the advantage of not needing to establish a link to realize fast and accurate transmission of messages, thereby ensuring that the information of the master and backup main control boards can be synchronized quickly and reliably.
[0037] The present invention also discloses a master-slave synchronization system based on Ethernet, comprising:
[0038] Static synchronization module, used to synchronize configuration files between the active and standby main control boards after power-on;
[0039] The dynamic synchronization module is used to realize real-time synchronization of module status information and command lines between the active main control board and the standby main control board. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] The specific embodiments of the present invention are further described in detail below in conjunction with the accompanying drawings, wherein:
[0041] Figure 1 This is the master-slave synchronization method described in Example 1. DETAILED DESCRIPTION
[0042] The preferred embodiments of the present invention are described below in conjunction with the accompanying drawings. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention.
[0043] Example 1
[0044] This embodiment discloses a master-slave synchronization method based on Ethernet, which includes the following steps:
[0045] S1. After power-on, the standby main control board sends a configuration file synchronization request message to the active main control board to synchronize the configuration files;
[0046] S2. The standby main control board sends a module information synchronization request message to the active main control board to synchronize module information.
[0047] S3. The active main control board sends a configuration command synchronization message to the standby main control board.
[0048] S4. The standby main control board receives and performs command line synchronization according to the configuration command synchronization message.
[0049] Specifically, step S1 includes:
[0050] S11. The standby main control board sends a configuration file synchronization request message to the active main control board.
[0051] S12. After receiving the configuration file synchronization request message, the active main control board encapsulates the configuration file content into the configuration file synchronization message, and sends the configuration file synchronization message to the standby main control board. In addition to the configuration file content, the configuration file synchronization message also includes one or more configuration file synchronization message synchronization start identifiers. The configuration file content can contain up to 9600 bytes. If the configuration file content is larger than 9600 bytes, it needs to be divided into multiple messages for sending.
[0052] S13. The standby main control board receives and synchronizes the configuration file according to the configuration file synchronization message.
[0053] Specifically, step S13, the standby main control board receives and synchronizes the configuration file according to the configuration file synchronization message, including:
[0054] The standby main control board receives the configuration file synchronization message and the configuration file synchronization request end message.
[0055] The standby main control board parses and updates and loads the configuration file according to the configuration file synchronization message content: the standby main control board writes the configuration file synchronization message content into its own configuration file, saves and loads the configuration file.
[0056] Specifically, step S2 includes:
[0057] S21. The standby main control board sends a module information synchronization request message to the active main control board: For some dynamic protocols, such as LACP, OSPF, ISIS, BGP, LDP, LLDP, etc., it is necessary to synchronize the status of the protocol state machine and the state variables of the protocol state machine on the active main control board and the standby main control board in real time to ensure the real-time synchronization of the protocol status on the active main control board and the standby main control board, so that after the active-standby switching is realized, the protocol on the new active main control board will not re-initiate negotiation due to the inconsistency between the status of the protocol state machine and the remote end, resulting in interruption of the flow.
[0058] S22. After receiving the module information synchronization request message, the active main control board encapsulates the status information to be synchronized into the module information synchronization message, and sends the module information synchronization message to the standby main control board: the active main control board encapsulates the updated status of the protocol state machine and the state variables of the protocol state machine into the module information synchronization message, and sends it to the standby main control board.
[0059] S23. The standby main control board receives and synchronizes module information according to the module information synchronization message.
[0060] Specifically, step S23 includes:
[0061] The standby main control board receives the module information synchronization message and the module information synchronization request end message.
[0062] The standby main control board parses and updates the module information according to the module information synchronization message content: The standby main control board parses the module information synchronization message, synchronizes the state of the protocol state machine and the state variables of the protocol state machine to the standby main control board's own protocol state machine, makes the state of the protocol state machine and the state variables of the protocol state machine consistent with those on the active main control board, and completes a protocol state machine state synchronization.
[0063] In the above embodiment, in step S3:
[0064] The execution of the command line is completed through each module API function, that is, the synchronization of the command line is implemented in each API function; after the module information synchronization is completed, the configurations on the active main control board and the standby main control board are consistent. When the active main control board executes the new configuration command and the normal API execution process ends, the active main control board encapsulates INDEX, CMD, and VALUE into the configuration command synchronization message and sends the configuration command synchronization message to the standby main control board.
[0065] Specifically, step S4 includes:
[0066] S41. The standby main control board receives and parses the configuration command synchronization message.
[0067] S42, the standby main control board calls the API for configuration according to the analysis result: the standby main control board obtains information such as INDEX, CMD, VALUE, etc. according to the analysis result, and calls the relevant API to complete the configuration.
[0068] Specifically, after step S4, the method further includes:
[0069] The standby main control board sends a configuration verification synchronization message to the active main control board: After the standby main control board performs command line synchronization, it sends the MD5 verification code (16 bytes in length) of its own configuration file to the active main control board.
[0070] The active main control board receives and compares the configuration verification synchronization message: The active main control board receives the MD5 verification code of the configuration file sent by the standby main control board, and compares it with the MD5 verification code of the configuration file of the active main control board itself.
[0071] The active main control board sends a verification confirmation message to the standby main control board according to the comparison result.
[0072] The standby main control board receives and determines whether the verification is successful based on the verification confirmation message: if the VALUE value in the verification confirmation message is 1, it indicates that the verification is successful; if the VALUE value in the verification confirmation message is 0, it indicates that the verification failed and the configuration file needs to be resynchronized.
[0073] In the above embodiment, each message is two bytes, the high byte indicates the main type of the message, which is used to distinguish the message operation type; the low byte indicates the message subtype, which is used to distinguish the module type. For configuration command synchronization messages and module information synchronization messages, the low byte is used to distinguish which module they belong to, such as: the high byte in the configuration command synchronization message indicates that the message type is a configuration command synchronization message, and the low byte indicates which module's command line synchronization the message belongs to.
[0074] The present invention can allow the active main control board to send synchronization information to the standby main control board, such as the active main control board sending a configuration command synchronization message to the standby main control board, and the standby main control board synchronizes the command line according to the configuration command synchronization message; the standby main control board can also actively send synchronization information to the active main control board, such as the standby main control board sending a synchronization request message to the active main control board, to synchronize the configuration file or the module information.
[0075] The present invention utilizes the high transmission efficiency of Ethernet, the advantages of message length and the advantage of not needing to establish a link to realize fast and accurate message transmission; at the same time, due to the stability of Ethernet data transmission, the probability of erroneous messages is reduced. If an erroneous message occurs, it can be judged by configuring a check synchronization message and a check confirmation message, and resynchronized, thereby ensuring that the information of the main control board and the standby main control board can be synchronized quickly and reliably.
[0076] Example 2
[0077] The present embodiment discloses an Ethernet-based master-slave synchronization system, including: a static synchronization module and a dynamic synchronization module. The static synchronization module is used to realize configuration file synchronization between the active main control board and the standby main control board after power-on; the dynamic synchronization module is used to realize real-time synchronization of module status information and real-time synchronization of command lines between the active main control board and the standby main control board.
[0078] The static synchronization module synchronizes the configuration files between the active and standby main control boards through the following steps:
[0079] S101. The standby main control board sends a configuration file synchronization request message to the active main control board.
[0080] S102. After receiving the configuration file synchronization request message, the active main control board encapsulates the configuration file content into a configuration file synchronization message, and sends the configuration file synchronization message to the standby main control board. In addition to the configuration file content, the configuration file synchronization message also includes one or more configuration file synchronization message synchronization start identifiers. The configuration file content can contain up to 9600 bytes. If the configuration file content is larger than 9600 bytes, it needs to be divided into multiple messages for sending.
[0081] S103: The standby main control board receives and synchronizes the configuration file according to the configuration file synchronization message.
[0082] Specifically, step S103 includes:
[0083] S1031. The standby main control board receives a configuration file synchronization message and a configuration file synchronization request end message.
[0084] S1032. The standby main control board parses and updates and loads the configuration file according to the configuration file synchronization message content: the standby main control board writes the configuration file synchronization message content into its own configuration file, saves and loads the configuration file.
[0085] The dynamic synchronization module implements real-time synchronization of module status information and command lines between the active and standby main control boards through the following steps:
[0086] S200: The standby main control board sends a module information synchronization request message to the active main control board to synchronize module information.
[0087] S300: The active main control board sends a configuration command synchronization message to the standby main control board.
[0088] S400: The standby main control board receives and performs command line synchronization according to the configuration command synchronization message.
[0089] Specifically, step S200 includes the following steps:
[0090] S201. The standby main control board sends a module information synchronization request message to the active main control board: For some dynamic protocols, such as LACP, OSPF, ISIS, BGP, LDP, LLDP, etc., it is necessary to synchronize the status of the protocol state machine and the state variables of the protocol state machine on the active main control board and the standby main control board in real time to ensure the real-time synchronization of the protocol status on the active main control board and the standby main control board, so that after the active-standby switching is realized, the protocol on the new active main control board will not re-initiate negotiation due to the inconsistency between the status of the protocol state machine and the remote end, resulting in interruption of the flow.
[0091] S202. After receiving the module information synchronization request message, the active main control board encapsulates the status information to be synchronized into the module information synchronization message, and sends the module information synchronization message to the standby main control board: the active main control board encapsulates the updated status of the protocol state machine and the state variables of the protocol state machine into the module information synchronization message, and sends it to the standby main control board.
[0092] S203: The standby main control board receives and synchronizes module information according to the module information synchronization message.
[0093] Specifically, step S203 includes:
[0094] The standby main control board receives the module information synchronization message and the module information synchronization request end message.
[0095] The standby main control board parses and updates the module information according to the module information synchronization message content: The standby main control board parses the module information synchronization message, synchronizes the state of the protocol state machine and the state variables of the protocol state machine to the standby main control board's own protocol state machine, makes the state of the protocol state machine and the state variables of the protocol state machine consistent with those on the active main control board, and completes a protocol state machine state synchronization.
[0096] In the above embodiment, in step S300:
[0097] The execution of the command line is completed through each module API function, that is, the synchronization of the command line is implemented in each API function; after the module information synchronization is completed, the configurations on the active main control board and the standby main control board are consistent. When the active main control board executes the new configuration command and the normal API execution process ends, the active main control board encapsulates INDEX, CMD, and VALUE into the configuration command synchronization message and sends the configuration command synchronization message to the standby main control board.
[0098] Specifically, step S400 includes:
[0099] S401: The standby main control board receives and parses a configuration command synchronization message.
[0100] S402, the standby main control board calls the API for configuration according to the analysis result: the standby main control board obtains information such as INDEX, CMD, VALUE, etc. according to the analysis result, and calls the relevant API to complete the configuration.
[0101] Specifically, after step S400, the following steps are further included:
[0102] The standby main control board sends a configuration verification synchronization message to the active main control board: After the standby main control board performs command line synchronization, it sends the MD5 verification code (16 bytes in length) of its own configuration file to the active main control board.
[0103] The active main control board receives and compares the configuration verification synchronization message: The active main control board receives the MD5 verification code of the configuration file sent by the standby main control board, and compares it with the MD5 verification code of the configuration file of the active main control board itself.
[0104] The active main control board sends a verification confirmation message to the standby main control board according to the comparison result.
[0105] The standby main control board receives and determines whether the verification is successful based on the verification confirmation message: if the VALUE value in the verification confirmation message is 1, it indicates that the verification is successful; if the VALUE value in the verification confirmation message is 0, it indicates that the verification failed and the configuration file needs to be resynchronized.
[0106] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. Therefore, any modification, equivalent change and modification made to the above embodiment based on the technical essence of the present invention without departing from the technical solution of the present invention shall still fall within the scope of the technical solution of the present invention.
Claims
1. A master-slave synchronization method based on Ethernet, characterized in that: The steps include: After power-on, the standby main control board sends a configuration file synchronization request message to the active main control board to synchronize the configuration files; The standby main control board sends a module information synchronization request message to the active main control board to synchronize module information, including: The standby main control board sends a module information synchronization request message to the active main control board; After receiving the module information synchronization request message, the active main control board encapsulates the state information to be synchronized into the module information synchronization message, and sends the module information synchronization message to the standby main control board; The standby main control board receives and performs module information synchronization according to the module information synchronization message; the module information synchronization message includes a new state of the protocol state machine of the active main control board and a new state variable of the protocol state machine; The active main control board sends a configuration command synchronization message to the standby main control board; The standby main control board receives and performs command line synchronization according to the configuration command synchronization message; After the standby main control board receives and performs command line synchronization according to the configuration command synchronization message, the following steps are also included: The standby main control board sends a configuration verification synchronization message to the active main control board; The active main control board receives the configuration verification synchronization message sent by the standby main control board and compares it with the configuration verification synchronization message of the active main control board itself; The active main control board sends a verification confirmation message to the standby main control board according to the comparison result; The standby main control board receives the verification and determines whether the verification is successful based on the verification confirmation message.
2. The method according to claim 1, characterized in that Step 1: The standby main control board sends a configuration file synchronization request message to the active main control board to synchronize the configuration file, including: The standby main control board sends a configuration file synchronization request message to the active main control board; After receiving the configuration file synchronization request message, the active main control board encapsulates the configuration file content into the configuration file synchronization message, and sends the configuration file synchronization message to the standby main control board; The standby main control board receives and synchronizes the configuration file according to the configuration file synchronization message.
3. The method according to claim 2, characterized in that Step 1: The standby main control board receives and synchronizes the configuration file according to the configuration file synchronization message, including: The standby main control board receives the configuration file synchronization message and the configuration file synchronization request end message; The standby main control board parses and updates and loads the configuration file according to the content of the configuration file synchronization message.
4. The method according to claim 1, characterized in that: Step: The standby main control board receives and synchronizes the module information according to the module information synchronization message, including: The standby main control board receives the module information synchronization message and the module information synchronization request end message; The standby main control board parses and updates the module information according to the module information synchronization message content.
5. The method according to claim 1, characterized in that Step 1: The standby main control board receives and performs command line synchronization according to the configuration command synchronization message, including: The standby main control board receives and parses the configuration command synchronization message; The standby main control board calls the API for configuration based on the analysis results.
6. An Ethernet-based master-slave synchronization system, used to implement the method according to any one of claims 1 to 5, characterized in that: include: Static synchronization module, used to synchronize configuration files between the active and standby main control boards after power-on; The dynamic synchronization module is used to realize real-time synchronization of module status information and command lines between the active main control board and the standby main control board.
Citation Information
Patent Citations
Real time synchronization network based on the standard Ethernet and its operating method
CN101018115A
Method for synchronous and real-time reversion for VOIP voice service primary and standby modules
CN101640611A