Main-standby switching method, device, system, equipment and medium

By having the highest-priority slave device take over the work when the master device fails and using mirrored NAS to synchronize data, the limitation of data recovery order when both the master and slave devices fail is resolved, improving business recovery speed and system availability.

CN121070701APending Publication Date: 2025-12-05CHINA CONSTRUCTION BANK +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511175286.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-21
Publication Date
2025-12-05

AI Technical Summary

Technical Problem

In existing technologies, when both the master and slave devices fail, the data recovery sequence is limited, which affects the speed of business recovery.

Method used

When the master device fails, the highest priority slave device takes over the work of the master device, synchronizes the synchronization data generated by the business processing to other slave devices, and directly synchronizes it to the master device after the master device recovers, realizing data transmission using mirrored NAS.

Benefits of technology

It improves data recovery speed, ensures data integrity from devices, reduces business recovery time, and enhances system high availability and fault tolerance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121070701A_ABST
    Figure CN121070701A_ABST
Patent Text Reader

Abstract

The invention relates to the field of data processing, in particular to a main-standby switching method, device and system, equipment and a medium. Because the master device synchronizes the synchronization data to each slave device, the data integrity of other slave devices cannot be influenced by any slave device fault, and during the master device fault period, the first slave device which has the highest priority and does not have a fault in each slave device of the master device does not have the fault. Synchronizing the synchronization data generated in the business processing process to the second slave device which has the priority lower than that of the first slave device and does not have a fault, the data stored by each second slave device and the first slave device being still complete synchronization data; therefore, the first slave device can directly synchronize the synchronization data generated by the service processing during the failure period of the master device to the master device, and does not need to perform data synchronization through other slave devices which fail and have the priority higher than that of the first slave device, that is to say, synchronization of the synchronization data does not need to be performed based on a certain recovery sequence. Therefore, the service recovery speed of data reading can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of data processing, and in particular to a primary-backup switching method, device, system, equipment and medium. BACKGROUND

[0002] A multi-device storage switching strategy refers to storing data in multiple devices and switching and synchronizing data between different devices to meet the reliability and security requirements of data. A common storage switching strategy is a master-slave replication mode, in which one device is selected as a master device, another device is selected as a slave device of the master device, and a third device is selected as a slave device of the other device. The master device processes all write requests and synchronizes data to its slave device. Once the data synchronization is complete, the slave device can perform data processing and storage as a master device, and the slave device synchronizes data to the third device, i.e., the slave device of the slave device.

[0003] However, during the synchronization of data, if the slave device of the master device fails, the slave device can no longer receive data synchronized by the master device, which will result in incomplete data saved by the slave device and the third device cannot function. When the master device and the slave device both fail and the third device is enabled for primary-backup switching, the slave device needs to be recovered first, and then the data of the third device can be synchronized to the slave device, and the master device needs to be recovered first, and then the data of the slave device can be synchronized to the master device. The data recovery sequence is limited, and the recovery speed of a business that needs to read data will be affected. For example, device A is a master device, device B is a slave device of device A, and device C is a slave device of device B. Data is synchronized from device A to device B and from device B to device C in daily use. When both device A and device B fail, device C is enabled. However, device B needs to be recovered first, and then the data of device C can be synchronized to device B, and device A needs to be recovered first, and then the data can be synchronized to device A. The data recovery sequence is limited. SUMMARY

[0004] Embodiments of the present application provide a primary-backup switching method, device, system, equipment and medium, which can solve the problem of limited data recovery sequence in related technologies, which may affect the recovery speed of a business that needs to read data.

[0005] Embodiments of the present application provide a primary-backup switching method, which includes:

[0006] If the first slave device receives the first instruction of the master device failure, the first slave device processes the business, judges whether there is each second slave device whose priority is lower than the first slave device and which has not failed currently, if yes, synchronizes the synchronization data generated by processing the business to each second slave device; wherein the first slave device and each second slave device are slave devices of the master device, and the first slave device is the slave device of the master device which has not failed and has the highest priority;

[0007] After receiving the second instruction of the master device failure recovery, the synchronization data generated by processing the business between the first instruction and the second instruction is synchronized to the master device.

[0008] Further, the method further comprises:

[0009] The heartbeat signal is sent to the detection device at a preset time interval, so that the detection device determines whether the first slave device fails based on whether the heartbeat signal sent by the first slave device is received at the preset time interval.

[0010] Further, the synchronization of the first synchronization data generated by processing the business to each second slave device comprises:

[0011] The synchronization data generated by processing the business is synchronized to each second slave device based on a mirror network attached storage (NAS), wherein the first slave device is connected to each second slave device through the mirror NAS.

[0012] Embodiments of the application also provide a master-slave switching method, the method comprising:

[0013] The master device processes the business, and synchronizes the synchronization data generated by processing the business to each slave device corresponding to the master device, wherein the master device corresponds to at least two slave devices;

[0014] If the master device recovers from the failure, each synchronization data generated by processing the business during the master device failure is received by the first slave device, wherein the first slave device is the slave device of the master device which has not failed and has the highest priority.

[0015] Further, the method further comprises:

[0016] The heartbeat signal is sent to the detection device at a preset time interval, so that the detection device determines whether the master device fails based on whether the heartbeat signal sent by the master device is received at the preset time interval.

[0017] Further, the synchronizing the synchronization data generated by processing the service to each slave device corresponding to the master device comprises:

[0018] synchronizing the synchronization data generated by processing the service to each slave device corresponding to the master device based on the mirror NAS; wherein the master device is connected with each slave device through the mirror NAS.

[0019] The embodiment of the application further provides a master-slave switching device applied to a first slave device, the device comprising:

[0020] a first processing module, configured to, if a first instruction of master device failure is received, process the service, determine whether there is each second slave device whose priority is lower than that of the first slave device and which has not failed at present, and if yes, synchronize the synchronization data generated by processing the service to each second slave device; wherein the first slave device and each second slave device are slave devices of the master device, and the first slave device is the slave device of the master device which has not failed and has the highest priority;

[0021] a synchronization module, configured to, after a second instruction of master device failure recovery is received, synchronize the synchronization data generated by processing the service between the first instruction and the second instruction to the master device.

[0022] Further, the first processing module is further configured to send a heartbeat signal to a detection device at a preset time interval, so that the detection device determines whether the first slave device fails based on whether the heartbeat signal sent by the first slave device is received at the preset time interval.

[0023] Further, the synchronization module is specifically configured to synchronize the synchronization data generated by processing the service to each second slave device based on the mirror NAS; wherein the first slave device is connected with each second slave device through the mirror NAS.

[0024] The embodiment of the application further provides a master-slave switching device applied to a master device, the device comprising:

[0025] a second processing module, configured to process the service and synchronize the synchronization data generated by processing the service to each slave device corresponding to the master device; wherein the master device corresponds to at least two slave devices.

[0026] a receiving module, configured to, if the master device recovers from failure, receive each synchronization data generated by processing the service during the master device failure and sent by a first slave device; wherein the first slave device is the slave device of the master device which has not failed and has the highest priority.

[0027] Further, the second processing module is further configured to send a heartbeat signal to the detection device at a preset time interval, so that the detection device determines whether the master device fails based on whether the heartbeat signal sent by the master device is received at the preset time interval.

[0028] Further, the second processing module is specifically configured to synchronize synchronization data generated by processing a service to each second slave device based on the mirror NAS; and the first slave device is connected to each second slave device through the mirror NAS.

[0029] Embodiments of the present application further provide a master-slave switching system, which comprises a master device and at least two slave devices.

[0030] The master device is configured to process a service and synchronize synchronization data generated by processing the service to the at least two slave devices corresponding to the master device.

[0031] The first slave device, which is not failed and has the highest priority among the at least two slave devices, is configured to process a service, determine whether there is each second slave device which has a lower priority than the first slave device and is not currently failed, synchronize synchronization data generated by processing the service to each second slave device if there is, and synchronize synchronization data generated by processing the service between receiving a first instruction indicating that the master device fails and receiving a second instruction indicating that the master device recovers to the master device.

[0032] Further, the system further comprises a detection device.

[0033] The master device and the at least two slave devices are configured to send a heartbeat signal to the detection device at a preset time interval.

[0034] The detection device is configured to determine whether any device fails based on whether the heartbeat signal sent by the device is received at the preset time interval.

[0035] Further, the detection device is further configured to send the second instruction indicating that the master device recovers to the first slave device if it is detected that the master device recovers.

[0036] Further, the detection device is further configured to determine the first slave device which is not failed and has the highest priority according to the saved priorities of the at least two slave devices corresponding to the master device if it is determined that the master device fails.

[0037] Further, the master device is connected to the at least two slave devices through a mirror NAS.

[0038] The master device is specifically configured to synchronize the synchronization data generated in processing the service to each second slave device based on the mirror NAS.

[0039] The embodiment of the present application further provides an electronic device, which comprises a processor configured to implement the steps of the master-slave switching method according to any of the above when executing a computer program stored in a memory.

[0040] The embodiment of the present application further provides a computer readable storage medium, which stores a computer program, and the computer program is configured to implement the steps of the master-slave switching method according to any of the above when executed by a processor.

[0041] The embodiment of the present application further provides a computer program product, which comprises computer program code, and the computer program code is configured to make a computer execute the steps of the master-slave switching method according to any of the above when the computer program code is executed on the computer.

[0042] In the embodiment of the present application, the master device synchronizes the synchronization data to each slave device, so that the data integrity of other slave devices will not be affected by the failure of any slave device, and during the failure of the master device, the first slave device with the highest priority and without failure among each slave device of the master device synchronizes the synchronization data generated in processing the service to a second slave device with a lower priority than the first slave device and without failure, and the data saved by each second slave device and the first slave device is still the complete synchronization data, and the first slave device can directly synchronize the synchronization data generated in processing the service during the failure of the master device to the master device, without the need of synchronizing the data through other slave devices without failure and with a higher priority than the first slave device, that is, without the need of synchronizing the synchronization data based on a certain recovery order, so that the service recovery speed of reading the data can be improved. BRIEF DESCRIPTION OF DRAWINGS

[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative effort.

[0044] Figure 1 A structural schematic diagram of a master-slave switching system provided by the embodiment of the present application;

[0045] Figure 2 A process schematic diagram of data synchronization provided by the embodiment of the present application;

[0046] Figure 3 A process schematic diagram of data synchronization after the failure of a master device provided by the embodiment of the present application;

[0047] Figure 4 A process diagram of data synchronization after a master device failure is provided for an embodiment of the present application;

[0048] Figure 5 A process diagram of data synchronization is provided for the related art;

[0049] Figure 6 A first master-slave switching process diagram is provided for an embodiment of the present application;

[0050] Figure 7 A second master-slave switching process diagram is provided for an embodiment of the present application;

[0051] Figure 8 A first master-slave switching device diagram is provided for an embodiment of the present application;

[0052] Figure 9 A second master-slave switching device diagram is provided for an embodiment of the present application;

[0053] Figure 10 An electronic device structure diagram is provided for an embodiment of the present application. DETAILED DESCRIPTION

[0054] In order to make the objects, technical solutions and advantages of the present application clearer, the following will further describe the present application with reference to the accompanying drawings. Obviously, the embodiments described in the present application are only a part of the embodiments of the present application, but not all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of protection of the present application.

[0055] It should be noted that the brief description of the terms in the present application is only for the convenience of understanding the following described embodiments, and is not intended to limit the embodiments of the present application. Unless otherwise specified, these terms should be understood according to their ordinary and general meanings.

[0056] The terms "first", "second", "third", etc. in the specification and claims of the present application and the above-described drawings are used to distinguish similar or similar objects or entities, and do not necessarily mean to limit the specific order or sequence, unless otherwise specified. It should be understood that the terms used in this way can be interchanged under appropriate circumstances.

[0057] The terms "include" and "have" and any variations thereof are intended to cover but not exclusive inclusion, for example, a product or device including a series of components does not necessarily limit to all components clearly listed, but can include other components not clearly listed or inherent to these products or devices.

[0058] The term "module" refers to any known or later developed hardware, software, firmware, artificial intelligence, fuzzy logic, or combination of hardware and / or software codes that can perform the function related to the element.

[0059] Finally, it should be noted that the above embodiments are merely used to illustrate the technical solutions of the present application, rather than limiting them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still make changes to the technical solutions recorded in the foregoing embodiments, or make equivalent replacements to some or all of the technical features; and these changes or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.

[0060] The exemplary embodiments of the present application are described below with reference to the accompanying drawings, which include various details of the embodiments of the present application to assist in understanding, and should be considered as merely exemplary. Therefore, those skilled in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope of the present disclosure. Also, for the sake of clarity and conciseness, the description below omits the description of well-known functions and structures. It should be noted that in the embodiments of the present application, some software, components, models, etc. may be mentioned, which should be considered as exemplary, and their purpose is only to illustrate the feasibility of the technical solutions in the embodiments of the present application, but it does not mean that the applicant has or must have used the scheme.

[0061] In the technical solutions of the present application, the acquisition, transmission, storage, use, etc. of data comply with the requirements of relevant national laws and regulations.

[0062] Before introducing the primary-backup switching method provided by the embodiments of the present application, in order to facilitate understanding, the background art of the embodiments of the present application is first introduced.

[0063] The multi-device storage switching strategy refers to storing data in multiple devices and switching and synchronizing data between different devices to meet the reliability and security requirements of data. A common storage switching strategy is the master-slave replication mode, in which one device is selected as the master device, another device is selected as the slave device of the master device, and a third device is selected as the slave device of the other device. The master device handles all write requests and synchronizes data to its slave device. Once the data synchronization is complete, the slave device can act as a master device for data processing and storage, and the slave device synchronizes data to the third device, i.e. the slave device of the slave device.

[0064] However, in the process of synchronizing data, if the slave device of the master device fails, the data saved by the slave device will be incomplete because it can no longer receive the data synchronized by the master device, and the third device cannot function as a slave device. Moreover, when the master device and the slave device both fail and the third device is enabled for master-slave switching, the slave device needs to be restored first, and then the data of the third device can be synchronized to the slave device, and the master device needs to be restored first, and then the data of the slave device can be synchronized to the master device, which limits the data recovery sequence and affects the recovery speed of the business that needs to read data. For example, device A is a master device, device B is a slave device of device A, and device C is a slave device of device B. In daily use, data is synchronized from device A to device B and from device B to device C. When both device A and device B fail, device C is enabled. However, device B needs to be restored first, and then the data of device C can be synchronized to device B, and device A needs to be restored first, and then the data can be synchronized to device A, which limits the data recovery sequence.

[0065] In addition, a master-slave switching system is usually used in both online transaction and file batch processing businesses. Online transaction refers to businesses that process user requests and transactions in real time, such as online shopping and bank transfers. To improve the high availability of the master-slave switching system, the devices included in the master-slave switching system usually adopt a distributed deployment strategy. To further enhance the business processing capacity, it is usually preferred to implement a construction mode of in-city dual-active and off-site disaster recovery. Two devices in a city are included in the master-slave switching system and jointly support the real-time processing of online transactions; and the device located in another city is only enabled in an emergency. When dual-active and disaster recovery switching occurs, thanks to the data sharing function of the database and the existence of off-site backup data, online applications can continue to operate normally, ensuring that user experience is not affected. As for file batch processing, it usually involves reading and processing a large number of files, so continuity needs to be ensured at the file transmission level. Therefore, a reasonable master-slave switching mode needs to be designed to ensure that the master-slave switching system can effectively process file batch processing businesses.

[0066] Therefore, the embodiments of the present application provide a master-slave switching method, device, system, equipment and medium. The master-slave switching system includes a master device and at least two slave devices. The master device processes a business and synchronizes synchronization data generated by processing the business to each slave device corresponding to the master device. If the first slave device with the highest priority among the at least two slave devices receives a first instruction that the master device fails, the first slave device processes the business, determines whether there is each second slave device with a lower priority than itself and currently not failing, and if so, synchronizes the synchronization data generated by processing the business to each second slave device. After receiving a second instruction that the master device recovers, the first slave device synchronizes the synchronization data generated by processing the business between receiving the first instruction and the second instruction to the master device.

[0067] The following describes the technical terms involved in the present application in detail:

[0068] NAS: a device connected to the network with data storage function, also known as "network storage". It is a special data storage server. NAS takes data as the core, completely separates storage devices from servers, centrally manages data, thereby releasing bandwidth, improving performance, reducing total cost, and protecting user investment.

[0069] Mirror NAS: an image that runs NAS services in Docker containers. This image can help users easily create and manage NAS services, thereby achieving data sharing and backup. In the image, the port mapping of the service can be defined, and the local folder can be mapped to the specified folder, thereby facilitating user access and use of the NAS service.

[0070] Embodiment 1:

[0071] Figure 1 A structure diagram of a master-slave switching system provided by the embodiment of the present application is provided, which includes a master device 101 and at least two slave devices 102.

[0072] The master device 101 is configured to process business and synchronize the synchronization data generated by processing the business to the at least two slave devices 102 corresponding to the master device 101.

[0073] The first slave device 1021 with the highest priority among the at least two slave devices 102 without failure is configured to, if receiving a first instruction of the master device 101 failure, process business, determine whether there is each second slave device 1022 with a lower priority than itself and without current failure, if yes, synchronize the synchronization data generated by processing the business to each second slave device 1022; and after receiving a second instruction of the master device 101 failure recovery, synchronize the synchronization data generated by processing the business between receiving the first instruction and the second instruction to the master device 101.

[0074] In order to efficiently and accurately realize master-slave switching and thereby speed up the business recovery process, the embodiment of the present application provides a master-slave switching system. The master-slave switching system includes one master device and multiple slave devices, specifically, the slave devices are at least two.

[0075] In order to ensure the consistency and real-time of data, the master device processes the business, wherein the processed business can be a file batch processing business, and the master device synchronizes the synchronization data generated in the business processing process to each slave device connected. Specifically, during the business processing process of the master device, multiple data can be generated, and the data types of the multiple data can be determined. Specifically, how the master device determines the data type of each data generated in the business processing process is prior art, which will not be described here.

[0076] Each slave device is pre-set with a specific priority, and when the master device fails, the master-backup switching system can trigger a failure response mechanism. At this time, among each slave device that does not fail, the slave device with the highest priority, which can be referred to as the first slave device for convenience, will receive a first instruction of the master device failure sent by a preset device. The preset device can be a device used by a business personnel, and the business personnel can select the identifier of the first slave device based on the preset page of the device used by the business personnel, and click a preset button, such as a "failure" button, so that the first slave device can receive the first instruction. After receiving the first instruction, the first slave device will take over the work of the master device and continue to process the business.

[0077] In order to ensure that data will not be lost, the first slave device determines each second slave device that has a lower priority than itself and does not currently fail, and the first slave device will continue to process the business and synchronize the synchronization data generated in the business processing to each second slave device.

[0078] In order to improve the business recovery speed, if the master device recovers from failure, the first slave device will receive a second instruction of the master device failure recovery sent by a preset device. The preset device can be a device used by a business personnel, and the business personnel can select the identifier of the first slave device based on the preset page of the device used by the business personnel, and click a preset button, such as a "failure recovery" button, so that the first slave device can receive the second instruction. After receiving the second instruction, the first slave device will immediately respond, and synchronize each synchronization data generated during the period from receiving the first instruction to receiving the second instruction to the master device. This way can ensure that data can seamlessly connect after the master device recovers, greatly improving the reliability and fault tolerance of the master-backup switching system. Specifically, during the business processing process of the first slave device, the generation time of each data is recorded, and if the data type of any data is a synchronization type and the data is generated before receiving the first instruction and receiving the second instruction, the data is determined as synchronization data to be synchronized to the master device, and the determined synchronization data is synchronized to the master device.

[0079] Taking the master device as device A, the first slave device as device B, and the second slave device as device C as an example, the second slave device can also be referred to as a backup device. When device A fails, device A no longer sends synchronization data to device B and device C, ensuring that the synchronization data of device B and device C is the synchronization data before the failure of device A. This process can be referred to as disconnecting the replication relationship between device A and device B and device C. A link is established for device B to synchronize data to device C, facilitating synchronization of data to device C. This process can be referred to as pulling up the replication link from device B to device C. Since the synchronization data of device B and device C is consistent, device B only needs to send synchronization data generated in the process of processing business to device C.

[0080] When device A recovers from failure, device B synchronizes each synchronization data generated in the process of processing business between the first instruction and the second instruction to device A. This process can be referred to as reversely establishing the replication relationship from device B to device A and leveling the data of device B and device A. After device B synchronizes each synchronization data to device A, it can be determined that the data stored by device B is leveled with the data stored by device A, and device B no longer sends synchronization data to device A. This process can be referred to as disconnecting the replication relationship from device B to device A and restoring to the daily operation state of device A to device B and device A to device C. That is, device A continues to process business and synchronizes the synchronization data generated in the process of processing business to device B and device C. In this way, the synchronization data of device A, device B, and device C remains consistent. When device A recovers from failure or device B fails and device C processes business, since it can be ensured that the synchronization data saved by device A and device C is complete synchronization data, the business can continue to be processed, ensuring business continuity.

[0081] The embodiment of the present application proposes a simple and efficient multi-device data storage switching strategy. The recoverability and data consistency of storage switching are improved. The master device and each slave device in the embodiment of the present application are compatible with the diversified deployment mode of city dual-homing and off-site backup, that is, the master device and the slave device can not only be deployed within the same city, but also can be deployed across regions, which can ensure multi-device data synchronization and consistency, and propose a reasonable switching and storage recovery mechanism to improve business continuity and meet the high availability design requirements.

[0082] The embodiment of the present application can solve the problem of off-site synchronization data transmission and synchronization. When multi-live and off-site master-backup switching occurs in the system, the synchronization data generated before and after switching needs to be synchronized and transmitted to support continuous operation of business. In the process of implementing storage switching, the reliability, recoverability, and security of backup need to be considered.

[0083] In the related art, in the process of synchronizing data from device A to device B and from device B to device C, if device B fails, the data of device C will be incomplete, and device C cannot play the role of a disaster recovery device. However, in the method provided in the embodiments of the present application, the master device sends synchronization data to the first slave device and the second slave device. If the master device and the first slave device fail, the synchronization data saved by the second slave device is complete, and the second slave device can play the role of a disaster recovery device.

[0084] The embodiments of the present application provide a multi-device data storage switching strategy, which reduces the risk of data inconsistency when a fault occurs and switches, improves business continuity, and improves the high availability of the system. When the master device fails, the storage switching method and the switching synchronization strategy can finally maintain the data consistency of each device. At the data recovery level, there is no dependency relationship between the recovery sequences of the devices, which improves the data recovery speed and reduces the affected business interruption time.

[0085] In the embodiments of the present application, the master device synchronizes synchronization data to each slave device, and the failure of any slave device will not affect the data integrity of other slave devices. During the failure of the master device, the first slave device with the highest priority and without failure among each slave device of the master device synchronizes the synchronization data generated in the business processing process to the second slave device with a lower priority than the first slave device and without failure. The data saved by each second slave device and the first slave device is still complete synchronization data. The first slave device can directly synchronize the synchronization data of the processing business during the failure of the master device to the master device, without the need for data synchronization through other slave devices that have failed and have a higher priority than the first slave device. That is, there is no need to synchronize the synchronization data based on a certain recovery sequence, thereby improving the business recovery speed of reading data.

[0086] Embodiment 2

[0087] In order to accurately and effectively perform master-slave switching, on the basis of the above-mentioned embodiments, in the embodiments of the present application, the system further comprises a detection device 103.

[0088] The master device 101 and the at least two slave devices 102 are configured to send a heartbeat signal to the detection device 103 at a preset time interval.

[0089] The detection device 103 is configured to determine whether any device fails based on whether a heartbeat signal sent by the device is received at a preset time interval.

[0090] In order to monitor whether the master device and the slave devices are faulty, the system provided by the embodiments of the present application further comprises a detection device, the master device and each slave device sends a heartbeat signal to the detection device at a preset time interval, and the detection device is responsible for receiving the heartbeat signals from all the devices. If the detection device fails to receive the heartbeat signal from a certain device within a preset time interval, the detection device can determine that the device which fails to send the heartbeat signal is faulty.

[0091] Embodiment 3

[0092] In order to accurately and effectively perform the master-backup switching, on the basis of the above embodiments, in the embodiments of the present application, the detection device 103 is further configured to send a second instruction of master device 101 failure recovery to the first slave device 1021 if the master device 101 failure recovery is detected.

[0093] After the detection device determines that a certain device is faulty, if the heartbeat signal sent by the device is received again, the detection device can determine that the device is recovered from the failure. In order to accurately and effectively perform the master-backup switching and thus perform the service processing, the detection device can send a second instruction of master device failure recovery to the first slave device if the detection device determines that the master device is recovered from the failure. In a possible implementation, after the master device is recovered from the failure, the heartbeat signal is re-sent to the detection device. After the detection device re-detects the heartbeat signal sent by the master device, it is determined that the master device is recovered from the failure.

[0094] In order to accurately and effectively perform the master-backup switching, on the basis of the above embodiments, in the embodiments of the present application, the detection device 103 is further configured to determine the first slave device 1021 which is not faulty and has the highest priority according to the saved priority of each slave device 102 corresponding to the master device 101 if the master device 101 is determined to be faulty.

[0095] The detection device locally saves each slave device corresponding to the master device and saves the priority of each slave device. If the detection device determines that the master device is faulty, it obtains each slave device corresponding to the master device which is saved, determines the first slave device which has the highest priority in each slave device which continuously sends the heartbeat signal to the detection device, that is, the slave device which is not faulty. After the first slave device is determined, the detection device sends a first instruction of master device failure to the first slave device.

[0096] Embodiment 4

[0097] In order to accurately and effectively perform the master-backup switching, on the basis of the above embodiments, in the embodiments of the present application, the master device 101 is connected to the at least two slave devices 102 through a mirror NAS respectively;

[0098] The master device 101 is specifically configured to synchronize the synchronization data generated by processing the service to the at least two slave devices 102 based on the mirror NAS.

[0099] In order to accurately and effectively perform master-slave switching, the master device is connected with each slave device through the mirror NAS. Specifically, the master device synchronizes the synchronization data generated by processing the service to each slave device connected in real time and accurately by using the mirror NAS.

[0100] Taking the master device as device A, the two slave devices as device B and device C, and the priority of device B being higher than that of device C as an example, at this time, device A can be referred to as a master cluster, device B can be referred to as a secondary cluster, and device C can be referred to as a standby cluster. In a daily running state, the mirror NAS connection of device A to device B and device A to device C is long-term established, which can be referred to as establishing the replication relationship of device A to device B and device A to device C. Device A can write the data that does not need to be shared into a local NAS and write the synchronization data that needs to be shared into a mirror NAS. In this way, the data stored by device A can be synchronized to device B and device C, and the data of the three devices is kept consistent. When device B or device C becomes a master device, the synchronization data saved locally, that is, the data synchronized from device A, can be read to continue processing the service. When master-slave switching occurs, that is, device A and device B are both unavailable, device C is switched to an active (Active) state, and device A no longer sends synchronization data to device C. This process can be referred to as disconnecting the replication relationship of device A to device C. Device C writes the synchronization data generated by processing the service into the mirror NAS. After device A recovers from failure, device C synchronizes the synchronization data generated by processing the service during the failure of device A to device A. This process can be referred to as reversely establishing the replication relationship of device C to device A. After the data is leveled, device A sends synchronization data to device B and device C again. This process can be referred to as resuming the replication relationship of device A to device B and device A to device C.

[0101] Figure 2 A process diagram of data synchronization provided by an embodiment of the application.

[0102] Each device has a NAS and a mirror NAS. Device A is a master device and is in an Active state. Device B is a slave device with higher priority and is in a secondary (Secondary) state. Device C is a slave device with lower priority and is in a standby (Standby) state. Device A synchronizes the synchronization data generated by processing the service to device B and device C based on the mirror NAS.

[0103] Figure 3 A process diagram of data synchronization after a master device fails provided by an embodiment of the application.

[0104] Figure 3 In the case of a master device failure, the system is in a multi-active switching state, at this time, the device B with lower priority in the slave device becomes the master device, in the Active state, the device A is in the Secondary state, and the device B is in the Standby state. The device B synchronizes the synchronization data generated by processing the business to the device C based on the mirror NAS. After the device A recovers from the failure, the device B synchronizes the synchronization data generated by processing the business during the failure of the device A to the device A based on the mirror NAS.

[0105] Figure 4 A process diagram of data synchronization after a master device failure is provided for the embodiments of the application.

[0106] Figure 4 In the case of a master device and a slave device with higher priority both failing, the system is in a master-backup switching state, at this time, the device C with lower priority in the slave device becomes the master device, in the Active state, the device A is in the Secondary state, and the device B is in the Standby state. After the device A recovers from the failure, the device C synchronizes the synchronization data generated by processing the business during the failure of the device A to the device A based on the mirror NAS, and the device A synchronizes the received synchronization data to the device B.

[0107] Figure 5 A process diagram of data synchronization is provided in the related art.

[0108] Figure 5 In the case of data synchronization between devices based on the mirror NAS, Figure 5 It can be known that in the related art, the device A synchronizes data to the device B based on the mirror NAS, and the device B synchronizes data to the device C based on the mirror NAS.

[0109] In the embodiments of the application, the system switching states are divided into three kinds: daily operation state, multi-active switching state, and master-backup switching state. Different data replication relationships are established according to the switching strategy in the three states.

[0110] It should be noted that in order to ensure the reliability and stability of the network connection, high-availability devices and network architecture can be used in the embodiments of the application to ensure the availability of the NAS service and the consistency of the data.

[0111] According to the system construction requirements, the business continuity requirements are met, when designing a high-availability solution, the availability of online transactions needs to be considered, and the synchronization and consistency of file off-site transmission also needs to be considered. The application proposes a storage switching strategy, which can synchronize data when the master cluster switches, and meet the continuity requirements.

[0112] Embodiment 5:

[0113] Based on the same inventive concept, on the basis of the above-mentioned embodiments, the embodiments of the present application further provide a master-slave switching method, applied to a first slave device, referring to Figure 6 , Figure 6 Fig. 1 shows a first master-slave switching process schematic diagram provided by some embodiments, which includes:

[0114] S601: If the first slave device receives a first instruction of master device failure, the first slave device processes the business, judges whether there is each second slave device whose priority is lower than itself and which has not occurred failure at present, if yes, synchronizes the synchronization data generated by processing the business to each second slave device; wherein the first slave device and each second slave device are slave devices of the master device, and the first slave device is the slave device of the master device which has not occurred failure and has the highest priority;

[0115] S602: After receiving a second instruction of master device failure recovery, synchronizes the synchronization data generated by processing the business between receiving the first instruction and the second instruction to the master device.

[0116] In a possible implementation, the method further includes:

[0117] Sending a heartbeat signal to the detection device at a preset time interval, so that the detection device determines whether the first slave device fails based on whether the heartbeat signal sent by the first slave device is received at the preset time interval.

[0118] In a possible implementation, the synchronizing the first synchronization data generated by processing the business to each second slave device includes:

[0119] Synchronizing the synchronization data generated by processing the business to each second slave device based on a mirror NAS; wherein the first slave device is connected with each second slave device through a mirror NAS respectively.

[0120] It can be understood that, since the above-mentioned master-slave switching method applied to the first slave device is similar to the problem-solving principle of the master-slave switching system discussed in the foregoing, the specific implementation process of the above-mentioned master-slave switching method applied to the first slave device can refer to the embodiments applied to the master-slave switching system, and the repeated parts will not be described herein.

[0121] Based on the same inventive concept, on the basis of the above-mentioned embodiments, the embodiments of the present application further provide a master-slave switching method, applied to a first slave device, referring to Figure 7 , Figure 7 Fig. 2 shows a second master-slave switching process schematic diagram provided by some embodiments, which includes:

[0122] S701: The master device processes a service, and synchronizes synchronization data generated by processing the service to each slave device corresponding to the master device respectively, wherein the master device corresponds to at least two slave devices;

[0123] S702: If the master device is recovered from failure, each synchronization data generated by processing the service during the failure of the master device is received by the first slave device; wherein the first slave device is a slave device with the highest priority and without failure among each slave device corresponding to the master device.

[0124] In a possible implementation, the method further comprises:

[0125] The heartbeat signal is sent to the detection device at a preset time interval, so that the detection device determines whether the master device is faulty based on whether the heartbeat signal sent by the master device is received at the preset time interval.

[0126] In a possible implementation, the synchronizing the synchronization data generated by processing the service to each slave device corresponding to the master device respectively comprises:

[0127] The synchronization data generated by processing the service is synchronized to each slave device corresponding to the master device based on the mirror NAS; wherein the master device is connected to each slave device through the mirror NAS respectively.

[0128] It can be understood that, since the master / standby switching method applied to the master device is similar to the principle of solving the problem of the master / standby switching system discussed above, the specific implementation process of the master / standby switching method applied to the master device can be referred to the embodiments applied to the master / standby switching system, and the repeated parts will not be described herein.

[0129] Embodiment 6:

[0130] Based on the same inventive concept, on the basis of the above-mentioned embodiments, the application provides a master / standby switching device applied to a first slave device, which is described with reference to Figure 8 , Figure 8 shows a first master / standby switching device provided by some embodiments, which comprises:

[0131] The first processing module 801 is configured to, if the first instruction of the master device failure is received, process a service, determine whether there is each second slave device with a lower priority than itself and without current failure, and if yes, synchronize synchronization data generated by processing the service to each second slave device; wherein the first slave device and each second slave device are slave devices of the master device, and the first slave device is a slave device with the highest priority and without failure among the slave devices of the master device;

[0132] The synchronization module 802 is configured to synchronize the synchronization data generated by processing the services to the master device, after receiving the second instruction of the master device failure recovery.

[0133] In a possible implementation, the first processing module 801 is further configured to send a heartbeat signal to the detection device at a preset time interval, so that the detection device determines whether the first slave device fails based on whether the heartbeat signal sent by the first slave device is received at the preset time interval.

[0134] In a possible implementation, the synchronization module 802 is specifically configured to synchronize the synchronization data generated by processing the services to each second slave device based on a mirror NAS; and the first slave device is connected to each second slave device through the mirror NAS.

[0135] Based on the same inventive concept, on the basis of the above-mentioned embodiments, the application provides a master-backup switching device, which is applied to a master device, and refers to Figure 9 , Figure 9 Fig. 2 shows a schematic diagram of a second master-backup switching device according to some embodiments, which comprises:

[0136] The second processing module 901 is configured to process services and synchronize the synchronization data generated by processing the services to each slave device corresponding to the master device, wherein the master device corresponds to at least two slave devices.

[0137] The receiving module 902 is configured to receive each synchronization data generated by processing the services during the master device failure, if the master device is recovered, and the synchronization data is sent by a first slave device; and the first slave device is a slave device that has not failed and has the highest priority among each slave device corresponding to the master device.

[0138] In a possible implementation, the second processing module 901 is further configured to send a heartbeat signal to the detection device at a preset time interval, so that the detection device determines whether the master device fails based on whether the heartbeat signal sent by the master device is received at the preset time interval.

[0139] In a possible implementation, the second processing module 901 is specifically configured to synchronize the synchronization data generated by processing the services to each second slave device based on a mirror NAS; and the first slave device is connected to each second slave device through the mirror NAS.

[0140] Embodiment 7

[0141] Based on the same inventive concept, on the basis of the above-mentioned embodiments, the embodiments of the present application further provide an electronic device which can realize the functions of the master-slave switching method discussed above. Please refer to Figure 10 , Figure 10 An electronic device provided by some embodiments is shown in a structural schematic diagram. The electronic device includes a processor 1001, a communication interface 1002, a memory 1003, and a communication bus 1004. The processor 1001, the communication interface 1002, and the memory 1003 complete mutual communication through the communication bus 1004.

[0142] The memory 1003 stores a computer program. When the program is executed by the processor 1001, the processor 1001 performs the following steps:

[0143] If the first slave device receives the first instruction of the master device failure, it processes the business, judges whether there is each second slave device whose priority is lower than itself and which has not failed at present, if yes, synchronizes the synchronization data generated by processing the business to each second slave device; wherein the first slave device and each second slave device are slave devices of the master device, and the first slave device is the slave device of the master device which has not failed and has the highest priority.

[0144] After receiving the second instruction of the master device failure recovery, the synchronization data generated by processing the business between the first instruction and the second instruction is synchronized to the master device.

[0145] In a possible implementation, the method further includes:

[0146] The heartbeat signal is sent to the detection device at a preset time interval, so that the detection device determines whether the first slave device fails based on whether the heartbeat signal sent by the first slave device is received at the preset time interval.

[0147] In a possible implementation, the synchronization of the first synchronization data generated by processing the business to each second slave device includes:

[0148] The synchronization data generated by processing the business is synchronized to each second slave device based on the mirror NAS; wherein the first slave device is connected to each second slave device through the mirror NAS.

[0149] In a possible implementation, when the program is executed by the processor 1001, the processor 1001 performs the following steps:

[0150] The master device processes the service, and synchronizes the synchronization data generated by processing the service to each slave device corresponding to the master device respectively, wherein the master device corresponds to at least two slave devices;

[0151] If the master device is recovered from failure, each synchronization data generated by processing the service during the failure of the master device is received by the first slave device, wherein the first slave device is the slave device with the highest priority and without failure among the slave devices corresponding to the master device.

[0152] In a possible implementation, the method further includes:

[0153] The heartbeat signal is sent to the detection device at a preset time interval, so that the detection device determines whether the master device is faulty based on whether the heartbeat signal sent by the master device is received at the preset time interval.

[0154] In a possible implementation, the synchronizing the synchronization data generated by processing the service to each slave device corresponding to the master device respectively includes:

[0155] The synchronization data generated by processing the service is synchronized to each slave device corresponding to the master device based on the mirror NAS, wherein the master device is connected to the at least two slave devices through the mirror NAS respectively.

[0156] The communication bus mentioned above can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For convenience of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or only one type of bus.

[0157] The communication interface 1002 is configured to communicate between the above-mentioned electronic device and other devices.

[0158] The memory can include a Random Access Memory (RAM) and can also include a Non-Volatile Memory (NVM), such as at least one disk memory. Optionally, the memory can also be at least one storage device located away from the aforementioned processor.

[0159] The processor can be a general processor, including a central processing unit, a network processor (NP), etc.; can also be a digital signal processor (DSP), an application specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic, a discrete hardware component, etc.

[0160] Embodiment 8:

[0161] Based on the same inventive concept, the embodiment of the present application provides a computer readable storage medium, which stores a computer program, the computer program includes program instructions, and the program instructions make the computer execute the following steps when executed by the computer:

[0162] If the first slave device receives the first instruction of the master device failure, the first slave device processes the business, judges whether there is each second slave device whose priority is lower than that of the first slave device and which has not failed at present, if yes, synchronizes the synchronization data generated by processing the business to each second slave device; wherein the first slave device and each second slave device are slave devices of the master device, and the first slave device is the slave device of the master device which has not failed and has the highest priority;

[0163] After receiving the second instruction of the master device failure recovery, the synchronization data generated by processing the business between the first instruction and the second instruction are synchronized to the master device.

[0164] In a possible implementation, the method further includes:

[0165] The heartbeat signal is sent to the detection device at a preset time interval, so that the detection device determines whether the first slave device fails based on whether the heartbeat signal sent by the first slave device is received at the preset time interval.

[0166] In a possible implementation, the synchronization of the first synchronization data generated by processing the business to each second slave device includes:

[0167] The synchronization data generated by processing the business is synchronized to each second slave device based on the mirror NAS; wherein the first slave device is connected to each second slave device through the mirror NAS respectively.

[0168] In a possible implementation, the program instructions make the computer execute the following steps when executed by the computer:

[0169] The master device processes the business, and synchronizes the synchronization data generated by processing the business to each slave device corresponding to the master device respectively, wherein the master device corresponds to at least two slave devices.

[0170] if the master device recovers from the failure, receiving each synchronization data generated by processing the service during the failure of the master device, which is sent by a first slave device; wherein the first slave device is a slave device with the highest priority among slave devices corresponding to the master device and not having failed.

[0171] In a possible implementation, the method further includes:

[0172] sending a heartbeat signal to the detection device at a preset time interval, so that the detection device determines whether the master device fails based on whether the heartbeat signal sent by the master device is received at the preset time interval.

[0173] In a possible implementation, the synchronizing the synchronization data generated by processing the service to each slave device corresponding to the master device includes:

[0174] synchronizing the synchronization data generated by processing the service to each slave device corresponding to the master device based on a mirror NAS; wherein the master device is connected to the at least two slave devices through the mirror NAS.

[0175] The computer readable storage medium described above can be any available medium or data storage device that the processor in the electronic device can access, including but not limited to a magnetic memory such as a floppy disk, a hard disk, a magnetic tape, a magneto-optical disk (MO), etc., an optical memory such as a CD, a DVD, a BD, a HVD, etc., and a semiconductor memory such as a ROM, an EPROM, an EEPROM.

[0176] Embodiment 9

[0177] Based on the same inventive concept, the embodiments of the present application also provide a computer program product, which includes computer program code, when the computer program code runs on a computer, causes the computer to execute any of the master-slave switching methods discussed above. Since the principle of solving problems of the above computer program product is similar to the master-slave switching method, the implementation of the above computer program product can be referred to the implementation of the method, and the repeated parts will not be described here.

[0178] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0179] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flow or blocks. Figure 1 one or more flow or blocks.

[0180] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instructions which implement the function specified in the flowchart block or blocks. Figure 1 one or more flow or blocks. Figure 1 one or more flow or blocks.

[0181] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flow or blocks. Figure 1 one or more flow or blocks.

[0182] Obviously, numerous modifications and variations of the present application are possible in light of the above teachings. It is therefore to be understood that within the scope of the appended claims and their equivalents, the application can be practiced otherwise than as specifically described.

Claims

1. A method for primary / standby switching, characterized in that, The method includes: If a first slave device receives a first instruction indicating a fault in the master device, it performs service processing and determines whether there are any second slave devices with lower priority than itself that are not currently experiencing a fault. If so, it synchronizes the synchronization data generated during service processing to each of the second slave devices. The first slave device and each of the second slave devices are both slave devices of the master device, and the first slave device is the slave device of the master device that has not experienced a fault and has the highest priority. After receiving the second instruction for fault recovery from the main device, the synchronization data generated during the processing of services between the first and second instructions will be synchronized to the main device.

2. The method according to claim 1, characterized in that, The method further includes: The detection device sends a heartbeat signal at a preset time interval, so that the detection device can determine whether the first slave device is faulty based on whether it receives the heartbeat signal sent by the first slave device at the preset time interval.

3. The method according to claim 1, characterized in that, The step of synchronizing the first synchronization data generated during service processing to each of the second slave devices includes: Based on the mirrored network attached storage (NAS), the synchronous data generated by the processing business is synchronized to each of the second slave devices; wherein, the first slave device is connected to each of the second slave devices via the mirrored NAS.

4. A method for primary / standby switching, characterized in that, The method includes: The master device performs business processing and synchronizes the synchronous data generated by the business processing to each slave device corresponding to the master device, wherein the master device has at least two slave devices. If the master device recovers from the fault, it receives each synchronization data generated during the processing of services during the fault period from the first slave device; wherein, the first slave device is the slave device with the highest priority that did not experience a fault among all slave devices corresponding to the master device.

5. The method according to claim 4, characterized in that, The method further includes: The master device sends a heartbeat signal to the detection device at preset time intervals, so that the detection device can determine whether the master device is faulty based on whether it receives the heartbeat signal sent by the master device at the preset time intervals.

6. The method according to claim 4, characterized in that, The step of synchronizing the synchronization data generated during business processing to each slave device corresponding to the master device includes: Based on the mirrored network attached storage (NAS), the synchronous data generated by the processing of services is synchronized to each slave device corresponding to the master device; wherein, the master device is connected to each slave device through the mirrored NAS.

7. A master / slave switching device, characterized in that, Applied to a first slave device, the device includes: The first processing module is used to perform service processing if a first instruction of master device failure is received, and to determine whether there are any second slave devices with lower priority than itself that are not currently experiencing a failure. If so, the synchronization data generated by the service processing is synchronized to each of the second slave devices. The first slave device and each of the second slave devices are slave devices of the master device, and the first slave device is the slave device of the master device that has not experienced a failure and has the highest priority. The synchronization module is used to synchronize the synchronization data generated during the processing of services between the first and second instructions to the main device after receiving the second instruction for fault recovery from the main device.

8. The apparatus according to claim 7, characterized in that, The first processing module is further configured to send a heartbeat signal to the detection device at a preset time interval, so that the detection device can determine whether the first slave device is faulty based on whether it receives the heartbeat signal sent by the first slave device at the preset time interval.

9. The apparatus according to claim 7, characterized in that, The synchronization module is specifically used to synchronize the synchronization data generated during service processing to each of the second slave devices based on the mirrored network attached storage (NAS); wherein the first slave device is connected to each of the second slave devices via the mirrored NAS.

10. A master / slave switching device, characterized in that, Applied to the main equipment, the device includes: The second processing module is used to perform business processing and synchronize the synchronous data generated by the business processing to each slave device corresponding to the master device, wherein the master device has at least two slave devices. The receiving module is configured to receive each synchronization data generated during the processing of services during the failure of the master device from the first slave device after the master device has recovered from the failure; wherein the first slave device is the slave device with the highest priority that has not experienced a failure among the slave devices corresponding to the master device.

11. The apparatus according to claim 10, characterized in that, The second processing module is further configured to send a heartbeat signal to the detection device at a preset time interval, so that the detection device can determine whether the main device is faulty based on whether it receives the heartbeat signal sent by the main device at the preset time interval.

12. The apparatus according to claim 10, characterized in that, The second processing module is specifically used to synchronize the synchronization data generated by the processing service to each of the second slave devices based on the mirrored network attached storage (NAS); wherein, the first slave device is connected to each of the second slave devices through the mirrored NAS.

13. A primary / standby switching system, characterized in that, The system includes: a master device and at least two slave devices; The master device is used to perform business processing and synchronize the synchronization data generated by the business processing to the at least two slave devices corresponding to the master device. The first slave device, which has not experienced a fault and has the highest priority among the at least two slave devices, is used to perform service processing if it receives a first instruction indicating a fault in the master device. It determines whether there are any second slave devices with lower priority than itself that are not currently experiencing a fault. If so, it synchronizes the synchronization data generated by processing the service to each of the second slave devices. After receiving a second instruction indicating a fault recovery from the master device, it synchronizes the synchronization data generated by processing the service between receiving the first instruction and the second instruction to the master device.

14. The system according to claim 13, characterized in that, The system also includes: detection equipment; The master device and the at least two slave devices are used to send heartbeat signals to the detection device at preset time intervals; The detection device is used to determine whether a device is malfunctioning based on whether it receives a heartbeat signal from any device at a preset time interval.

15. The system according to claim 14, characterized in that, The detection device is further configured to send a second instruction for main device fault recovery to the first slave device if the main device fault recovery is detected.

16. The system according to claim 14, characterized in that, The detection device is further configured to, if the master device is determined to be faulty, determine the first slave device that has not been faulty and has the highest priority based on the priority of each slave device corresponding to the master device stored in the database.

17. The system according to claim 13, characterized in that, The master device is connected to the at least two slave devices via a mirrored network attached storage (NAS). The master device is specifically used to synchronize the synchronization data generated during business processing to each of the second slave devices based on mirrored NAS.

18. An electronic device, characterized in that, The electronic device includes a processor that executes a computer program stored in a memory to implement the steps of the primary / standby switching method as described in any one of claims 1-6.

19. A computer-readable storage medium, characterized in that, It stores a computer program that, when executed by a processor, implements the steps of the primary / standby switching method as described in any one of claims 1-6.

20. A computer program product, characterized in that, The computer program product includes: computer program code, which, when run on a computer, causes the computer to perform the steps of the primary / standby switchover method as described in any one of claims 1-6.