Cluster capacity expansion method and device, equipment and storage medium
By obtaining the target configuration data of the cluster master node, creating and deploying container instances, and realizing online expansion of the cluster, the problem of cluster expansion in the existing technology requires the shutdown of cluster capacity, and improving the utilization rate and responsiveness of the cluster.
Patent Information
- Application Number
- CN202411805120.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-09
- Publication Date
- 2025-04-01
AI Technical Summary
When the existing technology expands the independent deployment cluster, it is necessary to shut down the entire cluster, resulting in the cluster being unavailable and affecting user request response and usage efficiency.
By obtaining the target configuration data of the cluster master node, creating a container instance, deploying it to the container node, returning the instance IP, and mounting it to the cluster, realizing online expansion of the cluster.
The online expansion of the cluster is achieved, avoiding unavailability problems caused by cluster shutdown and restart, and improving the utilization rate and responsiveness of the cluster.
Smart Images

Figure CN119739515A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a cluster expansion method, device, equipment and storage medium. Background Art
[0002] For a standalone deployment cluster, the cluster can only select the deployment method, specifications, and number of master nodes when creating the cluster. If the resource requirements cannot be accurately estimated when creating the cluster, the master node may be overloaded, which in turn affects the overall availability of the cluster. Therefore, cluster expansion is an urgent problem that needs to be solved.
[0003] In the related art, when the master node needs to be expanded, the entire cluster needs to be shut down first, and then a new physical device is added as the expanded node, and the entire cluster is restarted based on the new device and the previous device.
[0004] However, shutting down and restarting the entire cluster will cause the entire cluster to be unavailable, and thus unable to respond to user requests, reducing the efficiency of cluster utilization. Summary of the invention
[0005] The present application provides a cluster expansion method, apparatus, device and storage medium, which can expand the cluster online without shutting down the cluster, avoid the unavailability problem caused by cluster shutdown and restart, and improve the utilization rate of the cluster.
[0006] In a first aspect, the present application provides a cluster expansion method, the method comprising:
[0007] When the cluster is expanded, the target configuration data of the master node in the cluster is obtained;
[0008] Using the target configuration data, create a container instance;
[0009] Send the container instance to a container node so that the container node deploys the container instance and returns an instance IP of the instance node, where the instance node is the node that completes the deployment of the container instance;
[0010] The instance IP is mounted to the cluster, so that the cluster uses the instance node corresponding to the instance IP as the node expanded by the cluster to process the data received by the cluster.
[0011] Optionally, the creating a container instance by using the target configuration data includes:
[0012] Obtain target configuration data and target load of the master node;
[0013] Determine the target number of container instances to be created according to the target load and the preset correspondence between the load and the number;
[0014] Using the configuration data, the target number of container instances are created.
[0015] Optionally, mounting the instance IP to the cluster includes:
[0016] Generate an IP adding request according to the instance IP;
[0017] The IP adding request is sent to the cluster, so that the cluster mounts the instance IP to the cluster by adding the IP in the IP adding request to the IP set corresponding to the cluster.
[0018] Optionally, the method further includes:
[0019] Obtaining a target load of a master node in the cluster;
[0020] Detecting whether the target load of the master node is greater than a first preset value;
[0021] When it is detected that the target load of the master node is greater than a first preset value, it is determined to expand the capacity of the master node in the cluster.
[0022] Optionally, the method further includes:
[0023] When an IP deletion instruction is received, the IP deletion instruction is parsed to obtain a target IP in the IP deletion instruction;
[0024] When the target IP is a non-instance IP, a message indicating that the IP cannot be deleted is generated and the message is displayed;
[0025] When the target IP is an instance IP, an IP deletion request is generated according to the target IP, and the IP deletion request is sent to the cluster, so that the cluster performs data transfer based on the target IP and deletes the target IP in the IP set.
[0026] Optionally, the method further includes:
[0027] When it is detected that the target load of the master node is less than a second preset value, determining the target number of instance IPs to be removed according to the target load of the master node;
[0028] According to the load of the node corresponding to each instance IP, obtain the load corresponding to each instance IP;
[0029] According to the load corresponding to each instance IP, determine the target number of instance IPs with the minimum corresponding load, and obtain the target number of target IPs;
[0030] An IP deletion request is generated according to the target IP, and the IP deletion request is sent to the cluster, so that the cluster transfers data based on the target IP and deletes the target IP in the IP set.
[0031] Optionally, the method further includes:
[0032] Check whether the node expansion instruction triggered by the user on the node expansion page is received;
[0033] When a node expansion instruction triggered by a user on a node expansion page is received, it is determined to expand the cluster.
[0034] In a second aspect, the present application provides a cluster expansion device, the device comprising:
[0035] An acquisition unit, used for acquiring target configuration data of a master node in the cluster when the cluster is expanded;
[0036] A creation unit, used to create a container instance using the target configuration data;
[0037] A sending unit, configured to send the container instance to a container node so that the container node deploys the container instance and returns an instance IP of the instance node, where the instance node is a node that completes the deployment of the container instance;
[0038] The mounting unit is used to mount the instance IP to the cluster, so that the cluster uses the instance node corresponding to the instance IP as the node expanded by the cluster to process the data received by the cluster.
[0039] Optionally, the creation unit is used to:
[0040] Obtain target configuration data and target load of the master node;
[0041] Determine the target number of container instances to be created according to the target load and the preset correspondence between the load and the number;
[0042] Using the configuration data, the target number of container instances are created.
[0043] Optionally, the mounting unit is used to:
[0044] Generate an IP adding request according to the instance IP;
[0045] The IP adding request is sent to the cluster, so that the cluster mounts the instance IP to the cluster by adding the IP in the IP adding request to the IP set corresponding to the cluster.
[0046] Optionally, the device further comprises a detection unit, wherein the detection unit is used to:
[0047] Obtaining a target load of a master node in the cluster;
[0048] Detecting whether the target load of the master node is greater than a first preset value;
[0049] When it is detected that the target load of the master node is greater than a first preset value, it is determined to expand the capacity of the master node in the cluster.
[0050] Optionally, the device further includes a first deleting unit, wherein the first deleting unit is configured to:
[0051] When an IP deletion instruction is received, the IP deletion instruction is parsed to obtain a target IP in the IP deletion instruction;
[0052] When the target IP is a non-instance IP, a message indicating that the IP cannot be deleted is generated and the message is displayed;
[0053] When the target IP is an instance IP, an IP deletion request is generated according to the target IP, and the IP deletion request is sent to the cluster, so that the cluster performs data transfer based on the target IP and deletes the target IP in the IP set.
[0054] Optionally, the device further includes a second deleting unit, wherein the second deleting unit is configured to:
[0055] When it is detected that the target load of the master node is less than a second preset value, determining the target number of instance IPs to be removed according to the target load of the master node;
[0056] According to the load of the node corresponding to each instance IP, obtain the load corresponding to each instance IP;
[0057] According to the load corresponding to each instance IP, determine the target number of instance IPs with the minimum corresponding load, and obtain the target number of target IPs;
[0058] An IP deletion request is generated according to the target IP, and the IP deletion request is sent to the cluster, so that the cluster transfers data based on the target IP and deletes the target IP in the IP set.
[0059] Optionally, the device further includes a receiving unit, wherein the receiving unit is configured to:
[0060] Check whether the node expansion instruction triggered by the user on the node expansion page is received;
[0061] When a node expansion instruction triggered by a user on a node expansion page is received, it is determined to expand the cluster.
[0062] In a third aspect, the present application provides a cluster expansion device, comprising: at least one communication interface; at least one bus connected to the at least one communication interface; at least one processor connected to the at least one bus; at least one memory connected to the at least one bus, wherein the processor is configured to:
[0063] When the cluster is expanded, the target configuration data of the master node in the cluster is obtained;
[0064] Using the target configuration data, create a container instance;
[0065] Send the container instance to a container node so that the container node deploys the container instance and returns an instance IP of the instance node, where the instance node is the node that completes the deployment of the container instance;
[0066] The instance IP is mounted to the cluster, so that the cluster uses the instance node corresponding to the instance IP as the node expanded by the cluster to process the data received by the cluster.
[0067] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, and the computer program implements the above-mentioned cluster expansion method when executed by a processor.
[0068] The above technical solution provided by the embodiment of the present application has the following advantages over the prior art: in the embodiment of the present application, when the cluster is expanded, the target configuration data of the master node in the cluster is obtained; the target configuration data is used to create a container instance; the container instance is sent to the container node so that the container node deploys the container instance and returns the instance IP of the instance node, which is the node that completes the deployment of the container instance; the instance IP is mounted to the cluster so that the cluster uses the instance node corresponding to the instance IP as the node expanded by the cluster to process the data received by the cluster. Since the present application creates a container instance and then mounts the node deployed with the container instance to the cluster, the cluster expansion is realized. Therefore, the present application can expand the cluster online without shutting down the cluster, which can avoid the unavailability of the cluster due to shutdown and restart, and improve the utilization rate of the cluster. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0070] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0071] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0072] Figure 1 A schematic diagram of a cluster expansion method provided in an embodiment of the present application;
[0073] Figure 2 A flowchart of a container instance creation method provided in an embodiment of the present application;
[0074] Figure 3 A flowchart of an IP adding method provided in an embodiment of the present application;
[0075] Figure 4 A flow chart of a load detection method provided in an embodiment of the present application;
[0076] Figure 5 A flowchart of another IP deletion method provided in an embodiment of the present application;
[0077] Figure 6 A flowchart of a target IP deletion method provided in an embodiment of the present application;
[0078] Figure 7 A flowchart of another instruction detection method provided in an embodiment of the present application;
[0079] Figure 8 A schematic diagram of a process flow of a cluster expansion device provided in an embodiment of the present application;
[0080] Fig. 9 A schematic diagram of a cluster expansion device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0081] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0082] The disclosure below provides many different embodiments or examples to implement different structures of the present invention. In order to simplify the disclosure of the present invention, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present invention. In addition, the present invention can repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed.
[0083] In the related art, when the master node needs to be expanded, the entire cluster needs to be shut down first, and then a new physical device is added as the expanded node, and the entire cluster is restarted based on the new device and the previous device. However, shutting down and restarting the entire cluster will make the entire cluster unavailable, and thus unable to respond to user requests, reducing the efficiency of cluster utilization.
[0084] In order to solve the above problems, the embodiment of the present application provides a cluster expansion method, which can avoid the unavailability problem caused by cluster shutdown and restart, and further avoid the problem that the cluster cannot respond to user requests, such as Figure 1 As shown, the specific steps include:
[0085] Step 101, when expanding the capacity of a cluster, obtaining target configuration data of a master node in the cluster.
[0086] Among them, the configuration data is the data used to generate the container instance, such as the network configuration and resource configuration required to create the container instance. The network configuration includes configuration data related to the private network VPC. In an embodiment of the present application, in order to reduce network latency, the cluster and the nodes where the container instance is deployed can be set in the same VPC, thereby achieving barrier-free data transmission between the cluster and the nodes where the container instance is deployed. The master node is the control node in the cluster, which mainly processes the data received by the cluster.
[0087] In this step, the cluster console periodically detects whether to expand the capacity of the cluster's master node. When it is detected that the cluster's master node needs to be expanded, the cluster console sends a data acquisition request to the cluster, which is used to request the cluster to send the target configuration data of the master node to the cluster console. When the cluster receives the data acquisition request, the cluster will obtain the target configuration data of its own master node and send the target configuration data to the cluster console, so that the cluster console obtains the target configuration data of the master node.
[0088] The cluster console is used to control the cluster through the user or automatically control the cluster. The cluster console includes a front-end program and a back-end program. The front-end program mainly displays the operation page to receive the user's operation instructions, and the back-end program performs the corresponding operation.
[0089] Step 102: Create a container instance using the target configuration data.
[0090] In this step, a container creation component is provided in the cluster console. When the cluster console obtains the target configuration data, the cluster console can send the target configuration data to the container creation component so that the container creation component creates a container instance. When the container creation component detects the target configuration data, it creates a container instance based on the target configuration data and sends the container instance to the cluster console.
[0091] Step 103: Send the container instance to the container node so that the container node deploys the container instance and returns the instance IP of the instance node.
[0092] Among them, the container node can allocate the control node of the instance node to the container instance, and the instance node is the node that completes the deployment of the container instance.
[0093] In this step, the cluster console can send the container instance to the container node. When the container node receives the container instance, the container node will determine the instance node that receives the container instance and send the container instance to the instance node to deploy the container instance to the instance node, and obtain the instance IP of the instance node and return the instance IP to the cluster console as the instance IP.
[0094] Step 104 , mount the instance IP to the cluster, so that the cluster uses the instance node corresponding to the instance IP as a node expanded by the cluster to process the data received by the cluster.
[0095] In this step, after the cluster console receives the instance IP, it sends the instance IP to the cluster so that the cluster adds the instance IP to the IP set. Since the cluster adds the instance IP to the IP set, when the cluster receives data to be processed, the cluster can send the data to be processed to the instance node corresponding to the instance IP, and then the instance node processes the data to be processed. In other words, the instance node corresponding to the instance IP actually becomes a node expanded by the cluster to assist the cluster in processing data.
[0096] In an embodiment of the present application, when the cluster is expanded, the target configuration data of the master node in the cluster is obtained; the target configuration data is used to create a container instance; the container instance is sent to the container node so that the container node deploys the container instance and returns the instance IP of the instance node, which is the node that completes the deployment of the container instance; the instance IP is mounted to the cluster so that the cluster uses the instance node corresponding to the instance IP as the node expanded by the cluster to process the data received by the cluster. Since the present application creates a container instance and then mounts the node deployed with the container instance to the cluster, the cluster expansion is achieved. Therefore, the present application can expand the cluster online without shutting down the cluster, which can avoid the unavailability of the cluster due to shutdown and restart, and improve the utilization rate of the cluster.
[0097] In the embodiment of the present application, the cluster console can create the number of container instances according to the number indicated by the user. Of course, the cluster console can also analyze the master node to determine the number of container instances required, and create the number of container instances according to the number. Therefore, the embodiment of the present application provides a container instance creation method, which is a further limitation of step 102, such as Figure 2 As shown, the specific steps include:
[0098] Step 201, obtaining target configuration data and target load of the master node.
[0099] The load may be a ratio of a node's used memory to its total memory, or a ratio of a node's used storage space to its total storage space, or other data used to represent the node's operating performance.
[0100] In this step, when the load of the master node in the cluster is too large, it means that the data processing pressure of the cluster is too large and the cluster needs to be expanded. Therefore, the cluster console can send a data acquisition request to the cluster, and the data acquisition request is used to obtain the target configuration data and target load of the master node of the cluster. After the cluster receives the data acquisition request, it obtains the target configuration data and target load of the master node, and sends the target configuration data and target load to the cluster console, so that the cluster console obtains the target configuration data and target load of the master node.
[0101] Step 202: Determine the target number of container instances to be created according to the target load and the preset corresponding relationship between the load and the number.
[0102] In this step, when the load of the master node is very large, in order to reduce the pressure of the master node on data processing, more container instances can be created to share the pressure of the master node. When the load of the master node is large, in order to reduce the waste of resources, fewer container instances can be created, thereby reducing the waste of resources caused by creating too many container instances when sharing the pressure of the master node. Therefore, the technician can determine the number of container instances to be created in this case based on the load of the master node, and then establish a corresponding relationship between the load and the number, and store the corresponding relationship in the cluster console. When the cluster control needs to create a container instance, the pre-stored corresponding relationship is obtained, and the target number of container instances to be created is determined based on the target load and the corresponding relationship.
[0103] Step 203: Create a target number of container instances using the configuration data.
[0104] In this step, when the cluster console obtains the configuration data and the target number, the cluster console can send the configuration data and the target number to the container creation component. When the container creation component receives the configuration data and the target number, it creates the target number of container instances according to the configuration data and the target number.
[0105] In the embodiment of the present application, when mounting the instance IP to the cluster, the cluster console can send the instance IP to the cluster, so that the cluster adds the instance IP to the IP set corresponding to the cluster, and then mounts the instance IP to the cluster. Therefore, the embodiment of the present application provides an IP adding method, which is a further limitation of step 104, such as Figure 3 As shown, the specific steps include:
[0106] Step 301: Generate an IP adding request according to the instance IP.
[0107] The IP add request is used to request the cluster to add the IP in the request to the IP set.
[0108] In this step, when the cluster console obtains the instance IP, the cluster console may generate an IP adding request including the instance IP.
[0109] Step 302 : Send an IP add request to the cluster, so that the cluster mounts the instance IP to the cluster by adding the IP in the IP add request to the IP set corresponding to the cluster.
[0110] In this step, the cluster console can send an IP add request to the cluster. After the cluster receives the IP add request, the cluster parses the IP add request to obtain the IP in the IP add request, and at the same time, obtains the IP set used in the load balancing, and adds the IP to the IP set to obtain a new IP set. At the same time, the cluster can also send a successful addition message to the cluster console so that the cluster console can confirm that the IP is successfully added.
[0111] It should be noted that when the cluster receives data to be processed, it uses load balancing technology to determine the node that processes the data. Then, based on the node and the new IP set, the IP of the node is determined, and then based on the IP, the user request is sent to the node corresponding to the IP so that the node processes the data.
[0112] In the embodiment of the present application, the cluster console can also automatically expand the capacity of the master node, thereby realizing the automatic expansion of the cluster. Therefore, the embodiment of the present application also provides a load detection method, which is as follows Figure 4 As shown, the specific steps include:
[0113] Step 401, obtaining the target load of the master node in the cluster.
[0114] This step is similar to the step of obtaining the target load in step 201, and will not be described in detail here.
[0115] Step 402, detecting whether the target load of the master node is greater than a first preset value.
[0116] Among them, the first preset value is set according to the experience of the technicians. When the target load of the master node in the cluster is greater than the first preset value, the technicians determine that the cluster needs to be expanded. When the target load of the master node in the cluster is less than the first preset value, the technicians determine that the cluster does not need to be expanded.
[0117] In this step, after the cluster console obtains the target load of the master node, the cluster console may detect whether the target load of the master node is greater than a first preset value.
[0118] Step 403: When it is detected that the target load of the master node is greater than a first preset value, it is determined to expand the capacity of the master node in the cluster.
[0119] In this step, when it is detected that the target load of the master node is greater than the first preset value, it means that the current data processing volume is too large and the cluster cannot cover the data of this amount. Therefore, the cluster console determines to expand the capacity of the master node in the cluster, and then automatically executes Figure 1 Execute the steps shown.
[0120] In an embodiment of the present application, the cluster console can also display an IP deletion page, which displays an IP filling box and an IP deletion button. The IP filling box is used to fill in the IP to be deleted, and the IP deletion button is used to indicate that the IP in the IP filling box is deleted. After the user fills in the IP in the IP filling box, the user can click the IP deletion button. At this time, the cluster console will receive an IP deletion instruction from the IP deletion button. The IP deletion instruction is generated based on the IP filled in the IP filling box, and then based on the IP deletion instruction, the IP in the IP set is deleted. Therefore, an embodiment of the present application provides an IP deletion method, such as Figure 5 As shown, the specific steps include:
[0121] Step 501, when an IP deletion instruction is received, the IP deletion instruction is parsed to obtain the target IP in the IP deletion instruction.
[0122] Among them, the target IP is the IP filled in the IP filling box, which is the IP to be deleted.
[0123] In this step, when the cluster console receives the IP deletion instruction, the cluster console parses the IP deletion instruction to obtain the target IP in the IP deletion instruction, that is, the IP to be deleted. Since only the instance IP can be deleted, the cluster console also needs to detect whether the target IP is the instance IP to determine whether the target IP can be deleted.
[0124] It should be noted that the IP set includes instance IP and non-instance IP. Instance IP is the node that is expanded and can be deleted in real time, while non-instance IP is the IP corresponding to the node in the cluster. These nodes correspond to physical devices and cannot be directly deleted. Therefore, in order to prevent accidental deletion, it is necessary to first detect whether the target IP is an instance IP. Only when the target IP is an instance IP can it be deleted.
[0125] Step 502: When the target IP is a non-instance IP, a message indicating that the IP cannot be deleted is generated and displayed.
[0126] In this step, when the target IP is a non-instance IP, it indicates that the target IP cannot be deleted. Therefore, the cluster console can generate a message indicating that the IP cannot be deleted, and display the message to inform the user that the indicated IP cannot be deleted.
[0127] Step 503, when the target IP is an instance IP, an IP deletion request is generated according to the target IP, and the IP deletion request is sent to the cluster, so that the cluster performs data transfer based on the target IP and deletes the target IP in the IP set.
[0128] In this step, when the target IP is an instance IP, it means that the target IP can be deleted. Therefore, the cluster console can generate an IP deletion request based on the target IP and send the IP deletion request to the cluster. When the cluster receives the IP deletion request, it parses the IP deletion request to obtain the IP to be deleted, that is, the target IP. Afterwards, in the IP set, other IPs except the target IP are determined, and load balancing technology is used to determine the standby node in the nodes corresponding to other IPs, and then the data in the node corresponding to the target IP is transferred to the standby node. Afterwards, the target IP in the IP set is deleted, and the set composed of the standby IPs is used as the new IP set.
[0129] In the embodiment of the present application, when the traffic volume in a certain period decreases, the cluster console can also automatically delete the instance IP in the IP set to reduce the waste of resources. Therefore, the embodiment of the present application also provides a method for deleting a target IP, such as Figure 6 As shown, the specific steps include:
[0130] Step 601, when it is detected that the target load of the master node is less than a second preset value, the target number of instance IPs to be removed is determined according to the target load of the master node.
[0131] The second preset value is set according to the experience of the technicians.
[0132] In this step, the cluster console can periodically obtain the target load of the master node and detect whether the target load is less than the second preset value. When it is detected that the target load is less than the second preset value, it means that the data processing pressure of the cluster is small, and the redundant instance nodes can be deleted. In order to determine the number of nodes to be deleted, the cluster console can analyze the target load of the master node to determine the target number of instance IPs to be removed.
[0133] Furthermore, technicians can set the correspondence between the load of the master node and the number of instance IPs to be removed based on experience, and store the correspondence in the cluster console. When the cluster console needs to analyze the target load of the master node, the cluster console can determine the number of instance IPs to be removed based on the target load of the master node and the correspondence.
[0134] Step 602: Obtain the load corresponding to each instance IP according to the load of the node corresponding to each instance IP.
[0135] In this step, the cluster console can find the instance node corresponding to each instance IP according to each instance IP, and obtain the load of these instance nodes. After that, the load of the instance node corresponding to each instance IP is determined as the load corresponding to each instance IP.
[0136] Step 603 , according to the load corresponding to each instance IP, determine a target number of instance IPs with the minimum corresponding load, and obtain a target number of target IPs.
[0137] The target IP is the IP to be deleted.
[0138] In this step, each instance IP is sorted in descending order according to the load corresponding to each instance IP to obtain an instance IP sequence. In the instance IP sequence, the last target number of instance IPs is determined, which is the target number of instance IPs with the smallest corresponding load.
[0139] It should be noted that when the load of a node is relatively small, it is easier to transfer the data of the node to other nodes. Therefore, this step adopts the method of first transferring data to the node with a smaller load. Of course, the embodiment of the present application can also first transfer data to the node with a larger load. The specific execution steps are similar to this step and are not limited here.
[0140] Step 604: Generate an IP deletion request based on the target IP, and send the IP deletion request to the cluster, so that the cluster transfers data based on the target IP and deletes the target IP in the IP set.
[0141] In this step, the cluster control center can generate an IP deletion request based on the target IP and send the IP deletion request to the cluster. When the cluster receives the IP deletion request, it parses the IP deletion request to obtain the IP to be deleted, that is, the target IP. Afterwards, in the IP set, other IPs except the target IP are determined, and load balancing technology is used to determine the standby node in the nodes corresponding to other IPs, and then the data in the node corresponding to the target IP is transferred to the standby node. Afterwards, the target IP in the IP set is deleted, and the set composed of the standby IPs is used as the new IP set.
[0142] In the embodiment of the present application, when the business volume in a certain period is about to increase, the user can also control the cluster through the cluster console to achieve cluster expansion. Therefore, the embodiment of the present application also provides an instruction detection method, such as Figure 7 As shown, the specific steps include:
[0143] Step 701: Detect whether a node expansion instruction triggered by a user on a node expansion page is received.
[0144] In this step, the cluster console may also display a node expansion page, on which a node expansion button is provided. The cluster console periodically detects whether a node expansion instruction corresponding to the node expansion button is received.
[0145] Step 702: When receiving a node expansion instruction triggered by a user on a node expansion page, determine to expand the cluster.
[0146] In this step, when the cluster console receives a node expansion instruction triggered by the user on the node expansion page, the cluster console determines to expand the cluster.
[0147] like Figure 8 As shown, an embodiment of the present application provides a cluster expansion device, which corresponds to the method embodiment and specifically includes:
[0148] The acquisition unit 801 is used to acquire target configuration data of the master node in the cluster when the cluster is expanded;
[0149] A creation unit 802, configured to create a container instance using the target configuration data;
[0150] A sending unit 803 is used to send the container instance to a container node so that the container node deploys the container instance and returns an instance IP of the instance node, where the instance node is a node that completes the deployment of the container instance;
[0151] The mounting unit 804 is used to mount the instance IP to the cluster, so that the cluster uses the instance node corresponding to the instance IP as the node expanded by the cluster to process the data received by the cluster.
[0152] Optionally, the creating unit 802 is used to:
[0153] Obtain target configuration data and target load of the master node;
[0154] Determine the target number of container instances to be created according to the target load and the preset correspondence between the load and the number;
[0155] Using the configuration data, the target number of container instances are created.
[0156] Optionally, the mounting unit 804 is used to:
[0157] Generate an IP adding request according to the instance IP;
[0158] The IP adding request is sent to the cluster, so that the cluster mounts the instance IP to the cluster by adding the IP in the IP adding request to the IP set corresponding to the cluster.
[0159] Optionally, the device further includes a detection unit 805, and the detection unit 805 is used to:
[0160] Obtaining a target load of a master node in the cluster;
[0161] Detecting whether the target load of the master node is greater than a first preset value;
[0162] When it is detected that the target load of the master node is greater than a first preset value, it is determined to expand the capacity of the master node in the cluster.
[0163] Optionally, the device further includes a first deleting unit 806, and the first deleting unit 806 is configured to:
[0164] When an IP deletion instruction is received, the IP deletion instruction is parsed to obtain a target IP in the IP deletion instruction;
[0165] When the target IP is a non-instance IP, a message indicating that the IP cannot be deleted is generated and the message is displayed;
[0166] When the target IP is an instance IP, an IP deletion request is generated according to the target IP, and the IP deletion request is sent to the cluster, so that the cluster performs data transfer based on the target IP and deletes the target IP in the IP set.
[0167] Optionally, the device further includes a second deleting unit 807, and the second deleting unit 807 is configured to:
[0168] When it is detected that the target load of the master node is less than a second preset value, determining the target number of instance IPs to be removed according to the target load of the master node;
[0169] According to the load of the node corresponding to each instance IP, obtain the load corresponding to each instance IP;
[0170] According to the load corresponding to each instance IP, determine the target number of instance IPs with the minimum corresponding load, and obtain the target number of target IPs;
[0171] An IP deletion request is generated according to the target IP, and the IP deletion request is sent to the cluster, so that the cluster transfers data based on the target IP and deletes the target IP in the IP set.
[0172] Optionally, the device further includes a receiving unit 808, and the receiving unit 808 is configured to:
[0173] Check whether the node expansion instruction triggered by the user on the node expansion page is received;
[0174] When a node expansion instruction triggered by a user on a node expansion page is received, it is determined to expand the cluster.
[0175] like Fig. 9 As shown, the embodiment of the present application provides a cluster expansion device, including a processor 901, a communication interface 902, a memory 903 and a communication bus 904, wherein the processor 901, the communication interface 902, and the memory 903 communicate with each other through the communication bus 904.
[0176] Memory 903, used for storing computer programs;
[0177] In one embodiment of the present application, the processor 901 is configured to implement the cluster expansion method provided by any one of the aforementioned method embodiments when executing the program stored in the memory 903, including:
[0178] When the cluster is expanded, the target configuration data of the master node in the cluster is obtained;
[0179] Using the target configuration data, create a container instance;
[0180] Send the container instance to a container node so that the container node deploys the container instance and returns an instance IP of the instance node, where the instance node is the node that completes the deployment of the container instance;
[0181] The instance IP is mounted to the cluster, so that the cluster uses the instance node corresponding to the instance IP as the node expanded by the cluster to process the data received by the cluster.
[0182] An embodiment of the present application further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps performed by the cluster expansion method provided in any of the aforementioned method embodiments are implemented.
[0183] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown 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 modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0184] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0185] It should be understood that the terms used herein are only for the purpose of describing specific example embodiments and are not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms "one", "an" and "said" as used herein may also be meant to include plural forms. The terms "include", "comprise", "contain", and "have" are inclusive, and therefore specify the existence of stated features, steps, operations, elements and / or parts, but do not exclude the existence or addition of one or more other features, steps, operations, elements, parts, and / or combinations thereof. The method steps, processes, and operations described herein are not interpreted as necessarily requiring them to be performed in the specific order described or illustrated, unless the execution order is clearly indicated. It should also be understood that additional or alternative steps may be used.
[0186] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A cluster expansion method, characterized in that: include: When the cluster is expanded, the target configuration data of the master node in the cluster is obtained; Using the target configuration data, create a container instance; Send the container instance to a container node so that the container node deploys the container instance and returns an instance IP of the instance node, where the instance node is the node that completes the deployment of the container instance; The instance IP is mounted to the cluster, so that the cluster uses the instance node corresponding to the instance IP as the node expanded by the cluster to process the data received by the cluster.
2. The method according to claim 1, characterized in that: The step of creating a container instance by using the target configuration data includes: Obtain target configuration data and target load of the master node; Determine the target number of container instances to be created according to the target load and the preset correspondence between the load and the number; Using the configuration data, the target number of container instances are created.
3. The method according to claim 1, characterized in that: The step of mounting the instance IP to the cluster includes: Generate an IP adding request according to the instance IP; The IP adding request is sent to the cluster, so that the cluster mounts the instance IP to the cluster by adding the IP in the IP adding request to the IP set corresponding to the cluster.
4. The method according to claim 1, characterized in that: The method further comprises: Obtaining a target load of a master node in the cluster; Detecting whether the target load of the master node is greater than a first preset value; When it is detected that the target load of the master node is greater than a first preset value, it is determined to expand the capacity of the master node in the cluster.
5. The method according to claim 1, characterized in that: The method further comprises: When an IP deletion instruction is received, the IP deletion instruction is parsed to obtain a target IP in the IP deletion instruction; When the target IP is a non-instance IP, a message indicating that the IP cannot be deleted is generated, and the message is displayed; When the target IP is an instance IP, an IP deletion request is generated according to the target IP, and the IP deletion request is sent to the cluster, so that the cluster performs data transfer based on the target IP and deletes the target IP in the IP set.
6. The method according to claim 1, characterized in that: The method further comprises: When it is detected that the target load of the master node is less than a second preset value, determining the target number of instance IPs to be removed according to the target load of the master node; According to the load of the node corresponding to each instance IP, obtain the load corresponding to each instance IP; According to the load corresponding to each instance IP, determine the target number of instance IPs with the minimum corresponding load, and obtain the target number of target IPs; An IP deletion request is generated according to the target IP, and the IP deletion request is sent to the cluster, so that the cluster transfers data based on the target IP and deletes the target IP in the IP set.
7. The method according to claim 1, characterized in that: The method further comprises: Check whether the node expansion instruction triggered by the user on the node expansion page is received; When a node expansion instruction triggered by a user on a node expansion page is received, it is determined to expand the cluster.
8. A cluster expansion device, characterized in that: The device comprises: An acquisition unit, used for acquiring target configuration data of a master node in the cluster when the cluster is expanded; A creation unit, used to create a container instance using the target configuration data; A sending unit, configured to send the container instance to a container node so that the container node deploys the container instance and returns an instance IP of the instance node, where the instance node is a node that completes the deployment of the container instance; The mounting unit is used to mount the instance IP to the cluster, so that the cluster uses the instance node corresponding to the instance IP as the node expanded by the cluster to process the data received by the cluster.
9. A cluster expansion device, characterized in that: include: at least one communication interface; at least one bus connected to the at least one communication interface; at least one processor connected to the at least one bus; at least one memory connected to the at least one bus, wherein the processor is configured to: When the cluster is expanded, the target configuration data of the master node in the cluster is obtained; Using the target configuration data, create a container instance; Send the container instance to a container node so that the container node deploys the container instance and returns an instance IP of the instance node, where the instance node is the node that completes the deployment of the container instance; The instance IP is mounted to the cluster, so that the cluster uses the instance node corresponding to the instance IP as the node expanded by the cluster to process the data received by the cluster.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the cluster expansion method according to any one of claims 1 to 7 is implemented.