A method, apparatus, equipment, and medium for dual-machine hot standby in a dual-machine cluster.
By detecting the availability of shared storage resources in a dual-machine cluster and switching to local storage, the problem of business interruption caused by the unavailability of shared storage is solved, and the business continuity and reliability of the dual-machine cluster are achieved. The stability of the system is ensured by enabling applications on the backup node.
Patent Information
- Application Number
- CN202411614495.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-13
- Publication Date
- 2025-12-02
- Estimated Expiration
- 2044-11-13
AI Technical Summary
In a dual-machine cluster, when shared storage becomes unavailable, the active node and the standby node cannot access storage resources together, leading to business interruption and compromising the continuity and reliability of services.
By detecting the application status of active nodes, it is determined whether the shared storage resources are available. If they are unavailable, the application's storage address is switched to local storage, and the resources are synchronized in local storage. If the application status is still abnormal, the active node application is shut down and the backup node application is enabled to ensure business continuity and reliability.
This effectively avoids application service interruptions caused by the unavailability of shared storage, ensuring the business continuity and reliability of the dual-machine cluster. By switching local storage resources and enabling backup nodes, the failure caused by the unavailability of shared storage is resolved.
Smart Images

Figure CN119484252B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of dual-machine hot standby technology, specifically to a dual-machine hot standby method, apparatus, equipment, and medium in a dual-machine cluster. Background Technology
[0002] In a high-availability (HA) dual-machine cluster hot standby scenario, the standby node replicates data from the active node. If the active node fails, the standby node is switched to become the active node. However, in some cases, the active and standby nodes may need to share storage resources. If these storage resources become unavailable, the active node may also fail. In this situation, switching the standby node to become the active node will not resolve the failure, making it impossible for the dual-machine cluster to guarantee business continuity and reliability. Summary of the Invention
[0003] This application provides a dual-machine hot standby method, apparatus, equipment, and medium in a dual-machine cluster to ensure the continuity and reliability of services in the dual-machine cluster.
[0004] In a first aspect, embodiments of this application provide a dual-machine hot standby method in a dual-machine cluster, the dual-machine cluster including an active node and a standby node, the method comprising:
[0005] The application status of at least one application among the active nodes is detected sequentially;
[0006] When the application status of any of the applications becomes abnormal, and any of the applications uses shared storage, it is checked whether the storage resources corresponding to any of the applications in the shared storage are available; wherein, the shared storage is the storage accessed by both the active node and the standby node;
[0007] If unavailable, the storage address in the configuration file of any of the applications will be switched from the first storage location in the shared storage to the corresponding second storage location in the local storage of the active node; wherein the local storage contains the storage resources in the shared storage.
[0008] After using the local storage, if the application status of any of the applications is still abnormal, then at least one of the applications in the active node is shut down, and at least one corresponding application in the standby node is enabled.
[0009] In this embodiment, for at least one application deployed on an active node, the application status of each application is checked sequentially. When the application status of an application using shared storage becomes abnormal, it is first determined whether the storage resources of that application in the shared storage are usable. If they are not usable, local storage is used instead. Since the local storage synchronizes with the storage resources in the shared storage, it can provide the same storage resources as the shared storage. If the application's abnormality is caused by the unavailability of storage resources in the shared storage, the application's abnormality can be resolved by using local storage, thereby avoiding service interruption due to the unavailability of shared storage. After using local storage, if the application status is still abnormal, it indicates that the application's abnormality is not caused by the unavailability of storage resources in the shared storage. In this case, at least one application on the active node is shut down, and at least one corresponding application on the standby node is enabled, thus avoiding service interruption due to active node failure. Therefore, this embodiment can guarantee the continuity and reliability of services in a dual-machine cluster.
[0010] In some embodiments, after sequentially detecting the application status of at least one application among the active nodes, the method further includes:
[0011] If the application status of any of the applications becomes abnormal and the application does not use the shared storage, the application shall be restarted for repair.
[0012] If the restart repair fails, shut down at least one of the applications on the active node and enable at least one corresponding application on the standby node.
[0013] In some embodiments, after detecting whether the storage resources corresponding to any of the applications in the shared storage are available, the method further includes:
[0014] If the storage resources of any of the applications in the shared storage are available, then any of the applications will be restarted and repaired.
[0015] If the restart repair fails, shut down at least one of the applications on the active node and enable at least one corresponding application on the standby node.
[0016] In some embodiments, after switching the storage address in the configuration file of any of the applications from the shared storage to local storage, the method further includes:
[0017] When the application status of any of the applications returns to normal, determine whether there are other applications using the shared storage among the multiple applications;
[0018] If it exists, when it is detected that the storage resources corresponding to the other applications in the shared storage are unavailable, the storage address in the configuration file of the other applications will be switched from the third storage location in the shared storage to the corresponding fourth storage location in the local storage.
[0019] When an abnormal application status is detected in the other applications, at least one of the applications in the active node is shut down, and at least one corresponding application in the backup node is enabled.
[0020] In some embodiments, determining that the application state of any of the applications is abnormal includes:
[0021] If the existence of any of the aforementioned applications is detected, and it is determined that the application process is in a non-service state, then it is determined that the application state of any of the aforementioned applications is abnormal; or
[0022] When it is detected that the application process of any of the applications does not exist, it is determined whether the application has a shutdown flag. If the shutdown flag does not exist, it is determined that the application status of any of the applications is abnormal. The shutdown flag indicates that the application status of any of the applications is normal when the application process does not exist.
[0023] In some embodiments, the step of sequentially detecting the application status of at least one application among the active nodes includes:
[0024] The multiple applications are divided into a first set of applications that use the shared storage and a second set of applications that do not use the shared storage;
[0025] The application status of at least one first application in the first application set is checked sequentially. When it is determined that the application status of at least one first application is normal, the application status of at least one second application in the second application set is checked sequentially.
[0026] In some embodiments, the method further includes:
[0027] Back up the storage resources in the shared storage to the local storage;
[0028] The system detects changes to storage resources in the shared storage in real time and synchronizes the detected changes to the local storage.
[0029] Secondly, embodiments of this application provide a dual-machine hot standby device in a dual-machine cluster, the dual-machine cluster including an active node and a standby node, the device comprising:
[0030] The detection module is used to sequentially detect the application status of at least one application among the active nodes;
[0031] The judgment module is used to detect whether the storage resources corresponding to any of the applications in the shared storage are available when the application state of any of the applications is abnormal and any of the applications are using shared storage; wherein, the shared storage is the storage jointly accessed by the active node and the standby node;
[0032] The switching module is used to switch the storage address in the configuration file of any application in the shared storage from the first storage location in the shared storage to the corresponding second storage location in the local storage of the active node if the storage resources of any application in the shared storage are unavailable; wherein the local storage synchronously contains the storage resources in the shared storage.
[0033] The transfer module is configured to, after using the local storage, shut down at least one application in the active node and enable at least one corresponding application in the backup node if the application status of any of the applications is still abnormal.
[0034] In some embodiments, the apparatus further includes a first repair module for:
[0035] If the application status of any of the applications becomes abnormal and the application does not use the shared storage, the application shall be restarted for repair.
[0036] If the restart repair fails, shut down at least one of the applications on the active node and enable at least one corresponding application on the standby node.
[0037] In some embodiments, the apparatus further includes a second repair module for:
[0038] If the storage resources of any of the applications in the shared storage are available, then any of the applications will be restarted and repaired.
[0039] If the restart repair fails, shut down at least one of the applications on the active node and enable at least one corresponding application on the standby node.
[0040] In some embodiments, the apparatus further includes a third repair module for:
[0041] When the application status of any of the applications returns to normal, determine whether there are other applications using the shared storage among the multiple applications;
[0042] If it exists, when it is detected that the storage resources corresponding to the other applications in the shared storage are unavailable, the storage address in the configuration file of the other applications will be switched from the third storage location in the shared storage to the corresponding fourth storage location in the local storage.
[0043] When an abnormal application status is detected in the other applications, at least one of the applications in the active node is shut down, and at least one corresponding application in the backup node is enabled.
[0044] In some embodiments, the determining module is further configured to:
[0045] If the existence of any of the aforementioned applications is detected, and it is determined that the application process is in a non-service state, then it is determined that the application state of any of the aforementioned applications is abnormal; or
[0046] When it is detected that the application process of any of the applications does not exist, it is determined whether the application has a shutdown flag. If the shutdown flag does not exist, it is determined that the application status of any of the applications is abnormal. The shutdown flag indicates that the application status of any of the applications is normal when the application process does not exist.
[0047] In some embodiments, the detection module is further configured to:
[0048] The multiple applications are divided into a first set of applications that use the shared storage and a second set of applications that do not use the shared storage;
[0049] The application status of at least one first application in the first application set is checked sequentially. When it is determined that the application status of at least one first application is normal, the application status of at least one second application in the second application set is checked sequentially.
[0050] In some embodiments, the apparatus further includes a synchronization module for:
[0051] Back up the storage resources in the shared storage to the local storage;
[0052] The system detects changes to storage resources in the shared storage in real time and synchronizes the detected changes to the local storage.
[0053] Thirdly, this application provides an electronic device, comprising:
[0054] Memory, used to store program instructions;
[0055] A processor is configured to invoke program instructions stored in the memory and execute the steps included in the method of any one of the first aspects or any one of the second aspects according to the obtained program instructions.
[0056] Fourthly, this application provides a computer-readable storage medium storing a computer program, the computer program including program instructions, which, when executed by a computer, cause the computer to perform the method described in any one of the first aspects or any one of the second aspects.
[0057] Fifthly, this application provides a computer program product comprising: computer program code, which, when executed on a computer, causes the computer to perform the method described in any one of the first aspects or any one of the second aspects. Attached Figure Description
[0058] Figure 1 A schematic diagram illustrating an application scenario provided in an embodiment of this application;
[0059] Figure 2 A flowchart illustrating a dual-machine hot standby method in a dual-machine cluster, as provided in this application embodiment;
[0060] Figure 3 A schematic diagram illustrating the synchronization process between shared storage and local storage provided in an embodiment of this application;
[0061] Figure 4A A flowchart illustrating another dual-machine hot standby method in a dual-machine cluster provided in this application embodiment;
[0062] Figure 4B A flowchart illustrating another dual-machine hot standby method in a dual-machine cluster provided in this application embodiment;
[0063] Figure 5 A structural diagram of a dual-machine hot standby device in a dual-machine cluster provided in an embodiment of this application;
[0064] Figure 6 This is a structural diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0065] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application. Unless otherwise specified, the embodiments and features in the embodiments of this application can be arbitrarily combined with each other. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than that shown here.
[0066] The terms "first" and "second" in the specification, claims, and accompanying drawings of this application are used to distinguish different objects, not to describe a specific order. Furthermore, the term "comprising" and any variations thereof are intended to cover non-exclusive protection. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or devices. The term "multiple" in this application can mean at least two, for example, two, three, or more, and the embodiments of this application do not impose limitations.
[0067] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of this application, including various details to aid understanding. These embodiments should be considered 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 this application. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description. It should be noted that in the embodiments of this application, certain existing industry solutions such as software, components, and models may be mentioned. These should be considered exemplary, intended only to illustrate the feasibility of implementing the technical solutions of this application, and do not imply that the applicant has already used or necessarily used such solutions.
[0068] The acquisition, transmission, storage, and use of data in this application all comply with the requirements of relevant national laws and regulations.
[0069] Before introducing the dual-machine hot standby method in a dual-machine cluster provided in the embodiments of this application, the technical background of the embodiments of this application will be described in detail below for ease of understanding.
[0070] In related technologies, in a Highly Available (HA) dual-machine hot standby scenario, the standby node replicates data from the active node. When the active node fails, the standby node becomes the active node. Typically, in an HA dual-machine hot standby system, nodes share resources, which are taken over by the standby node when the active node fails. However, if this resource fails, the entire system will be unable to continue providing services. In some cases, however, the active and standby nodes may need to share storage resources, such as SAN (Storage Area Network) storage. In the event of an active node failure, this shared storage is taken over by the standby node.
[0071] However, the unavailability of storage resources in shared storage can also cause the active node to fail. In this case, switching the standby node to the active node cannot resolve the failure, and the dual-machine cluster will be unable to continue handling business, making it impossible to guarantee the continuity and reliability of services. Furthermore, considering that in some scenarios, both the active and standby nodes need to deploy multiple applications, to ensure business continuity, it is necessary to ensure that all applications can run on the standby node when the active node fails.
[0072] In view of this, embodiments of this application provide a dual-machine hot standby method, apparatus, device, and medium in a dual-machine cluster. For at least one application deployed on an active node, the application status of each application is sequentially detected. When the application status of an application using shared storage becomes abnormal, it can first be determined whether the storage resources of that application in the shared storage are usable. If they are not usable, local storage is used instead. Since the local storage synchronously contains the storage resources in the shared storage, it can provide the same storage resources as the shared storage. If the application's abnormality is caused by the unavailability of storage resources in the shared storage, the application's abnormality can be resolved by using local storage, thereby avoiding service interruption due to the unavailability of shared storage. After using local storage, if the application status is still abnormal, it indicates that the application's abnormality is not caused by the unavailability of storage resources in the shared storage. In this case, at least one application on the active node is shut down, and at least one corresponding application on the standby node is enabled, thus avoiding service interruption due to active node failure. Therefore, embodiments of this application can guarantee the continuity and reliability of services in a dual-machine cluster.
[0073] The application scenarios of the embodiments of this application will be described in detail below.
[0074] like Figure 1 The diagram shown illustrates an application scenario of an embodiment of this application. The application scenario diagram includes an active node 110 and a standby node 120 in a dual-machine cluster. The active node 110 and the standby node 120 can communicate with each other via a communication network, which can be a wired network or a wireless network.
[0075] An active node is the node currently executing tasks in a dual-machine cluster. A standby node is used to take over services from the active node when it fails, ensuring uninterrupted service across the entire cluster. Active node 110 can deploy one or more applications, such as message queue middleware or Web (World Wide Web) server software. Standby node 120 can deploy the same applications as active node 110, and during the normal operation of each application on the active node, the application's runtime data is synchronized to standby node 120. Thus, when active node 110 fails, standby node 120 can be activated and become the new active node.
[0076] Specifically, active nodes and backup nodes can be deployed on servers. These servers can be independent physical servers, server clusters or distributed systems composed of multiple physical servers, or cloud servers that provide basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms.
[0077] It should be noted that, Figure 1 The example shown is merely illustrative; in reality, the number of backup nodes 120 is not limited and is not specifically limited in this embodiment.
[0078] like Figure 2 The diagram shown is a flowchart of a dual-machine hot standby method in a dual-machine cluster provided in an embodiment of this application. The method is illustrated using an active node in the dual-machine cluster executing the method as an example. The method includes the following steps S21-S24:
[0079] S21. Sequentially check the application status of at least one application among the active nodes.
[0080] Each active node can deploy one or more applications, which can be message queue middleware software, web server software, etc. A corresponding detection script is deployed for each application to detect its application status, i.e., whether it is running abnormally or normally.
[0081] When multiple applications are deployed on an active node, these applications can include those using shared storage or those not. Shared storage is accessed by both the active and standby nodes and can be deployed within a storage device. Specifically, shared storage is used exclusively by the primary and standby nodes. When the active node is running normally, the shared storage is mounted to it. When the active node fails, the shared storage needs to be mounted to the standby node and restarted. For example, the shared storage can be SAN storage. Shared storage provides centralized storage management capabilities, allowing multiple servers (such as active and standby nodes) to access the same storage pool simultaneously, improving storage resource utilization and flexibility.
[0082] In some embodiments, when an active node has applications that use shared storage and applications that do not use shared storage deployed, when the application status of at least one application in the active node is detected sequentially, the multiple applications can be divided into a first set of applications using shared storage and a second set of applications not using shared storage; the application status of at least one first application in the first set is detected sequentially, and when it is determined that the application status of at least one first application is normal, the application status of at least one second application in the second set is detected sequentially.
[0083] Specifically, for different applications within multiple applications, corresponding application status monitoring commands can be executed. For example, when the application is message queue middleware software, it is necessary to determine the channel status. A channel is a communication path used to transmit messages between two queue managers, which can be understood as an application process. The dedicated commands provided by the message queue middleware software (such as the dspmqsc and runmqsc commands) can be used to check the channel status to determine whether fault repair is needed. As another example, when the application is web server software, general process viewing commands can be used, such as the ps -ef command, which is a commonly used Linux command used to display detailed information about all running processes in the system.
[0084] In this embodiment, it is necessary not only to detect whether the application process exists, but also to detect whether the application process's state is abnormal. When the application process enters a non-service state such as sleep or suspension, the application state is considered abnormal. When the application process is in a service state (i.e., an active state), the application state is authenticated as normal. Furthermore, if the application process does not exist, it can be further determined whether the application has been manually shut down, specifically by checking for the presence of a shutdown flag. If it has not been manually shut down, the application state is considered abnormal and requires fault repair; if it has been manually shut down, the application state is considered normal and no fault repair is required.
[0085] Therefore, determining whether an application's application state is abnormal includes the following two situations:
[0086] In the first scenario, if the application process of any application is detected to exist, and it is determined that the application process is in a non-service state, then it is determined that the application state of any application is abnormal.
[0087] In the second scenario, when the application process of any application is detected to be non-existent, it is determined whether any application has a shutdown flag. If no shutdown flag is found, it is determined that the application status of any application is abnormal. The shutdown flag indicates that the application status of any application is normal when the application process is non-existent.
[0088] In this embodiment, when detecting the application status of each application, if the application process is detected to exist, the application status is determined to be abnormal by judging whether the application process is in a non-service state; if the application process is detected to be non-existent, it is necessary to judge again whether the application process was manually shut down. Since in actual application scenarios there are scenarios that require active shutdown of applications, such as business pauses, in order to prevent inaccurate application status detection results, a shutdown flag is added to the manual shutdown script to indicate that the application is manually shut down. That is, when the shutdown flag is present, it means that the application is normal when the application process is not present.
[0089] It should be noted that there is no restriction on the detection order of multiple applications. You can detect applications that use shared resources first, and then detect applications that do not use shared resources. Alternatively, you can detect multiple applications in the set order without distinguishing whether they use shared resources or not.
[0090] S22. When the application state of any application is abnormal and any application is using shared storage, check whether the storage resources corresponding to any application in the shared storage are available.
[0091] When any application's application status becomes abnormal, if the application uses shared storage, the application abnormality may be due to the unavailability of shared storage or the abnormality of active nodes. In this case, the first step is to check whether the storage resources corresponding to the application in the shared storage are available. Specifically, it can be determined whether the storage resources corresponding to the application are accessible. If they are inaccessible, then the application is unavailable.
[0092] Specifically, when an active node includes multiple applications using shared storage, the shared storage can store the storage resources that each application needs to access. Each application's configuration file stores the storage address of the required storage resources, which corresponds to a specific storage location in the shared storage.
[0093] S23. If unavailable, the storage address in the configuration file of any application will be switched from the first storage location in the shared storage to the corresponding second storage location in the local storage of the active node; wherein, the local storage contains storage resources from the shared storage.
[0094] There are several reasons why storage resources corresponding to applications in shared storage may be unavailable, such as network failures or hard drive damage on the storage device hosting the shared storage. The storage resources in shared storage that any application needs to access are located in the first storage location mentioned above. The second storage location in local storage stores the same storage resources as the first storage location. For example, the first storage location could be the location of file b under folder a in shared storage, and the second storage location could be the location of file b under folder a in local storage. After changing the storage address in the configuration file of any application from the first storage location to the second storage location, you can restart the application to determine if the application has been successfully repaired.
[0095] At the same time, the standby node replicates the running data of any of the above applications from the active node, and also switches the storage address of the application's configuration file from the first storage location in the shared storage to the corresponding storage location in the local storage of the standby node.
[0096] In some embodiments, before performing S23 above, the active node can back up the storage resources in the shared storage to the active node's local storage; then, it can detect changes in the shared storage resources in real time and synchronize the detected changes to the local storage.
[0097] Meanwhile, the standby node also backs up the storage resources in the shared storage to the standby node's local storage; then, it detects changes in the shared storage resources in real time and synchronizes the detected changes to the local storage.
[0098] Among them, such as Figure 3 As shown, you can use a detection tool to detect changed storage resources in shared storage, and then use a synchronization tool to synchronize the changed storage resources to local storage.
[0099] Specifically, shared storage includes one or more folders. Operating system-provided listening interfaces can be used to monitor changes to specified directories or files in the shared storage, such as creation, modification, deletion, and movement, thereby detecting changes to storage resources in the shared storage in real time. Specifically, when the content or directory structure of files within a folder changes, file synchronization tools can be used to synchronize the changed content or directory structure to the corresponding files or folders on local storage. During the synchronization process between local and shared storage, only the changed storage resources can be synchronized, thus improving synchronization efficiency.
[0100] In this embodiment of the application, in order to overcome the single point of failure risk of shared storage, a real-time backup method is adopted to write the storage resources in the shared storage to the local storage. When the shared storage is unavailable, the application is restarted using the real-time backup of the local storage to ensure that the application's business is not interrupted, thereby ensuring the continuity of business and the robustness of the system.
[0101] S24. After using local storage, if the application status of any application is still abnormal, shut down at least one application in the active node and enable at least one corresponding application in the standby node.
[0102] If any of the above applications is detected as abnormal after using local storage, it indicates that the application's abnormality is due to a failure of the active node itself. Therefore, at least one application on the active node is shut down, and a shutdown flag is set for each of these applications. Then, the corresponding at least one application on the standby node is enabled. During the normal operation of at least one application on the active node, the standby node will synchronize the running data of at least one application on the active node.
[0103] In this embodiment, when an application using shared storage experiences an abnormal application status, if it is determined that the application's storage resources in the shared storage are unusable, local storage is used instead. Since local storage synchronizes with the shared storage resources, it can provide the same storage resources. If the application's abnormality is caused by the unavailability of shared storage resources, using local storage can resolve the issue, thus preventing service interruption due to shared storage unavailability. If the application status remains abnormal after using local storage, it indicates that the abnormality is not caused by the unavailability of shared storage resources. In this case, shutting down at least one application on the active node and enabling at least one corresponding application on the standby node can prevent service interruption due to active node failure. Therefore, this embodiment ensures the continuity and reliability of services in a dual-machine cluster.
[0104] In some embodiments, during the process of sequentially detecting the application status of at least one application in the active nodes in S21 above, when the application status of any application is abnormal and the application is not using shared storage, the application is restarted and repaired; when the restart and repair fails, at least one application in the active nodes is shut down, and a shutdown flag is set for each of the at least one application to indicate that at least one application in the active nodes is manually shut down; then, the corresponding at least one application in the standby node is enabled; in addition, when the restart and repair of any of the above applications is successful, it is not necessary to enable the standby node.
[0105] In this embodiment, when an application that does not use shared storage encounters an anomaly, a repair-then-transfer approach is adopted. That is, if restarting and modification fails, a backup node is then activated to minimize unnecessary application startups and shutdowns and ensure business continuity and the availability of the dual-machine cluster.
[0106] In some embodiments, after detecting whether the storage resources corresponding to any application in the shared storage are available in S22, the method further includes: if the storage resources of any application in the shared storage are available, restarting and repairing any application; if the restart and repair fails, shutting down at least one application in the active nodes and setting a shutdown flag for each of the at least one application to indicate that at least one application in the active nodes is manually shut down; then, enabling the corresponding at least one application in the standby node; furthermore, if the restart and repair of any application is successful, it is not necessary to enable the standby node.
[0107] In this embodiment of the application, when an application using shared storage encounters an anomaly, if the storage resources corresponding to the application in the shared storage are available, a repair-then-transfer approach is adopted. That is, if restarting and modification fails, a backup node is then activated to minimize unnecessary application startups and shutdowns and ensure business continuity and the availability of the dual-machine cluster.
[0108] In some embodiments, after switching the storage address in the configuration file of any application from shared storage to local storage, when the application state of any application returns to normal, it is determined whether there are other applications using shared storage among the multiple applications; if so, when it is detected that the storage resources corresponding to the other applications in the shared storage are unavailable, the storage address in the configuration file of the other applications is switched from the third storage location in the shared storage to the corresponding fourth storage location in the local storage; wherein the storage resources in the shared storage that the other applications need to access are located in the aforementioned third storage location, and the fourth storage location in the local storage stores the same storage resources as the third storage location.
[0109] Furthermore, when an abnormal application status is detected in other applications, at least one application in the active node is shut down, and a shutdown flag is set for each of the at least one application. Then, at least one corresponding application in the standby node is enabled.
[0110] Specifically, after switching the storage address in the configuration file of any application from shared storage to local storage, when the application status of any application returns to normal, for other applications using shared storage, it is possible to check whether the storage resources corresponding to the other application in shared storage are available. Specifically, the storage resources in shared storage are determined according to the storage address in the configuration file of the other application. If they are unavailable, the application is switched from shared storage to local storage. After using local storage, if the application status of the other application becomes abnormal, at least one application in the active node is shut down, and at least one corresponding application in the standby node is enabled.
[0111] Furthermore, if storage resources for other applications in the shared storage are available, those other applications can continue to use the shared storage.
[0112] It's important to note that for multiple applications using shared storage, a shared storage failure may render the storage resources for some applications unavailable, or it may render the storage resources for all applications unavailable. For example, if some hard drives on the storage device hosting the shared storage fail, some storage resources may become unavailable; conversely, a network failure on the storage device may render all storage resources unavailable. Therefore, when an active node detects a shared storage failure, it can determine which applications' storage resources are unavailable and switch those applications to use the corresponding storage resources on local storage.
[0113] In this embodiment of the application, after switching any abnormal application from shared storage to local storage, if the application status returns to normal, it is possible to continue to check whether the storage resources corresponding to other applications in the shared storage are available. If they are also unavailable, the other applications are also switched from shared storage to local storage, thereby reducing the risk of failure caused by shared storage abnormalities.
[0114] The following is combined with Figure 4A and Figure 4B The overall implementation process of the dual-machine hot standby method in a dual-machine cluster according to the embodiments of this application will be described by way of example.
[0115] like Figure 4A and Figure 4B As shown, the overall process of the dual-machine hot standby method in a dual-machine cluster includes the following S41-S57:
[0116] S41. Read the list of applications that do not use shared storage among the active nodes.
[0117] S42. Determine if there are any unprocessed applications. If yes, execute S43; otherwise, execute S47.
[0118] S43. Determine if the current application status is normal. If yes, return to S42; otherwise, execute S44.
[0119] S44. Restart and repair the current application.
[0120] S45. Determine if the current application status is normal. If yes, return to S42; otherwise, execute S46.
[0121] S46. Shut down all applications on the active node, create a shutdown flag, and enable the standby node.
[0122] S47. Read the list of applications using shared storage in active nodes.
[0123] S48. Determine if there are any unprocessed applications. If not, proceed to S49. If yes, end the process.
[0124] S49. Determine if the current application status is normal. If yes, return to S48; otherwise, execute S50.
[0125] S50. Determine if the shared storage is functioning correctly. If yes, proceed to S57; otherwise, proceed to S52. Here, when the shared storage is not functioning correctly, all applications using the shared storage will be switched to using local storage.
[0126] S51. Read the list of applications using shared storage.
[0127] S52. Determine whether all applications using shared storage have completed the switch. If not, proceed to S53. If not, end.
[0128] Here, it determines whether all applications using shared storage should switch to local storage.
[0129] S53. Applications currently using shared storage should switch to local storage.
[0130] S54. Determine if the current application status is normal. If yes, return to S52; otherwise, execute S57.
[0131] S55. Restart and repair the current application.
[0132] S56. Determine if the current application status is normal. If yes, return to S48; otherwise, execute S57.
[0133] S57. Shut down all applications on the active node, create a shutdown flag, and enable the standby node.
[0134] Based on the same inventive concept, this application also provides a dual-machine hot standby device in a dual-machine cluster. The principle of this device in solving the problem is similar to the method in the above embodiments. Therefore, the implementation of this device can refer to the implementation of the above method, and the repeated parts will not be described again.
[0135] like Figure 5 As shown in the illustration, this application provides a dual-machine hot standby device 500 in a dual-machine cluster. The dual-machine cluster includes an active node and a standby node. The device includes:
[0136] Detection module 501 is used to sequentially detect the application status of at least one application among the active nodes;
[0137] The judgment module 502 is used to detect whether the storage resources corresponding to any application in the shared storage are available when the application status of any application is abnormal and any application uses shared storage; wherein, the shared storage is the storage accessed by both active nodes and standby nodes.
[0138] The switching module 503 is used to switch the storage address in the configuration file of any application from the first storage location in the shared storage to the corresponding second storage location in the local storage of the active node if the storage status of the shared storage becomes abnormal; wherein, the local storage contains storage resources from the shared storage.
[0139] The transfer module 504 is used to shut down at least one application in the active node and enable at least one corresponding application in the standby node if the application status of any application is still abnormal after using local storage.
[0140] In some embodiments, the apparatus further includes a first repair module for:
[0141] If any application's application status becomes abnormal, and that application is not using shared storage, restart and repair that application.
[0142] The second transfer module is used to shut down at least one application on the active node and enable at least one corresponding application on the standby node when the restart repair fails.
[0143] In some embodiments, the apparatus further includes a second repair module for:
[0144] If storage resources are available for any application in the shared storage, then restart and repair that application.
[0145] If the restart repair fails, shut down at least one application on the active node and enable at least one corresponding application on the standby node.
[0146] In some embodiments, the apparatus further includes a third repair module for:
[0147] When the application status of any application returns to normal, determine whether there are other applications using shared storage among the multiple applications;
[0148] If it exists, when the storage resources corresponding to the other applications in the shared storage are detected to be unavailable, the storage address in the configuration file of the other applications will be switched from the third storage location in the shared storage to the corresponding fourth storage location in the local storage.
[0149] When an abnormal application status is detected in the other applications, at least one of the applications in the active node is shut down, and at least one corresponding application in the backup node is enabled.
[0150] In some embodiments, the determining module is further configured to:
[0151] If the existence of any application process is detected, and it is determined that the application process is in a non-service state, then the application state of any application is determined to be abnormal; or
[0152] When it is detected that the application process of any application does not exist, it is determined whether the application has a shutdown flag. If there is no shutdown flag, it is determined that the application status of any application is abnormal. The shutdown flag indicates that the application status of any application is normal when the application process does not exist.
[0153] In some embodiments, the detection module is further configured to:
[0154] The applications are divided into a first set of applications that use shared storage and a second set of applications that do not use shared storage.
[0155] The application status of at least one first application in the first application set is checked sequentially. When it is determined that the application status of at least one first application is normal, the application status of at least one second application in the second application set is checked sequentially.
[0156] In some embodiments, the apparatus further includes a synchronization module for:
[0157] Back up storage resources in shared storage to local storage;
[0158] Real-time detection of changes to shared storage resources and synchronization of detected changes to local storage.
[0159] Based on the same inventive concept, this application provides an execution device that can realize the dual-machine hot standby function in a dual-machine cluster as discussed above. Please refer to... Figure 6 The device includes a memory 601 and a processor 602.
[0160] The memory 601 is used to store program instructions;
[0161] The processor 602 is used to call the program instructions stored in the memory and execute the dual-machine hot standby method in the dual-machine cluster according to the obtained program.
[0162] In the embodiments of this application, the processor 602 may be a general-purpose processor, a digital signal processor, an application-specific integrated circuit, a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules within the processor.
[0163] Memory 601, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. Memory 601 may include at least one type of storage medium, such as flash memory, hard disk, multimedia card, card-type memory, random access memory (RAM), static random access memory (SRAM), programmable read-only memory (PROM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), magnetic storage, magnetic disk, optical disk, etc. Memory 601 can be any other medium capable of carrying or storing desired program code in the form of instructions or data structures that can be accessed by a computer, but is not limited thereto. Memory 601 in the embodiments of this application may also be a circuit or any other device capable of implementing storage functions for storing program instructions and / or data.
[0164] Since the principle behind the problem-solving of the above electronic devices is similar to the dual-machine hot standby method in a dual-machine cluster, the implementation of the above electronic devices can be found in the implementation of the method, and the repeated parts will not be described again.
[0165] Based on the same inventive concept, embodiments of this application provide a computer-readable storage medium. The computer program product includes computer program code, which, when executed on a computer, causes the computer to perform any of the dual-machine hot standby methods in a dual-machine cluster discussed above. Since the principle by which the above-described computer-readable storage medium solves the problem is similar to that of the dual-machine hot standby method in a dual-machine cluster, the implementation of the above-described computer-readable storage medium can be referred to the implementation of the method, and repeated details will not be elaborated further.
[0166] Based on the same inventive concept, this application also provides a computer program product, which includes computer program code. When the computer program code is run on a computer, it causes the computer to execute any of the dual-machine hot standby methods in a dual-machine cluster discussed above. Since the principle by which the above-described computer program product solves the problem is similar to that of the dual-machine hot standby method in a dual-machine cluster, the implementation of the above-described computer program product can refer to the implementation of the method, and repeated details will not be elaborated further.
[0167] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied 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.
[0168] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0169] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0170] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of user-operated steps to be executed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0171] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.
Claims
1. A dual-machine hot standby method in a dual-machine cluster, characterized in that, The dual-machine cluster includes an active node and a standby node, and the method includes: The application status of at least one application among the active nodes is detected sequentially; When the application status of any of the applications becomes abnormal, and any of the applications uses shared storage, it is checked whether the storage resources corresponding to any of the applications in the shared storage are available; wherein, the shared storage is the storage accessed by both the active node and the standby node; If unavailable, the storage address in the configuration file of any of the applications will be switched from the first storage location in the shared storage to the corresponding second storage location in the local storage of the active node; wherein the local storage contains the storage resources in the shared storage. After using the local storage, if the application status of any of the applications is still abnormal, then at least one of the applications in the active node is shut down, and at least one corresponding application in the standby node is enabled.
2. The method according to claim 1, characterized in that, After sequentially detecting the application status of at least one application among the active nodes, the process further includes: If the application status of any of the applications becomes abnormal and any of the applications does not use the shared storage, the application will be restarted for repair. If the restart repair fails, shut down at least one of the applications on the active node and enable at least one corresponding application on the standby node.
3. The method according to claim 1, characterized in that, After detecting whether the storage resources corresponding to any of the applications in the shared storage are available, the method further includes: If the storage resources of any of the applications in the shared storage are available, then any of the applications will be restarted and repaired. If the restart repair fails, shut down at least one of the applications on the active node and enable at least one corresponding application on the standby node.
4. The method according to claim 1, characterized in that, After using the local storage, the following is also included: When the application status of any of the applications returns to normal, determine whether there are other applications using the shared storage among the multiple applications; If it exists, when it is detected that the storage resources corresponding to the other applications in the shared storage are unavailable, the storage address in the configuration file of the other applications will be switched from the third storage location in the shared storage to the corresponding fourth storage location in the local storage. When an abnormal application status is detected in the other applications, at least one of the applications in the active node is shut down, and at least one corresponding application in the backup node is enabled.
5. The method according to any one of claims 1 to 4, characterized in that, Determining that the application state of any of the aforementioned applications is abnormal includes: If the existence of any of the aforementioned applications is detected, and it is determined that the application process is in a non-service state, then it is determined that the application state of any of the aforementioned applications is abnormal; or When it is detected that the application process of any of the applications does not exist, it is determined whether the application has a shutdown flag. If the shutdown flag does not exist, it is determined that the application status of any of the applications is abnormal. The shutdown flag indicates that the application status of any of the applications is normal when the application process does not exist.
6. The method according to any one of claims 1 to 4, characterized in that, The step of sequentially detecting the application status of at least one application among the active nodes includes: The multiple applications are divided into a first set of applications that use the shared storage and a second set of applications that do not use the shared storage; The application status of at least one first application in the first application set is checked sequentially. When it is determined that the application status of at least one first application is normal, the application status of at least one second application in the second application set is checked sequentially.
7. The method according to any one of claims 1 to 4, characterized in that, The method further includes: Back up the storage resources in the shared storage to the local storage; The system detects changes to storage resources in the shared storage in real time and synchronizes the detected changes to the local storage.
8. A dual-machine hot standby device in a dual-machine cluster, characterized in that, The dual-machine cluster includes an active node and a standby node, and the device includes: The detection module is used to sequentially detect the application status of at least one application among the active nodes; The judgment module is used to detect whether the storage resources corresponding to any of the applications in the shared storage are available when the application state of any of the applications is abnormal and any of the applications are using shared storage; wherein, the shared storage is the storage jointly accessed by the active node and the standby node; The switching module is used to switch the storage address in the configuration file of any application in the shared storage from the first storage location in the shared storage to the corresponding second storage location in the local storage of the active node if the storage resources of any application in the shared storage are unavailable; wherein the local storage synchronously contains the storage resources in the shared storage. The transfer module is configured to, after using the local storage, shut down at least one application in the active node and enable at least one corresponding application in the backup node if the application status of any of the applications is still abnormal.
9. The apparatus according to claim 8, characterized in that, The device further includes a first repair module for: If the application status of any of the applications becomes abnormal and any of the applications does not use the shared storage, the application will be restarted for repair. If the restart repair fails, shut down at least one of the applications on the active node and enable at least one corresponding application on the standby node.
10. The apparatus according to claim 8, characterized in that, The device further includes a second repair module for: If the storage resources of any of the applications in the shared storage are available, then any of the applications will be restarted and repaired. If the restart repair fails, shut down at least one of the applications on the active node and enable at least one corresponding application on the standby node.
11. The apparatus according to claim 8, characterized in that, The device also includes a third repair module for: When the application status of any of the applications returns to normal, determine whether there are other applications using the shared storage among the multiple applications; If it exists, when it is detected that the storage resources corresponding to the other applications in the shared storage are unavailable, the storage address in the configuration file of the other applications will be switched from the third storage location in the shared storage to the corresponding fourth storage location in the local storage. When an abnormal application status is detected in the other applications, at least one of the applications in the active node is shut down, and at least one corresponding application in the backup node is enabled.
12. The apparatus according to any one of claims 8 to 11, characterized in that, The judgment module is also used for: If the application process of any of the aforementioned applications is detected to exist, and it is determined that the application process is in a non-service state, then it is determined that the application state of any of the aforementioned applications is abnormal. or When it is detected that the application process of any of the applications does not exist, it is determined whether the application has a shutdown flag. If the shutdown flag does not exist, it is determined that the application status of any of the applications is abnormal. The shutdown flag indicates that the application status of any of the applications is normal when the application process does not exist.
13. The apparatus according to any one of claims 8 to 11, characterized in that, The detection module is also used for: The multiple applications are divided into a first set of applications that use the shared storage and a second set of applications that do not use the shared storage; The application status of at least one first application in the first application set is checked sequentially. When it is determined that the application status of at least one first application is normal, the application status of at least one second application in the second application set is checked sequentially.
14. The apparatus according to any one of claims 8 to 11, characterized in that, The device further includes a synchronization module for: Back up the storage resources in the shared storage to the local storage; The system detects changes to storage resources in the shared storage in real time and synchronizes the detected changes to the local storage.
15. An electronic device, characterized in that, include: Memory, used to store program instructions; A processor is configured to invoke program instructions stored in the memory and execute the steps of the method according to any one of claims 1-7.
16. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, the computer program including program instructions that, when executed by a computer, cause the computer to perform the method as described in any one of claims 1-7.
17. 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 method described in any one of claims 1-7.
Citation Information
Patent Citations
Server cluster system and method for implementation of high availability of server cluster system
CN109194515A
System and method for controlling access to shared storage device
US20110179231A1