Dual master control configuration synchronization method, electronic equipment and storage medium
By introducing backplane eeprom as the third backup in the dual master control system, the problem of configuration data synchronization delay and exception in the prior art is solved, and efficient and stable data synchronization and service recovery are achieved.
Patent Information
- Application Number
- CN202510437754.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-09
- Publication Date
- 2025-07-25
AI Technical Summary
The existing dual-master device configuration data synchronization scheme has a large delay, and data may not be synchronized when the master control is abnormal, and it is necessary to actively manage the synchronization of each configuration item, resulting in slow and unstable business recovery.
The backplane eeprom is introduced as the third backup, and files are synchronized through the main master memory flash and the backup master memory flash, and configuration file changes are monitored in real time or regularly, and backplane eeprom data files are checked regularly to ensure data consistency and security.
It improves the data synchronization consistency and stability of the dual master control system, reduces the risk of configuration abnormalities, improves configuration synchronization efficiency and equipment performance, and ensures the stability of the service during main and standby switching.
Smart Images

Figure CN120378775A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technologies, and in particular, to a dual-master configuration synchronization method, an electronic device, and a storage medium. Background Art
[0002] With the development of optical communication, the communication system has higher and higher requirements for the stability and security of network services, and also puts forward higher requirements for the unity and configuration ability of communication device monitoring and management. Therefore, for optical communication devices, a hard control design with dual masters is adopted to ensure the stability of device management and the reliability of services.
[0003] On the basis of the hardware of the device side being equipped with dual masters, only the primary master provides normal services during operation. When the primary master is abnormal, the device automatically and quickly switches to the standby master, and the standby master takes over and restores the configuration to provide consistent services. This requires the configuration of the standby master to be consistent with that of the primary master to ensure the stability and consistency of services. For the current synchronization and recovery solutions for the configuration data of dual-master devices, there is a solution where the standby master actively synchronizes the configuration from the primary master after startup. The disadvantage of this solution is that the delay is large, the service recovery is slow, and data may not be synchronized when the primary master is abnormal. Additionally, there is an immediate synchronization solution where when the configuration of the primary master changes, it is immediately saved to the standby master. The disadvantage of this method is that it is necessary to actively manage the synchronization of each configuration item and ensure its success.
[0004] In view of the above situation, this patent introduces an enhanced configuration synchronization method that adds a backup file to a common storage structure and periodically checks the reliability of the file to avoid possible synchronization failures or abnormal file damage during the transmission of the primary and standby configurations, and maximally ensures the data security and service stability of dual-master devices. Summary of the Invention
[0005] Based on the problems existing in the above-mentioned prior art, the present invention aims to solve the technical problems in the synchronization and recovery solutions for the configuration data of dual-master devices in the prior art. For the solution where the standby master actively synchronizes the configuration from the primary master after startup, there is a large delay, slow service recovery, and data may not be synchronized when the primary master is abnormal. For the solution where when the configuration of the primary master changes, it is immediately saved to the standby master, it is necessary to actively manage the synchronization of each configuration item and ensure the success of actively managing the synchronization of each configuration item.
[0006] The present invention provides a dual-master configuration synchronization method, which includes the following steps:
[0007] When issuing a service configuration, the primary master sets the corresponding configuration to a single disk. After the service of the single-disk configuration takes effect and returns successfully, the primary master writes the structured configuration data into the corresponding configuration file and stores the configuration file in the flash memory of the primary master's memory.
[0008] The main master creates a file synchronization task, monitors the configuration file in the main master's memory flash in real time or periodically. If the configuration file changes, the changed configuration file is updated to the backup master's memory flash and the backplane EEPROM.
[0009] The main master creates a backplane file self-check task, and checks the data files stored in the backplane EEPROM in real time or periodically. If a file is found to be damaged or abnormal, a copy of the data is actively obtained from the main master's memory flash and updated to the backplane EEPROM.
[0010] According to an embodiment of the present invention, the dual-master configuration synchronization method further includes the following steps:
[0011] When the main and backup master systems are started and loaded, the configuration files in their respective memory flashes are first checked. If the files are damaged or the data is abnormal, the data files are actively obtained from the backplane EEPROM.
[0012] According to an embodiment of the present invention, the dual-master configuration synchronization method further includes the following steps:
[0013] When the main and backup switch, the configuration is not issued to the single disk. Only when the single disk reports the cold restart flag bit, the saved configuration is issued.
[0014] According to an embodiment of the present invention, when the main and backup switch, the configuration is not issued to the single disk. Only when the single disk reports the cold restart flag bit, the saved configuration is issued, which specifically includes the following steps:
[0015] After the backup master takes over the device, during the configuration recovery process, if a file is found to be abnormal, the configuration file is obtained from the backplane EEPROM, and the configuration is recovered according to the new data file. The recovered configuration data is only stored in the master's memory flash and is not actually issued to the single disk; only when the single disk reports the cold restart status to the master, the configuration is issued to the single disk.
[0016] According to an embodiment of the present invention, the trigger condition for the single disk cold restart is that the single disk loses power.
[0017] According to an embodiment of the present invention, the main master creates a file synchronization task and monitors the configuration file in the main master's memory flash in real time or periodically, specifically including:
[0018] The main master detects the change of the configuration file in real time or periodically through the task mechanism, compares the file modification time in the main master's memory flash with the configuration file information stored in the backplane EEPROM. If the file modification time changes, it is considered that the configuration file has changed.
[0019] According to an embodiment of the present invention, in a dual-master device, the determination method of the primary master and the standby master is as follows:
[0020] When the device starts up, the two masters are initialized and start sending heartbeats to the interface card every second. The master whose heartbeat information is received first by the interface card is determined as the primary master.
[0021] According to an embodiment of the present invention, the structured configuration data is stored in xml format, and the configuration parameters are defined according to the netconf protocol in combination with the yang model.
[0022] The present invention also provides an electronic device, which includes a processor and a memory. A computer program is stored in the memory, and the processor is used to execute the computer program to implement the dual-master configuration synchronization method described above.
[0023] The present invention also provides a computer-readable storage medium, which is characterized in that a computer program is stored, and when the computer program is executed by a processor, the dual-master configuration synchronization method described above is implemented.
[0024] A dual-master configuration synchronization method provided by the present invention has the following beneficial effects:
[0025] (1) Based on the primary master's internal memory flash and the standby master's internal memory flash, this solution introduces the backplane eeprom as the third backup and conducts self-checks, which can effectively avoid anomalies during the data synchronization process and improve the consistency and stability of the dual-master system;
[0026] (2) The configuration data does not need to be collected and sent to the standby master in real time by the primary master. Instead, by analyzing the structured configuration file and comparing the file modification time, the configuration file is synchronously modified to the standby master and the backplane eeprom. This synchronization mechanism makes the implementation easier and has low consumption of device performance. When configuring is issued in batches at high frequencies, it can improve the security of the primary master's configuration file while enhancing the configuration synchronization efficiency;
[0027] (3) When the primary / standby switch occurs, the master does not immediately issue configurations to single disks. Only when a single disk undergoes a cold restart, the configuration recovery process is carried out, ensuring the stability of the service. Description of the Drawings
[0028] In order to more clearly illustrate the technical solutions in the embodiments or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0029] Figure 1It is a flowchart of a dual-master configuration synchronization method provided by an embodiment of the present invention;
[0030] Figure 2 It is a schematic flowchart of the main master creating a file synchronization task in an embodiment of the present invention;
[0031] Figure 3 It is a schematic flowchart of the standby master configuration recovery and distribution in an embodiment of the present invention. Detailed implementation manners
[0032] The descriptions of the following embodiments refer to the attached drawings, which are used to illustrate specific embodiments in which the present invention can be implemented.
[0033] The present invention provides a dual-master configuration synchronization method. As Figure 1 shown in the flowchart of the dual-master configuration synchronization method, the dual-master configuration synchronization method includes the following steps:
[0034] S1: When the device starts up, the two masters are initialized, and start sending heartbeats to the interface card every second. The master heartbeat information received first by the interface card is determined as the main master.
[0035] S2: When distributing service configurations, the main master will set the corresponding configurations to the single disk. After the single-disk configuration service takes effect and returns successfully, the main master writes the structured configuration data into the corresponding configuration file, and stores the configuration file in the main master memory flash. Please refer to Figure 1 steps ① to ④ in
[0036] S3: The main master creates a file synchronization task, and monitors the configuration file in the main master memory flash in real time or regularly. If the configuration file changes, the configuration change file is updated to the standby master memory flash and the backplane eeprom. Please refer to Figure 1 step ⑤ in
[0037] As Figure 2 shown, the main master regularly detects changes in the configuration file through the task mechanism, compares the file modification time in the main master memory flash with the configuration file information stored in the backplane eeprom, and if the file modification time changes, it is considered that the configuration file has changed.
[0038] For the configuration data distributed through multiple channels (such as network management or cli), according to the commonly used netconf protocol combined with the yang model definition, the configuration data can be saved in the form of an xml file, and the service parameters of multiple boards are stored in the corresponding xml files respectively. When synchronizing the configuration data modification, the main master needs to synchronize the corresponding xml to the standby master memory flash and the backplane eeprom of the device.
[0039] S4: The main master creates a backplane file self-check task to check the data files stored in the backplane eeprom in real time or periodically. If a file is found to be damaged or abnormal, it actively obtains a copy of the data from the main master's internal memory flash and updates it to the backplane eeprom to ensure data security and consistency. Please refer to Figure 1 Step ⑥ in
[0040] Specifically, the inspection period of the backplane configuration file can be set. For example, the saved configuration file is self-checked every hour. If the file format or data is found to be abnormal, the current configuration file is discarded and a copy of the data is synchronized from the main master again.
[0041] S5: As Figure 3 shown, when the main and standby master control systems start and load, they first check the configuration files in their respective internal memory flashes. If a file is damaged or the data is abnormal, they actively obtain the data file from the backplane eeprom to enhance data security.
[0042] S6: Please continue to refer to Figure 3 , when the main and standby switch, the configuration is not issued to a single disk. Only when the single disk reports the cold restart flag bit, the saved configuration is issued to reduce the risk of service exceptions caused by incorrect configuration parameters.
[0043] Before the standby master takes over the device, the program has completed the basic initialization work. When the main master resets or switches, the standby master will quickly take over the device and can resume polling of the single disk and communication with the network management within 15 seconds; the delay of communication interruption during the switch is low and will not affect the service;
[0044] After the standby master takes over the device, during the configuration recovery process, if a file is found to be abnormal, it obtains the configuration file from the backplane eeprom and performs configuration recovery according to the new data file. The recovered configuration data is only stored in the internal memory flash of the master control (referring to the standby master, after the main and standby switch, the standby master has been upgraded to the main master) and is not actually issued to the single disk. If the single disk loses power, the configuration is only issued to the single disk after reporting the cold restart status to the master control (referring to the standby master, which has been upgraded to the main master at this time), ensuring the stability of the service to the greatest extent.
[0045] The present invention also provides an electronic device, which includes a processor and a memory. The memory stores a computer program, and the processor is used to execute the computer program to implement the dual-master configuration synchronization method described above.
[0046] The present invention also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the dual-master configuration synchronization method described above.
[0047] In summary, a dual-master configuration synchronization method provided by the present invention has the following advantages:
[0048] (1) Based on the main master memory flash and the backup master memory flash, this solution introduces a backplane EEPROM as the third backup and conducts self-checks, which can effectively avoid anomalies during the data synchronization process and improve the consistency and stability of the dual-master system;
[0049] (2) The configuration data does not need to be collected and sent to the backup master in real time by the main master. Instead, by analyzing the structured configuration file and comparing the file modification time, the configuration file is synchronously modified to the backup master and the backplane EEPROM. This synchronization mechanism makes the implementation easier and consumes less device performance. When configuring is issued in batches at high frequencies, it can improve the security of the main master configuration file while enhancing the configuration synchronization efficiency;
[0050] (3) When the primary and backup switchover occurs, the master does not immediately issue configurations to individual disks. Only when an individual disk undergoes a cold restart, the configuration restoration process is carried out, ensuring the stability of the service.
[0051] It should be noted that although the present invention is disclosed as above with specific embodiments, the above embodiments are not intended to limit the present invention. Those of ordinary skill in the art can make various changes and modifications without departing from the spirit and scope of the present invention. Therefore, the protection scope of the present invention is subject to the scope defined by the claims.
Claims
1. A dual-master configuration synchronization method, characterized in that, It includes the following steps: When issuing service configurations, the main master will set the corresponding configurations to the single disks. After the single-disk configurations become effective and return successfully, the main master will write the structured configuration data into the corresponding configuration files and store the configuration files in the flash memory of the main master. The main master creates a file synchronization task to monitor the configuration files in the flash memory of the main master in real time or periodically. If the configuration files change, the changed configuration files will be updated to the flash memory of the standby master and the backplane EEPROM. The main master creates a backplane file self-check task to check the data files stored in the backplane EEPROM in real time or periodically. If file damage or anomalies are found, a copy of the data will be actively retrieved from the flash memory of the main master and updated to the backplane EEPROM.
2. The dual-master configuration synchronization method according to claim 1, wherein It also includes the following steps: When the main and standby master control systems start and load, they first check the configuration files in their respective flash memories. If the files are damaged or the data is abnormal, they will actively retrieve the data files from the backplane EEPROM.
3. The dual-master configuration synchronization method according to claim 1, wherein It also includes the following steps: When the main and standby switchover occurs, no configuration is issued to the single disks. Only when the single disks report the cold restart flag bit, the saved configuration is issued.
4. The dual-master configuration synchronization method according to claim 3, wherein When the main and standby switchover occurs, no configuration is issued to the single disks. Only when the single disks report the cold restart flag bit, the saved configuration is issued, which specifically includes the following steps: After the standby master takes over the device, during the configuration restoration process, if file anomalies are found, the configuration files will be retrieved from the backplane EEPROM and the configuration will be restored according to the new data files. The restored configuration data is only stored in the flash memory of the master control and is not actually issued to the single disks. Only when the single disks report the cold restart status to the master control, the configuration is issued to the single disks.
5. The dual-master configuration synchronization method according to claim 4, wherein The trigger condition for the cold restart of the single disk is that the single disk experiences a power failure.
6. The dual-master configuration synchronization method according to claim 1, wherein, When the main master creates a file synchronization task to monitor the configuration files in the flash memory of the main master in real time or periodically, it specifically includes: The main master detects changes in the configuration files in real time or periodically through the task mechanism, compares the file modification time in the flash memory of the main master with the configuration file information stored in the backplane EEPROM, and if the file modification time changes, it is considered that the configuration file has changed.
7. The dual-master configuration synchronization method according to claim 1, wherein, In a dual-master device, the determination method for the main master and the standby master is as follows: When the device starts, the two masters are initialized and start sending heartbeats to the interface cards every second. The master whose heartbeat information is received first by the interface cards is determined as the main master.
8. The dual-master configuration synchronization method according to claim 1, wherein The structured configuration data is stored in xml format and the configuration parameters are defined according to the netconf protocol in combination with the yang model.
9. An electronic device, characterized in that, It includes a processor and a memory. The memory stores a computer program, and the processor is used to execute the computer program to implement the dual-master configuration synchronization method according to any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that, A computer program is stored, and when the computer program is executed by a processor, it implements the dual-master configuration synchronization method according to any one of claims 1 to 8.