A master-slave switching method and system based on device synchronization

By configuring the monitoring system and data synchronization mechanism in the main and backup switching system, using machine learning algorithms to analyze heartbeat packets and monitoring data, combining heartbeat and status monitoring results for fault confirmation, and smoothly switching service traffic through dynamic load balancing strategies, the current solution is solved There are problems of insufficient fault detection accuracy and data consistency in the technology, which achieves high reliability and data integrity of master-sec switches.

CN119011374BActive Publication Date: 2024-12-31SHENZHEN BOHAOYUAN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411482894.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-23
Publication Date
2024-12-31
Estimated Expiration
2044-10-23

AI Technical Summary

Technical Problem

The prior art lacks in-depth analysis and evaluation of the actual operating status of the equipment during the main and standby switching process, the fault detection accuracy and comprehensiveness are insufficient, and the data synchronization and consistency verification steps are not clarified, resulting in data loss or inconsistency.

Method used

By configuring the monitoring system and data synchronization mechanism of the main and backup devices, using machine learning algorithms to analyze heartbeat packets and monitoring data to generate multi-dimensional health assessment indicators, combining heartbeat and status monitoring results to confirm faults, and smoothly switch services through dynamic load balancing strategies Traffic, ensure data consistency verification to ensure seamless switching.

Benefits of technology

It realizes comprehensive monitoring and data protection of the status of the main equipment, accurately and quickly identify faults, ensures service continuity and data integrity, and improves the reliability and fault recovery capabilities of the main and standby switching system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119011374B_ABST
    Figure CN119011374B_ABST
Patent Text Reader

Abstract

The present invention discloses a master-slave switching method and system based on device synchronization, which belongs to the field of computer technology, and specifically comprises: by configuring a master device and a backup device, deploying a monitoring system and a data synchronization mechanism, and monitoring the status of the master device in real time; the master-slave switching system uses a machine learning algorithm to analyze heartbeat packets and monitoring data, generates a multi-dimensional health assessment index, and preliminarily determines the fault once it exceeds a preset threshold; comprehensively considers the heartbeat and status monitoring results, confirms the fault through a preset fault detection logic, and triggers a switching decision module to generate a switching instruction; after receiving the instruction, the execution module smoothly switches the business traffic to the backup device according to the priority and dynamic load balancing strategy; the backup device immediately takes over the service, and ensures seamless switching through data consistency verification, thereby ensuring system continuity and data integrity, improving system reliability and fault recovery capability, and improving the efficiency and accuracy of fault detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of computer technology, and in particular to a method and system for master-slave switching based on device synchronization. Background Art

[0002] In data processing and communication systems, in order to ensure the stability and reliability of the system, a redundant design is usually adopted. This design includes establishing a data synchronization mechanism between the main device and the backup device so that when the main device fails, the backup device can quickly take over the work and ensure business continuity. In early data processing and communication systems, the main-backup switching mainly relied on manual intervention. When the main device fails, the administrator needs to manually start the backup device and perform corresponding configuration and testing to ensure that the backup device can work normally. However, this method is not only inefficient, but also prone to errors.

[0003] For example, the patent with the authorization announcement number CN113722396B discloses a method for synchronous switching between a host and a forwarding device, including: each forwarding device in the forwarding device group notifies the host of its current active / standby status; the host determines the active device in the forwarding device group according to the active / standby status notified by each forwarding device, and switches the port connected to the active device to the active port, and re-establishes the connection with the active device through the active port. This technical solution directly connects the host and the active device, reduces the number of hops of the forwarded message, the system delay, and minimizes the bandwidth occupied between the forwarding devices in the forwarding device group, saves system resources, and reduces the interconnection cost between the forwarding devices.

[0004] For example, the patent with the authorization announcement number CN113810227B discloses a master-slave switching method and a power station, including: the local device communicates with the opposite device and obtains the synchronization signal of the local device and the opposite device; wherein, if the local device is the master, the opposite device is the backup; if the local device is the backup, the opposite device is the master; the local device uses the synchronization signal as a fault judgment basis to perform a fault judgment step to switch the operation mode of the local device, or maintain the original operation mode; if the opposite device recovers from an abnormal heartbeat, the local device uses the synchronization signal as a judgment basis to perform a heartbeat recovery step to correct the operation mode of the local device. Compared with the prior art, this technical solution embodiment improves equipment utilization on the basis of reducing manual operation costs.

[0005] The above existing technologies all have the following problems: 1) There is a lack of in-depth analysis and evaluation of the actual operating status of the equipment, which leads to limitations in fault detection, and is mainly based on the master-slave status notified by the forwarding device, lacking an intelligent decision-making mechanism; 2) It mainly relies on synchronization signals and heartbeat detection to make fault judgments, and the accuracy and comprehensiveness of fault detection are insufficient, and the degree of intelligence is low. At the same time, the steps of data synchronization and consistency verification are not clearly mentioned, resulting in data loss or inconsistency during the switching process. Summary of the invention

[0006] In view of the shortcomings of the prior art, the present invention proposes a master-slave switching method and system based on device synchronization. By configuring the main device and the backup device, deploying the monitoring system and the data synchronization mechanism, the status of the main device is monitored in real time; the master-slave switching system uses a machine learning algorithm to analyze the heartbeat packet and monitoring data to generate a multi-dimensional health assessment index, and preliminarily judges the fault once it exceeds the preset threshold; the heartbeat and status monitoring results are combined, the fault is confirmed through the preset fault detection logic, and the switching decision module is triggered to generate a switching instruction; after the execution module receives the instruction, the business traffic is smoothly switched to the backup device according to the priority and dynamic load balancing strategy; the backup device immediately takes over the service, and ensures seamless switching through data consistency verification, thereby ensuring the continuity and data integrity of the master-slave switching system, and improving the reliability and fault recovery capability of the master-slave switching system.

[0007] To achieve the above object, the present invention provides the following technical solutions:

[0008] A master-slave switching method based on device synchronization, comprising:

[0009] Step S1: Configure the master device and the backup device, deploy the monitoring system, and set up the data synchronization mechanism;

[0010] Step S2: The monitoring system receives the heartbeat packet data sent by the master device, analyzes the heartbeat packet data using a machine learning algorithm, and generates a multi-dimensional health assessment index in combination with the monitoring data of the operating status and performance indicators of the master device. If it is detected that the multi-dimensional health assessment index exceeds a preset threshold, it is preliminarily determined that the master device is faulty.

[0011] Step S3: The monitoring system integrates the results of heartbeat detection and status monitoring, and performs fault confirmation through a preset fault detection logic. If the main device is confirmed to be faulty, a switching instruction is generated through a switching decision module;

[0012] Step S4: Send the switching instruction to the execution module, and the execution module switches the service traffic from the primary device to the backup device through dynamic load balancing adjustment according to the preset switching decision and priority;

[0013] Step S5: The standby device immediately takes over the service after receiving the switching instruction, and ensures that the data on the standby device after the switching is consistent with the data on the primary device before the failure through data consistency verification.

[0014] Specifically, the specific steps of step S2 include:

[0015] S2.1: The monitoring system obtains the real-time heartbeat packet data sent by the main device , and preprocessing is performed, where Indicates the nth heartbeat packet data, where n indicates the number of heartbeat packet data. Indicates the operating status data of the main device. Indicates the performance indicator data of the main device. Indicates additional information of the master device. a, b, and c represent The number of operating status data, performance index data and additional information of the main equipment;

[0016] S2.2: After preprocessing Perform feature extraction to obtain the main device feature data ,in, represents the mth master device characteristic data, where m represents the number of master device characteristic data.

[0017] Specifically, the specific steps of step S2 also include:

[0018] S2.3: Load pre-built machine learning models and Obtain a trained machine learning model. At the same time, input the real-time heartbeat data into the trained machine learning model to generate a multidimensional health evaluation index. The formula for the multidimensional health evaluation index is:

[0019] ;

[0020] in, Represents the comprehensive evaluation value, represents the weight of the i-th performance indicator, represents the i-th performance indicator, represents the time weight of the abnormality of the i-th performance indicator, represents the dynamic adjustment factor of the i-th performance indicator, represents the weight of the jth interaction term, represents the jth interaction term, represents the global adjustment parameter, A represents the type of performance indicator, B represents the number of interaction terms, and ;

[0021] S2.4: Set the evaluation index threshold h;

[0022] like , then the main device is judged to be normal;

[0023] like , it is preliminarily determined that the main device has a fault and the early warning mechanism is triggered.

[0024] Specifically, the fault detection logic in step S3 includes:

[0025] Check the number of heartbeat timeouts: If the number of heartbeat timeouts , it is judged that the main device is normal; if the heartbeat timeout number , then the judgment result is that the main device is faulty, where: Indicates the heartbeat timeout threshold. Indicates the number of heartbeat timeouts;

[0026] Evaluate the abnormality of performance indicators: If , then the result is that the main device is normal. ,or , then the judgment result is that the main device is faulty; among them, Indicates the number of abnormal performance indicators. Indicates the type threshold of the performance indicator abnormality. Indicates the time threshold of a single performance indicator exception.

[0027] Specifically, the specific steps of generating the switching instruction in step S3 include:

[0028] S3.1: Obtain the fault judgment results of the fault detection logic, collect fault data, and load the pre-trained risk assessment model;

[0029] S3.2: Input the fault judgment result and fault data into the risk assessment model to obtain a dynamic risk assessment result, and make a switching decision based on the dynamic risk assessment result to determine whether equipment switching needs to be performed immediately;

[0030] S3.3: If switching is required, the list of candidate devices is traversed to evaluate the status, performance, and load of the candidate devices, and the optimal candidate device is determined using an intelligent optimization algorithm based on the preset priority and load balancing strategy;

[0031] S3.4: Generate a switching instruction according to the selected optimal candidate device, automatically verify the switching instruction, and prepare context information during the switching process;

[0032] S3.5: Send the verified switching instruction to the execution module.

[0033] Specifically, the formula of the intelligent optimization algorithm in S3.3 is:

[0034] ;

[0035] in, Indicates the load balancing degree. represents the current load of the kth server, Indicates the monitoring system response time. represents a function that estimates the response time based on the monitoring system status and the selected server, Indicates network delay, Indicates the server processing capacity. Indicates the current load, Indicates resource utilization, represents the CPU utilization of the kth server, and M represents the number of servers.

[0036] Specifically, the switching instruction in S3.4 includes switching the failed main device, selecting the backup device, the switching timestamp and the switching duration.

[0037] A master-slave switching system based on device synchronization, comprising: a configuration module, a monitoring module, a switching decision module, an execution module, and a verification module;

[0038] The configuration module copies and sets the parameters and configurations of the primary and backup devices, installs and configures the monitoring system, and sets the data synchronization strategy and mechanism between the primary and backup devices;

[0039] The monitoring module is used to monitor the operating status of the main device, detect whether the main device is abnormal through a preset threshold, and feed back the monitored operating status of the main device to the switching decision module in real time;

[0040] The switching decision module makes a decision based on the information provided by the monitoring module and the results of the comprehensive heartbeat detection and status monitoring. If switching is required, a switching instruction is generated and sent to the execution module;

[0041] The execution module is used to receive the switching instruction generated by the switching decision module, execute the switching operation, and update the status information of the monitoring system;

[0042] The verification module is used to verify the operating status and business continuity of the backup device after the switch is completed, evaluate the performance of the monitoring system after the switch, and provide feedback to the configuration module and the switch decision module based on the verification results to optimize the switch strategy and configuration parameters.

[0043] Specifically, the switching decision module includes: a fault confirmation unit and a switching decision unit;

[0044] A fault confirmation unit is used to confirm whether the main device is in a fault state through a preset fault detection logic in combination with the results of heartbeat detection and status monitoring;

[0045] The switching decision unit is used to generate a switching instruction according to a preset switching strategy after confirming that the main device fails.

[0046] Specifically, the execution module includes: an instruction receiving unit, a data synchronization unit, and a switching execution unit;

[0047] An instruction receiving unit, used to receive a switching instruction sent by the switching decision module;

[0048] A data synchronization unit is used to synchronize the key data of the primary device to the backup device before switching;

[0049] The switching execution unit executes the switching operation according to the switching instruction and the preset switching strategy.

[0050] Compared with the prior art, the present invention has the following beneficial effects:

[0051] 1. The present invention proposes a master-slave switching system based on device synchronization, and optimizes and improves the architecture, operation steps and processes. The system has the advantages of simple processes, low investment and operation costs, and low production work costs.

[0052] 2. The present invention proposes a master-slave switching method based on device synchronization. By configuring master and standby devices, deploying a monitoring system and a data synchronization mechanism, comprehensive monitoring of the master device status and data protection are achieved, and the risk of data loss is prevented. A machine learning algorithm is used for multi-dimensional health assessment. Combined with heartbeat detection and status monitoring, the method can accurately and quickly identify and confirm master device failures, trigger the switching process in a timely manner, and smoothly migrate business traffic to the standby device through a dynamic load balancing strategy, thereby ensuring service continuity and high availability. At the same time, the data consistency verification mechanism ensures the integrity and accuracy of the data during the switching process. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] Figure 1 A schematic diagram of a master-slave switching method based on device synchronization according to the present invention;

[0054] Figure 2 This is a principle flow chart of a method for master-slave switching based on device synchronization according to the present invention;

[0055] Figure 3 This is a fault judgment flow chart of a master-slave switching method based on device synchronization of the present invention;

[0056] Figure 4 This is an architecture diagram of a master-slave switching system based on device synchronization according to the present invention. DETAILED DESCRIPTION

[0057] Example 1

[0058] See also Figure 1and Figure 2 , an embodiment of the present invention provides: a master-slave switching method based on device synchronization, comprising the following steps:

[0059] Step S1: Configure the master device and the backup device, deploy the monitoring system, and set up the data synchronization mechanism;

[0060] The primary device periodically sends a heartbeat packet to the backup device, and the backup device receives the heartbeat packet and confirms receipt.

[0061] Step S2: The monitoring system receives the heartbeat packet data sent by the master device, analyzes the heartbeat packet data using a machine learning algorithm, and generates a multi-dimensional health assessment index in combination with the monitoring data of the operating status and performance indicators of the master device. If it is detected that the multi-dimensional health assessment index exceeds a preset threshold, it is preliminarily determined that the master device is faulty.

[0062] The heartbeat packet data includes the operating status, performance indicators and additional information of the main device. The additional information includes timestamp, status code, serial number, device identification, device load, available resources and network status.

[0063] Furthermore, 1) Timestamp: The heartbeat packet will contain a timestamp to record the time when the heartbeat packet was sent. This timestamp helps the receiver determine the frequency of the heartbeat packet and whether it arrives in time, thereby further evaluating the status of the connection; 2) Sequence number: It can ensure that the receiver can process the heartbeat packet in the correct order and detect whether any heartbeat packet is lost or out of order; 3) Device identification: The heartbeat packet will contain the sender's device identification information, such as device ID, IP address or MAC address; 4) Status code: It is used to indicate the sender's current status or the type of heartbeat packet. For example, a specific status code can be set to indicate that the device is normal, abnormal, or requires different operations.

[0064] Step S3: The monitoring system integrates the results of heartbeat detection and status monitoring, and performs fault confirmation through a preset fault detection logic. If the main device is confirmed to be faulty, a switching instruction is generated through a switching decision module;

[0065] Step S4: Send the switching instruction to the execution module, and the execution module switches the service traffic from the primary device to the backup device through dynamic load balancing adjustment according to the preset switching decision and priority;

[0066] Furthermore, the specific steps of sending the switching instruction to the execution module include:

[0067] (1) Instruction generation and encoding:

[0068] 1) Generate a switching instruction based on the preset switching decision and priority, as well as the current service traffic and device status. The switching instruction contains key information such as target device information, switching time, and service traffic allocation strategy;

[0069] 2) Encode the generated switching instructions to ensure their accuracy and integrity during transmission. The encoding method includes data verification and encryption to prevent the instructions from being tampered with or lost during transmission.

[0070] (2) Command transmission and communication protocol:

[0071] 1) Select TCP / IP communication protocol according to the communication requirements between the execution module and the sending module;

[0072] 2) Send the encoded switching instructions to the execution module through the selected TCP / IP communication protocol. During the transmission process, network delays, packet loss and other issues need to be handled to ensure that the instructions can reach the execution module accurately and in a timely manner;

[0073] (3) Command reception and analysis:

[0074] 1) The execution module receives the switching instruction from the sending module. During the receiving process, the execution module needs to perform identity authentication, data decryption and other operations to ensure that the received instruction is legal and complete;

[0075] 2) The execution module parses the received switching instructions and extracts key information. During the parsing process, it needs to deal with issues such as data format conversion and data verification to ensure the accuracy and readability of the instruction information;

[0076] (4) Instruction execution and feedback:

[0077] 1) According to the parsed switching instructions, the execution module performs the corresponding switching operations, including adjusting the distribution strategy of business traffic, starting the backup equipment, etc.;

[0078] 2) After executing the switching operation, the execution module sends execution feedback to the sending module. The feedback content includes information such as the success or failure of the switching operation, execution time, and problems encountered. At the same time, the sending module can evaluate the effect of the switching operation based on the execution feedback and make corresponding adjustments and optimizations.

[0079] Furthermore, the specific steps of dynamic load balancing adjustment include:

[0080] S4.1: After receiving the switch command, the execution module performs resource evaluation, including the availability of the backup device and the network bandwidth;

[0081] S4.2: According to the evaluation results, the execution module adjusts the distribution of business traffic through a dynamic load balancing algorithm, and switches part or all of the business traffic from the primary device to the backup device. The dynamic load balancing algorithm adopts a consistent hash algorithm. The consistent hash algorithm is a prior art content in this field and is not an inventive solution of the present application, and will not be elaborated here.

[0082] Step S5: The backup device takes over the service immediately after receiving the switching instruction, and ensures that the data on the backup device after the switching is consistent with the data on the main device before the failure through data consistency verification. The data consistency verification method is the prior art content in this field, not the creative solution of this application, and will not be elaborated here.

[0083] Example 2

[0084] See also Figure 3 , the specific steps of step S2 in this implementation include:

[0085] S2.1: The monitoring system obtains the real-time heartbeat packet data sent by the main device , and preprocessing is performed, where Indicates the nth heartbeat packet data, where n indicates the number of heartbeat packet data. Indicates the operating status data of the main device. Indicates the performance indicator data of the main device. Indicates additional information of the master device. a, b, and c represent The number of operating status data, performance index data and additional information of the main equipment;

[0086] S2.2: After preprocessing Perform feature extraction to obtain the main device feature data ,in, represents the mth master device characteristic data, where m represents the number of master device characteristic data;

[0087] S2.3: Load pre-built machine learning models and Obtain a trained machine learning model. At the same time, input the real-time heartbeat data into the trained machine learning model to generate a multidimensional health evaluation index. The formula for the multidimensional health evaluation index is:

[0088] ;

[0089] in, Represents the comprehensive evaluation value, represents the weight of the i-th performance indicator, represents the i-th performance indicator, represents the time weight of the abnormality of the i-th performance indicator, represents the dynamic adjustment factor of the i-th performance indicator, represents the weight of the jth interaction term, represents the jth interaction term, represents the global adjustment parameter, A represents the type of performance indicator, B represents the number of interaction terms, and ;

[0090] Among them, in the present invention, a neural network algorithm is used to construct a machine learning model, but the specific process of using a neural network algorithm to construct a machine learning model is the prior art content in this field, and is not an inventive solution of this application, and will not be elaborated here.

[0091] Furthermore, the analysis of the heartbeat packet data includes: extracting key features that can reflect the device status by analyzing the structure and content of the heartbeat packet data, and the specific process includes:

[0092] (1) Obtain , and the history Divide into training set and test set;

[0093] (2) Select a neural network-based machine learning algorithm based on the nature of the problem and the characteristics of the data;

[0094] (3) Usage history Train the machine learning model with the training set data in the The test set data in the machine learning model is used to evaluate the performance of the machine learning model, such as accuracy;

[0095] (4) Real-time reception , using the trained machine learning model to classify or regress the heartbeat packet data, wherein the prediction process of the machine learning model for the heartbeat packet data is the prior art content in this field, and is not the inventive solution of the present application, and will not be described in detail here;

[0096] (5) Generate multidimensional health assessment indicators by combining performance indicator data;

[0097] (6) When the health assessment indicator exceeds the preset threshold, the fault warning mechanism is triggered.

[0098] S2.4: Set the evaluation index threshold h;

[0099] like , then the main device is judged to be normal;

[0100] like , it is preliminarily determined that the main device has a fault and the early warning mechanism is triggered.

[0101] The fault detection logic in step S3 includes:

[0102] Check the number of heartbeat timeouts: If the number of heartbeat timeouts , it is judged that the main device is normal; if the heartbeat timeout number , then the judgment result is that the main device is faulty, where: Indicates the heartbeat timeout threshold. Indicates the number of heartbeat timeouts;

[0103] Evaluate the abnormality of performance indicators: If , then the result is that the main device is normal. ,or , then the judgment result is that the main device is faulty; among them, Indicates the number of abnormal performance indicators. Indicates the type threshold of the performance indicator abnormality. Indicates the time threshold of a single performance indicator exception.

[0104] The specific steps of generating the switching instruction in step S3 include:

[0105] S3.1: Obtain the fault judgment results of the fault detection logic, collect fault data, and load the pre-trained risk assessment model;

[0106] Among them, the fault judgment result is output, including fault type, fault location, fault time and fault severity information. At the same time, the training process of the risk assessment model is the existing technical content in this field, which is not the creative solution of this application and will not be elaborated here.

[0107] S3.2: Input the fault judgment result and the fault data into the risk assessment model to obtain a dynamic risk assessment result, and make a switching decision based on the dynamic risk assessment result to determine whether it is necessary to switch the equipment immediately. The process of performing dynamic risk assessment based on the risk assessment model and known data is the prior art content in the art, and is not the inventive solution of the present application, and will not be described in detail here.

[0108] It should be noted that the risk assessment model refers to a tool that uses different methods and technologies to evaluate and measure the possibility and potential impact of specific risk events. In the scenario of equipment monitoring and switching decision-making, the risk assessment model can evaluate the operating status and risk level of the equipment in real time based on fault data and related judgment results. The specific expression of the risk assessment model is:

[0109] ;

[0110] in, Indicates the risk assessment results. Indicates the risk probability, which refers to the likelihood of a specific risk event occurring, usually expressed as a percentage or numerical range To express, Indicates the severity of the risk, which refers to the extent of loss or impact that may be caused when a specific risk event occurs, also expressed as a percentage or numerical range To express.

[0111] Furthermore, the specific process of obtaining dynamic assessment results according to the risk assessment model is as follows:

[0112] (1) Input the fault judgment results and fault data into the risk assessment model, including equipment status, fault type, fault frequency, and fault duration;

[0113] (2) The risk assessment model uses the input data and preset algorithms and formulas to calculate the risk probability and risk severity. Then, according to the risk assessment formula , and obtain a numerical value representing the risk assessment result;

[0114] 1) Calculation of risk probability:

[0115] a. Identify risk events: Identify risk events that need to be assessed, such as equipment failure and data loss;

[0116] b. Analyze the possibility of risk events: Based on historical data and professional knowledge, analyze the frequency and trend of risk events, and use statistical methods based on probability distribution to estimate the possibility of risk events. The calculation formula of the statistical method based on probability distribution is the prior art content in this field, which is not the inventive solution of this application and will not be elaborated here;

[0117] c. Quantify the probability of a risk event occurring as a value, usually using a range express.

[0118] 2) Calculation of risk severity:

[0119] a. Identify risk impacts: Analyze the impact that risk events may have on projects, organizations, or stakeholders;

[0120] b. Assess the extent of risk impact: Use qualitative analysis methods to assess the extent of risk impact, wherein the qualitative analysis method is the prior art content in this field, is not the inventive solution of this application, and is not described in detail here;

[0121] c. Quantify the severity of the risk: Quantify the extent of the risk impact as a numerical value, usually using a range express.

[0122] (3) The risk assessment model calculates the risk assessment results Output,Based on the risk assessment results, a switching decision can be made.

[0123] Furthermore, the switching decision refers to the decision on whether it is necessary to switch the currently running equipment, as well as the specific plan and time arrangement of the switching, based on the dynamic risk assessment results output by the risk assessment model, taking into account business continuity, system stability, and resource availability. Specifically, the switching decision includes the following:

[0124] (1) Decision-making basis:

[0125] 1) Risk assessment results: This is the main basis for switching decisions, including key indicators such as risk level, potential loss, and recovery time;

[0126] 2) Business continuity plan: Consider the business requirements for system availability and ensure that the switching operation does not affect business operations;

[0127] 3) System criticality level: evaluates the importance of the system in the entire business architecture. For monitoring systems, faster switching response and higher switching success rate are required;

[0128] 4) Current resource status: including the availability of backup devices, network bandwidth, and storage space resources to ensure that the switching operation is supported by resources;

[0129] (2) Decision content:

[0130] 1) Whether switching is needed: Based on the risk assessment results and other decision-making basis, determine whether equipment switching is needed immediately;

[0131] 2) Switching priority: For situations where switching is required, determine the switching priority and give priority to the devices or systems that have the greatest impact on the business;

[0132] 3) Switching time: Arrange the switching time to reduce the impact on the business. It is necessary to communicate with users to determine the best switching window;

[0133] 4) Switching plan: Develop a detailed switching plan, including switching steps, personnel division of labor, and emergency plans, to ensure that the switching operation can proceed smoothly and can be quickly restored when problems occur;

[0134] (3) Decision execution:

[0135] 1) After the decision is made, the switching operation is performed according to the switching plan, including shutting down the services of the current device, starting the backup device, and performing necessary configuration and testing steps;

[0136] 2) During the switching process, closely monitor the operating status of the system to ensure that the switching operation will not have a significant impact on the business;

[0137] 3) After the switch is completed, verification and testing are carried out to ensure that the backup equipment has taken over the business normally and is running stably;

[0138] (4) Decision adjustment:

[0139] Adjust the switching decision based on actual conditions and changes in risk assessment results.

[0140] For example, if the risk assessment results show that the risk is reduced or eliminated, then consider canceling or delaying the switching operation. During the switching process, if new problems or risks are discovered, then adjust the switching plan and response measures in a timely manner.

[0141] S3.3: If switching is required, the list of candidate devices is traversed to evaluate the status, performance, and load of the candidate devices. Based on the preset priority and load balancing strategy, an intelligent optimization algorithm is used to determine the optimal candidate device. The formula of the intelligent optimization algorithm is:

[0142] ;

[0143] in, Indicates the load balancing degree. represents the current load of the kth server, Indicates the monitoring system response time. represents a function that estimates the response time based on the monitoring system status and the selected server, Indicates network delay, Indicates the server processing capacity. Indicates the current load, Indicates resource utilization, represents the CPU utilization of the kth server, and M represents the number of servers.

[0144] Furthermore, the load balancing strategy is a technology that distributes the workload to multiple computing resources, aiming to improve the performance, reliability and scalability of the system by intelligently allocating requests or tasks to different servers or resources to avoid overloading a single server. In the present invention, the load balancing strategy adopts a consistent hashing method, and maps request parameters to specific services through a consistent hashing algorithm to achieve load balancing and distributed caching.

[0145] S3.4: Generate a switching instruction according to the selected optimal candidate device, automatically verify the switching instruction, and prepare context information during the switching process;

[0146] The switching instruction includes switching the failed main device, selecting the backup device, switching timestamp and switching duration.

[0147] The context information includes the latest data synchronization status, network connection quality report, and dependency diagram of related services. At the same time, this context information is presented to operation and maintenance personnel through visualization tools.

[0148] S3.5: Send the verified switching instruction to the execution module.

[0149] Example 3

[0150] See also Figure 4 Another embodiment provided by the present invention is a master-slave switching system based on device synchronization, comprising:

[0151] Configuration module, monitoring module, switching decision module, execution module, verification module;

[0152] Configuration module, which copies and sets the parameters and configurations of the primary and backup devices, installs and configures the monitoring system, and sets the data synchronization strategy and mechanism between the primary and backup devices to ensure that all system components are ready and can monitor and respond to device status changes in real time; the primary and backup devices refer to the primary and backup devices;

[0153] The monitoring module is used to monitor the operating status of the main device, detect whether the main device has any abnormal situation through the preset threshold, and feed back the monitored operating status of the main device to the switching decision module in real time;

[0154] The switching decision module makes a decision based on the information provided by the monitoring module and the results of heartbeat detection and status monitoring. If switching is required, a switching instruction is generated and sent to the execution module;

[0155] An execution module is used to receive the switching instruction generated by the switching decision module, execute the switching operation, and update the status information of the monitoring system, wherein the switching operation includes shutting down the main device, starting the backup device, and adjusting the network route, and updating the status information of the monitoring system includes updating the roles and operating status of the main and backup devices;

[0156] The verification module is used to verify the operating status and business continuity of the backup device after the switch is completed, to ensure that the switch is successful and the system is running stably, and to evaluate the performance of the system after the switch, including response time, throughput, etc., to verify the effectiveness of the switching strategy and the reliability of the system. At the same time, based on the verification results, feedback is provided to the configuration module and the switching decision module to optimize the switching strategy and configuration parameters and improve the overall performance of the system.

[0157] The monitoring module includes: a data receiving unit, a data analyzing unit, and a threshold judgment unit;

[0158] A data receiving unit, used for receiving heartbeat packet data sent by the master device in real time;

[0159] The data analysis unit uses machine learning algorithms to process and analyze the received data and generate multi-dimensional health assessment indicators;

[0160] The threshold judgment unit judges the multi-dimensional health assessment indicators according to the preset threshold value and preliminarily identifies whether the main device is faulty.

[0161] The switching decision module includes: a fault confirmation unit and a switching decision unit;

[0162] A fault confirmation unit is used to confirm whether the main device is in a fault state through a preset fault detection logic in combination with the results of heartbeat detection and status monitoring;

[0163] A switching decision unit, used to generate a switching instruction according to a preset switching strategy after confirming that the main device fails;

[0164] The execution module includes: an instruction receiving unit, a data synchronization unit, and a switching execution unit;

[0165] The instruction receiving unit is used to receive the switching instruction sent by the switching decision module, ensure the accuracy of the instruction, and prepare for execution;

[0166] Data synchronization unit, used to synchronize the key data of the primary device to the backup device before switching, to ensure the integrity and consistency of the data during the switching process;

[0167] The switching execution unit performs switching operations according to the switching instructions and the preset switching strategy, including adjusting load balancing and switching service traffic.

[0168] Furthermore, the workflow among the configuration module, the monitoring module, the switching decision module, the execution module, the verification module and their units includes:

[0169] First, the configuration module is responsible for initializing various parameters and settings of the system, including the configuration information of the master and standby devices and the switching conditions. These configurations provide the basis for subsequent monitoring, switching and verification operations. Then, the data receiving unit in the monitoring module continuously collects the operating data of the master device, such as performance indicators, error logs, etc. The data analysis unit processes and analyzes these data to evaluate the health status of the device. The threshold judgment unit determines whether the device has a fault or performance degradation based on the preset threshold. Once the monitoring module detects a problem with the master device, it will pass the fault information to the switching decision module. The fault confirmation unit in the switching decision module further verifies the fault condition to ensure the accuracy of the switching operation. Subsequently, the switching decision unit decides whether to perform the master-slave switching based on the preset switching strategy and priority, and generates the corresponding Switching instruction; the switching instruction is sent to the execution module, the instruction receiving unit in the execution module is responsible for receiving and parsing these instructions, the data synchronization unit performs data synchronization between the primary and backup devices to ensure that the backup device can seamlessly take over the business of the primary device after the switch, and the switching execution unit performs the actual switching operation according to the instruction to switch the business traffic from the primary device to the backup device; finally, the verification module verifies the switching operation to ensure that the switch is successful and the backup device can operate normally. Among them, the verification module may include performance testing, business continuity checking and other links to ensure system stability and business continuity after the switch. Through the collaborative work of this series of modules and units, the primary and backup switching system based on device synchronization can quickly switch to the backup device when the primary device fails, thereby ensuring the stable operation of the system and business continuity.

[0170] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation modes, which are merely illustrative rather than restrictive. Under the guidance of the present invention, ordinary technicians in the field may also change, modify, replace and modify the above-mentioned embodiments without departing from the purpose and scope of protection of the present invention, and all of these are within the protection of the present invention.

Claims

1. A master-slave switching method based on device synchronization, characterized in that: include: Step S1: Configure the master device and the backup device, deploy the monitoring system, and set up the data synchronization mechanism; Step S2: The monitoring system receives the heartbeat packet data sent by the master device, analyzes the heartbeat packet data using a machine learning algorithm, and generates a multi-dimensional health assessment index in combination with the monitoring data of the operating status and performance indicators of the master device. If it is detected that the multi-dimensional health assessment index exceeds a preset threshold, it is preliminarily determined that the master device is faulty. Step S3: The monitoring system integrates the results of heartbeat detection and status monitoring, and performs fault confirmation through a preset fault detection logic. If the main device is confirmed to be faulty, a switching instruction is generated through a switching decision module; Step S4: Send the switching instruction to the execution module, and the execution module switches the service traffic from the primary device to the backup device through dynamic load balancing adjustment according to the preset switching decision and priority; Step S5: The standby device immediately takes over the service after receiving the switching instruction, and ensures that the data on the standby device after the switching is consistent with the data on the primary device before the failure through data consistency verification; The specific steps of step S2 include: S2.1: The monitoring system obtains the real-time heartbeat packet data sent by the main device , and preprocessing is performed, where Indicates the nth heartbeat packet data, where n indicates the number of heartbeat packet data. Indicates the operating status data of the main device. Indicates the performance indicator data of the main device. Indicates additional information of the master device. a, b, and c represent The number of operating status data, performance index data and additional information of the main equipment; S2.2: After preprocessing Perform feature extraction to obtain the main device feature data ,in, represents the mth master device characteristic data, where m represents the number of master device characteristic data; The specific steps of step S2 also include: S2.3: Load pre-built machine learning models and Obtain a trained machine learning model. At the same time, input the real-time heartbeat data into the trained machine learning model to generate a multidimensional health evaluation index. The formula for the multidimensional health evaluation index is: ; in, Represents the comprehensive evaluation value, represents the weight of the i-th performance indicator, represents the i-th performance indicator, represents the time weight of the abnormality of the i-th performance indicator, represents the dynamic adjustment factor of the i-th performance indicator, represents the weight of the jth interaction term, represents the jth interaction term, represents the global adjustment parameter, A represents the type of performance indicator, B represents the number of interaction terms, and ; S2.4: Set the evaluation index threshold h; like , then the main device is judged to be normal; like , it is preliminarily determined that the main device has a fault and the early warning mechanism is triggered; The specific steps of generating the switching instruction in step S3 include: S3.1: Obtain the fault judgment results of the fault detection logic, collect fault data, and load the pre-trained risk assessment model; S3.2: Input the fault judgment result and fault data into the risk assessment model to obtain a dynamic risk assessment result, and make a switching decision based on the dynamic risk assessment result to determine whether equipment switching needs to be performed immediately; S3.3: If switching is required, the list of candidate devices is traversed to evaluate the status, performance, and load of the candidate devices, and the optimal candidate device is determined using an intelligent optimization algorithm based on the preset priority and load balancing strategy; S3.4: Generate a switching instruction according to the selected optimal candidate device, automatically verify the switching instruction, and prepare context information during the switching process; S3.5: Send the verified switching instruction to the execution module.

2. A method for master-slave switching based on device synchronization as claimed in claim 1, characterized in that: The fault detection logic in step S3 includes: Check the number of heartbeat timeouts: If the number of heartbeat timeouts , it is judged that the main device is normal; if the heartbeat timeout number , then the judgment result is that the main device is faulty, where: Indicates the heartbeat timeout threshold. Indicates the number of heartbeat timeouts; Evaluate the abnormality of performance indicators: If , then the result is that the main device is normal. ,or , then the judgment result is that the main device is faulty; among them, Indicates the number of abnormal performance indicators. Indicates the type threshold of the performance indicator abnormality. Indicates the time threshold of a single performance indicator exception.

3. A method for master-slave switching based on device synchronization as claimed in claim 2, characterized in that: The formula of the intelligent optimization algorithm in S3.3 is: ; in, Indicates the load balancing degree. represents the current load of the kth server, Indicates the monitoring system response time. represents a function that estimates the response time based on the monitoring system status and the selected server, Indicates network delay, Indicates the server processing capacity. Indicates the current load, Indicates resource utilization, represents the CPU utilization of the kth server, and M represents the number of servers.

4. A method for master-slave switching based on device synchronization as claimed in claim 3, characterized in that: The switching instruction in S3.4 includes switching the failed main device, selecting the backup device, switching timestamp and switching duration.

5. A master-slave switching system based on device synchronization, which is used to implement a master-slave switching method based on device synchronization according to any one of claims 1 to 4, characterized in that: include: Configuration module, monitoring module, switching decision module, execution module, verification module; The configuration module copies and sets the parameters and configurations of the primary and backup devices, installs and configures the monitoring system, and sets the data synchronization strategy and mechanism between the primary and backup devices; The monitoring module is used to monitor the operating status of the main device, detect whether the main device is abnormal through a preset threshold, and feed back the monitored operating status of the main device to the switching decision module in real time; The switching decision module makes a decision based on the information provided by the monitoring module and the results of the comprehensive heartbeat detection and status monitoring. If switching is required, a switching instruction is generated and sent to the execution module; The execution module is used to receive the switching instruction generated by the switching decision module, execute the switching operation, and update the status information of the monitoring system; The verification module is used to verify the operating status and business continuity of the backup device after the switch is completed, evaluate the performance of the system after the switch, and provide feedback to the configuration module and the switch decision module based on the verification results to optimize the switch strategy and configuration parameters.

6. A master-slave switching system based on device synchronization as claimed in claim 5, characterized in that: The switching decision module includes: a fault confirmation unit and a switching decision unit; A fault confirmation unit is used to confirm whether the main device is in a fault state through a preset fault detection logic in combination with the results of heartbeat detection and status monitoring; The switching decision unit is used to generate a switching instruction according to a preset switching strategy after confirming that the main device fails.

7. A master-slave switching system based on device synchronization as claimed in claim 6, characterized in that: The execution module includes: an instruction receiving unit, a data synchronization unit, and a switching execution unit; An instruction receiving unit, used to receive a switching instruction sent by the switching decision module; A data synchronization unit is used to synchronize the key data of the primary device to the backup device before switching; The switching execution unit executes the switching operation according to the switching instruction and the preset switching strategy.