Cluster management method and device, equipment and medium
Through cross-cluster replica resource indicator monitoring and dynamic scheduling, the problem of insufficient resource scheduling in cross-regional deployment and multi-data center disaster recovery is solved, dynamic resource scheduling and load balancing across clusters is realized, and high availability and resource utilization of containerized applications are improved.
Patent Information
- Application Number
- CN202510636327.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-16
- Publication Date
- 2025-08-19
AI Technical Summary
In the prior art, the horizontal elastic scaling mechanism of a single cluster cannot achieve dynamic scheduling of resources across clusters when deploying across regions, multi-data center disaster recovery and responding to sudden traffic peaks, and lacks unified indicator monitoring and dynamic scheduling capabilities across clusters, resulting in insufficient cross-cluster linkage capabilities, low degree of automation, limitations in disaster recovery and high availability, and low global resource utilization.
Through real-time monitoring of replica resource indicators across clusters, dynamically adjust replicas based on preset resource indicators to expand to other clusters, achieving horizontal elastic scaling across nodes, and using the connection establishment between management clusters and work clusters, acquisition of proxy component resource indicators and elastic scaling strategies, accurately determine replica adjustment information and issue scheduling tasks.
It significantly improves the high availability and disaster recovery capabilities of containerized applications, optimizes resource allocation, improves resource utilization and business flexibility in dealing with complex scenarios, and realizes dynamic resource scheduling and load balancing across clusters.
Smart Images

Figure CN120512367A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computers, and in particular to a cluster management method, apparatus, device, and medium. Background Art
[0002] In the cloud computing environment, as business scale expands and traffic fluctuations intensify, users have higher requirements for the high availability, disaster recovery capabilities and resource optimization configuration of containerized applications.
[0003] Currently, the horizontal elastic scaling mechanism (HPA) of clusters in related technologies is mainly based on resource indicators within a single cluster (such as CPU and memory utilization), and achieves elastic expansion by adjusting the number of replicas within a single cluster. However, when facing cross-regional deployment, multi-data center disaster recovery or sudden traffic peaks, it is impossible to achieve dynamic scheduling of resources across clusters, and lacks unified indicator monitoring and dynamic scheduling capabilities across clusters. Summary of the Invention
[0004] The present disclosure provides a cluster management method, apparatus, device, and medium, addressing the limitations of single cluster elastic scaling mechanisms in related technologies when deploying across regions, performing multi-data center disaster recovery, and coping with sudden traffic peaks.
[0005] A first embodiment of the present disclosure provides a cluster management method, including:
[0006] Determine the target replica in the pre-established elastic scaling resources and the target working cluster corresponding to the target replica;
[0007] Based on the target proxy component corresponding to the target working cluster, obtain the replica resource indicators of the target replica;
[0008] Determine the replica adjustment information corresponding to the target replica based on the replica resource indicators and the preset resource indicators;
[0009] The replica scheduling task corresponding to the replica adjustment information is sent to the schedulable working cluster, so that the schedulable working cluster performs replica scheduling based on the replica scheduling task.
[0010] A second embodiment of the present disclosure provides a cluster management device, including:
[0011] A first determining unit is configured to determine a target replica in a pre-established elastic scaling resource and a target working cluster corresponding to the target replica;
[0012] An acquisition unit, configured to acquire a replica resource indicator of a target replica based on a target proxy component corresponding to a target working cluster;
[0013] A second determining unit, configured to determine replica adjustment information corresponding to the target replica based on the replica resource indicator and the preset resource indicator;
[0014] The scheduling unit is configured to send the replica scheduling task corresponding to the replica adjustment information to the schedulable working cluster, so that the schedulable working cluster performs replica scheduling based on the replica scheduling task.
[0015] The third aspect embodiment of the present disclosure proposes an electronic device, comprising: a processor and a memory for storing a computer program that can be run on the processor, wherein the processor, when used to run the computer program, executes the method described in the first aspect embodiment of the present disclosure.
[0016] The fourth aspect embodiment of the present disclosure proposes a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the method described in the first aspect embodiment of the present disclosure.
[0017] The fifth aspect embodiment of the present disclosure provides a computer program product, including a computer program, which implements the method described in the first aspect embodiment of the present disclosure when executed by a processor.
[0018] In summary, according to a cluster management method provided by the present disclosure, by determining the target replica in the pre-established elastic scaling resources and the target working cluster corresponding to the target replica; based on the target proxy component corresponding to the target working cluster, obtaining the replica resource index of the target replica; based on the replica resource index and the preset resource index, determining the replica adjustment information corresponding to the target replica; sending the replica scheduling task corresponding to the replica adjustment information to the schedulable working cluster, so that the schedulable working cluster performs replica scheduling based on the replica scheduling task. Dynamic resource scheduling across clusters is achieved. By uniformly monitoring the replica resource index of each cluster and comparing and analyzing it with the preset index, the replica adjustment information is accurately determined, and the scheduling task is sent to the schedulable working cluster, which significantly improves the high availability and disaster recovery capabilities of containerized applications, while optimizing resource allocation, improving resource utilization and the flexibility of the business in responding to complex scenarios.
[0019] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The accompanying drawings are provided to facilitate a better understanding of the present invention and do not constitute a limitation of the present disclosure.
[0021] Figure 1 A schematic diagram of a cluster management method according to an embodiment of the present disclosure;
[0022] Figure 2A flowchart of another cluster management method provided by an embodiment of the present disclosure;
[0023] Figure 3 A schematic diagram of the architecture of a specific cluster management system provided by an embodiment of the present disclosure;
[0024] Figure 4 A schematic diagram of the structure of a cluster management device provided by an embodiment of the present disclosure;
[0025] Figure 5 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0026] The following description of exemplary embodiments of the present disclosure is made in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding. These details should be considered as merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0027] In cloud computing environments, as business scale expands and traffic fluctuations intensify, users are placing higher demands on the high availability, disaster recovery, and optimized resource configuration of containerized applications. While horizontal autoscaling (HPA) for a single cluster can improve resource utilization within a single cluster, it cannot dynamically schedule resources across clusters when faced with cross-region deployments, multi-data center disaster recovery, or sudden traffic spikes. Users hope to break through the limitations of a single cluster and achieve cross-node autoscaling of container groups (Pods) across multiple clusters to address resource scheduling requirements in complex business scenarios, ensuring application stability while optimizing global resource allocation.
[0028] Current technologies for horizontal cluster scaling (HPA, or Horizontal Pod Autoscaler) are an automatic scaling mechanism for container groups in Kubernetes. It automatically adjusts the number of replicas based on predefined metrics to achieve dynamic resource allocation, optimize resource utilization, and ensure application stability. HPA primarily relies on resource metrics within a single cluster (such as CPU and memory utilization), achieving elastic scaling by adjusting the number of replicas within that cluster. While some multi-cluster management solutions enable cross-cluster application deployment and lifecycle management, their elastic scaling capabilities are limited to independent control within a single cluster and lack unified cross-cluster metric monitoring and dynamic scheduling capabilities.
[0029] Related technologies usually require manual pre-configuration of cross-cluster resource allocation strategies and cannot automatically trigger cross-cluster replica adjustments based on real-time load.
[0030] It can be seen that the relevant technology has the following problems:
[0031] 1) Insufficient cross-cluster linkage capabilities: The HPA of a single cluster cannot perceive the resource status of other clusters, making it difficult to achieve load balancing across multiple clusters. This may cause some clusters to have insufficient resources while others are idle.
[0032] 2) Low degree of automation: Cross-cluster elastic scaling relies on manually preset rules or static resource allocation, which cannot cope with sudden traffic or dynamic load changes, resulting in delayed response and high configuration complexity.
[0033] 3) Disaster recovery and high availability limitations: Cross-cluster scaling and disaster recovery mechanisms are not deeply integrated. When a single cluster fails, traffic and replicas cannot be automatically and quickly migrated to other clusters, affecting application continuity.
[0034] 4) Low global resource utilization: The lack of unified indicator monitoring and scheduling strategies makes it difficult to optimize resource allocation from a global perspective across multiple clusters, potentially leading to resource waste or performance bottlenecks.
[0035] In order to solve the technical problems existing in the related technology, the embodiments of the present disclosure provide a cluster management method, which realizes the horizontal elastic scaling of replicas across nodes by real-time monitoring of replica resource indicators across clusters and dynamically expanding replicas to other clusters based on the set resource indicators, thereby improving the utilization of replica resources in the cluster.
[0036] The embodiments of the present disclosure will be described in detail below.
[0037] like Figure 1 As shown, an embodiment of the present disclosure provides a cluster management method, comprising the following steps:
[0038] Step 101: Determine a target replica in a pre-established elastic scaling resource and a target working cluster corresponding to the target replica.
[0039] In some embodiments, the elastic scaling resource refers to a cluster hpa resource created by a user, which defines a target replica and a target working cluster corresponding to the target replica.
[0040] Among them, the cluster of this application refers to the Kubernetes cluster, referred to as K8s cluster. Kubernetes is a scalable containerized application orchestration platform. Through Kubernetes, users can deploy and manage large-scale containerized applications more efficiently and improve resource utilization. The target replica refers to the pod (container) that needs to be elastically scaled, and the target working cluster refers to the working clusters where the pods (i.e., target replicas) that need to be elastically scaled are distributed. Replicas, also known as container instances (i.e., pods), are lightweight, portable, and self-contained software running technologies that allow developers to package applications and their dependencies into a deployable unit and ensure that applications run in a consistent manner in different environments. Pod is the smallest resource management component in kubernetes, and Pod is also the resource object that minimizes the running of containerized applications. A Pod represents a process running in a cluster. Most other components in kubernetes are centered around Pod to support and extend Pod functions, such as controller objects such as StatefulSet and Deployment for managing Pod operations.
[0041] The auto-scaling resource can also define a preset cluster weight ratio, that is, the weight of the pod in the distributable resource pool (the ratio of replicas allocated to each cluster) when auto-scaling is performed.
[0042] The elastic scaling resources of this application may also define the type, name, etc. corresponding to the target replica.
[0043] After Cluster hpa is created successfully, the management cluster can monitor the creation of cluster hpa resources, parse the target replica that needs to be scaled, and determine the target working cluster corresponding to the target replica.
[0044] Step 102: Obtain the replica resource indicator of the target replica based on the target proxy component corresponding to the target working cluster.
[0045] In some embodiments, the target agent component refers to an agent deployed in a working cluster, which is responsible for collecting resource indicators of the local cluster.
[0046] Replica resource metrics are real-time resource usage data of the target replica, such as CPU usage, memory usage, and request rate.
[0047] The management cluster can send information collection tasks to the agent of the target working cluster. Based on the information collection tasks, the agent obtains the real-time replica resource indicators of the target replica.
[0048] After the agent uploads the collected replica resource indicators to the management cluster, the management cluster can aggregate the replica resource indicators of each working cluster to obtain the overall replica resource indicators.
[0049] Step 103: Determine the replica adjustment information corresponding to the target replica based on the replica resource indicator and the preset resource indicator.
[0050] In some embodiments, the preset resource indicator refers to the threshold for triggering scaling set by the user in the elastic scaling resource, for example: CPU usage threshold (such as 70%), memory usage threshold (such as 80%), and custom indicator threshold (such as QPS).
[0051] Replica adjustment information refers to the target replica quantity adjustment plan determined based on the comparison result of the current replica resource indicator with the preset resource indicator corresponding to the replica resource indicator, including: adjustment direction (increase or decrease) and adjustment quantity (such as 2 replicas).
[0052] Step 104 : Send the replica scheduling task corresponding to the replica adjustment information to the schedulable working cluster, so that the schedulable working cluster performs replica scheduling based on the replica scheduling task.
[0053] In some embodiments, a schedulable working cluster refers to a working cluster that meets the following conditions: a healthy state (non-faulty cluster), sufficient resources to accommodate new replicas, and is allowed to be scheduled by the elastic scaling policy.
[0054] The replica scheduling task includes instructions for adjusting information, for example: adding two replicas in schedulable cluster A and deleting one replica in schedulable cluster B.
[0055] This application can calculate the number of replicas that should be allocated to each cluster based on the cluster weight ratio preset in the elastic scaling resources and the available resources of each working cluster (such as remaining CPU and memory).
[0056] The schedulable worker cluster can perform actual replica scheduling according to the replica scheduling tasks sent by the management cluster by deploying replicas to appropriate schedulable nodes.
[0057] In summary, the cluster management method proposed in the present disclosure includes: determining the target replica in the pre-established elastic scaling resources and the target working cluster corresponding to the target replica; obtaining the replica resource index of the target replica based on the target proxy component corresponding to the target working cluster; determining the replica adjustment information corresponding to the target replica based on the replica resource index and the preset resource index; sending the replica scheduling task corresponding to the replica adjustment information to the schedulable working cluster, so that the schedulable working cluster performs replica scheduling based on the replica scheduling task. This method realizes dynamic resource scheduling across clusters, and by uniformly monitoring the replica resource index of each cluster and comparing and analyzing it with the preset index, accurately determines the replica adjustment information, and sends the scheduling task to the schedulable working cluster, significantly improving the high availability and disaster recovery capabilities of containerized applications, while optimizing resource allocation, improving resource utilization and the flexibility of the business in responding to complex scenarios.
[0058] Figure 2 The following further illustrates a flow chart of another cluster management method proposed in the present disclosure. Figure 1 The illustrated embodiment further explains, Figure 2 The following steps may be included.
[0059] Step 201: Determine a target replica in a pre-established elastic scaling resource and a target working cluster corresponding to the target replica.
[0060] In some embodiments, before determining the target replica in the pre-established elastic scaling resource and the target working cluster corresponding to the target replica, the present application needs to establish a connection relationship between the management cluster and multiple working clusters; when the connection relationship between the management cluster and the multiple working clusters is successfully established, the service interfaces of the multiple working clusters are called to distribute the multiple proxy components to the multiple working clusters, so that the multiple proxy components collect the multiple cluster node information of the multiple working clusters; based on the multiple cluster node information sent by the multiple proxy components, cluster resources are created.
[0061] Among them, establishing a connection relationship between the management cluster and multiple working clusters requires sending connection requests to multiple working clusters based on authentication information, and the authentication information is generated and stored in advance by multiple working clusters; obtaining connection responses from multiple working clusters based on the connection request feedback, thereby establishing a connection relationship between the management cluster and multiple working clusters.
[0062] In other words, this application can create cluster resources (i.e., cluster resources) in the management cluster based on the working cluster authentication information (kubeconfig). The cluster controller in the management cluster monitors the creation of cluster resources, calls the working cluster API-server interface according to kubeconfig, and sends an agent component (i.e., proxy component) to each working cluster. After the agent component is successfully created and running, it begins to push cluster node information for each working cluster and each node in each working cluster to the management cluster.
[0063] Among them, kubeconfig is a file used to configure cluster access information in Kubernetes. It defines the configuration of the storage cluster (Cluster), user (User), and context (Context), as well as their relationship, so that clients (such as kubectl) or APIs can communicate securely with the Kubernetes API Server.
[0064] It is understood that the management cluster in this application can obtain cluster node information of each working cluster according to a preset period, thereby achieving monitoring of each working cluster. That is, after creating a cluster resource based on multiple cluster node information sent by multiple proxy components, it obtains multiple updated cluster node information sent by multiple proxy components according to a preset period; based on the multiple updated cluster node information, it generates multiple working cluster states and cluster resource usage information; and adds the multiple working cluster states and cluster resource usage information to the cluster resource.
[0065] In other words, after the agent component is started, it periodically queries the cluster node information of each node in the working cluster by calling the API of the working cluster, and calls the API of the management cluster Cluster Manager to push the corresponding cluster node information.
[0066] The cluster controller receives the cluster node information sent by each working cluster agent component, updates the cluster node information (status, resource usage) of each node in each working cluster, and generates the corresponding working cluster status and cluster resource usage information based on the information of each cluster node, and adds the working cluster status and cluster resource usage information to the corresponding cluster resources.
[0067] It should be noted that each working cluster can correspond to a cluster resource, that is, this application creates a corresponding cluster resource for each working cluster.
[0068] Step 202: Send the information collection task to the target agent component corresponding to the target working cluster, so that the target agent component collects the replica resource indicators of the target replica.
[0069] Step 203: Obtain the replica resource indicator sent by the target proxy component.
[0070] In some embodiments, after the cluster hpa resource (i.e., elastic scaling resource) is successfully created, the cluster controller in the management cluster monitors the creation of the cluster hpa resource, parses the corresponding cluster hpa resource, and sends the collection task to the agent component of the corresponding target working cluster based on the target replica corresponding to the cluster hpa resource and the target working cluster corresponding to the target replica. The agent component queries the corresponding target replica based on the application space, type, and name conditions, and collects the target replica's CPU, memory and other replica resource indicators based on the native metrics interface of the target working cluster, and reports them to the cluster hpa controller in the management cluster.
[0071] Step 204: Determine the expected number of replicas based on the replica resource indicator sent by the target proxy component and the preset resource indicator.
[0072] In some embodiments, the cluster hpa controller in the management cluster can summarize the replica resource indicators of the target replicas collected by all target working clusters, and calculate the corresponding expected number of replicas based on the defined preset resource indicators. The calculation formula is: expected number of replicas = [(current number of replicas * (current replica resource indicator / preset resource indicator))].
[0073] Step 205: If the expected number of replicas is different from the target number of replicas, replica adjustment information corresponding to the target replica is determined, and the replica resource indicator is added to the elastic scaling resource.
[0074] In the present disclosure, the replica adjustment information includes an adjustment direction and an adjustment amount.
[0075] In some embodiments, when the expected number of replicas does not match the current target number of replicas, the cluster HPA controller in the management cluster notifies the cluster scheduler in the management cluster to reschedule the replicas. The cluster scheduler determines the direction and number of target replicas to adjust based on the expected number of replicas and the current target number of replicas. In other words, by comparing the expected number of replicas with the current target number of replicas, the number of replicas that needs to be increased or decreased is determined. The corresponding replica resource indicators are also written to the cluster HPA resources.
[0076] Step 206 : Determine a schedulable node based on the replica adjustment information and information about multiple cluster nodes in the preset cluster resources.
[0077] In some embodiments, the cluster hpa controller in the management cluster can screen the schedulable nodes that are in normal status and meet the scheduling conditions based on the cluster node information defined in the cluster resources (such as the CPU, memory and other available resources of each node).
[0078] Step 207: Based on the preset cluster weight ratio in the elastic scaling resources, determine the replica scheduling task of the schedulable working cluster corresponding to the schedulable node, and send the replica scheduling task to the schedulable working cluster so that the schedulable working cluster performs replica scheduling on the schedulable node based on the scheduling replica.
[0079] In the present disclosure, the replica scheduling task is the adjustment direction and adjustment quantity of replica scheduling performed by the schedulable working cluster.
[0080] In some embodiments, the replica scheduling task (for example, increasing or decreasing the number of replicas) corresponding to the working cluster corresponding to each schedulable node can be determined based on the preset cluster weight ratio, and then the replica scheduling task can be sent to the k8s controller in each working cluster, so that the k8s controller can adjust the number of replicas in the schedulable node based on the replica scheduling task (for example, adding or deleting replicas in the schedulable node according to deleting or increasing the number of replicas), thereby completing the entire cross-cluster elastic scaling process.
[0081] In summary, according to the cluster management method proposed in the present invention, by establishing the connection between the management cluster and the working cluster, collecting resource indicators of the proxy component, dynamically calculating the elastic scaling strategy and cross-cluster scheduling, real-time monitoring and automatic elastic scaling of multi-cluster resource usage are achieved. The number of replicas can be intelligently adjusted according to preset indicators, and resource scheduling can be optimized based on cluster weights, effectively improving cluster resource utilization, system elasticity and load balancing capabilities, and providing an efficient and flexible cross-cluster management solution for distributed applications.
[0082] based on Figures 1 to 2 The embodiment shown, as Figure 3 As shown, the present disclosure provides a schematic diagram of the architecture of a specific cluster management system.
[0083] Reference Figure 3The cluster management system disclosed in this disclosure is divided into two parts: a management cluster and multiple working clusters. The management cluster includes two controllers (cluster controller and cluster HPA controller) and a scheduler (cluster scheduler), as well as two custom resources: cluster resources and cluster HPA resources.
[0084] Among them, the agent component is uniformly deployed in each working cluster.
[0085] Reference Figure 3 The functions of each component and resource are as follows:
[0086] 1) Agent refers to the agent component (i.e., the proxy component in this disclosure) distributed to the working cluster when the management cluster adds a working cluster. The main functions of the agent component are as follows: the agent component collects the status information and resource usage of each node in the working cluster (i.e., the cluster node information in this disclosure), and reports the cluster node information to the cluster controller in the management cluster. The cluster controller can summarize the overall status and resource usage of the working cluster. The agent component can also collect the status and usage (i.e., the replica resource indicators in this disclosure) of pods (i.e., replicas in this disclosure) that need to be elastically scaled across clusters, and report the collected information to the clusterhpa controller in the management cluster.
[0087] 2) The cluster controller is the cluster resource controller in the management cluster of this disclosure. This component is deployed in the management cluster and mainly implements the following functions: when the working cluster registers, it distributes the agent component to each working cluster. It receives and records the cluster node information of each cluster sent by the agent in the working cluster.
[0088] 3) The Cluster HPA Controller is the elastic scaling resource controller in the management cluster in this disclosure. This component is deployed in the management cluster and calculates the number of replicas that need to be increased or decreased based on the set resource threshold (i.e., the preset resource indicator in this disclosure) and the expected number of replicas, combined with the replica usage in each working cluster reported by the agent component (i.e., the replica resource indicator in this disclosure). It then sends the replica adjustment information that needs to be updated and the adjusted number of replicas to the Cluster Scheduler component.
[0089] 4) Cluster scheduler is the scheduler in the management cluster in this disclosure. This component is deployed in the management cluster. This component mainly selects the optimal working cluster for the newly added replicas based on the current resource indicators of the replicas and the expected number of replicas, combined with the actual resource usage of each working cluster (i.e., the cluster node information in this disclosure) during the elastic scaling of replicas across clusters.
[0090] 5) Cluster resources refer to the cluster resources in this disclosure. This resource exists in the management cluster and mainly records the cluster node information of each node in the working cluster, such as the status of the working cluster, resource (CPU, memory) usage, and the status and resource (CPU, memory) usage information of the nodes under the corresponding working cluster.
[0091] The definition format is as follows: It mainly records the cluster's authentication information (kubeconfig), cluster resource usage, cluster status, basic information of the nodes under the cluster, resource usage, and node status.
[0092] 6. Cluster hpa resources are elastically scalable resources in this disclosure. This resource exists in the management cluster and is mainly used to record resources that need to be elastically scaled across clusters (i.e., the target replicas and the target working clusters where the target replicas are distributed in this disclosure) and the corresponding resource threshold information (i.e., the preset resource indicators in this disclosure), as well as the expected scheduling replica weights (i.e., the preset cluster weight ratio in this disclosure).
[0093] In summary, this disclosure can more effectively utilize all available resources across an organization, avoiding over-allocation or under-allocation of resources within a single cluster. For example, when a working cluster fails, the management cluster receives the failure information and, based on the cluster HPA information recorded in the management cluster, redistributes replicas to other working clusters. This automatically creates new replicas in other healthy clusters, ensuring uninterrupted service. This disclosure's cross-cluster container elastic scaling provides customers with greater flexibility, reliability, and cost-effectiveness.
[0094] In order to implement the cluster management method provided by the embodiment of the present disclosure, the embodiment of the present disclosure also provides a cluster management device, such as Figure 4 As shown, the cluster management device 400 includes:
[0095] A first determining unit 410 is configured to determine a target replica in a pre-established elastic scaling resource and a target working cluster corresponding to the target replica;
[0096] An acquiring unit 420 is configured to acquire a replica resource indicator of the target replica based on a target proxy component corresponding to the target working cluster;
[0097] A second determining unit 430 is configured to determine replica adjustment information corresponding to the target replica based on the replica resource indicator and a preset resource indicator;
[0098] The scheduling unit 440 is configured to send the replica scheduling task corresponding to the replica adjustment information to the schedulable working cluster, so that the schedulable working cluster performs replica scheduling based on the replica scheduling task.
[0099] In some embodiments, the acquisition unit 420 is used to: send the information collection task to the target proxy component corresponding to the target working cluster, so that the target proxy component collects the replica resource indicators of the target replica; and obtain the replica resource indicators sent by the target proxy component.
[0100] In some embodiments, the second determination unit 430 is used to: determine the expected number of replicas based on the replica resource indicator sent by the target proxy component and the preset resource indicator; if the expected number of replicas is different from the number of target replicas, determine the replica adjustment information corresponding to the target replica, and add the replica resource indicator to the elastic scaling resource, the replica adjustment information includes the adjustment direction and adjustment quantity.
[0101] In some embodiments, the scheduling unit 440 is used to: determine the schedulable node based on the replica adjustment information and multiple cluster node information in the preset cluster resources; determine the replica scheduling task of the schedulable working cluster corresponding to the schedulable node based on the preset cluster weight ratio in the elastic scaling resources, and send the replica scheduling task to the schedulable working cluster so that the schedulable working cluster performs replica scheduling on the schedulable node based on the scheduling replica, and the replica scheduling task is the adjustment direction and adjustment quantity of the replica scheduling of the schedulable working cluster.
[0102] In some embodiments, the device also includes: a creation unit, which is used to establish a connection relationship between the management cluster and multiple working clusters before determining the target copy in the pre-established elastic scaling resource and the target working cluster corresponding to the target copy; when the connection relationship between the management cluster and the multiple working clusters is successfully established, calling the service interface of the multiple working clusters to distribute multiple proxy components to the multiple working clusters, so that the multiple proxy components collect multiple cluster node information of the multiple working clusters; and creating cluster resources based on the multiple cluster node information sent by the multiple proxy components.
[0103] In some embodiments, the creation unit is used to: send a connection request to the multiple working clusters based on authentication information, where the authentication information is generated and pre-stored by the multiple working clusters; obtain connection responses from the multiple working clusters based on the connection request feedback, and establish a connection relationship between the management cluster and the multiple working clusters.
[0104] In some embodiments, the creation unit is used to: after creating cluster resources based on multiple cluster node information sent by the multiple proxy components, obtain multiple updated cluster node information sent by the multiple proxy components according to a preset period; based on the multiple updated cluster node information, generate multiple working cluster states and cluster resource usage information; and add the multiple working cluster states and the cluster resource usage information to the cluster resources.
[0105] It should be noted that the cluster management device provided in the above embodiment only illustrates the division of the aforementioned program modules when performing cluster management. In actual applications, the aforementioned processing can be assigned to different program modules as needed, that is, the internal structure of the cluster management device can be divided into different program modules to complete all or part of the aforementioned processing. Furthermore, the cluster management device provided in the above embodiment and the cluster management method provided in the present disclosure are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0106] Figure 5 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present disclosure is shown in FIG. Figure 5 As shown, the electronic device 500 includes at least one processor 502; and a memory 501 communicatively connected to the at least one processor 502; wherein the memory 501 stores instructions that can be executed by the at least one processor 502, and the instructions are executed by the at least one processor 502 to implement the steps of the cluster management method described in the embodiment of the present disclosure.
[0107] Optionally, the electronic device may specifically be the cluster management device of the embodiment of the present disclosure, and the electronic device may implement the corresponding processes implemented by the cluster management device in each method of the embodiment of the present disclosure, which will not be described in detail here for the sake of brevity.
[0108] It is understood that the electronic device also includes a communication interface 503. The various components in the electronic device are coupled together through a bus system 504. It is understood that the bus system 504 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 504 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, Figure 5 Various buses are labeled as bus system 504 .
[0109] It is understood that the memory 501 can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory, a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD-ROM); the magnetic surface memory can be a magnetic disk memory or a magnetic tape memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), synchronous static random access memory (SSRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct rambus random access memory (DRRAM).The memory 501 described in the embodiments of the present invention is intended to include, but is not limited to, these and any other suitable types of memories.
[0110] The methods disclosed in the above embodiments of the present disclosure can be applied to or implemented by processor 502. Processor 502 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by hardware integrated logic circuits in processor 502 or by software instructions. The above processor 502 may be a general-purpose processor, a DSP, or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, etc. Processor 502 can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present disclosure. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in conjunction with the embodiments of the present disclosure can be directly implemented and executed by a hardware decoding processor, or by a combination of hardware and software modules in the decoding processor. The software module may be located in a storage medium located in memory 501. Processor 502 reads information from memory 501 and, in conjunction with its hardware, completes the steps of the above method.
[0111] In an exemplary embodiment, the electronic device may be implemented by one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), FPGAs, general-purpose processors, controllers, MCUs, microprocessors, or other electronic components to perform the aforementioned method.
[0112] The embodiment of the present disclosure further provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable the computer to implement the steps of the cluster management method described in the embodiment of the present disclosure when executed.
[0113] The embodiments of the present disclosure further provide a computer program product, including a computer program, which implements the steps of the cluster management method described in the embodiments of the present disclosure when executed by a processor.
[0114] Optionally, the computer-readable storage medium may be applied to the cluster management device in the embodiment of the present disclosure, and the computer instructions enable the computer to execute the corresponding processes implemented by the cluster management device in each method of the embodiment of the present disclosure. For the sake of brevity, they are not described here in detail.
[0115] In the several embodiments provided in the present disclosure, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0116] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0117] In addition, all functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may be separately used as a unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0118] Those skilled in the art will understand that all or part of the steps of implementing the above-mentioned method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above-mentioned method embodiment; and the aforementioned storage medium includes: mobile storage devices, ROM, RAM, disks or optical disks, etc. Various media that can store program codes.
[0119] Alternatively, if the above-mentioned integrated unit of the present invention is implemented in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, magnetic disks or optical disks.
[0120] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any modifications or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in the present invention should be included in the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.
Claims
1. A cluster management method, characterized in that: The method is applied to manage a cluster, and the method includes: Determine a target replica in a pre-established elastic scaling resource and a target working cluster corresponding to the target replica; Based on the target agent component corresponding to the target working cluster, obtaining the replica resource indicator of the target replica; Determining replica adjustment information corresponding to the target replica based on the replica resource indicator and the preset resource indicator; The replica scheduling task corresponding to the replica adjustment information is sent to the schedulable working cluster, so that the schedulable working cluster performs replica scheduling based on the replica scheduling task.
2. The method according to claim 1, characterized in that The acquiring of the replica resource indicator of the target replica based on the target proxy component corresponding to the target working cluster includes: Sending the information collection task to the target agent component corresponding to the target working cluster, so that the target agent component collects the replica resource indicators of the target replica; Obtain the replica resource indicator sent by the target proxy component.
3. The method according to claim 1, characterized in that The determining, based on the replica resource indicator and the preset resource indicator, the replica adjustment information corresponding to the target replica includes: Determining the expected number of replicas based on the replica resource indicator sent by the target proxy component and the preset resource indicator; If the expected number of replicas is different from the target number of replicas, replica adjustment information corresponding to the target replica is determined, and the replica resource indicator is added to the elastic scaling resource, where the replica adjustment information includes an adjustment direction and an adjustment quantity.
4. The method according to claim 1, wherein The sending of the replica scheduling task corresponding to the replica adjustment information to the schedulable working cluster includes: Determine a schedulable node based on the replica adjustment information and information of multiple cluster nodes in the preset cluster resources; Based on the preset cluster weight ratio in the elastic scaling resource, determine the replica scheduling task of the schedulable working cluster corresponding to the schedulable node, and send the replica scheduling task to the schedulable working cluster so that the schedulable working cluster performs replica scheduling on the schedulable node based on the scheduling replica. The replica scheduling task is the adjustment direction and adjustment quantity of the replica scheduling performed by the schedulable working cluster.
5. The method according to claim 1, wherein Before determining the target replica in the pre-established elastic scaling resource and the target working cluster corresponding to the target replica, the method includes: Establish a connection relationship between the management cluster and multiple working clusters; When the connection relationship between the management cluster and the multiple working clusters is successfully established, calling the service interfaces of the multiple working clusters to distribute multiple agent components to the multiple working clusters, so that the multiple agent components collect multiple cluster node information of the multiple working clusters; Cluster resources are created based on the plurality of cluster node information sent by the plurality of proxy components.
6. The method according to claim 5, characterized in that The establishing of a connection relationship between the management cluster and the plurality of working clusters includes: Sending connection requests to the multiple working clusters based on authentication information, where the authentication information is generated and pre-stored by the multiple working clusters; Acquire connection responses fed back by the multiple working clusters based on the connection requests, and establish connection relationships between the management cluster and the multiple working clusters.
7. The method according to claim 5, characterized in that After creating cluster resources based on the multiple cluster node information sent by the multiple proxy components, the method includes: Acquire multiple updated cluster node information sent by the multiple proxy components according to a preset period; generating a plurality of working cluster states and cluster resource usage information based on the plurality of updated cluster node information; The multiple working cluster states and the cluster resource usage information are added to the cluster resources.
8. A cluster management device, characterized in that: The device comprises: A first determining unit is configured to determine a target replica in a pre-established elastic scaling resource and a target working cluster corresponding to the target replica; An acquiring unit, configured to acquire a replica resource indicator of the target replica based on a target proxy component corresponding to the target working cluster; A second determining unit, configured to determine replica adjustment information corresponding to the target replica based on the replica resource indicator and a preset resource indicator; The scheduling unit is configured to send the replica scheduling task corresponding to the replica adjustment information to the schedulable working cluster, so that the schedulable working cluster performs replica scheduling based on the replica scheduling task.
9. An electronic device, characterized in that: include: a processor and a memory for storing a computer program capable of being executed on the processor, Wherein, when the processor is used to run the computer program, it executes the cluster management method according to any one of claims 1-7.
10. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to enable the computer to execute the cluster management method according to any one of claims 1 to 7.