Cluster adjustment method and apparatus, electronic device, and storage medium
By acquiring the status of the target cluster and automatically executing corresponding adjustment actions, the problem of complex cluster management is solved, realizing automated cluster management and simplifying the operation process.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD
- Filing Date
- 2024-12-31
- Publication Date
- 2026-06-30
AI Technical Summary
Cluster management is complex and error-prone in computer network systems, especially in large-scale systems, where current technologies require manual operation by administrators.
A cluster adjustment method and apparatus are provided, which automatically determine and execute target adjustment actions by acquiring the cluster status of the target cluster, including cluster creation, deletion, publicity adjustment, default cluster adjustment, etc., to achieve automatic cluster management.
It simplifies the complexity of cluster management, enables automated cluster management, and reduces the occurrence of human error.
Smart Images

Figure CN122309026A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of cluster management technology, and in particular to a cluster adjustment method and apparatus, electronic device and storage medium. Background Technology
[0002] In computer network systems, the load balancer (LB) is one of the key components. It is responsible for distributing incoming network traffic to multiple servers to improve system response speed and availability.
[0003] In existing technologies, cluster management typically requires manual intervention by administrators, including operations such as creating clusters, deleting clusters, and setting default clusters. These operations are not only cumbersome but also prone to errors, especially in large-scale systems where cluster management becomes particularly complex.
[0004] Therefore, cluster management is a complex issue in related technologies. Summary of the Invention
[0005] This application provides a cluster adjustment method and apparatus, electronic device and storage medium to at least solve the technical problem of complex cluster management in related technologies.
[0006] According to one aspect of the embodiments of this application, a cluster adjustment method is provided, comprising:
[0007] Obtain the cluster status of the target cluster;
[0008] Based on the cluster status, determine the target adjustment actions that need to be performed on the target cluster;
[0009] The target adjustment action is performed on the target cluster to complete the adjustment of the target cluster.
[0010] Optionally, as described above, determining the target adjustment action to be performed on the target cluster based on the cluster state includes:
[0011] If it is determined that a new physical machine will be added to the target cluster based on the cluster status, the target adjustment action to be performed on the target cluster is determined to be a cluster creation action;
[0012] The step of performing the target adjustment action on the target cluster to complete the adjustment of the target cluster includes: creating a target sub-cluster based on the new physical machine by performing the cluster creation action.
[0013] Optionally, as described above, determining the target adjustment action to be performed on the target cluster based on the cluster state includes:
[0014] If, based on the cluster status, it is determined that a specified physical machine under the target cluster needs to be deleted, the target adjustment action to be performed on the target cluster is determined to be a cluster deletion action;
[0015] The step of performing the target adjustment action on the target cluster to complete the adjustment of the target cluster includes: deleting the specified sub-cluster, which includes the specified physical machine, by performing the cluster deletion action.
[0016] Optionally, as described above, determining the target adjustment action to be performed on the target cluster based on the cluster state includes:
[0017] If a target value is obtained based on the cluster status to modify the public field value of the target sub-cluster in the target cluster, the target adjustment action to be performed on the target sub-cluster is determined to be a cluster publicity adjustment action.
[0018] The step of performing the target adjustment action on the target cluster to complete the adjustment of the target cluster includes: modifying the value of the public disclosure field to the target value by performing the cluster public disclosure adjustment action, and modifying the cluster public disclosure of the target sub-cluster to the target public disclosure indicated by the target value.
[0019] Optionally, as described above, determining the target adjustment action to be performed on the target cluster based on the cluster state includes:
[0020] If the cluster state determines that the public sub-cluster with the fewest current listeners in the target cluster is the target public sub-cluster, then the target adjustment action is determined to be the default cluster adjustment action.
[0021] The step of performing the target adjustment action on the target cluster to complete the adjustment of the target cluster includes: by performing the default cluster adjustment action, caching the cluster identifier of the target common sub-cluster to a preset storage area, so as to use the target common sub-cluster as the default cluster, wherein the preset storage area is used to cache the cluster identifier of the default cluster.
[0022] Optionally, as described above, determining the target adjustment action to be performed on the target cluster based on the cluster state includes:
[0023] If the cluster state is such that a listener creation request is obtained to create a listener in the target cluster, the target adjustment action is determined to be a listener creation action;
[0024] The step of performing the target adjustment action on the target cluster to complete the adjustment of the target cluster includes: if the listener creation request includes a specified cluster identifier, creating a listener for forwarding requests to the specified cluster indicated by the specified cluster identifier by performing the listener creation action; if the listener creation request does not include any cluster identifier, obtaining a default cluster identifier from a preset storage area and creating a specified listener for forwarding requests to the default cluster indicated by the default cluster identifier.
[0025] Optionally, as described above, determining the target adjustment action to be performed on the target cluster based on the cluster state includes:
[0026] If the cluster status determines that the last host of the current default sub-cluster in the target cluster has been deleted or the publicness field value of the current default sub-cluster has been modified, then the target adjustment action is determined to be a default cluster reset action.
[0027] The step of performing the target adjustment action on the target cluster to complete the adjustment of the target cluster includes: determining a new default sub-cluster in the target cluster by performing the default cluster reset action.
[0028] According to another aspect of the embodiments of this application, a cluster adjustment device is also provided, comprising:
[0029] The acquisition module is used to obtain the cluster status of the target cluster;
[0030] The determination module is used to determine the target adjustment actions to be performed on the target cluster based on the cluster status.
[0031] The execution module is used to perform the target adjustment action on the target cluster and complete the adjustment of the target cluster.
[0032] According to another aspect of the embodiments of this application, an electronic device is also provided, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; wherein the memory is used to store a computer program; and the processor is used to execute the method steps of any of the above embodiments by running the computer program stored in the memory.
[0033] According to another aspect of the embodiments of this application, a computer-readable storage medium is also provided, wherein a computer program is stored therein, wherein the computer program is configured to execute the method steps of any of the above embodiments when running.
[0034] In this embodiment, the cluster status of the target cluster is obtained; the target adjustment action to be performed on the target cluster is determined based on the cluster status; and the target adjustment action is performed on the target cluster to complete the adjustment of the target cluster. Since the target adjustment action to be performed on the target cluster can be automatically determined based on the cluster status of the target cluster, and the target cluster is adjusted through this target adjustment cluster, the purpose of automatic cluster management can be achieved, simplifying the complexity of cluster management and solving the problem of complex cluster management in related technologies. Attached Figure Description
[0035] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0036] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0037] Figure 1 This is a schematic diagram of the hardware environment for an optional cluster adjustment method according to an embodiment of this application;
[0038] Figure 2 This is a flowchart illustrating an optional cluster adjustment method according to an embodiment of this application;
[0039] Figure 3 This is a structural block diagram of an optional cluster adjustment device according to an embodiment of this application;
[0040] Figure 4 This is a structural block diagram of an optional electronic device according to an embodiment of this application. Detailed Implementation
[0041] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0042] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0043] First, some nouns or terms that appear in the description of the embodiments of this application shall be interpreted as follows:
[0044] 1. Task-service: A scheduled task used to periodically scan all clusters and set the default cluster.
[0045] 2. Layer 7 Load Balancing: Layer 7 load balancers reside at the highest layer of the OSI model, the application layer. They analyze and process network traffic, distributing requests to different servers to achieve load balancing. This load balancing method intelligently distributes traffic based on application layer protocols (such as HTTP, HTTPS, SMTP, etc.), thereby improving server performance and reliability.
[0046] 3. Tengine_host: A real physical machine; the cluster exists in the form of physical machines.
[0047] According to one aspect of the embodiments of this application, a cluster adjustment method is provided. Optionally, in this embodiment, the above-described cluster adjustment method can be applied to, for example... Figure 1 The hardware environment shown consists of terminal 1402 and server 1404. For example... Figure 1 As shown, server 1404 is connected to terminal 1402 via a network and can be used to provide services (such as game services, application services, etc.) to the terminal or clients installed on the terminal. A database can be set up on the server or independently of the server to provide data storage services for server 1404.
[0048] The aforementioned network may include, but is not limited to, at least one of the following: wired network, wireless network. The aforementioned wired network may include, but is not limited to, at least one of the following: wide area network, metropolitan area network, local area network. The aforementioned wireless network may include, but is not limited to, at least one of the following: Wi-Fi (Wireless Fidelity), Bluetooth. The terminal is not limited to PC, mobile phone, tablet computer, etc.
[0049] The cluster adjustment method of this application embodiment can be executed by a server, a terminal, or both. Alternatively, the cluster adjustment method of this application embodiment can be executed by a client installed on the terminal.
[0050] Taking the cluster adjustment method in this embodiment as an example, which is executed by the server, Figure 2 A cluster adjustment method provided in this application includes the following steps:
[0051] Step S202: Obtain the cluster status of the target cluster.
[0052] The cluster adjustment method in this embodiment can be applied to scenarios that require creating, deleting, or setting a default cluster.
[0053] In this embodiment, the target cluster can be any cluster that requires cluster management.
[0054] Cluster status can be the state of the cluster after the cluster administrator performs operations on the target cluster. For example, when the administrator creates a physical machine in the target cluster, the corresponding cluster status can be "new physical machine"; when the administrator deletes a physical machine in the target cluster, the corresponding cluster status can be "deleted physical machine", and so on.
[0055] Step S204: Determine the target adjustment actions to be performed on the target cluster based on the cluster status.
[0056] After obtaining the cluster status, the corresponding target adjustment action can be executed according to the cluster status. Optionally, candidate adjustment actions corresponding to different types of cluster status can be pre-defined, so that after determining the cluster status of the target cluster, the target adjustment action corresponding to the target cluster can be matched among all candidate adjustment actions according to the cluster status.
[0057] Step S206: Perform target adjustment actions on the target cluster to complete the adjustment of the target cluster.
[0058] Once the target adjustment action is determined, the target adjustment action can be executed on the target cluster to complete the adjustment of the target cluster.
[0059] In this embodiment, the cluster status of the target cluster is obtained; the target adjustment action to be performed on the target cluster is determined based on the cluster status; and the target adjustment action is performed on the target cluster to complete the adjustment of the target cluster. Since the target adjustment action to be performed on the target cluster can be automatically determined based on the cluster status of the target cluster, and the target cluster is adjusted through this target adjustment cluster, the purpose of automatic cluster management can be achieved, thus simplifying the complexity of cluster management and solving the problem of complex cluster management in related technologies.
[0060] As an optional implementation, as described above, the target adjustment action to be performed on the target cluster is determined based on the cluster status, including: if it is determined based on the cluster status that a new physical machine will be added to the target cluster, the target adjustment action to be performed on the target cluster is determined to be a cluster creation action.
[0061] Perform target adjustment actions on the target cluster to complete the adjustment of the target cluster, including: creating a target sub-cluster based on the new physical machine by performing a cluster creation action.
[0062] In other words, when the cluster status indicates that the cluster administrator should add a new physical machine to the target cluster, the target adjustment action to be performed on the target cluster is determined to be a cluster creation action. A cluster creation action is an action that creates a new sub-cluster under the target cluster. In this embodiment, the target cluster can be a large cluster consisting of all physical machines corresponding to a certain user. A sub-cluster can be a small cluster within the large cluster, targeting a specific service or usage scenario. If the target adjustment action is determined to be a cluster creation action, then by executing the cluster creation action, a target sub-cluster consisting of the new physical machine can be automatically created.
[0063] As an optional implementation, the method described above determines the target adjustment actions to be performed on the target cluster based on the cluster state, including:
[0064] If the cluster status determines the specific physical machine to be deleted from the target cluster, the target adjustment action to be performed on the target cluster is determined to be the cluster deletion action.
[0065] Perform target adjustment actions on the target cluster to complete the adjustment of the target cluster, including: deleting the specified sub-cluster, which includes the specified physical machine, by performing a cluster deletion action.
[0066] In other words, when the cluster status indicates that the cluster administrator should delete a specified physical machine under the target cluster, the target adjustment action to be performed on the target cluster is determined to be a cluster deletion action. A cluster deletion action is an action that deletes an existing sub-cluster under the target cluster. In this embodiment, the specified physical machine can be the collection of all physical machines under a certain sub-cluster. If the target adjustment action is determined to be a cluster deletion action, then executing the cluster deletion action will automatically delete the self-generated sub-cluster composed of the specified physical machine.
[0067] As an optional implementation, as described above, the target adjustment action to be performed on the target cluster is determined based on the cluster state, including: when a target value for modifying the public field value of the target sub-cluster in the target cluster is obtained based on the cluster state, the target adjustment action to be performed on the target sub-cluster is determined to be a cluster publicity adjustment action.
[0068] Perform target adjustment actions on the target cluster to complete the adjustment of the target cluster, including: modifying the public field value to the target value by performing cluster publicity adjustment actions, and modifying the cluster publicity of the target sub-cluster to the target publicity indicated by the target value.
[0069] Specifically, cluster administrators can distinguish between public and private clusters by setting the value of the `shared` field (i.e., the publicity field value) of the cluster or sub-cluster. When the cluster status indicator shows that the publicity field value for a target sub-cluster has been modified to the target value, it indicates that a cluster publicity adjustment action is needed for the target sub-cluster. This can then be performed to modify the publicity field value to the target value and change the target sub-cluster's publicity to the target value's indicated publicity. Publicity can include both publicly accessible public sub-clusters and privately accessible clusters. For example, if the target value for modifying the `shared` field value for a target sub-cluster is True, then the value of the `shared` field is changed to True, and the target sub-cluster's publicity is changed to public.
[0070] As an optional implementation, the method described above determines the target adjustment action to be performed on the target cluster based on the cluster state, including: if the cluster state determines that the common sub-cluster with the fewest current listeners in the target cluster is the target common sub-cluster, the target adjustment action is determined to be the default cluster adjustment action.
[0071] Perform target adjustment actions on the target cluster to complete the adjustment of the target cluster, including: by performing default cluster adjustment actions, caching the cluster identifier of the target common sub-cluster to the preset storage area, so as to use the target common sub-cluster as the default cluster, wherein the preset storage area is used to cache the cluster identifier of the default cluster.
[0072] In other words, the method in this embodiment is used to select the default cluster: by periodically scanning the task_service, the target common sub-cluster with the fewest listeners is selected from the clusters where shared=True (i.e., common sub-clusters), and the target adjustment action is determined to be the default cluster adjustment action. Then, by executing the default cluster adjustment action, the cluster identifier of the target common sub-cluster is cached in a preset storage area, so that the target common sub-cluster is used as the default cluster, and subsequent listener requests are forwarded to the target common sub-cluster by default. Optionally, the cluster identifier can be cached using Redis (Remote Dictionary Server, an open-source, high-performance key-value store system, commonly used as a database, cache, and message broker). Since Redis is an in-memory database, the preset storage area is a storage area in memory.
[0073] As an optional implementation, the method described above determines the target adjustment action to be performed on the target cluster based on the cluster state, including: when the cluster state is to obtain a listener creation request to create a listener in the target cluster, the target adjustment action is determined to be a listener creation action.
[0074] Perform target adjustment actions on the target cluster to complete the adjustment of the target cluster, including: if the listener creation request includes a specified cluster identifier, create a listener to forward the request to the specified cluster indicated by the specified cluster identifier by performing a listener creation action; if the listener creation request does not include any cluster identifier, obtain a default cluster identifier from the preset storage area and create a specified listener to forward the request to the default cluster indicated by the default cluster identifier.
[0075] Specifically, when creating a listener, if the listener creation request includes a specified cluster identifier, it indicates that the cluster to which the request corresponding to the listener to be created is to be forwarded has been specified, and a listener is created to forward the request to the specified cluster indicated by the specified cluster identifier. If the listener creation request does not include any cluster identifier, it indicates that no cluster has been specified, and a default cluster identifier is automatically obtained from a preset storage area (e.g., Redis), and a specified listener is created to forward the request to the default cluster indicated by the default cluster identifier. In other words, all requests to this specified listener will be forwarded to the default cluster later. Furthermore, if no arbitrary cluster identifier is included, and Redis does not contain any default cluster identifier, a new cluster name is generated based on the cluster type name, a new cluster is created based on the generated cluster name, and the newly created cluster is associated with the listener.
[0076] As an optional implementation, the method described above determines the target adjustment actions to be performed on the target cluster based on the cluster state, including:
[0077] If the cluster status determines that the last host of the current default sub-cluster in the target cluster has been deleted or the publicness field value of the current default sub-cluster has been modified, the target adjustment action is determined to be the default cluster reset action.
[0078] Perform target adjustment actions on the target cluster to complete the adjustment of the target cluster, including: determining a new default sub-cluster in the target cluster by performing a default cluster reset action.
[0079] Specifically, the current default sub-cluster is the sub-cluster currently used as the default sub-cluster in the target cluster.
[0080] In other words, when the last host in the current default sub-cluster cluster is deleted or its shared settings are changed (i.e., the public field value of the current default sub-cluster cluster is modified and it is adjusted to a private cluster), if there is no current default sub-cluster cluster or a new default sub-cluster cluster is determined, the target adjustment action is a default cluster reset action. This default cluster reset action can then be executed to determine a new default sub-cluster cluster in the target cluster. Furthermore, the new default sub-cluster cluster can be the sub-cluster cluster with the lowest load in the target cluster (e.g., the fewest associated listeners).
[0081] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0082] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM (Read-Only Memory) / RAM (Random Access Memory), magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0083] According to another aspect of the embodiments of this application, a cluster adjustment apparatus for implementing the above-described cluster adjustment method is also provided. Figure 3 This is a structural block diagram of an optional cluster adjustment device according to an embodiment of this application, such as... Figure 3 As shown, the device may include:
[0084] The acquisition module 31 is used to acquire the cluster status of the target cluster;
[0085] The determination module 32 is used to determine the target adjustment actions that need to be performed on the target cluster based on the cluster status.
[0086] Execution module 33 is used to perform target adjustment actions on the target cluster and complete the adjustment of the target cluster.
[0087] It should be noted that the acquisition module 31 in this embodiment can be used to perform the above step S202, the determination module 32 in this embodiment can be used to perform the above step S204, and the execution module 33 in this embodiment can be used to perform the above step S206.
[0088] The aforementioned modules acquire the cluster status of the target cluster; determine the target adjustment actions to be performed on the target cluster based on the cluster status; and execute the target adjustment actions to complete the adjustment of the target cluster. Because the target adjustment actions can be automatically determined based on the cluster status of the target cluster, and the target cluster can be adjusted accordingly, the goal of automatic cluster management can be achieved. This simplifies the complexity of cluster management and solves the problem of complex cluster management in related technologies.
[0089] In addition to the modules described above, the apparatus in this embodiment may also include modules that execute any method in any of the aforementioned cluster adjustment methods.
[0090] It should be noted that the examples and application scenarios implemented by the above modules and corresponding steps are the same, but are not limited to the content disclosed in the above embodiments. It should also be noted that the above modules, as part of a device, can operate in environments such as... Figure 1 The hardware environment shown can be implemented through software or hardware, and the hardware environment includes the network environment.
[0091] According to another aspect of the embodiments of this application, an electronic device for implementing the above-described cluster adjustment method is also provided. The electronic device may be a server, a terminal, or a combination thereof.
[0092] According to another embodiment of this application, an electronic device is also provided, comprising: Figure 4 As shown, the electronic device may include: a processor 1501, a communication interface 1502, a memory 1503, and a communication bus 1504, wherein the processor 1501, the communication interface 1502, and the memory 1503 communicate with each other through the communication bus 1504.
[0093] Memory 1503 is used to store computer programs;
[0094] When processor 1501 executes the program stored in memory 1503, it performs the following steps:
[0095] Step S202: Obtain the cluster status of the target cluster.
[0096] Step S204: Determine the target adjustment actions to be performed on the target cluster based on the cluster status.
[0097] Step S206: Perform target adjustment actions on the target cluster to complete the adjustment of the target cluster.
[0098] Optionally, in this embodiment, the communication bus can be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is used to represent it in the figure, but this does not mean that there is only one bus or one type of bus. The communication interface is used for communication between the aforementioned electronic device and other devices.
[0099] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0100] As an example, the memory 1503 described above may include, but is not limited to, the acquisition module 31, the determination module 32, and the execution module 33 from the cluster adjustment device described above. Furthermore, it may include, but is not limited to, other module units from the cluster adjustment device described above, which will not be elaborated upon in this example.
[0101] The processors mentioned above can be general-purpose processors, including but not limited to: CPU (Central Processing Unit), NP (Network Processor), etc.; they can also be DSP (Digital Signal Processor), ASIC (Application Specific Integrated Circuit), FPGA (Field-Programmable Gate Array) or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0102] This application also provides a computer-readable storage medium, which includes a stored program, wherein the program executes the method steps of the above method embodiments when it runs.
[0103] Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing program code, such as USB flash drives, ROMs, RAMs, portable hard drives, magnetic disks, or optical disks.
[0104] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0105] If the integrated units in the above embodiments are implemented as software functional units and sold or used as independent products, they can be stored in the aforementioned computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause one or more computer devices (which may be personal computers, servers, or network devices, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application.
[0106] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0107] In the several embodiments provided in this application, it should be understood that the disclosed client can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, indirect coupling or communication connection between units or modules, and may be electrical or other forms.
[0108] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of the solution provided in this embodiment, depending on actual needs.
[0109] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0110] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A cluster adjustment method, characterized in that, include: Obtain the cluster status of the target cluster; Based on the cluster status, determine the target adjustment actions that need to be performed on the target cluster; The target adjustment action is performed on the target cluster to complete the adjustment of the target cluster.
2. The method according to claim 1, characterized in that, The step of determining the target adjustment action to be performed on the target cluster based on the cluster status includes: If it is determined that a new physical machine will be added to the target cluster based on the cluster status, the target adjustment action to be performed on the target cluster is determined to be a cluster creation action; The step of performing the target adjustment action on the target cluster to complete the adjustment of the target cluster includes: creating a target sub-cluster based on the new physical machine by performing the cluster creation action.
3. The method according to claim 1, characterized in that, The step of determining the target adjustment action to be performed on the target cluster based on the cluster status includes: If, based on the cluster status, it is determined that a specified physical machine under the target cluster needs to be deleted, the target adjustment action to be performed on the target cluster is determined to be a cluster deletion action; The step of performing the target adjustment action on the target cluster to complete the adjustment of the target cluster includes: deleting the specified sub-cluster, which includes the specified physical machine, by performing the cluster deletion action.
4. The method according to claim 1, characterized in that, The step of determining the target adjustment action to be performed on the target cluster based on the cluster status includes: If a target value is obtained based on the cluster status to modify the public field value of the target sub-cluster in the target cluster, the target adjustment action to be performed on the target sub-cluster is determined to be a cluster publicity adjustment action. The step of performing the target adjustment action on the target cluster to complete the adjustment of the target cluster includes: modifying the value of the public disclosure field to the target value by performing the cluster public disclosure adjustment action, and modifying the cluster public disclosure of the target sub-cluster to the target public disclosure indicated by the target value.
5. The method according to claim 1, characterized in that, The step of determining the target adjustment action to be performed on the target cluster based on the cluster status includes: If the cluster state determines that the public sub-cluster with the fewest current listeners in the target cluster is the target public sub-cluster, then the target adjustment action is determined to be the default cluster adjustment action. The step of performing the target adjustment action on the target cluster to complete the adjustment of the target cluster includes: by performing the default cluster adjustment action, caching the cluster identifier of the target common sub-cluster to a preset storage area, so as to use the target common sub-cluster as the default cluster, wherein the preset storage area is used to cache the cluster identifier of the default cluster.
6. The method according to claim 1, characterized in that, The step of determining the target adjustment action to be performed on the target cluster based on the cluster status includes: If the cluster state is such that a listener creation request is obtained to create a listener in the target cluster, the target adjustment action is determined to be a listener creation action; The step of performing the target adjustment action on the target cluster to complete the adjustment of the target cluster includes: if the listener creation request includes a specified cluster identifier, creating a listener for forwarding requests to the specified cluster indicated by the specified cluster identifier by performing the listener creation action; if the listener creation request does not include any cluster identifier, obtaining a default cluster identifier from a preset storage area and creating a specified listener for forwarding requests to the default cluster indicated by the default cluster identifier.
7. The method according to claim 1, characterized in that, The step of determining the target adjustment action to be performed on the target cluster based on the cluster status includes: If the cluster status determines that the last host of the current default sub-cluster in the target cluster has been deleted or the publicness field value of the current default sub-cluster has been modified, then the target adjustment action is determined to be a default cluster reset action. The step of performing the target adjustment action on the target cluster to complete the adjustment of the target cluster includes: determining a new default sub-cluster in the target cluster by performing the default cluster reset action.
8. A cluster adjustment device, characterized in that, include: The acquisition module is used to obtain the cluster status of the target cluster; The determination module is used to determine the target adjustment actions to be performed on the target cluster based on the cluster status. The execution module is used to perform the target adjustment action on the target cluster and complete the adjustment of the target cluster.
9. An electronic device comprising a processor, a communication interface, a memory, and a communication bus, wherein, The processor, the communication interface, and the memory communicate with each other via the communication bus, characterized in that... The memory is used to store computer programs; The processor is configured to perform the method of any one of claims 1 to 7 by running the computer program stored in the memory.
10. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, wherein the computer program is configured to execute the method described in any one of claims 1 to 7 when it is run.