Metadata management method, system, electronic device and storage medium
Through the metadata management method, the stability and security issues of Kubernetes cluster deployed with a single-architecture server are solved during resource deletion or migration, and the metadata restoration and migration are realized, improving the overall performance of the cluster.
Patent Information
- Application Number
- CN202110873157.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-30
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2041-07-30
AI Technical Summary
Kubernetes clusters deployed with a single-architecture server are difficult to effectively recover and quickly enable when users mistakenly operate to delete resources or migrate resources in the data center, resulting in insufficient stability and security.
Provide a metadata management method, by receiving metadata management instructions, determine the original namespace and destination namespace of the target metadata, determine whether it is the same namespace of the same cluster, and send a resource restore command, if not, stop the service and migrate the metadata.
It realizes the restoration and migration of Kubernetes cluster metadata, improving the stability and security of Kubernetes clusters deployed with a single architecture server.
Smart Images

Figure CN113687911B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of cluster management, and in particular to a metadata management method, system, electronic device and storage medium. Background Art
[0002] In the era of container technology, a large number of business application scenarios are migrated to the cloud through Kubernetes container orchestration technology. The Kubernetes metadata and user data corresponding to the business scenarios migrated to the cloud are important data assets for users.
[0003] Deploying a Kubernetes cluster in a single data center based on a single-architecture operating system cannot effectively meet the following business scenarios in its native state: (1) situations where users accidentally delete resources and need to restore them; and (2) situations where resources are migrated within the data center and the migrated applications need to be quickly enabled.
[0004] Therefore, how to improve the stability and security of the Kubernetes cluster deployed on a single-architecture server is a technical problem that technical personnel in this field currently need to solve. Summary of the invention
[0005] The purpose of this application is to provide a metadata management method, system, electronic device and storage medium, which can improve the stability and security of a Kubernetes cluster deployed on a single-architecture server.
[0006] To solve the above technical problems, the present application provides a metadata management method, which is applied to a Kubernetes cluster deployed on a single-architecture server. The metadata management method includes:
[0007] Receive a metadata management instruction, and determine an original namespace and a destination namespace where target metadata are located according to the metadata management instruction;
[0008] Determine whether the original namespace and the destination namespace are the same namespace of the same cluster;
[0009] If yes, sending a resource restoration command to the backup and restoration device so that the backup and restoration device restores the target metadata from the original namespace to the destination namespace from the object storage device;
[0010] If not, the service corresponding to the target metadata is stopped, and the target metadata is migrated from the original namespace to the destination namespace from the object storage device.
[0011] Optionally, stopping the service corresponding to the target metadata includes:
[0012] Controlling the stop of the service corresponding to the target metadata by executing a service stop operation;
[0013] Among them, the service stops operating any one or a combination of the first operation, the second operation and the third operation; the first operation is to change the number of copies of the stateless load and / or the stateful load to 0, the second operation is to set the task timeout to 0, and the third operation is to suspend the scheduled task.
[0014] Optionally, after sending the resource migration command to the backup and restoration device, the method further includes:
[0015] Determining whether the target metadata is successfully migrated;
[0016] If yes, update the resource business relationship of the Kubernetes cluster and delete the target metadata in the original namespace;
[0017] If not, the service corresponding to the target metadata is restored.
[0018] Optionally, determining whether the target metadata is successfully migrated includes:
[0019] Determining whether the target metadata is migrated from the original namespace to the destination namespace within a preset time;
[0020] If yes, it is determined that the target metadata migration is successful;
[0021] If not, it is determined that the target metadata migration has failed.
[0022] Optionally, restoring the service corresponding to the target metadata includes:
[0023] Controlling the startup of the service corresponding to the target metadata by executing a service activation operation;
[0024] Among them, the service enables the operation of any one or a combination of any several of the fourth operation, the fifth operation and the sixth operation; the fourth operation is to restore the number of copies of the stateless load and / or the stateful load to the initial number of copies, the fifth operation is to set the task timeout to a null value, and the sixth operation is to release the suspended state of the scheduled task.
[0025] Optionally, also include:
[0026] Send a resource backup command to the backup and restore device so that the backup and restore device backs up the metadata of the Kubernetes cluster to the object storage device.
[0027] Optionally, sending a resource backup command to the backup and restore device includes:
[0028] A resource backup command is sent to the backup and restore device according to a preset period.
[0029] The present application also provides a metadata management system, which is applied to a Kubernetes cluster deployed on a single-architecture server, and the metadata management system includes:
[0030] A management device, for receiving a metadata management instruction, and determining an original namespace and a destination namespace where target metadata are located according to the metadata management instruction; and for determining whether the original namespace and the destination namespace are the same namespace of the same cluster; if so, sending a resource restoration command to a backup and restoration device; if not, stopping a service corresponding to the target metadata, and migrating the target metadata from the original namespace to the destination namespace from the object storage device;
[0031] The backup and restore device is used to restore the target metadata from the original namespace to the destination namespace from the object storage device if the resource restoration command is received;
[0032] The object storage device is used to provide metadata uploading service, metadata pulling service and metadata query service for the backup and restoration device.
[0033] The present application also provides a storage medium on which a computer program is stored. When the computer program is executed, the steps of the metadata management method described above are implemented.
[0034] The present application also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above-mentioned metadata management method when calling the computer program in the memory.
[0035] The present application provides a metadata management method, which is applied to a Kubernetes cluster deployed on a single-architecture server. The metadata management method includes: receiving a metadata management instruction, and determining an original namespace and a destination namespace where target metadata are located according to the metadata management instruction; judging whether the original namespace and the destination namespace are the same namespace of the same cluster; if so, sending a resource restoration command to a backup and restoration device so that the backup and restoration device restores the target metadata from the original namespace to the destination namespace from an object storage device; if not, stopping the service corresponding to the target metadata, and migrating the target metadata from the original namespace to the destination namespace from the object storage device.
[0036] The present application is applied to a Kubernetes cluster deployed on a single-architecture server. After receiving a metadata management instruction, the original namespace and the destination namespace where the target metadata to be moved are located are determined. If the original namespace and the destination namespace are the same, it means that the metadata management instruction is an instruction for restoring metadata. Therefore, a resource restoration command is sent to a backup and restore device so that the backup and restore device restores the target metadata from the original namespace to the destination namespace from the object storage device. If the original namespace and the destination namespace are different, it means that the metadata management instruction is an instruction for migrating metadata. The migration of metadata requires stopping the corresponding service. In this scenario, the present application stops the service corresponding to the target metadata and migrates the target metadata from the original namespace to the destination namespace from the object storage device. The above scheme can realize the restoration and migration of metadata in a Kubernetes cluster deployed on a single-architecture server, and can improve the stability and security of the Kubernetes cluster deployed on a single-architecture server. The present application also provides a metadata management system, an electronic device and a storage medium, which have the above-mentioned beneficial effects and are not repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0038] Figure 1 A flowchart of a metadata management method provided in an embodiment of the present application;
[0039] Figure 2 A schematic diagram of the principle of a single data center deployment of a Kubernetes cluster for resource disaster recovery based on a single-architecture operating system provided in an embodiment of the present application;
[0040] Figure 3 A schematic diagram of a metadata backup process provided in an embodiment of the present application;
[0041] Figure 4 A schematic diagram of a metadata restoration process provided in an embodiment of the present application;
[0042] Figure 5 A schematic diagram of a metadata migration process provided in an embodiment of the present application;
[0043] Figure 6 A schematic diagram of the structure of a metadata management system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution 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. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0045] See below Figure 1 , Figure 1 A flowchart of a metadata management method provided in an embodiment of the present application.
[0046] Specific steps may include:
[0047] S101: receiving a metadata management instruction, and determining an original namespace and a destination namespace where target metadata are located according to the metadata management instruction;
[0048] This embodiment can be applied to a Kubernetes cluster deployed on a single-architecture server, where the single-architecture server can be an ARM server or an X86 server. In this embodiment, a management device can be added to the Kubernetes cluster, and the management device performs the related operations from S101 to S103. Kubernetes, also known as K8s, is an open source platform for automated deployment, expansion, and operation and maintenance of container clusters.
[0049] The metadata management instruction can be an instruction issued by a user, an instruction sent by other devices, or a metadata management instruction generated periodically. After receiving the metadata management instruction, the metadata management instruction can be parsed to determine the target metadata to be moved, the original namespace is the namespace where the target metadata is located, and the destination namespace is the namespace to which the target metadata is to be moved.
[0050] The metadata mentioned in this embodiment may be K8s metadata, which may specifically include Kubernetes cluster resources and PV user data, such as Deployment (stateless load), StatefulSet (stateful load), NetworkPolicy (network policy), ConfigMap (normal configuration) and other types of resources. PV user data refers to the business data generated by users when operating Kubernetes cluster resources, which will eventually fall on the disk.
[0051] S102: Determine whether the original namespace and the destination namespace are the same namespace of the same cluster; if so, proceed to S103; if not, proceed to S104;
[0052] Among them, the movement of target metadata between namespaces can be resource restoration and resource migration. In order to distinguish between resource restoration and resource migration, this embodiment judges the original namespace and the destination namespace. If the original namespace and the destination namespace are the same namespace of the same cluster, it means that this operation is resource restoration; if the original namespace and the destination namespace are not the same namespace of the same cluster, it means that this operation is resource migration. Namespace is a way to isolate resources in Kubernetes clusters and is used for resource grouping. The same namespace in the same cluster refers to the namespace with the same ID in the same cluster.
[0053] Resource restoration refers to the action of creating cluster resources and PV user data in the target namespace from the K8s metadata and PV (Persistent Volume) data snapshots in the backup storage pool. Resource migration refers to the operation of restoring the k8s metadata to another namespace or another cluster in the same data center.
[0054] S103: Sending a resource restoration command to the backup and restoration device so that the backup and restoration device restores the target metadata from the original namespace to the destination namespace from the object storage device;
[0055] After determining that the operation is a resource restoration operation, a resource restoration command may be sent to the backup restoration device. After receiving the resource restoration command, the backup restoration device may restore the target metadata from the original namespace to the destination namespace from the object storage device.
[0056] Object storage, also known as backup storage pool, is an object storage used to store K8s metadata.
[0057] S104: Stop the service corresponding to the target metadata, and migrate the target metadata from the original namespace to the destination namespace from the object storage device.
[0058] Among them, since resource migration design applies service start and stop and monitoring operations, after determining that this operation is a resource migration operation, the service corresponding to the target metadata can be stopped, and the target metadata can be migrated from the original namespace to the destination namespace from the object storage device.
[0059] As a feasible implementation method, this embodiment can control the stop of the service corresponding to the target metadata by executing a service stop operation; wherein, the service stop operation is any one or a combination of any several of the first operation, the second operation and the third operation; the first operation is to change the number of copies of the stateless load and / or the stateful load to 0, the second operation is to set the task timeout to 0, and the third operation is to suspend the scheduled task.
[0060] This embodiment is applied to a Kubernetes cluster deployed on a single-architecture server. After receiving the metadata management instruction, the original namespace and the destination namespace where the target metadata to be moved are located are determined. If the original namespace and the destination namespace are the same, it means that the metadata management instruction is an instruction for restoring metadata. Therefore, a resource restore command is sent to the backup and restore device so that the backup and restore device restores the target metadata from the original namespace to the destination namespace from the object storage device. If the original namespace and the destination namespace are different, it means that the metadata management instruction is an instruction for migrating metadata. The migration of metadata requires stopping the corresponding service. In this scenario, this embodiment stops the service corresponding to the target metadata, and migrates the target metadata from the original namespace to the destination namespace from the object storage device. The above scheme can realize the restoration and migration of metadata in a Kubernetes cluster deployed on a single-architecture server, and can improve the stability and security of the Kubernetes cluster deployed on a single-architecture server.
[0061] As a feasible implementation method, after sending a resource migration command to the backup and restoration device, it is also possible to determine whether the target metadata has been successfully migrated; if the migration is successful, the resource business relationship of the Kubernetes cluster is updated, and the target metadata in the original namespace is deleted; if the migration fails, the service corresponding to the target metadata is restored.
[0062] Specifically, this embodiment can determine whether the target metadata migration is successful in the following manner: determine whether the target metadata is migrated from the original namespace to the destination namespace within a preset time; if so, determine that the target metadata migration is successful; if not, determine that the target metadata migration has failed.
[0063] Correspondingly, if the migration fails, the startup of the service corresponding to the target metadata can be controlled by executing a service activation operation; wherein, the service activation operation is any one or a combination of any ones of the fourth operation, the fifth operation and the sixth operation; the fourth operation is to restore the number of replicas of the stateless load and / or the stateful load to the initial number of replicas, the fifth operation is to set the task timeout to a null value, and the sixth operation is to release the suspended state of the scheduled task.
[0064] As a feasible implementation method, this embodiment may also have an operation of backing up metadata, and the specific process is as follows: sending a resource backup command to the backup and restore device so that the backup and restore device backs up the metadata of the Kubernetes cluster to the object storage device. Furthermore, this embodiment may send a resource backup command to the backup and restore device according to a preset period. Resource backup refers to the action of uploading the K8s metadata of the Kubernetes cluster to the backup storage pool, or the action of storing PV data in the form of snapshots.
[0065] The process described in the above embodiment is explained below through an embodiment in actual application.
[0066] This embodiment is applied to the operation of resource disaster recovery of a single data center deployed with a Kubernetes cluster based on a single architecture operating system. By using this solution to perform resource disaster recovery operations based on a single architecture operating system, the high availability, high stability, and high resource security characteristics of resources in a single data center deployed with a Kubernetes cluster based on a single architecture operating system can be improved.
[0067] In the era of container technology, a large number of business application scenarios are cloud-based through Kubernetes container orchestration technology. Among them, the K8s metadata and PV user data corresponding to the cloud-based business scenarios are important data assets of users. When users perform unpredictable operations, such as accidentally deleting business components, how to ensure that the business components are quickly restored to ensure the sustainability of the business scenario; or, when users migrate resources within the data center, how to ensure that the migrated resources are quickly restored and enabled to ensure the rapid switching of business scenarios. Therefore, the high availability, high stability, and high resource security of resources in a single data center deployed with a Kubernetes cluster based on a single architecture operating system is a problem that needs to be faced and solved. This solution is based on a solution for resource disaster recovery operations in a single data center deployed with a Kubernetes cluster based on a single architecture operating system. Through this solution, K8s metadata can be backed up to the backup storage pool, and PV user data can be backed up in the storage using storage snapshot technology; Kubernetes resources are restored in the target namespace to ensure the recoverability of Kubernetes cluster resources, and in the case of migration within the data center, the migrated resources are quickly restored and enabled. This solution can ensure the disaster recovery of resources in a single data center deployed with a Kubernetes cluster based on a single architecture operating system, and improves the high availability, high stability, and high resource security of resources in a single data center deployed with a Kubernetes cluster based on a single architecture operating system.
[0068] The basic idea of this solution is to establish a management device based on a single-architecture operating system to deploy a Kubernetes cluster in a single data center, which is used to select application resources that need to be backed up and k8s metadata that need to be restored. If resources are migrated, application resources need to be started, stopped, and monitored; an object storage device is established to store k8s metadata; a backup and restore device is established to receive and execute backup and restore resource requests, upload k8s metadata to the object storage device, or obtain K8s metadata from the object storage device to generate cluster resources.
[0069] See also Figure 2 , Figure 2 A schematic diagram of the principles of a single data center deployment of a Kubernetes cluster for resource disaster recovery operations based on a single-architecture operating system is provided in an embodiment of the present application.
[0070] (1) Users deploy object storage devices to expose object storage services for backup and restore devices to upload, pull, and query.
[0071] Specifically, the object storage used in this embodiment must be compatible with the S3 object storage protocol to support uploading k8s metadata to the storage device, or pulling it down from the storage device.
[0072] (2) The backup and restore device is used to upload the k8s metadata to the object storage device, or pull the k8s metadata from the storage device to generate cluster resources. The flowchart of resource data backup and restoration performed by the backup and restore device is as follows: Figure 3 As shown, Figure 3 A metadata backup process diagram is provided for an embodiment of the present application, and the process is as follows: the management device selects resources for backup; detects whether to perform scheduled backup; if so, sends a scheduled backup command to execute the resource backup operation; if not, sends a backup command to execute the resource backup operation.
[0073] When the backup and restore device backs up the k8s metadata, it can back up the entire namespace, or a single or multiple resources under the namespace, such as stateful load, stateless load, general configuration, encrypted configuration, service and other resources, and upload the K8s metadata to the object storage device. The backup and restore device pulls the K8s metadata from the object storage device, executes and creates cluster resources. The backup and restore device can back up and restore PV user data through snapshots through the velero CSI plug-in.
[0074] (3) The management device is used to select application resources that need to be backed up, restored, and migrated. The backup resource data can be transmitted to the backup and restore device through scheduled or manual methods to perform resource backup. The management device determines whether the resource needs to be restored or migrated and performs different operations. The restored resource is only restored through the backup and restore device. The migration of resources also requires the start and stop and monitoring operations of the application service. During the process, the resource is restored through the backup and restore device. The flow chart of executing the resource data restoration operation through the management device is shown in the attached figure. Figure 4 As shown, Figure 4 This is a metadata restoration process diagram provided by an embodiment of the present application. The process is as follows: the management device selects the resources to be restored, obtains K8s metadata from the backup storage pool, and executes the restoration command to generate resource and PV user data. The resource data restoration operation flow chart executed by the management device is shown in the attached figure. Figure 5 As shown, Figure 5 A schematic diagram of a metadata migration process is provided for an embodiment of the present application, and the process is as follows: select resources for migration, and determine whether the original namespace and the destination namespace are in the same cluster and the same namespace; if they are in the same cluster and the same namespace, execute the resource restoration process. After listening to the resource restoration results, determine whether the restoration is successful. If the restoration fails, determine whether it has timed out. If it has timed out, output a prompt message that the resource restoration timed out. If it has not timed out, continue to listen to the resource restoration results. If they are not in the same cluster and the same namespace, disable the application resources and execute the resource migration process. After the resource migration, maintain the business relationship of the migrated resources and delete the original application resources. Application resources are management resources for stateful loads, stateless loads, tasks, and scheduled tasks abstracted at the business layer.
[0075] In the above process, select the k8s metadata that needs to be restored or migrated, and determine whether to restore or migrate resources by judging whether they are in the same cluster and namespace. If it is a resource restoration, the process ends after sending a resource restoration command to the backup and restore device. If it is a resource migration, stop the corresponding service according to the following rules: i. The purpose of stopping the service is achieved by changing the number of copies to 0 for stateless loads; ii. The purpose of stopping the service is achieved by setting the timeout period to 0 for tasks; iii. The purpose of stopping the service is achieved by suspending scheduled tasks. After stopping the service, execute the restore command and enable the thread to query the progress of the restore result to monitor the migration status. If the migration fails, re-enable the original service. The rules for enabling the original service are as follows: i. The purpose of enabling the service is achieved by changing the number of copies to the previous number of copies for stateless loads; ii. The purpose of enabling the service is achieved by setting the timeout period to a null value for tasks; iii. The purpose of enabling the service is achieved by closing and suspending scheduled tasks. If the migration is successful, the resource business relationship is maintained again and the original application resources are deleted.
[0076] The schematic diagram of the operation principle of the user execution management device, backup and restore device, and object storage device is shown in the attached figure. Figure 6 As shown, Figure 6 A schematic diagram of the structure of a metadata management system provided by an embodiment of the present application. The management device can back up, restore and migrate resources. The resource migration process includes application resource deactivation and application resource activation. The management device can send backup resource commands and restore resource commands to the backup and restore device. The backup and restore device can query data resources, pull K8s metadata, generate resources, and upload K8s metadata through the velero CSI plug-in. Figure 6 In the ns, it indicates the namespace. The backup and restore device can query resource A from the storage volume of the container in the namespace nsA. The backup and restore device can restore or migrate resource A from the storage volume of the container in the namespace nsA and nsB. The backup and restore device can also generate resources and migrate resource A to the storage volume of the container in the namespace nsA. The storage volume is associated with the backend storage, and the object storage device is used to store K8s metadata.
[0077] The above-mentioned embodiment provides a management device, a backup and restore device, and an object storage device. The management device is used to select which application resources need to be backed up, which backed-up k8s metadata need to be restored, and to start and stop and monitor application resources when performing migration operations in the data center. The object storage device is a service based on object storage deployment. The object storage used must be compatible with the S3 protocol. The device is used to store K8s metadata. The backup and restore device is used to receive resource backup and restore commands issued by the management device. Upon receiving the resource backup command, the k8s metadata is uploaded to the object storage device through the device. If there is PV user data, a snapshot is created in the corresponding storage for backup; upon receiving the resource restore command, the K8s metadata is obtained from the object storage device through the device, and the resource restore command is executed to generate cluster resources. If there is PV user data, the snapshot is restored from the storage to generate.
[0078] This solution selects application resources for backup operations. In the event of resource loss due to unpredictable human operations, the backed-up k8s metadata is pulled from the backup storage pool for restoration; alternatively, resources are migrated within the data center to ensure that the migrated resources are quickly restored and enabled to ensure rapid switching of business scenarios, thereby improving the high availability, high stability, and high resource security of single data center resources of a Kubernetes cluster deployed based on a single-architecture operating system.
[0079] Specifically, when a resource disaster recovery operation is required in a single data center with a Kubernetes cluster deployed based on a single-architecture operating system, enter the management device, select the resource backup and restore operation through the management device, and if the resource needs to be directly backed up and restored, select the backup and restore device to perform the restore operation; if the resource is selected for migration, start and stop, monitor, restore, and delete the application resources in the management device. If the resource needs to be restored during the process, select the backup and restore device to perform the restore operation. The process of the backup and restore device performing the restore operation includes: receiving the k8s metadata that needs to be backed up from the management device, executing the resource backup command, and uploading the k8s metadata to the object storage device; receiving the k8s metadata that needs to be restored from the management device, executing the resource restore command, and generating cluster resources.
[0080] A metadata management system provided in an embodiment of the present application is applied to a Kubernetes cluster deployed on a single-architecture server, specifically including:
[0081] A management device, for receiving a metadata management instruction, and determining an original namespace and a destination namespace where target metadata are located according to the metadata management instruction; and for determining whether the original namespace and the destination namespace are the same namespace of the same cluster; if so, sending a resource restoration command to a backup and restoration device; if not, stopping a service corresponding to the target metadata, and migrating the target metadata from the original namespace to the destination namespace from the object storage device;
[0082] The backup and restore device is used to restore the target metadata from the original namespace to the destination namespace from the object storage device if the resource restoration command is received;
[0083] The object storage device is used to provide metadata uploading service, metadata pulling service and metadata query service for the backup and restoration device.
[0084] This embodiment is applied to a Kubernetes cluster deployed on a single-architecture server. After receiving the metadata management instruction, the original namespace and the destination namespace where the target metadata to be moved are located are determined. If the original namespace and the destination namespace are the same, it means that the metadata management instruction is an instruction for restoring metadata. Therefore, a resource restore command is sent to the backup and restore device so that the backup and restore device restores the target metadata from the original namespace to the destination namespace from the object storage device. If the original namespace and the destination namespace are different, it means that the metadata management instruction is an instruction for migrating metadata. The migration of metadata requires stopping the corresponding service. In this scenario, this embodiment stops the service corresponding to the target metadata, and migrates the target metadata from the original namespace to the destination namespace from the object storage device. The above scheme can realize the restoration and migration of metadata in a Kubernetes cluster deployed on a single-architecture server, and can improve the stability and security of the Kubernetes cluster deployed on a single-architecture server.
[0085] Furthermore, the process of the management device stopping the service corresponding to the target metadata includes: controlling the stopping of the service corresponding to the target metadata by executing a service stop operation; wherein the service stop operation is any one or a combination of any several of the first operation, the second operation and the third operation; the first operation is to modify the number of copies of the stateless load and / or the stateful load to 0, the second operation is to set the task timeout to 0, and the third operation is to suspend the scheduled task.
[0086] Furthermore, the management device is also used to determine whether the target metadata is migrated successfully after sending a resource migration command to the backup and restoration device; if so, update the resource business relationship of the Kubernetes cluster and delete the target metadata in the original namespace; if not, restore the service corresponding to the target metadata.
[0087] Furthermore, the process by which the management device determines whether the target metadata has been successfully migrated includes: determining whether the target metadata has been migrated from the original namespace to the destination namespace within a preset time; if so, determining that the target metadata migration has been successful; if not, determining that the target metadata migration has failed.
[0088] Furthermore, the process of the management device restoring the service corresponding to the target metadata includes: controlling the startup of the service corresponding to the target metadata by executing a service activation operation; wherein, the service activation operation is any one or a combination of any several of the fourth operation, the fifth operation and the sixth operation; the fourth operation is to restore the number of replicas of the stateless load and / or the stateful load to the initial number of replicas, the fifth operation is to set the task timeout to a null value, and the sixth operation is to release the suspended state of the scheduled task.
[0089] Furthermore, the management device is also used to send a resource backup command to the backup and restoration device so that the backup and restoration device backs up the metadata of the Kubernetes cluster to the object storage device.
[0090] Furthermore, the process of the management device sending the resource backup command to the backup and restoration device includes: sending the resource backup command to the backup and restoration device according to a preset period.
[0091] Since the embodiments of the system part correspond to the embodiments of the method part, please refer to the description of the embodiments of the method part for the embodiments of the system part, which will not be repeated here.
[0092] The present application also provides a storage medium on which a computer program is stored, and when the computer program is executed, the steps provided in the above embodiment can be implemented. The storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.
[0093] The present application also provides an electronic device, which may include a memory and a processor, wherein a computer program is stored in the memory, and when the processor calls the computer program in the memory, the steps provided in the above embodiment may be implemented. Of course, the electronic device may also include various network interfaces, power supplies and other components.
[0094] The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the various embodiments can be referred to each other. For the system disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of this application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of this application.
[0095] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprises", "comprising" 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, an element defined by the statement "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
Claims
1. A metadata management method, characterized in that: Applied to a Kubernetes cluster deployed on a single-architecture server, the metadata management method includes: Receive a metadata management instruction, and determine an original namespace and a destination namespace where target metadata are located according to the metadata management instruction; Determine whether the original namespace and the destination namespace are the same namespace of the same cluster; If so, a resource restoration command is sent to the backup and restoration device so that the backup and restoration device restores the target metadata from the original namespace to the destination namespace from the object storage device; the backup and restoration device queries data resources, pulls K8s metadata, generates resources, and uploads K8s metadata through the velero CSI plug-in; If not, stopping the service corresponding to the target metadata, and migrating the target metadata from the original namespace to the destination namespace from the object storage device; Controlling the stop of the service corresponding to the target metadata by executing a service stop operation; The service stops operating any one or a combination of the first operation, the second operation and the third operation; the first operation is to modify the number of copies of the stateless load and / or the stateful load to 0, the second operation is to set the task timeout to 0, and the third operation is to suspend the scheduled task; Also includes: Send a resource backup command to the backup and restore device so that the backup and restore device backs up the metadata of the Kubernetes cluster to the object storage device.
2. The metadata management method according to claim 1, characterized in that: After sending the resource migration command to the backup and restoration device, the method further includes: Determining whether the target metadata is successfully migrated; If yes, update the resource business relationship of the Kubernetes cluster and delete the target metadata in the original namespace; If not, the service corresponding to the target metadata is restored.
3. The metadata management method according to claim 2, characterized in that: Determining whether the target metadata is successfully migrated includes: Determining whether the target metadata is migrated from the original namespace to the destination namespace within a preset time; If yes, it is determined that the target metadata migration is successful; If not, it is determined that the target metadata migration has failed.
4. The metadata management method according to claim 2, characterized in that: Restoring the service corresponding to the target metadata includes: Controlling the startup of the service corresponding to the target metadata by executing a service activation operation; Among them, the service enables the operation of any one or a combination of any several of the fourth operation, the fifth operation and the sixth operation; the fourth operation is to restore the number of copies of the stateless load and / or the stateful load to the initial number of copies, the fifth operation is to set the task timeout to a null value, and the sixth operation is to release the suspended state of the scheduled task.
5. The metadata management method according to claim 1, characterized in that: Sending a resource backup command to the backup and restore device includes: A resource backup command is sent to the backup and restore device according to a preset period.
6. A metadata management system, characterized in that: Applied to a Kubernetes cluster deployed on a single-architecture server, the metadata management system includes: A management device, for receiving a metadata management instruction, and determining an original namespace and a destination namespace where target metadata are located according to the metadata management instruction; and for determining whether the original namespace and the destination namespace are the same namespace of the same cluster; if so, sending a resource restoration command to a backup and restoration device; if not, stopping a service corresponding to the target metadata, and migrating the target metadata from the original namespace to the destination namespace from an object storage device; The backup and restore device is used to restore the target metadata from the original namespace to the destination namespace from the object storage device if the resource restoration command is received; The object storage device is used to provide metadata uploading service, metadata pulling service and metadata query service for the backup and restoration device; The process of the management device stopping the service corresponding to the target metadata includes: controlling the service corresponding to the target metadata to stop by executing a service stop operation; wherein the service stop operation is any one or a combination of any several of a first operation, a second operation and a third operation; the first operation is to modify the number of copies of the stateless load and / or the stateful load to 0, the second operation is to set the task timeout to 0, and the third operation is to suspend the scheduled task; The management device is further used to send a resource backup command to the backup and restore device so that the backup and restore device backs up the metadata of the Kubernetes cluster to the object storage device; The backup and restore device queries data resources, pulls K8s metadata, generates resources, and uploads K8s metadata through the velero CSI plug-in.
7. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the metadata management method according to any one of claims 1 to 5 when calling the computer program in the memory.
8. A storage medium, characterized in that: The storage medium stores computer executable instructions, and when the computer executable instructions are loaded and executed by the processor, the steps of the metadata management method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Cloud host complete machine backup and restoration method, device and equipment and storage medium
CN112333008A
Data migration method and device for large-scale cluster and medium
CN112765132A