Dual-cluster deployment method and device, equipment and storage medium

By adopting a dual-cluster deployment method in the industrial Internet platform, backup files are used to realize data synchronization and service switching between the main and backup clusters, the problem of difficult to ensure high availability in the event of cluster failure is solved, and business continuity and efficient recovery are achieved.

CN119484251APending Publication Date: 2025-02-18CISDI INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411584364.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-07
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

In industrial Internet platforms, it is difficult for existing technology to ensure high availability of the platform in case of cluster failure, especially for applications with complex business logic, high data consistency requirements or resource limitations. It is impossible to diversify risks through multiple instance deployment, resulting in a slow recovery process And error-prone.

Method used

Using the dual-cluster deployment method, we create two main and backup clusters in the Kubernetes environment, and use backup files to configure and synchronize the second cluster when the first cluster fails, to realize automatic switching and recovery of services.

Benefits of technology

It has achieved continuity guarantee for industrial Internet platform business, ensured high availability, significantly improved the speed and accuracy of business recovery, and reduced the risks and costs of manual intervention.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119484251A_ABST
    Figure CN119484251A_ABST
Patent Text Reader

Abstract

The invention provides a double-cluster deployment method and device, equipment and a storage medium, and the method comprises the steps: creating a first cluster and a second cluster based on a deployment container, the second cluster being a standby cluster of the first cluster; if it is monitored that the first cluster is in the unavailable state, backup files of the first cluster are obtained, and the backup files comprise a first backup file for storing metadata of the first cluster and a second backup file for storing service data of a first data volume associated with the first cluster; the second cluster is configured based on the first backup file, the second backup file is synchronized to a second data volume associated with the second cluster according to a preset first mapping relation, and the preset first mapping relation is a mapping relation between the first data volume and the second data volume; and switching the service deployed on the first cluster to the second cluster for bearing. In this way, the service of the first cluster which breaks down is quickly and automatically switched to the standby second cluster, and high availability and service continuity of the platform are ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of cluster deployment, and in particular to a dual-cluster deployment method, apparatus, device and storage medium. Background Art

[0002] The Industrial Internet platform is an industrial cloud platform that is oriented to the digitalization, networking and intelligence needs of the manufacturing industry, builds a service system based on massive data collection, aggregation and analysis, and supports ubiquitous connection, elastic supply and efficient configuration of manufacturing resources. It not only carries key tasks such as equipment monitoring, data analysis, and production scheduling, but also involves the processing and transmission of a large amount of sensitive data. Any system downtime or data loss may cause significant economic losses to the enterprise, and even cause safety accidents. Therefore, with the widespread application of the Industrial Internet platform, the requirements for its stability and high availability are increasing. In order to achieve high availability and stability of the platform, it is usually deployed based on the way of deploying containers. The mainstream is to deploy the Industrial Internet platform using a high-availability deployment method based on Kubernetes (referred to as K8S). The Kubernetes cluster has the characteristics of high availability, self-healing and load balancing, and can automatically manage the deployment, expansion and operation and maintenance of containerized applications, effectively improving the stability and reliability of the platform. However, although the Kubernetes cluster can solve problems such as single node failure in the cluster, when facing cluster failures, such as hardware failure, network interruption or misoperation that causes the entire Kubernetes cluster to be unavailable, it cannot guarantee the high availability of the services in the cluster.

[0003] In related technologies, the solution of cross-cluster multi-instance deployment is mainly used to solve cluster-level failures, that is, by distributing and deploying applications within a cluster in different clusters in the form of multiple instances to provide services, even if a cluster fails, it will not affect the instance of the Kia cluster, so as to ensure the availability of the service. However, due to complex business logic, high data consistency requirements or resource limitations, some applications in the Industrial Internet platform can only be deployed in the form of a single instance, which is not suitable for the deployment scheme of multiple implementations. When facing cluster failures, it is impossible to disperse risks through multi-instance deployment, and recovery still needs to rely on manual intervention, resulting in an extremely slow and error-prone recovery process. Therefore, how to ensure the high availability of the platform when a cluster fails is a problem that needs to be solved urgently. Summary of the invention

[0004] In order to provide a basic understanding of some aspects of the disclosed embodiments, a brief summary is given below. The summary is not an extensive review, nor is it intended to identify key / critical components or delineate the scope of protection of these embodiments, but rather serves as a prelude to the detailed description that follows.

[0005] In view of the above-mentioned shortcomings of the prior art, the present application discloses a dual-cluster deployment method, apparatus, device and storage medium to solve the above-mentioned technical problem of how to ensure the high availability of the platform when a cluster failure occurs.

[0006] In a first aspect, the present application provides a dual-cluster deployment method, the method comprising: creating a first cluster and a second cluster based on a deployment container, the second cluster being a backup cluster of the first cluster; if it is monitored that the first cluster is in an unavailable state, obtaining a backup file of the first cluster, the backup file comprising a first backup file storing metadata of the first cluster, and a second backup file storing business data of a first data volume associated with the first cluster; configuring the second cluster based on the first backup file, and synchronizing the second backup file to a second data volume associated with the second cluster according to a preset first mapping relationship, the preset first mapping relationship being a mapping relationship between the first data volume and the second data volume; switching the business deployed on the first cluster to the second cluster for carrying.

[0007] In one embodiment of the present application, before the first cluster is monitored to be in an unavailable state, it also includes: monitoring each target indicator of the first cluster, the target indicators including node health indicators, component health indicators, Pod health indicators, service health indicators, network status indicators and storage status indicators; performing weighted scoring on each of the target indicators to obtain a fault score of the first cluster; if the fault score of the first cluster is lower than a preset score threshold, determining that the first cluster is in an unavailable state.

[0008] In one embodiment of the present application, the weighted scoring of each of the target indicators to obtain the fault score of the first cluster includes: obtaining an application scenario of the first cluster; matching the application scenario according to a preset second mapping relationship, assigning weights to each of the target indicators based on the matching results, and determining the target weight of each of the target indicators, wherein the preset second mapping relationship is a mapping relationship between the application scenario and the target weight of each of the target indicators; and weighted scoring each of the target indicators according to the target weight of each of the target indicators to obtain the fault score of the first cluster.

[0009] In one embodiment of the present application, the monitoring of each target indicator of the first cluster includes: monitoring the operating status of the nodes, components, Pods and services in the first cluster, as well as the network status and storage status; calculating the ratio of the number of the nodes in a healthy operating status to the total number of the nodes to determine the node health indicator; calculating the ratio of the number of the components in a healthy operating status to the total number of the components to determine the component health indicator; calculating the ratio of the number of the Pods in a healthy operating status to the total number of the Pods to determine the Pod health indicator; calculating the ratio of the number of the services in a healthy operating status to the total number of the services to determine the service health indicator; determining the network status indicator based on the network connectivity, network delay and packet loss rate included in the network status; determining the storage status indicator based on the storage capacity and storage performance included in the storage status.

[0010] In one embodiment of the present application, before obtaining the backup file of the first cluster, it also includes: backing up the metadata of the first cluster and the first data volume associated with the first cluster to obtain the first backup file and the second backup file; detecting the validity of the first backup file and the second backup file; if the first backup file and the second backup file are both valid, uploading the first backup file and the second backup file to a target storage space, and the target storage space is provided by a preset object storage service.

[0011] In one embodiment of the present application, the backing up of the metadata of the first cluster and the data volume associated with the first cluster also includes: when a preset time interval is reached or a preset event is triggered, the metadata of the first cluster and the first data volume associated with the first cluster are backed up; wherein the backed up metadata is serialized to generate the first backup file; the first data volume is snapshotted to generate a snapshot file of the first data volume, and used as the second backup file.

[0012] In one embodiment of the present application, obtaining the backup file of the first cluster also includes: if there are at least two backup files, comparing the timestamps of each backup file; determining the target backup file by the backup file closest to the current time; and obtaining the target backup file of the first cluster.

[0013] In a second aspect, the present application provides a dual-cluster deployment device, the device comprising: a creation module, used to create a first cluster and a second cluster based on a deployment container, the second cluster being a backup cluster of the first cluster; a monitoring module, used to obtain a backup file of the first cluster if it is detected that the first cluster is in an unavailable state, the backup file comprising a first backup file storing metadata of the first cluster, and a second backup file storing business data of a first data volume associated with the first cluster; a data synchronization module, used to configure the second cluster based on the first backup file, and synchronize the second backup file to the second data volume associated with the second cluster according to a preset first mapping relationship, the preset first mapping relationship being a mapping relationship between the first data volume and the second data volume; a business switching module, used to switch the business deployed on the first cluster to the second cluster for carrying.

[0014] In a third aspect, the present application also provides an electronic device, comprising: a processor, a memory and a communication bus; the communication bus is used to connect the processor and the memory; the processor is used to execute a computer program stored in the memory to implement the dual-cluster deployment method as described in the above embodiment.

[0015] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor of a computer, the computer is caused to execute the dual-cluster deployment method as described in the above embodiment.

[0016] Beneficial effects of the present application: The present application proposes a dual cluster deployment method, device, equipment and storage medium. First, a first cluster and a second cluster are created based on a deployment container, and the second cluster is a backup cluster of the first cluster; then, when the first cluster is detected to be unavailable, a backup file of the first cluster is obtained, and the backup file includes a first backup file storing metadata of the first cluster, and a second backup file storing business data of the first data volume associated with the first cluster; the second cluster is configured based on the first backup file, and the second backup file is synchronized to the second data volume associated with the second cluster according to a preset first mapping relationship, so as to achieve data synchronization between the first cluster and the second cluster, and the preset first mapping relationship is a mapping relationship between the first data volume and the second data volume; the business deployed on the first cluster is switched to the second cluster for carrying to ensure the continuous operation of the business. In this way, by constructing two active and standby clusters (the first cluster and the second cluster), and when the first cluster fails, an efficient data synchronization mechanism is established between the two clusters to quickly and automatically switch the business of the first cluster to the standby second cluster, the business continuity of the industrial Internet platform is effectively guaranteed, thereby ensuring the high availability of the industrial Internet platform. In addition, automated failover between active and standby clusters significantly improves the speed and accuracy of business recovery and reduces the risk and cost of manual intervention.

[0017] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and together with the specification, are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work. In the drawings:

[0019] Figure 1 is a flowchart of a dual-cluster deployment method shown in an exemplary embodiment of the present application;

[0020] Figure 2 is a schematic diagram of a file backup process shown in an exemplary embodiment of the present application;

[0021] Figure 3 is a schematic diagram of a cluster switching process shown in an exemplary embodiment of the present application;

[0022] Figure 4 is a schematic diagram of a system structure applicable to dual-cluster deployment shown in an exemplary embodiment of the present application;

[0023] Figure 5 is a block diagram of a dual-cluster deployment device shown in an exemplary embodiment of the present application;

[0024] Figure 6 It is a structural diagram of a computer system suitable for implementing the electronic device of the present application, shown as an exemplary embodiment of the present application. DETAILED DESCRIPTION

[0025] The following will describe the implementation methods of the present application with reference to the accompanying drawings and preferred embodiments. Those skilled in the art can easily understand other advantages and effects of the present application from the contents disclosed in this specification. The present application can also be implemented or applied through other different specific implementation methods, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present application. It should be understood that the preferred embodiments are only for illustrating the present application, not for limiting the scope of protection of the present application.

[0026] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present application, and thus the drawings only show components related to the present application rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the form, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.

[0027] In the following description, a large number of details are discussed to provide a more thorough explanation of the embodiments of the present application. However, it is obvious to those skilled in the art that the embodiments of the present application can be implemented without these specific details. In other embodiments, well-known structures and devices are shown in the form of block diagrams rather than in detail to avoid making the embodiments of the present application difficult to understand.

[0028] It should be noted that the Industrial Internet platform, as a product of the deep integration of new-generation information technology and manufacturing, has brought unprecedented changes to the traditional manufacturing industry. Through advanced technologies such as the Internet of Things, big data, cloud computing, and artificial intelligence, it has achieved data interconnection and interoperability among equipment, production lines, factories, supply chains, and even the entire life cycle of products, greatly improving the level of intelligence and operational efficiency of the manufacturing industry. However, in the manufacturing industry, system stability is crucial, and production line downtime may lead to significant economic losses or even safety accidents. Therefore, to give full play to the advantages of the Industrial Internet platform, its high availability is the key, and the Industrial Internet platform needs to have strong fault tolerance and fast fault recovery mechanisms.

[0029] Kubernetes is an open source container orchestration system that aims to automatically deploy, scale, and manage containerized applications, providing developers and operators with a powerful platform to run applications in a more efficient, reliable, and scalable way. The Kubernetes cluster is mainly composed of the control node (Master) responsible for cluster management and control and the workload nodes in the cluster, that is, the worker nodes (Node) used to run containers. It can easily manage hundreds of microservices and provide load balancing and service discovery functions; it can automatically scale and manage large-scale containerized deployments to meet growing business needs; it can be deployed on multiple cloud platforms and provide cross-platform portability, allowing applications to be easily migrated between different cloud environments. Therefore, when building an Internet platform, in order to achieve high availability and stability of the platform, using a Kubernetes cluster for deployment is undoubtedly a very suitable choice.

[0030] However, although the K8S cluster can solve problems such as single-node failures within the cluster, its built-in high-availability mechanism is unable to cope with cluster-level failures, such as hardware failures, network interruptions, or misoperation that cause the entire K8S cluster to be unavailable. Therefore, in order to solve cluster failures, a cross-cluster multi-instance deployment solution is proposed to ensure service continuity by deploying multiple instances of applications in different K8S clusters. However, this solution is not suitable for all industrial Internet platforms. Some applications can only be deployed in a single instance due to complex business logic, high data consistency requirements, or resource limitations. When facing cluster failures, such applications cannot disperse risks through multi-instance deployment, so their high availability issues are particularly prominent. In addition, even for applications that can be deployed in multiple instances, the cross-cluster multi-instance solution faces complex problems such as data synchronization, load balancing, and failover. In particular, how to ensure the smooth transition of business and the integrity of data during failover is an unresolved technical problem.

[0031] Based on this, the present application proposes a dual-cluster deployment method to ensure the high availability of the platform when a cluster failure occurs, thereby effectively ensuring the continuity of the platform's business operations.

[0032] See also Figure 1 , is a flowchart of a dual cluster deployment method shown in an exemplary embodiment of the present application. The dual cluster deployment method can be executed by a computer device, such as Figure 1 As shown, in an exemplary embodiment, the dual cluster deployment method includes at least steps S110 to S170, which are described in detail as follows:

[0033] Step S110: creating a first cluster and a second cluster based on the deployment container, where the second cluster is a backup cluster of the first cluster.

[0034] In one embodiment of the present application, based on the deployment container, for example, in a Kubernetes environment, the first cluster and the second cluster are created as the main cluster and the backup cluster, respectively. The first cluster and the second cluster need to avoid configuration conflicts when they are deployed. For example, the node names and IP addresses of the two clusters need to be different when configured to ensure that when the main cluster fails, the backup cluster can take over the business of the main cluster. In addition, if the server resources of the industrial Internet platform are sufficient, a backup cluster of the second cluster can also be created, and the failover method between it and the second cluster is the same as the failover method between the first cluster and the second cluster.

[0035] In one embodiment of the present application, after the first cluster is created, data backup is required for it, and the data backup strategy of the first cluster includes: when a preset time interval is reached or a preset event is triggered, the metadata of the first cluster and the first data volume associated with the first cluster are backed up; wherein, the backed-up metadata is serialized to generate a first backup file; the first data volume is snapshotted to generate a snapshot file of the first data volume, and used as a second backup file.

[0036] In one embodiment of the present application, the triggering conditions for data backup of the first cluster include a preset time and a preset event. The preset time can be flexibly set according to the frequency of use of the cluster, the amount of data change, and the business's demand for data security. The data backup of the first cluster is automatically performed once every preset time interval (such as every day, every week, every month, N hours, etc.); or, a preset event related to the state change of the first cluster (such as application upgrade, a large amount of new data, and receiving a control instruction for backup, etc.) is set. When the preset time is detected, the data backup of the first cluster is automatically performed once. In addition, the preset time, preset event, serialization processing method, and preset format can be adjusted according to actual needs without limitation.

[0037] In one embodiment of the present application, metadata is key information that describes the cluster structure, configuration, and resource status. Through the metadata of the first cluster, the same topology and resource status as the first cluster can be configured in the second cluster. Snapshot processing is to create a snapshot of the first data area to generate a complete copy of the first data volume at the time point of this backup, that is, a snapshot file, which contains the business data of the first data volume at that time point, and can ensure that when a failure occurs in the first cluster, the snapshot is restored to the second cluster through the snapshot file to ensure the consistency and integrity of the data between the first cluster and the second cluster. For businesses that rely on the first cluster to run, this ensures business continuity and stability, avoids business interruptions due to data loss, and ensures the correctness and reliability of business switching to the second cluster when running.

[0038] In one embodiment of the present application, the first data volume and the second data volume may be persistent volumes (PersistentVolume, PV), and the snapshot file of the first data volume also includes a persistent volume declaration (PersistentVolumeClaim, PVC) of the first data volume, which is a request form for applying for persistent storage resources from the first cluster, defines the storage requirements for the first data volume, and provides Pods (the basic unit for running applications in the cluster) with a way to access persistent storage.

[0039] See also Figure 2 , is a schematic diagram of a file backup process shown in an exemplary embodiment of the present application. Figure 2 As shown. The scheduled task scheduler can be used to implement the scheduled backup of the first cluster data. The scheduled task scheduler is a software tool or framework for automatically executing tasks at a specified time or at a specific time interval. It allows users to define the execution plan of the task and execute the task at a specified time or periodically. If the task is executed, the metadata of the backup object in the K8S cluster (first cluster) is backed up. The backup objects are Pods, Service (service), and Deployments (i.e., resources in the cluster for managing Pods and ReplicaSet) in the first cluster, and the metadata is serialized into the system required format, that is, the metadata is serialized to convert it into a preset format, which is easy to store and transmit; then the persistent volume (first data volume) of the first cluster and the snapshot of the persistent volume declaration are created, and the backup data, i.e., the validity of the metadata and snapshot in the preset format, is verified. If the verification passes, it is packaged and uploaded to the object storage service (Object Storage Service). Among them, the object storage service is a technology for storing and accessing a large amount of unstructured data. This storage method stores data in the form of objects, usually provides high reliability, scalability and data persistence, and is suitable for scenarios that need to process a large amount of data.

[0040] Specifically, after creating the first and second clusters, the metadata of the first cluster and the first data volume associated with the first cluster are backed up to obtain a first backup file and a second backup file; the validity of the first backup file and the second backup file are detected; if both the first backup file and the second backup file are valid, the first backup file and the second backup file are uploaded to a target storage space, which is provided by a preset object storage service.

[0041] In one embodiment of the present application, first, backing up the metadata of the first cluster is the basis for ensuring that the first cluster can be quickly restored when a problem occurs, and backing up the key business data such as application data and user data contained in the first data volume is the key to ensuring business continuity and data integrity. If at least one of the first backup file and the second backup file fails the validity test, subsequent data synchronization using the backup file may cause data loss or inconsistency, and the backup file is judged invalid. Among them, the validity test usually includes verifying the integrity, consistency and recoverability of the data, which can be adjusted according to actual needs, and the specific technical means of the validity test are not limited here.

[0042] Step S120: if it is detected that the first cluster is unavailable, a backup file of the first cluster is obtained, the backup file including a first backup file storing metadata of the first cluster and a second backup file storing business data of a first data volume associated with the first cluster.

[0043] Specifically, determining whether the first cluster is available includes: monitoring various target indicators of the first cluster, the target indicators including node health indicators, component health indicators, Pod health indicators, service health indicators, network status indicators and storage status indicators; performing weighted scoring on each target indicator to obtain a fault score of the first cluster; if the fault score of the first cluster is lower than a preset score threshold, determining that the first cluster is in an unavailable state.

[0044] In one embodiment of the present application, monitoring the node health indicators in the first cluster, that is, monitoring the health status of each node, is intended to ensure that the node is not overloaded or has a resource bottleneck. Monitoring the component health indicators is to check the operating status of key components in the first cluster (such as the application programming interface server, scheduler, controller manager, etc. on the Master node) to ensure that these components can work together to provide control and management functions for the first cluster; monitoring the Pod health indicators at least includes monitoring the operating status of the Pod, including whether the Pod is successfully started, whether the running Pod is stable, and the number of restarts of the Pod, etc., to ensure that the Pod can perform its tasks normally; monitoring the service health indicators at least includes detecting the availability of the service in the first cluster, and whether the service can correctly route traffic to the backend Pod, to ensure that user requests can smoothly reach the backend service and be responded to; the network status indicators at least include monitoring the network connection status within the first cluster, and the network connection status between the first cluster and other clusters, including network delay, packet loss rate and bandwidth utilization, etc., to ensure that the communication within the first cluster and with the external network is unimpeded; monitoring the storage status indicators at least includes detecting the health status of the storage system in the first cluster, including the capacity of the storage volume, I / O (output / input) performance and availability, etc., to ensure that the storage system can reliably store and access data.

[0045] In one embodiment of the present application, the method for determining each target indicator includes: monitoring the operating status of nodes, components, Pods and services in the first cluster, as well as the network status and storage status; calculating the ratio of the number of nodes in a healthy operating state to the total number of nodes to determine the node health indicator; calculating the ratio of the number of components in a healthy operating state to the total number of components to determine the component health indicator; calculating the ratio of the number of Pods in a healthy operating state to the total number of Pods to determine the Pod health indicator; calculating the ratio of the number of services in a healthy operating state to the total number of services to determine the service health indicator; determining the network status indicator based on the network connectivity, network delay and packet loss rate included in the network status; determining the storage status indicator based on the storage capacity and storage performance included in the storage status. Based on this, the expression for calculating the fault score of the first cluster according to each target indicator is as follows:

[0046]

[0047] Wherein, ω1 to ω6 in formula 1 represent the weights assigned to the health indicators of the node nodes, the health indicators of the master nodes, the health indicators of the etcd nodes, the pod health indicators, the network status indicators, and the storage status indicators of the first cluster, respectively, n and N are the number of healthy node nodes and the total number of node nodes, m and M are the number of healthy master nodes and the total number of master nodes of the first cluster, e and E are the number of healthy etcd nodes and the total number of etcd nodes, p and P are the number of normal pods and the total number of pods, ns and vs are the scores of the network status indicators and the storage status indicators (i.e., 0 to 100), and s is the preset score threshold for judging the failure of the first cluster. Wherein, the node node is the working node in the cluster, and its health indicator is used as the node health indicator; the master node is responsible for managing all the node nodes in the cluster, which includes multiple core components, therefore, determining the component health indicator can be achieved by determining the health indicator of the master node; the etcd node provides data storage services for the cluster, so that each component in the cluster can make decisions and operations based on the latest cluster status, therefore, in this embodiment, the service health indicator is determined by determining the health indicator of the etcd node. In addition, the target indicator set in formula (1) can be adjusted according to actual needs.

[0048] In one embodiment of the present application, in response to different requirements of different application scenarios, differentiated weights are assigned to each target indicator, including: obtaining the application scenario of the first cluster; matching the application scenario according to a preset second mapping relationship, assigning weights to each target indicator based on the matching result, determining the target weight of each target indicator, and presetting the second mapping relationship as a mapping relationship between the application scenario and the target weight of each target indicator; weighted scoring each target indicator according to the target weight of each target indicator to obtain the fault score of the first cluster. In this way, as the application scenario changes, the application scenario can be matched by the preset second mapping relationship to reallocate the weights to adapt to new requirements, which can more accurately reflect the actual performance status of the first cluster in the application scenario, improve the accuracy and flexibility of the availability judgment of the first cluster, and in addition, the fault score is calculated by weighted scoring, which comprehensively considers the impact of multiple target indicators on the performance of the first cluster, avoids the one-sidedness of a single indicator evaluation, and helps to improve the accuracy and reliability of the availability judgment.

[0049] In an embodiment of the present application, the preset score threshold may also be adjusted according to different application scenarios to further improve the accuracy of availability detection.

[0050] Step S130, configuring the second cluster based on the first backup file, and synchronizing the second backup file to the second data volume associated with the second cluster according to a preset first mapping relationship, where the preset first mapping relationship is a mapping relationship between the first data volume and the second data volume.

[0051] In one embodiment of the present application, if there are at least two backup files, the timestamps of the backup files are compared; the backup file closest to the current time is used to determine the target backup file; the target backup file of the first cluster is obtained, and the first backup file and the second backup file in the target backup file are selected to perform step S130. In this way, by comparing the timestamps, the latest backup file can be accurately identified, thereby ensuring that the selected target backup file is the latest version, so that the second cluster synchronizes the latest data.

[0052] See also Figure 3 , is a schematic diagram of a cluster switching process shown in an exemplary embodiment of the present application. Figure 3As shown, the cluster switching process includes judging the availability of the K8S cluster, that is, the first cluster. If the cluster is unavailable, the backup file containing metadata information is parsed from the available backup file closest to the current time (that is, the backup file with validity) stored in the preset object storage service, and related resources are created in the backup K8S cluster, that is, the first backup file is parsed to configure the second cluster, and then the persistent volume snapshot in the backup file is restored to the data volume of the backup cluster to ensure data consistency and integrity, that is, the snapshot of the first data volume in the second backup file is restored to the second data volume in the second cluster.

[0053] In the above manner, by utilizing the synchronization of backup data, the same business environment and data status as the first cluster can be quickly rebuilt in the second cluster, which greatly shortens the time required for business migration and reduces the risks during the business migration process.

[0054] Step S140: Switch the service deployed on the first cluster to the second cluster for carrying.

[0055] In one embodiment of the present application, after migrating the data of the first cluster to the second cluster using the backup file, that is, recreating resources on the second cluster based on the metadata in the first backup file, and restoring the business data in the second backup file to the second cluster, the traffic of the first cluster is automatically transferred to the second cluster, so that the business deployed in the first cluster can be switched to the second cluster for carrying, so as to ensure the stable operation of the business.

[0056] See also Figure 4 , is a schematic diagram of a dual cluster deployment applicable system structure shown in an exemplary embodiment of the present application. The dual cluster deployment method proposed in the present application can be applied to Figure 4 The system structure shown mainly includes K8S cluster management module, backup module, monitoring module, decision module and recovery module. Among them, the K8S cluster management module is used to create K8S cluster and backup K8S cluster, namely the first cluster and the second cluster; the backup module is used to issue backup instructions, back up the data of the first cluster module to obtain the backup file and transmit it to the object storage service; the monitoring module is used to monitor the first cluster, and push the monitoring indicators of the first cluster obtained by monitoring, namely the target indicators, to the decision module; the decision module is used to determine whether the first cluster is unavailable according to the target indicators, and if the first cluster is unavailable, it notifies the recovery module; the recovery module is used to issue recovery instructions to the second cluster, so that the second cluster reads the required backup files from the object storage service, realizes data synchronization, and then switches the business of the first cluster to the second cluster.

[0057] The dual cluster deployment method provided by the present application has the following advantages: by constructing two active and standby clusters (the first cluster and the second cluster), and when the first cluster fails, an efficient data synchronization mechanism is established between the two clusters to quickly and automatically switch the business of the first cluster to the standby second cluster, thereby effectively ensuring the business continuity of the industrial Internet platform, thereby ensuring the high availability of the industrial Internet platform. In addition, through the automatic switching between the active and standby clusters, the recovery speed and accuracy of the business are significantly improved, and the risk and cost of manual intervention are reduced.

[0058] See also Figure 5 , is a block diagram of a dual cluster deployment device shown in an exemplary embodiment of the present application. Figure 5 As shown, in an exemplary embodiment, the dual cluster deployment device includes at least a creation module 510, a monitoring module 520, a data synchronization module 530 and a service switching module 540, which are described in detail as follows:

[0059] A creation module 510, configured to create a first cluster and a second cluster based on the deployment container, wherein the second cluster is a backup cluster of the first cluster;

[0060] The monitoring module 520 is configured to obtain a backup file of the first cluster if it is detected that the first cluster is in an unavailable state, the backup file comprising a first backup file storing metadata of the first cluster and a second backup file storing business data of a first data volume associated with the first cluster;

[0061] The data synchronization module 530 is used to configure the second cluster based on the first backup file, and synchronize the second backup file to the second data volume associated with the second cluster according to a preset first mapping relationship, where the preset first mapping relationship is a mapping relationship between the first data volume and the second data volume;

[0062] The service switching module 540 is used to switch the service deployed on the first cluster to the second cluster for carrying.

[0063] It should be noted that the dual-cluster deployment device provided in the above embodiment and the dual-cluster deployment method provided in the above embodiment belong to the same concept, wherein the contents of the operations performed by each module have been described in detail in the method embodiment and will not be repeated here.

[0064] The present application also provides an electronic device, including: a processor, a memory and a communication bus; the communication bus is used to connect the processor and the memory; the processor is used to execute a computer program stored in the memory to implement the dual-cluster deployment method in the above embodiment.

[0065] See also Figure 6, shows a schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application. It should be noted that, Figure 6 The computer system 600 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0066] like Figure 6 As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 602 or the program loaded from the storage part 608 to the random access memory (RAM) 603, such as executing the method in the above embodiment. In the RAM 603, various programs and data required for system operation are also stored. The CPU 601, ROM 602 and RAM 603 are connected to each other through a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0067] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 609 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed so that a computer program read therefrom is installed into the storage section 608 as needed.

[0068] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 609, and / or installed from a removable medium 611. When the computer program is executed by a central processing unit (CPU) 601, various functions defined in the system of the present application are executed.

[0069] The present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor of a computer, the computer executes the dual-cluster deployment method as described above. The computer-readable storage medium may be included in the electronic device described in the above embodiment, or may exist independently without being assembled into the electronic device.

[0070] It should be noted that the computer-readable medium shown in the embodiment of the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, an electrical, magnetic, optical, electromagnetic, infrared or semiconductor system, system or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a computer-readable computer program is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, system or device. A computer program contained on a computer-readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0071] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0072] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.

[0073] The above embodiments are merely illustrative of the principles and effects of the present application, and are not intended to limit the present application. Anyone familiar with the technology may modify or change the above embodiments without violating the spirit and scope of the present application. Therefore, all equivalent modifications or changes made by a person of ordinary skill in the art without departing from the spirit and technical ideas disclosed in the present application shall still be covered by the claims of the present application.

Claims

1. A dual cluster deployment method, characterized in that: The method comprises: Creating a first cluster and a second cluster based on the deployment container, where the second cluster is a backup cluster of the first cluster; If it is monitored that the first cluster is in an unavailable state, a backup file of the first cluster is obtained, the backup file including a first backup file storing metadata of the first cluster and a second backup file storing business data of a first data volume associated with the first cluster; configuring the second cluster based on the first backup file, and synchronizing the second backup file to the second data volume associated with the second cluster according to a preset first mapping relationship, where the preset first mapping relationship is a mapping relationship between the first data volume and the second data volume; The services deployed on the first cluster are switched to the second cluster for carrying.

2. The dual cluster deployment method according to claim 1, characterized in that: Before the first cluster is monitored to be in an unavailable state, the method further includes: Monitor various target indicators of the first cluster, the target indicators including node health indicators, component health indicators, Pod health indicators, service health indicators, network status indicators, and storage status indicators; Performing a weighted score on each of the target indicators to obtain a fault score of the first cluster; If the fault score of the first cluster is lower than a preset score threshold, it is determined that the first cluster is in an unavailable state.

3. The dual cluster deployment method according to claim 2, characterized in that: The performing weighted scoring on each of the target indicators to obtain a fault score of the first cluster includes: Obtaining an application scenario of the first cluster; Matching the application scenario according to a preset second mapping relationship, assigning weights to the target indicators based on the matching results, and determining the target weight of each target indicator, wherein the preset second mapping relationship is a mapping relationship between the application scenario and the target weight of each target indicator; A weighted score is performed on each of the target indicators according to the target weight of each of the target indicators to obtain the fault score of the first cluster.

4. The dual cluster deployment method according to claim 2, characterized in that: The monitoring of each target indicator of the first cluster includes: Monitor the running status of nodes, components, Pods, and services in the first cluster, as well as the network status and storage status; Calculate the ratio of the number of the nodes in a healthy state to the total number of the nodes to determine the node health index; Calculate the ratio of the number of the components in a healthy operating state to the total number of the components to determine the component health index; Calculate the ratio of the number of the Pods in a healthy state to the total number of the Pods to determine the Pod health index; Calculate the ratio of the number of the services in a healthy running state to the total number of the services to determine the service health index; Determine the network status indicator according to the network connectivity, network delay and packet loss rate included in the network status; The storage status indicator is determined according to the storage capacity and storage performance included in the storage status.

5. The dual cluster deployment method according to claim 1, characterized in that: Before obtaining the backup file of the first cluster, the method further includes: Backing up the metadata of the first cluster and the first data volume associated with the first cluster to obtain the first backup file and the second backup file; Detecting the validity of the first backup file and the second backup file; If both the first backup file and the second backup file are valid, the first backup file and the second backup file are uploaded to a target storage space provided by a preset object storage service.

6. The dual cluster deployment method according to claim 5, characterized in that: The backing up the metadata of the first cluster and the data volume associated with the first cluster further includes: When a preset time interval is reached or a preset event is triggered, backing up the metadata of the first cluster and the first data volume associated with the first cluster; wherein the metadata of the backup is serialized to generate the first backup file; A snapshot process is performed on the first data volume to generate a snapshot file of the first data volume and use the snapshot file as the second backup file.

7. The dual cluster deployment method according to any one of claims 1 to 6, characterized in that: The acquiring the backup file of the first cluster further includes: If there are at least two backup files, comparing the timestamps of the backup files; Determine the target backup file by using the backup file closest to the current time; The target backup file of the first cluster is obtained.

8. A dual cluster deployment device, characterized in that: The device comprises: A creation module, used to create a first cluster and a second cluster based on the deployment container, where the second cluster is a backup cluster of the first cluster; a monitoring module, configured to obtain a backup file of the first cluster if it is detected that the first cluster is in an unavailable state, the backup file comprising a first backup file storing metadata of the first cluster and a second backup file storing business data of a first data volume associated with the first cluster; a data synchronization module, configured to configure the second cluster based on the first backup file, and synchronize the second backup file to a second data volume associated with the second cluster according to a preset first mapping relationship, wherein the preset first mapping relationship is a mapping relationship between the first data volume and the second data volume; The service switching module is used to switch the service deployed on the first cluster to the second cluster for carrying.

9. An electronic device, characterized in that: include: processor, memory, and communication bus; The communication bus is used to connect the processor and the memory; The processor is configured to execute the computer program stored in the memory to implement the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and the computer program is used to make a computer execute the method according to any one of claims 1 to 7.