A method, device, electronic device and storage medium for restoring application resources
By monitoring the status of the primary cluster and obtaining configuration information through the backup cluster, the problem of business interruption and data loss caused by resource failures on the Kubernetes platform was solved, achieving high availability and stability, and ensuring rapid service recovery and data consistency.
Patent Information
- Application Number
- CN202111657667.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-30
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2041-12-30
AI Technical Summary
On the Kubernetes platform, business interruptions and data loss caused by resource failures or shortages cannot be effectively guaranteed by existing technologies to ensure business security, stability, and high availability. In particular, when switching to other platforms, it is impossible to migrate the original resources and data equally, resulting in production accidents and high-cost deployment and debugging.
By monitoring the running status of the primary cluster through the standby cluster, obtaining the configuration information of application resources, and initiating a restore task in the standby cluster, including detecting the environment space, determining the restore type, and performing application resource creation operations, the service can be quickly restored in the event of an anomaly in the primary cluster.
It achieves high availability of application resources and stability of service systems on the Kubernetes platform, avoids data loss and high-cost deployment and debugging, and improves system continuity and reliability.
Smart Images

Figure CN114297033B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, electronic device and storage medium for restoring application resources. Background Art
[0002] Kubernetes, abbreviated as k8s, is a portable container orchestration and management tool created for container services. More and more companies are embracing Kubernetes, and currently Kubernetes has dominated cloud business processes, promoted the popularization and implementation of popular technologies such as microservice architecture, and is developing in full swing. More and more systems are based on the Kubernetes platform to expand or run their own businesses.
[0003] Based on the powerful load of the Kubernetes platform, many complex business application scenarios are derived. When there are predictable or unpredictable disasters, human misoperation leading to resource downtime or accidental deletion, the resulting business interruption and recovery costs will be unpredictable. Therefore, how to ensure the safe, stable, and continuously high-availability operation and maintenance of business scenarios based on the Kubernetes platform requires us to provide a safe and reliable resource protection mechanism.
[0004] When the resources of the Kubernetes platform fail or are insufficient to continue to provide services, the only option is to switch to other platforms for continued use. However, after the switch, resources need to be rebuilt, and the original resources and data cannot be migrated in the same way. Tens of thousands of data cannot be reused, resulting in the obstruction of business continuity. Even if the data backup mechanism of the storage hardware itself is used, it is not matched with the storage management mechanism of Kubernetes, and the backup information cannot be read. The resulting data loss may also cause major production accidents in real life, and the deployment and debugging of Kubernetes platform services also requires a lot of time and manpower costs. Summary of the invention
[0005] In order to solve the above technical problems or at least partially solve the above technical problems, the present application provides a method, device, electronic device and storage medium for restoring application resources.
[0006] According to one aspect of an embodiment of the present application, a method for restoring application resources is provided, which is applied to a standby cluster, and the method includes:
[0007] Monitoring the operating status of the active cluster, wherein the active cluster is in communication connection with the standby cluster;
[0008] When it is determined according to the running status that the active cluster is in an abnormal state, obtaining configuration information of application resources of the active cluster backed up in the object storage;
[0009] Initiate a restore task in the standby cluster based on the configuration information;
[0010] An application resource creation operation is performed in the standby cluster based on the restoration task.
[0011] Furthermore, monitoring the running status of application resources deployed in the active cluster includes:
[0012] Receiving a heartbeat message from the active cluster;
[0013] Determine the running status corresponding to the active cluster according to the heartbeat message;
[0014] The step of determining the operating state corresponding to the active cluster according to the heartbeat message includes:
[0015] When the heartbeat message is received within a preset time, the operating state is determined to be a normal state; or, when the heartbeat message is not received within the preset time, the operating state is determined to be an abnormal state.
[0016] Further, the obtaining of configuration information of the application resources of the active cluster backed up in the object storage includes:
[0017] Sending an information acquisition request to the object storage, wherein the information acquisition request carries the address information and authentication ciphertext of the standby cluster;
[0018] Receive configuration information fed back by the object storage, wherein the configuration information is sent by the object storage after authenticating the address information and the authentication ciphertext.
[0019] Furthermore, before initiating a restore task in the standby cluster based on the configuration information, the method further includes:
[0020] Detecting a target environment space of the standby cluster;
[0021] In the case where the target environment space meets the preset deployment requirements, a restore task is initiated to the standby cluster based on the configuration information.
[0022] Further, the performing the creation operation of the application resource in the standby cluster based on the restoration task includes:
[0023] Determining whether there is an application resource identical to the original application resource in the standby cluster;
[0024] In a case where the application resource identical to the original application resource does not exist in the standby cluster, a target application resource is created in the standby cluster based on the configuration information in the restoration task.
[0025] Furthermore, in the case that the backup cluster has an application resource identical to the original application resource, the method further includes:
[0026] Get the restore type corresponding to the application resource;
[0027] When the restoration type is forced restoration, the application resources in the standby cluster that are related to the original application resources are deleted, and target application resources are created in the standby cluster based on the configuration information in the restoration task; or, when the restoration type is non-forced restoration, the target application resources are created in the standby cluster based on the configuration information in the restoration task.
[0028] Further, after executing the creation operation of the application resource in the standby cluster based on the restoration task, the method further includes:
[0029] Acquire target application resources created in the standby cluster based on the configuration information;
[0030] Comparing the original application resource based on the target application resource to obtain a comparison result;
[0031] If the comparison result indicates that the target application resource is inconsistent with the original application resource, generating a data synchronization task;
[0032] A data incremental synchronization operation is performed on the target application resource based on the data synchronization task until the target application resource is consistent with the original application resource.
[0033] According to another aspect of an embodiment of the present application, there is also provided a device for restoring application resources, including:
[0034] A monitoring module, used to monitor the operating status corresponding to the active cluster, wherein the active cluster is communicatively connected with the standby cluster;
[0035] A determination module, configured to obtain configuration information of application resources of the active cluster backed up in the object storage when it is determined according to the running status that the active cluster is in an abnormal state;
[0036] An acquisition module, used to initiate a restore task to the standby cluster based on the configuration information;
[0037] A processing module is used to execute a creation operation of application resources in the standby cluster based on the restoration task.
[0038] According to another aspect of an embodiment of the present application, a storage medium is further provided, which includes a stored program, and the above steps are executed when the program is run.
[0039] According to another aspect of an embodiment of the present application, there is also provided an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; wherein: the memory is used to store computer programs; and the processor is used to execute the steps in the above method by running the program stored in the memory.
[0040] The embodiment of the present application also provides a computer program product including instructions, which, when executed on a computer, enables the computer to execute the steps in the above method.
[0041] The above-mentioned technical scheme provided by the embodiment of the present application has the following advantages over the prior art: the method provided by the embodiment of the present application monitors the operating status of the main cluster through the standby cluster master, and when it is determined that the operating status of the main cluster is abnormal, the standby cluster actively obtains the configuration information of the application resources deployed in the main cluster, and restores the application resources according to the configuration information, thereby achieving high availability of the service and ensuring the stability of the service system. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0043] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0044] Figure 1 A flowchart of a method for restoring application resources provided in an embodiment of the present application;
[0045] Figure 2 A flowchart of a method for restoring application resources provided in another embodiment of the present application;
[0046] Figure 3 A block diagram of a device for restoring application resources provided in an embodiment of the present application;
[0047] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0048] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. The schematic embodiments of the present application and their descriptions are used to explain the present application and do not constitute improper limitations on the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0049] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another similar entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0050] The embodiments of the present application provide a method, device, electronic device and storage medium for restoring application resources. The method provided by the embodiments of the present invention can be applied to any required electronic device, for example, it can be a server, a terminal and other electronic devices, which are not specifically limited here, and for the convenience of description, they are referred to as electronic devices in the following.
[0051] According to one aspect of an embodiment of the present application, a method embodiment of a method for restoring an application resource is provided. Figure 1 A flowchart of a method for restoring application resources provided in an embodiment of the present application is shown in FIG. Figure 1 As shown, the method includes:
[0052] Step S11 , monitoring the operating status corresponding to the active cluster, wherein the active cluster is in communication connection with the standby cluster.
[0053] The method provided in the embodiment of the present application is applied to a backup cluster, and the backup cluster is deployed in a service system, and the service system also includes: a primary cluster and an object storage. Among them, multiple application resources are deployed in the primary cluster, and the application resources are used to provide services to the outside. The object storage is used to store the configuration information of the application resources deployed in the primary cluster. It can be understood that the various application resources deployed in the cluster can be stored in the object storage in a backup manner. Based on the powerful storage and upload and download functions of the object storage, the configuration information of the application resources is stored in the form of a configuration file. During backup and recovery, the configuration information of the application is pulled through the download function of the object storage.
[0054] In the embodiment of the present application, step S11, monitoring the running status of application resources deployed in the active cluster, includes the following steps A1-A2:
[0055] Step A1: receiving a heartbeat message from the active cluster.
[0056] Step A2: determining the operating status corresponding to the active cluster according to the heartbeat message.
[0057] In an embodiment of the present application, the standby cluster will be monitored in real time through a monitoring mechanism. Since the active cluster and the standby cluster will communicate regularly, the standby cluster will receive the heartbeat message from the active cluster and determine the operating status of the application resources deployed in the active cluster based on the heartbeat message. If the standby cluster does not receive the heartbeat message sent by the active cluster within a preset time, it is determined that the active cluster and the application resources in the active cluster are abnormal (and the operating status shows an abnormal state). If the standby cluster receives the heartbeat message sent by the active cluster within a preset time, it is determined that the active cluster and the application resources in the active cluster are normal.
[0058] Step S12: when it is determined according to the running status that the active cluster is in an abnormal state, configuration information of the application resources of the active cluster backed up in the object storage is obtained.
[0059] In the embodiment of the present application, step S12, obtaining configuration information of application resources of the active cluster backed up in the object storage, includes the following steps B1-B2:
[0060] Step B1: Send an information acquisition request to the object storage, wherein the information acquisition request carries the address information of the standby cluster and the authentication ciphertext.
[0061] In an embodiment of the present application, when the standby cluster determines that the active cluster is in an abnormal state, it will automatically start the backup mechanism. Specifically, the standby cluster will automatically generate an information acquisition request, and the information acquisition request is used to obtain the configuration information of the application resources deployed in the active cluster from the object storage. The process of the standby cluster generating the information acquisition request is as follows: first determine the address information of the standby cluster, then use the pre-generated encryption key to encrypt the address information, generate the authentication ciphertext, and finally generate the information acquisition request based on the address information and the authentication ciphertext, and send the information acquisition request to the object storage.
[0062] It should be noted that the object storage will receive resource backup requests sent from the primary device, obtain the configuration information corresponding to the application resources deployed in the primary device based on the resource backup request, and store the configuration information. It should be noted that users deploy applications through the image warehouse as needed, mount components such as stateful loads, stateless loads, tasks, scheduled tasks, whether to mount storage volumes, etc., and upload the deployed application configuration files to the object storage for storage through the backup function.
[0063] Step B2: receiving configuration information fed back by the object storage, wherein the configuration information is sent by the object storage after the address information and the authentication ciphertext are authenticated.
[0064] In the embodiment of the present application, after receiving the information acquisition request, the object storage will decrypt the authentication ciphertext. If the decryption result obtained by decryption is consistent with the address information, it is determined that the information acquisition request authentication is successful.
[0065] In an embodiment of the present application, the object storage is connected to the backup cluster by verifying the IP and public and private keys, and uses the storage bucket device provided by it. Based on the storage and upload and download functions of the object storage, the configuration information of the application resource module is stored in the object storage in the form of a configuration file. During backup and recovery, the configuration information of the application is pulled through the download function of the object storage.
[0066] Step S13: Initiate a restore task in the standby cluster based on the configuration information.
[0067] In an embodiment of the present application, after downloading the configuration information from the object storage, the standby cluster initiates a restore task within the standby cluster, and the restore task is used to restore the application resources in the active cluster in the standby cluster according to the configuration information.
[0068] Step S14: executing a creation operation of application resources in the standby cluster based on the restoration task.
[0069] In the embodiment of the present application, in step S14, before initiating the restore task to the standby cluster based on the configuration information, the method further includes the following steps C1-C2:
[0070] Step C1, detecting the target environment space of the standby cluster.
[0071] Step C2: When the target environment space meets the preset deployment requirements, a restore task is initiated to the standby cluster based on the configuration information.
[0072] In the embodiment of the present application, in order to ensure the restoration efficiency of application resources, before initiating the restoration task, it is necessary to detect the target environment space of the standby cluster, for example, the space utilization rate in the current standby cluster, so as to determine whether the standby cluster is in a fully loaded state. At the same time, if the space utilization rate is less than the preset utilization rate or the remaining space utilization rate meets the requirements of the configuration information of the application resources, it is determined that the target environment space meets the preset deployment requirements. At this time, a restoration task will be initiated to the standby cluster based on the configuration information.
[0073] In the embodiment of the present application, the creation operation of the application resource is performed in the standby cluster based on the restoration task, including the following steps D1-D2:
[0074] Step D1, determining whether there is an application resource identical to the original application resource in the standby cluster.
[0075] Step D2: if the application resource identical to the original application resource does not exist in the standby cluster, create a target application resource in the standby cluster based on the configuration information in the restoration task.
[0076] In an embodiment of the present application, in order to rationally utilize the space of the standby cluster, during the execution of the restoration task, it is first determined whether there are application resources in the standby cluster that are identical to the original application resources. If there are no application resources in the standby cluster that are identical to the original application resources, the target application resources are created in the standby cluster based on the configuration information in the restoration task.
[0077] In the embodiment of the present application, when there are application resources identical to the original application resources in the standby cluster, the method further includes the following steps E1-E2:
[0078] Step E1, obtaining the restoration type corresponding to the application resource.
[0079] Step E2, when the restore type is forced restore, delete the application resources in the standby cluster and the original application resources, and create the target application resources in the standby cluster based on the configuration information in the restore task; or, when the restore type is non-forced restore, create the target application resources in the standby cluster based on the configuration information in the restore task.
[0080] As an example, the restore type is divided into forced restore and non-forced restore. Forced restore means that when the instruction to restore certain resources is obtained, the backup cluster is checked for application resources that are the same as the original application resources. If so, the application resources are deleted before restoration. Non-forced restore means that when the instruction to restore certain resources is obtained, the backup cluster is checked for application resources that are the same as the original application resources. If so, the application resources are skipped and the next application resource is restored.
[0081] The method provided in the embodiment of the present application monitors the operating status of the active cluster through the standby cluster master, and when it is determined that the operating status of the active cluster is abnormal, the standby cluster actively obtains the configuration information of the application resources deployed in the active cluster, and restores the application resources based on the configuration information, thereby achieving high availability of the service and ensuring the stability of the service system.
[0082] Figure 2 A flowchart of a method for restoring application resources provided in another embodiment of the present application is shown in FIG. Figure 2 As shown, after executing the creation operation of the application resource in the standby cluster based on the restoration task, the method further includes:
[0083] Step S21, obtaining target application resources created based on configuration information in the standby cluster;
[0084] Step S22, comparing the original application resources based on the target application resources to obtain a comparison result;
[0085] Step S23, when the comparison result indicates that the target application resource is inconsistent with the original application resource, generating a data synchronization task;
[0086] Step S24: performing a data incremental synchronization operation on the target application resource based on the data synchronization task until the target application resource is consistent with the original application resource.
[0087] In the embodiment of the present application, after the target application resources are deployed in the backup cluster, the restored target application resources are extracted and compared with the original application resource configuration information. If the comparison is consistent, the application resource is successfully restored. If the comparison is inconsistent, the synchronization task is called to perform incremental data synchronization until the data is consistent. At this point, the application resource is successfully restored. One-to-one fault migration recovery is performed based on the original application space resources, which ensures the accuracy of the data, provides high-availability technical support for the user's system service support, avoids data loss, time and labor costs, and further improves system stability.
[0088] The embodiment of the present application also provides a service system, which includes: a primary cluster, a backup cluster and an object storage. Multiple application resources are deployed in the primary cluster and the backup cluster, and the object storage is used to store the configuration information of the application resources in the primary cluster and the backup cluster. Based on the powerful storage and upload and download functions of the object storage, the object storage module stores the configuration information of the application resource module in the form of a configuration file in the object storage. During backup and restoration, the configuration information of the application is pulled through the download function of the object storage.
[0089] At the same time, the standby cluster monitors the operating status of the active cluster in real time through the heartbeat mechanism, and decides whether to back up resources based on the status of the monitoring feedback. During the backup, the space required for the application is built and the application is deployed and the application metadata is restored in the new environment according to the obtained backup configuration file. By comparing with the original resources, the consistency of resource data is ensured.
[0090] Figure 3 This is a block diagram of an application resource restoration device provided in an embodiment of the present application. The device can be implemented as part or all of an electronic device through software, hardware, or a combination of both. Figure 3 As shown, the device comprises:
[0091] A monitoring module 31 is used to monitor the operation status corresponding to the active cluster, wherein the active cluster is in communication connection with the standby cluster;
[0092] The determination module 32 is used to obtain the configuration information of the application resources of the active cluster backed up in the object storage when it is determined that the active cluster is in an abnormal state according to the running state;
[0093] An acquisition module 33 is used to initiate a restore task to the standby cluster based on the configuration information;
[0094] The processing module 34 is used to execute a creation operation of application resources in the standby cluster based on the restoration task.
[0095] In the embodiment of the present application, the monitoring module 31 is used to receive a heartbeat message from the active cluster; determine the operating state corresponding to the active cluster according to the heartbeat message; wherein, if the heartbeat message is received within a preset time, the operating state is determined to be a normal state, or, if the heartbeat message is not received within the preset time, the operating state is determined to be an abnormal state. .
[0096] In an embodiment of the present application, a determination module 32 is used to send an information acquisition request to the object storage, wherein the information acquisition request carries the address information and the authentication ciphertext of the backup cluster; and receive configuration information fed back by the object storage, wherein the configuration information is sent by the object storage after the address information and the authentication ciphertext are authenticated.
[0097] In an embodiment of the present application, the device for restoring application resources further includes: a detection module for detecting a target environment space of a standby cluster; and initiating a restoration task to the standby cluster based on configuration information when the target environment space meets preset deployment requirements.
[0098] In an embodiment of the present application, the processing module 34 is used to determine whether there is an application resource identical to the original application resource in the standby cluster; if there is no application resource identical to the original application resource in the standby cluster, create a target application resource in the standby cluster based on the configuration information in the restoration task.
[0099] In an embodiment of the present application, the application resource restoration device also includes: an analysis module, used to obtain the restoration type corresponding to the application resource; when the restoration type is forced restoration, the application resources in the backup cluster and the original application resources are deleted, and the target application resources are created in the backup cluster based on the configuration information in the restoration task; or, when the restoration type is non-forced restoration, the target application resources are created in the backup cluster based on the configuration information in the restoration task.
[0100] In an embodiment of the present application, the application resource restoration device also includes: a comparison module, which is used to obtain a target application resource created in a backup cluster based on configuration information; compare the original application resource based on the target application resource to obtain a comparison result; when the comparison result indicates that the target application resource is inconsistent with the original application resource, generate a data synchronization task; perform an incremental data synchronization operation on the target application resource based on the data synchronization task until the target application resource is consistent with the original application resource.
[0101] In this application, the standby cluster monitors the operating status of the main cluster. When it is determined that the operating status of the main cluster is abnormal, the standby cluster actively obtains the configuration information of the application resources deployed in the main cluster, and restores the application resources based on the configuration information, thereby achieving high availability of the service and ensuring the stability of the service system.
[0102] The present application also provides an electronic device, such as Figure 4 As shown, the electronic device may include: a processor 1501 , a communication interface 1502 , a memory 1503 and a communication bus 1504 , wherein the processor 1501 , the communication interface 1502 , and the memory 1503 communicate with each other via the communication bus 1504 .
[0103] Memory 1503, used for storing computer programs;
[0104] The processor 1501 is used to implement the steps of the above embodiment when executing the computer program stored in the memory 1503.
[0105] The communication bus mentioned in the above terminal 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 ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0106] The communication interface is used for communication between the above terminal and other devices.
[0107] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0108] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0109] In another embodiment provided in the present application, a computer-readable storage medium is provided, in which instructions are stored. When the computer-readable storage medium is executed on a computer, the computer executes the method for restoring application resources described in any of the above embodiments.
[0110] In another embodiment provided by the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute the method for restoring application resources described in any one of the above embodiments.
[0111] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that a computer can access or a data object storage such as a server or data center that contains one or more available media integration. The available medium can be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk SolidState Disk), etc.
[0112] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.
[0113] The above description is only a specific implementation of the present application, so that those skilled in the art can understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest range consistent with the principles and novel features applied for herein.
Claims
1. A method for restoring application resources, applied to a standby cluster, characterized in that: The method comprises: Monitoring the operating status of the active cluster, wherein the active cluster is in communication connection with the standby cluster; When it is determined according to the running status that the active cluster is in an abnormal state, obtaining configuration information of application resources of the active cluster backed up in the object storage; Initiate a restore task in the standby cluster based on the configuration information; Executing a creation operation of application resources in the standby cluster based on the restoration task; The obtaining of configuration information of the application resources of the active cluster backed up in the object storage includes: determining the address information of the standby cluster, encrypting the address information using a pre-generated encryption key, generating an authentication ciphertext, generating an information acquisition request based on the address information and the authentication ciphertext, and sending the information acquisition request to the object storage; receiving configuration information fed back by the object storage, wherein the configuration information is sent by the object storage after the address information and the authentication ciphertext are authenticated; The performing of the creation operation of the application resource in the standby cluster based on the restoration task includes: determining whether there is an application resource identical to the original application resource in the standby cluster; and creating a target application resource in the standby cluster based on the configuration information in the restoration task when there is no application resource identical to the original application resource in the standby cluster; In the case where there is an application resource identical to the original application resource in the standby cluster, the method further includes: obtaining a restore type corresponding to the application resource; in the case where the restore type is a forced restore, deleting the application resource identical to the original application resource in the standby cluster, and creating a target application resource in the standby cluster based on the configuration information in the restore task; or, in the case where the restore type is a non-forced restore, creating a target application resource in the standby cluster based on the configuration information in the restore task; After executing the application resource creation operation in the standby cluster based on the restore task, the method further includes: obtaining the target application resource created based on the configuration information in the standby cluster; comparing the original application resource based on the target application resource to obtain a comparison result; generating a data synchronization task when the comparison result indicates that the target application resource is inconsistent with the original application resource; and performing an incremental data synchronization operation on the target application resource based on the data synchronization task until the target application resource is consistent with the original application resource.
2. The method according to claim 1, characterized in that The monitoring of the running status corresponding to the active cluster includes: Receiving a heartbeat message from the active cluster; Determine the running status corresponding to the active cluster according to the heartbeat message; The step of determining the operating state corresponding to the active cluster according to the heartbeat message includes: When the heartbeat message is received within a preset time, the operating state is determined to be a normal state; or, when the heartbeat message is not received within the preset time, the operating state is determined to be an abnormal state.
3. The method according to claim 1, characterized in that: Before initiating a restore task in the standby cluster based on the configuration information, the method further includes: Detecting a target environment space of the standby cluster; In the case where the target environment space meets the preset deployment requirements, a restore task is initiated to the standby cluster based on the configuration information.
4. A device for restoring application resources, characterized in that: include: A monitoring module, used to monitor the operating status corresponding to the active cluster, wherein the active cluster is communicatively connected with the standby cluster; A determination module, configured to obtain configuration information of application resources of the active cluster backed up in the object storage when it is determined according to the running status that the active cluster is in an abnormal state; An acquisition module, used to initiate a restore task to the standby cluster based on the configuration information; A processing module, configured to execute a creation operation of application resources in the standby cluster based on the restoration task; The determination module is used to determine the address information of the standby cluster, encrypt the address information using a pre-generated encryption key, generate an authentication ciphertext, generate an information acquisition request based on the address information and the authentication ciphertext, and send the information acquisition request to the object storage; receive the configuration information fed back by the object storage, wherein the configuration information is sent by the object storage after the address information and the authentication ciphertext are authenticated; The acquisition module is used to determine whether there is an application resource identical to the original application resource in the standby cluster; if there is no application resource identical to the original application resource in the standby cluster, create a target application resource in the standby cluster based on the configuration information in the restoration task; The device further comprises: an analysis module, configured to obtain a restoration type corresponding to an application resource; when the restoration type is a forced restoration, delete the application resource in the standby cluster corresponding to the original application resource, and create a target application resource in the standby cluster based on the configuration information in the restoration task; or, when the restoration type is a non-forced restoration, create a target application resource in the standby cluster based on the configuration information in the restoration task; The application resource restoration device also includes: a comparison module, which is used to obtain the target application resource created in the backup cluster based on the configuration information; compare the original application resource based on the target application resource to obtain a comparison result; generate a data synchronization task when the comparison result indicates that the target application resource is inconsistent with the original application resource; and perform an incremental data synchronization operation on the target application resource based on the data synchronization task until the target application resource is consistent with the original application resource.
5. A storage medium, characterized in that: The storage medium includes a stored program, wherein the program executes the method according to any one of claims 1 to 3 when executed.
6. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; wherein: Memory, used to store computer programs; A processor, configured to execute the method according to any one of claims 1 to 3 by running a program stored in a memory.
Citation Information
Patent Citations
Design method for improving cluster business availability by using cluster management node as two computers
CN102629906A
Implementing automatic switchover
CN108351823A
Node exception processing method, electronic equipment, system and medium
CN110730110A
System disaster tolerance method, device and equipment and storage medium
CN112527567A
