Resource management method, device, computer equipment, storage medium and product
By receiving resource management requests in the Kubernetes cluster, matching the target cluster and generating a management script, the target node is added to the cluster, which solves the problem of limited capacity of a single cluster and achieves efficient resource management and improved operation and maintenance efficiency.
Patent Information
- Application Number
- CN202410865031.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-28
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2044-06-28
AI Technical Summary
A single Kubernetes cluster is inefficient in resource management, has limited capacity and complex operation and maintenance, making it difficult to meet the growing demand for resource storage and management.
By receiving the resource management request of the target node, matching the target cluster based on the data center identifier, obtaining the target token and generating a resource management script, and sending the script to cause the target node to join the target cluster, resource management is performed at the data center level to solve the problem of limited cluster capacity. problem.
It realizes resource management at the data center level, improves scalability, reduces usage thresholds and operation and maintenance complexity, and improves management efficiency.
Smart Images

Figure CN118413573B
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of cloud storage technology, and in particular to resource management methods, devices, computer equipment, storage media and products. Background Art
[0002] Kubernetes, or K8s for short, is an open-source automated operation and maintenance platform that can eliminate the operations involved in deploying and scaling containerized applications and help manage clusters. Enterprises are increasingly demanding computing power, and emerging technologies such as edge computing are developing, as well as multi-cloud and hybrid cloud applications are becoming more and more widespread. Due to factors such as limited capacity and difficult operation and maintenance, a single Kubernetes cluster is increasingly unable to meet the increasing demands for resource storage and management. Summary of the invention
[0003] In view of this, the present disclosure provides a resource management method, apparatus, computer equipment, storage medium and product to solve the problem of insufficient efficiency in resource management of k8s cluster.
[0004] In a first aspect, the present disclosure provides a resource management method, comprising:
[0005] Receive a resource management request issued by a target node, wherein the resource management request carries an identifier of a data center to which the target node belongs; determine a target cluster to which the target node belongs by matching existing resource clusters based on the identifier of the data center; obtain a target token corresponding to the target cluster, wherein the target token is valid within a preset time; generate a resource management script based on the identifier of the target cluster and the target token; and send the resource management script to the target node so that the target node joins the target cluster based on the resource management script.
[0006] In a second aspect, the present disclosure provides a resource management device, the device comprising:
[0007] A request receiving module is used to receive a resource management request issued by a target node, wherein the resource management request carries an identifier of a data center to which the target node belongs; a cluster determining module is used to match existing resource clusters based on the identifier of the data center to determine a target cluster to which the target node belongs; a token acquiring module is used to acquire a target token corresponding to the target cluster, wherein the target token is valid within a preset time; a script determining module is used to generate a resource management script based on the identifier of the target cluster and the target token; and a node joining module is used to send the resource management script to the target node so that the target node joins the target cluster based on the resource management script.
[0008] In a third aspect, the present disclosure provides a computer device, comprising: a memory and a processor, the memory and the processor are communicatively connected to each other, computer instructions are stored in the memory, and the processor executes the resource management method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0009] In a fourth aspect, the present disclosure provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the resource management method of the first aspect or any corresponding embodiment thereof.
[0010] In a fifth aspect, the present disclosure provides a computer program product, including computer instructions, wherein the computer instructions are used to enable a computer to execute the resource management method of the first aspect or any corresponding embodiment thereof.
[0011] The resource management method provided by the embodiment of the present disclosure is that the server receives a resource management request issued by the target node, and matches the data center identifier to which the target node belongs carried in the resource management request in the existing resource cluster, thereby determining the target cluster to which the target node belongs. The server obtains the target token corresponding to the target cluster, and generates a resource management script based on the target token and the identifier of the target cluster, and sends the resource management script to the target node, so that the target node joins the target cluster based on the resource management script. This method can be specific to the data center level when managing nodes, and management can be performed at the data center level, which solves the problem of limited capacity of a single cluster and has strong scalability. In addition, there is no need to operate the cluster, nor is there any need to perceive how many clusters currently exist, which reduces the usage threshold and operation complexity, and improves operation and maintenance efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the related technologies, the drawings required for use in the specific embodiments or the related technical descriptions will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0013] Figure 1 is a schematic diagram of the architecture of a resource management method according to an embodiment of the present disclosure;
[0014] Figure 2 is a flowchart of a resource management method according to an embodiment of the present disclosure;
[0015] Figure 3 is a schematic diagram of a scenario of a resource management method according to an embodiment of the present disclosure;
[0016] Figure 4is a flowchart of another resource management method according to an embodiment of the present disclosure;
[0017] Figure 5 is a schematic diagram of a scenario of a resource management method according to an embodiment of the present disclosure;
[0018] Figure 6 is a flowchart of another resource management method according to an embodiment of the present disclosure;
[0019] Figure 7 is a scenario schematic diagram of another resource management method according to an embodiment of the present disclosure;
[0020] Figure 8 is a structural block diagram of a resource management device according to an embodiment of the present disclosure;
[0021] Fig. 9 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0022] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.
[0023] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments set forth herein. On the contrary, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0024] In the description of the embodiments of the present disclosure, the term "including" and similar terms should be understood as open inclusion, that is, "including but not limited to". The term "based on" should be understood as "based at least in part on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The term "some embodiments" should be understood as "at least some embodiments". Other explicit and implicit definitions may also be included below.
[0025] Herein, unless explicitly stated, executing a step “in response to A” does not mean executing the step immediately after “A” but may include one or more intermediate steps.
[0026] It is understandable that the data involved in this technical solution (including but not limited to the data itself, the acquisition, use, storage or deletion of the data) shall comply with the requirements of relevant laws, regulations and relevant provisions.
[0027] It is understandable that before using the technical solutions disclosed in the various embodiments of the present disclosure, the types, scopes of use, usage scenarios, etc. of the information involved in the present disclosure should be informed to relevant users and their authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations. The relevant users may include any type of right holders, such as individuals, enterprises, and groups.
[0028] For example, in response to receiving an active request from a user, a prompt message is sent to the relevant user to clearly prompt the relevant user that the operation requested to be performed will require obtaining and using the information of the relevant user, so that the relevant user can independently choose whether to provide information to software or hardware such as an electronic device, application, server or storage medium that executes the operation of the technical solution of the present disclosure based on the prompt message.
[0029] As an optional but non-limiting implementation, in response to receiving an active request from a relevant user, a prompt message is sent to the relevant user, for example, in the form of a pop-up window, in which the prompt message may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to select "agree" or "disagree" to provide information to the electronic device.
[0030] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0031] Cloud storage is a cloud computing model that can store data and files on the Internet, and users can access these data and files. With the development of cloud storage technology and the increasing demand for computing power by enterprises, edge computing, multi-cloud, hybrid cloud and other related applications are becoming more and more widespread. Nowadays, more and more companies are beginning to adopt Kubernetes (abbreviated as K8s) to accelerate the development and deployment process of modern applications. However, a single Kubernetes cluster can accommodate a limited number of nodes, and its performance is easily limited. On the other hand, if a large number of nodes are stored in a single K8s cluster, when an IDC in the same region fails, other IDCs in the same region in the cluster may also be affected.
[0032] Based on this, the embodiment of the present disclosure provides a resource management method. As a resource management service, the method can be applied to a centralized server. The server can be a terminal such as a computer or a tablet. There is a CMDB (Configuration Management Database) on the server. The K8s cluster can be set up in an edge computer room or centrally deployed according to the actual usage scenario. Multiple IDCs (Internet Data Centers) can share the K8s cluster. The resource management service on the server can manage the K8s cluster. The specific architecture is as follows: Figure 1 shown.
[0033] According to an embodiment of the present disclosure, a resource management method embodiment is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0034] In this embodiment, a resource management method is provided, which can be used for the above-mentioned server. Figure 2 is a flow chart of a resource management method according to an embodiment of the present disclosure, such as Figure 2 As shown, the process includes the following steps:
[0035] Step S101: receiving a resource management request sent by a target node.
[0036] The resource management request carries the identifier of the data center to which the target node belongs.
[0037] The target node can be a physical server or a cloud host. The data center is an IDC. Each node has its corresponding data center. The regional operator data center corresponding to each node can be determined based on the node's coordinate information.
[0038] When the target node needs to be managed, the target node sends a resource management request to the server. The resource management request contains the data center identifier to which the target node belongs, that is, the data center corresponding to the target node can be determined based on the resource management request.
[0039] Step S102: matching in existing resource clusters based on the data center identifier to determine the target cluster to which the target node belongs.
[0040] A resource cluster refers to multiple K8s clusters. Each K8s cluster can have multiple planned data centers. The correspondence between clusters and data centers is stored in the CMDB on the server.
[0041] The resource management service on the server side queries the CMDB for the K8s cluster that matches the data center based on the data center identifier in the resource management request. During the query process, there may be a K8s cluster that has stored the data center, and the target cluster to which the target node belongs can be directly determined. In addition, it is also possible that the cluster to which the data center belongs has not been queried. The cluster that is most suitable for storing the current data center can be selected based on the current storage conditions of each cluster. The cluster that can be stored in the data center is the target cluster to which the target node belongs. After determining the target cluster, if the correspondence between the target cluster and the data center to which the target node belongs is not originally stored in the CMDB, it will be stored.
[0042] Step S103, obtaining a target token corresponding to the target cluster, wherein the target token is valid within a preset time.
[0043] After determining the target cluster to which the target node belongs, the target token of the target cluster is obtained through the designated proxy interface. The target token can be set to be valid within a preset time to ensure that it will not be used by other nodes and ensure data security. In this embodiment, the designated proxy interface refers to the cluster proxy interface, which can be K8s-apiserver here.
[0044] Step S104: Generate a resource management script based on the identifier of the target cluster and the target token.
[0045] Each cluster has a corresponding identifier. After obtaining the target token of the target cluster, the server renders it through a preset script, fills the corresponding fields in the preset script with the representation of the target cluster, the target token and other information, and generates a resource management script. The resource management script includes node initialization information (node initialization), cluster joining information (join cluster), and labeling the node after successful access. Among them, node initialization can include formatting disks, making partitions, configuring iptables (firewall) rules, configuring network card information and other data.
[0046] Step S105: Send the resource management script to the target node, so that the target node joins the target cluster based on the resource management script.
[0047] After generating the resource management script, the server sends the resource management script to the target node. After receiving the resource management script, the target node executes the resource management script and joins the target cluster.
[0048] The schematic diagram of the scenario corresponding to the resource management method provided in the embodiment of the present disclosure is as follows Figure 3As shown, the server receives a resource management request from the target node, and matches the target node in the existing resource cluster according to the data center identifier carried in the resource management request, thereby determining the target cluster to which the target node belongs. The server obtains the target token corresponding to the target cluster, and generates a resource management script based on the target token and the identifier of the target cluster, and sends the resource management script to the target node so that the target node joins the target cluster based on the resource management script. This method can be specific to the data center level when managing nodes, and management can be performed at the data center level, which solves the problem of limited capacity of a single cluster and has strong scalability. In addition, there is no need to operate the cluster, nor is there any need to perceive how many clusters currently exist, which reduces the usage threshold and operation complexity, and improves operation and maintenance efficiency.
[0049] In this embodiment, a resource management method is provided, which can be used for the above-mentioned server. Figure 4 is a flow chart of a resource management method according to an embodiment of the present disclosure, such as Figure 4 As shown, the process includes the following steps:
[0050] Step S201: receiving a resource management request sent by a target node.
[0051] For details, please see Figure 2 Step S101 of the illustrated embodiment will not be described in detail here.
[0052] Step S202: matching in existing resource clusters based on the data center identifier to determine the target cluster to which the target node belongs.
[0053] Specifically, the above step S202 includes:
[0054] Step S2021: Determine whether the data center identifier has a corresponding first resource cluster in the existing resource clusters.
[0055] The existing resource cluster can be one or more K8s clusters, each cluster can store multiple data centers, and the data center stores one or more nodes. The corresponding relationship between K8s and data centers is stored in the CMDB on the server side. According to the data center identifier, it is queried in the existing resource cluster whether there is a first resource cluster corresponding to the data center, that is, the first resource cluster storing the data center.
[0056] Step S2022: If there is a corresponding first resource cluster, determine that the target cluster to which the target node belongs is the first resource cluster.
[0057] When it is found that there is a first resource cluster corresponding to the data center, it can be determined as a target cluster that can be stored in the target node.
[0058] In some optional embodiments, step S2021 includes:
[0059] Step a1: querying in a resource cluster database based on the data center identifier to determine whether there is a corresponding first resource cluster in the existing resource clusters for the data center identifier.
[0060] The resource cluster database is used to represent the identifiers of the data centers included in the existing resource cluster.
[0061] The resource cluster database is a CMDB, which is stored on the server side. The resource cluster database stores the identifier of the data center and the data center stored in the existing resource cluster. After receiving the resource management request, the resource management service on the server side queries the resource cluster database based on the data center identifier to determine whether the corresponding relationship between the data center and the cluster has been stored.
[0062] The above step S202 also includes:
[0063] Step S2023: If there is no corresponding first resource cluster, obtain the remaining capacity of the existing resource cluster.
[0064] The resource management database on the server also stores the capacity limit of each cluster and the number of nodes that have been stored. Based on the capacity limit and the number of nodes that have been stored, the remaining capacity of each cluster can be calculated, and the remaining capacity represents the number of nodes that can be stored at present.
[0065] When no first resource cluster corresponding to the data center is found, the remaining capacity of each cluster determined in the resource management database is calculated.
[0066] Step S2024: Determine the target cluster to which the target node belongs based on the remaining capacity of the existing resource cluster.
[0067] Each resource cluster is scored based on the remaining capacity. The remaining capacity is positively correlated with the score, that is, the higher the remaining capacity, the higher the score. The cluster with the highest score is determined as the target cluster. Among them, it can be set to score only clusters whose remaining capacity is greater than a certain capacity threshold. If only one cluster has a remaining capacity greater than the capacity threshold, then this cluster is directly used as the target cluster.
[0068] In some optional embodiments, the above step S2024 includes:
[0069] Step b1, based on the data center identifier, determine the target area to which the target node belongs.
[0070] The data center identifier can be used to characterize the corresponding data center. The data center identifier carries the regional information of the data center. The regional information may include the coordinates of the data center, the province or city to which it belongs, etc., thereby determining the target region to which the target node belongs.
[0071] Step b2: determining the number of data centers belonging to the target area in an existing resource cluster, wherein the existing resource cluster includes at least one data center.
[0072] The number of data centers belonging to the target area in each existing resource cluster is counted. There may be data centers belonging to the target area in each cluster, that is, data centers in the same area can be stored in different clusters.
[0073] Step b3: determining the target cluster to which the target node belongs based on the remaining capacity of the existing resource cluster and the number of data centers belonging to the target area.
[0074] Based on the remaining capacity of each cluster and the number of data centers belonging to the target area stored in each cluster, each cluster is scored to further determine the most matching target cluster.
[0075] Further, step b3 includes:
[0076] Step b31: based on the remaining capacity of the existing resource cluster, determine a first score value of the existing resource cluster as the target cluster, wherein the first score value is positively correlated with the remaining capacity.
[0077] Each cluster is scored according to the remaining capacity of each cluster, and the obtained score is a first score value. The higher the remaining capacity, the higher the first score value.
[0078] Step b32: determining a second score value of the existing resource cluster as the target cluster based on the number of data centers belonging to the target area, wherein the second score value is negatively correlated with the number of data centers belonging to the target area.
[0079] Count the number of data centers belonging to the target area in each existing resource cluster. There may be data centers belonging to the target area in each cluster, that is, data centers in the same area can be stored in different clusters. In the same cluster, if there are more data centers in the same area, when any data center fails, other data centers in the same area may fail. Based on this, in this embodiment, the number of data centers belonging to the target area in the cluster is scored. The higher the number, the lower the second score. Take the region as a consideration to avoid too many data centers in the same area in the same cluster, thereby improving disaster recovery efficiency.
[0080] Step b33: Determine a target score for the existing resource cluster as the target cluster based on a fusion result of the first score value and the second score value.
[0081] The first score value and the second score value are comprehensively considered and merged, and specifically, the calculation can be performed according to a preset calculation formula to determine the target score of each cluster.
[0082] Step b34: determining the target cluster to which the target node belongs based on the target scores corresponding to the existing resource clusters.
[0083] By sorting the target scores of the clusters, the target cluster with the highest target score can be determined as the target cluster to which the target node belongs, that is, the target cluster that is most suitable for storage of the target node.
[0084] Step S203, obtaining a target token corresponding to the target cluster, wherein the target token is valid within a preset time.
[0085] Specifically, the above step S203 includes:
[0086] Step S2031, sending a token request to the cluster proxy interface.
[0087] The token request carries the identifier of the target cluster, and the cluster proxy interface corresponds to the existing resource cluster.
[0088] The cluster proxy interface is a proxy interface that can be used as a unified interface for all clusters. It can be used for resource acquisition and verification of each cluster, and supports cross-cluster operations. The cluster proxy interface corresponds to all existing resource clusters. The token request carries the identifier of the target cluster, so that the cluster proxy interface determines the target cluster through the identifier of the target cluster. After determining the target cluster, send a token request to the cluster proxy interface.
[0089] The server also has a cluster management interface and a query management script interface. The query management script interface is used to obtain the resource management script so that the target node can join the matching cluster. The cluster management interface is used to change the cluster according to actual needs. Specific change operations may include adding a cluster, updating a cluster, deleting a cluster, etc.
[0090] Step S2032: receiving a target token fed back by the cluster proxy interface based on the identifier of the target cluster.
[0091] The cluster proxy interface determines the target cluster through the target cluster identifier, and then determines to generate the target token corresponding to the target cluster, and sends the target token to the resource management service on the server side. The target token can be set to be valid within a preset time.
[0092] Step S204: Generate a resource management script based on the identifier of the target cluster and the target token.
[0093] Specifically, the above step S204 includes:
[0094] Step S2041: Render the resource management template based on the identifier of the target cluster and the target token to generate a resource management script.
[0095] The resource management service on the server side stores the resource management template, renders the resource management script according to the received target cluster identifier and target token, fills the preset fields in the resource management script, and generates the resource management script after rendering. The resource management script may include node initialization information (node initialization), cluster joining information (join cluster), and labeling the node after successful access. Among them, node initialization may include data such as formatting the disk, making partitions, configuring iptables rules, and configuring network card information.
[0096] Step S205: Send the resource management script to the target node, so that the target node joins the target cluster based on the resource management script.
[0097] For details, please see Figure 2 Step S105 of the illustrated embodiment will not be described in detail here.
[0098] In some optional embodiments, the resource management method further includes: identifying the target node, wherein the content of the identification includes the data center identification.
[0099] After the target node joins the target cluster by executing the resource management script, the target node is identified, that is, the target node is labeled, and the identification content includes the data center identification.
[0100] Since there may be many nodes stored in the cluster and different nodes come from different data centers, marking the nodes makes it easier to understand which nodes are in each data center and facilitate screening.
[0101] The resource management method provided by the embodiment of the present disclosure queries whether there is a target cluster to which the target node belongs. If not, planning is performed for the target node by means of scoring. In the planning process, factors such as the remaining capacity of the cluster and the data centers in the same area of the cluster are taken into consideration to avoid too many data centers in the same area in the same cluster, improve the disaster recovery rate, and solve the problem of limited capacity of a single cluster. When managing nodes, management is performed at the data center level. One cluster can manage multiple data center resources and has high scalability. A unified cluster proxy interface is abstracted. When managing nodes, there is no need to worry about specific clusters, which reduces the usage threshold and operation complexity and improves operation and maintenance efficiency.
[0102] In this embodiment, a resource management method is provided, such as Figure 5 As shown. The resource management service and CMDB are on the server side, and K8s-apiserver is the cluster proxy interface. When a node needs to be managed, the node requests the management script from the resource management service on the server side and initiates a resource management request. The resource management service queries the CMDB based on the data center related information of the node in the resource management request and determines the corresponding K8s cluster. Obtain the target token from the cluster proxy interface, assemble the management script based on the obtained target token, and send the obtained management script to the node. The node joins the target K8s cluster by executing the management script.
[0103] In this embodiment, a resource management method is provided, which can be used for the above-mentioned server. Figure 6 is a flow chart of a resource management method according to an embodiment of the present disclosure, such as Figure 6 As shown, the process includes the following steps:
[0104] Step S301: Obtain a first deployment request of a workload.
[0105] The first deployment request carries an identifier of a target data center.
[0106] When a workload needs to be deployed, the user initiates a first deployment request, specifies the data center to be deployed in the first deployment request, and deploys the workload by calling the resource management service SDK (Software Development Kit). The first deployment request includes a description file, which specifies the target data center to which the workload needs to be deployed and provides the identifier of the target data center.
[0107] Step S302: determining the second resource cluster to which the target data center belongs based on the identifier of the target data center.
[0108] The resource management service on the server side searches the CMDB for the second resource cluster planned for the data center according to the data center identifier in the resource management request. During the query process, the query is performed according to the regional information of the data center.
[0109] Step S303: deploy the workload to the target data center of the second resource cluster.
[0110] After querying the second resource cluster from the CMDB, the resource management service deploys the workload to the target data center in the corresponding second resource cluster.
[0111] In some optional embodiments, step S303 includes: sending a second deployment request for the workload to the cluster proxy interface to deploy the workload to the target data center of the second resource cluster based on the cluster proxy interface, the second deployment request carrying an identifier of the second resource cluster and an identifier of the target data center.
[0112] After the resource management service queries the second resource cluster from the CMDB, it sends a second deployment request through the cluster proxy interface. The second deployment request carries the identifier of the second resource cluster and the identifier of the target data center, and deploys the workload to the target data center in response to the second deployment request.
[0113] The resource management method provided by the embodiment of the present disclosure has a scenario flow chart as shown in Figure 7 As shown in the figure, a unified cluster proxy interface is abstracted, which can be directly deployed to a specific data center, solving the problem of a single cluster capacity limit. There is no need to operate the cluster, which reduces the usage threshold and operation complexity, improves operation and maintenance efficiency, and shields the underlying complexity.
[0114] In the present embodiment, a resource management device is also provided, and the device is used to implement the above-mentioned embodiments and implementation methods, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware is also possible and conceived.
[0115] This embodiment provides a resource management device, such as Figure 8 As shown, including:
[0116] The request receiving module 401 is used to receive a resource management request sent by a target node, wherein the resource management request carries an identifier of a data center to which the target node belongs;
[0117] A cluster determination module 402, configured to match the existing resource clusters based on the data center identifier to determine the target cluster to which the target node belongs;
[0118] A token acquisition module 403 is used to acquire a target token corresponding to the target cluster, where the target token is valid within a preset time;
[0119] A script determination module 404, configured to generate a resource management script based on the identifier of the target cluster and the target token;
[0120] The node joining module 405 is used to send the resource management script to the target node, so that the target node joins the target cluster based on the resource management script.
[0121] In some optional implementations, the cluster determination module 402 includes:
[0122] A first resource cluster determining unit, configured to determine whether the data center identifier has a corresponding first resource cluster in the existing resource clusters;
[0123] The first target cluster determining unit is configured to determine that the target cluster to which the target node belongs is the first resource cluster if there is a corresponding first resource cluster.
[0124] In some optional implementations, the first target cluster determining unit includes:
[0125] The first target cluster determination subunit is used to query in a resource cluster database based on the data center identifier to determine whether the data center identifier has a corresponding first resource cluster in the existing resource cluster. The resource cluster database is used to represent the identifier of the data center included in the existing resource cluster.
[0126] In some optional implementations, the cluster determination module 402 further includes:
[0127] A remaining capacity acquisition unit, configured to acquire the remaining capacity of the existing resource cluster if there is no corresponding first resource cluster;
[0128] The second target cluster determining unit is configured to determine the target cluster to which the target node belongs based on the remaining capacity of the existing resource cluster.
[0129] In some optional implementations, the second target cluster determining unit includes:
[0130] A target area determination subunit, configured to determine a target area to which the target node belongs based on the data center identifier;
[0131] A data center quantity determination subunit, configured to determine the number of data centers belonging to a target area in the existing resource cluster, wherein the existing resource cluster includes at least one data center;
[0132] The target cluster determination subunit is used to determine the target cluster to which the target node belongs based on the remaining capacity of the existing resource cluster and the number of data centers belonging to the target area.
[0133] In some optional implementations, the target cluster determination subunit includes:
[0134] A first score value determination subunit, configured to determine, based on the remaining capacity of the existing resource cluster, a first score value of the existing resource cluster as the target cluster, wherein the first score value is positively correlated with the remaining capacity;
[0135] A second score value determination subunit, configured to determine a second score value of the existing resource cluster as the target cluster based on the number of data centers belonging to the target area, wherein the second score value is negatively correlated with the number of data centers belonging to the target area;
[0136] a target score determination subunit, configured to determine a target score for the existing resource cluster to be the target cluster based on a fusion result of the first score and the second score;
[0137] The cluster determination subunit is used to determine the target cluster to which the target node belongs based on the target scores corresponding to the existing resource clusters.
[0138] In some optional implementations, the script determination module 404 includes:
[0139] The template rendering unit is used to render the resource management template based on the identifier of the target cluster and the target token to generate the resource management script.
[0140] In some optional implementations, the token acquisition module 403 includes:
[0141] A token request sending unit, configured to send a token request to a cluster proxy interface, wherein the token request carries an identifier of the target cluster, and the cluster proxy interface corresponds to the existing resource cluster;
[0142] The token receiving unit is configured to receive the target token fed back by the cluster proxy interface based on the identifier of the target cluster.
[0143] In some optional embodiments, the device further comprises:
[0144] A node identification module is used to identify the target node, and the content of the identification includes the data center identification.
[0145] In some optional embodiments, the device further comprises:
[0146] A first deployment acquisition module, configured to acquire a first deployment request of a workload, wherein the first deployment request carries an identifier of a target data center;
[0147] A second resource cluster determining module, configured to determine the second resource cluster to which the target data center belongs based on the identifier of the target data center;
[0148] A workload deployment module is used to deploy the workload to a target data center of the second resource cluster.
[0149] In some optional implementations, the second resource cluster determination module includes:
[0150] The second resource cluster determination unit is used to send a second deployment request for the workload to the cluster proxy interface to deploy the workload to the target data center of the second resource cluster based on the cluster proxy interface, and the second deployment request carries the identifier of the second resource cluster and the identifier of the target data center.
[0151] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0152] The resource management device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0153] The present disclosure also provides a computer device having the above Figure 8 The resource management device shown.
[0154] See also Fig. 9 , Fig. 9 is a schematic diagram of a computer device provided by an optional embodiment of the present disclosure, such as Fig. 9 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Fig. 9 A processor 10 is taken as an example.
[0155] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0156] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.
[0157] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0158] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0159] The computer device further comprises a communication interface 30 for the computer device to communicate with other devices or a communication network.
[0160] The embodiments of the present disclosure also provide a computer-readable storage medium. The above-mentioned method according to the embodiments of the present disclosure can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium and downloaded through a network, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state drive, etc.; further, the storage medium can also include a combination of the above-mentioned types of memory. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0161] A part of the present disclosure may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present disclosure through the operation of the computer. Those skilled in the art should understand that the existence of computer program instructions in computer-readable media includes, but is not limited to, source files, executable files, installation package files, etc., and accordingly, the way in which computer program instructions are executed by a computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to the computer.
[0162] Although the embodiments of the present disclosure have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present disclosure, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A resource management method, It is characterized in that The method comprises: Receive a resource management request sent by a target node, wherein the resource management request carries an identifier of a data center to which the target node belongs; Based on the data center identifier, matching is performed in an existing resource cluster to determine a target cluster to which the target node belongs, where the existing resource cluster includes at least one data center, and the data center is used to store one or more of the target nodes; Obtain a target token corresponding to the target cluster, where the target token is valid within a preset time; Generate a resource management script based on the identifier of the target cluster and the target token; The resource management script is sent to the target node, so that the target node joins the target cluster based on the resource management script.
2. The method according to claim 1, It is characterized in that The matching in the existing resource clusters based on the data center identifier to determine the target cluster to which the target node belongs includes: Determine whether the data center identifier has a corresponding first resource cluster in the existing resource clusters; If there is a corresponding first resource cluster, it is determined that the target cluster to which the target node belongs is the first resource cluster.
3. The method according to claim 2, It is characterized in that The determining whether the data center identifier has a corresponding first resource cluster in the existing resource clusters includes: A query is performed in a resource cluster database based on the data center identifier to determine whether the data center identifier has a corresponding first resource cluster in the existing resource cluster. The resource cluster database is used to represent identifiers of data centers included in the existing resource cluster.
4. The method according to claim 2, It is characterized in that The matching in the existing resource clusters based on the data center identifier to determine the target cluster to which the target node belongs also includes: If there is no corresponding first resource cluster, obtaining the remaining capacity of the existing resource cluster; Based on the remaining capacity of the existing resource cluster, a target cluster to which the target node belongs is determined.
5. The method according to claim 4, It is characterized in that The determining, based on the remaining capacity of the existing resource cluster, the target cluster to which the target node belongs includes: Based on the data center identifier, determining a target area to which the target node belongs; Determining the number of data centers belonging to the target area in the existing resource cluster; Based on the remaining capacity of the existing resource cluster and the number of data centers belonging to the target area, a target cluster to which the target node belongs is determined.
6. The method according to claim 5, It is characterized in that The determining, based on the remaining capacity of the existing resource cluster and the number of data centers belonging to the target area, the target cluster to which the target node belongs includes: Based on the remaining capacity of the existing resource cluster, determining a first score value of the existing resource cluster as the target cluster, where the first score value is positively correlated with the remaining capacity; Based on the number of data centers belonging to the target area, determining a second score value for the existing resource cluster to be the target cluster, wherein the second score value is negatively correlated with the number of data centers belonging to the target area; Based on a fusion result of the first score value and the second score value, determining that the existing resource cluster is a target score of the target cluster; The target cluster to which the target node belongs is determined based on the target scores corresponding to the existing resource clusters.
7. The method according to claim 1, It is characterized in that The generating a resource management script based on the identifier of the target cluster and the target token includes: Based on the identifier of the target cluster and the target token, the resource management template is rendered to generate the resource management script.
8. The method according to claim 1, It is characterized in that The obtaining of the target token corresponding to the target cluster includes: Sending a token request to a cluster proxy interface, wherein the token request carries an identifier of the target cluster, and the cluster proxy interface corresponds to the existing resource cluster; The target token fed back by the cluster proxy interface based on the identifier of the target cluster is received.
9. The method according to claim 1, It is characterized in that The method further includes: identifying the target node, wherein the content of the identification includes the data center identification.
10. The method according to any one of claims 1 to 9, It is characterized in that The method further comprises: Obtaining a first deployment request for the workload, wherein the first deployment request carries an identifier of a target data center; Determine, based on the identifier of the target data center, a second resource cluster to which the target data center belongs; The workload is deployed to a target data center of the second resource cluster.
11. The method according to claim 10, It is characterized in that The deploying the workload to a target data center of the second resource cluster includes: A second deployment request for the workload is sent to the cluster proxy interface to deploy the workload to the target data center of the second resource cluster based on the cluster proxy interface, wherein the second deployment request carries an identifier of the second resource cluster and an identifier of the target data center.
12. A resource management device, It is characterized in that The device comprises: A request receiving module, used to receive a resource management request sent by a target node, wherein the resource management request carries an identifier of a data center to which the target node belongs; A cluster determination module, used to match in an existing resource cluster based on the data center identifier to determine a target cluster to which the target node belongs, wherein the existing resource cluster includes at least one data center, and the data center is used to store one or more of the target nodes; A token acquisition module, used to acquire a target token corresponding to the target cluster, wherein the target token is valid within a preset time; A script determination module, used to generate a resource management script based on the identifier of the target cluster and the target token; The node joining module is used to send the resource management script to the target node, so that the target node joins the target cluster based on the resource management script.
13. A computer device, It is characterized in that include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the resource management method according to any one of claims 1 to 11 by executing the computer instructions.
14. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the resource management method according to any one of claims 1 to 11.
15. A computer program product, It is characterized in that The method comprises computer instructions, wherein the computer instructions are used to cause a computer to execute the resource management method according to any one of claims 1 to 11.
