Cluster scaling method and apparatus, electronic device, and computer readable medium
By automatically analyzing node usage data of the Elasticsearch cluster on the cloud platform and dynamically adjusting the number of nodes, the problems of high latency and resource waste in traditional Elasticsearch cluster operation and maintenance are solved, achieving efficient cluster scaling and resource optimization.
Patent Information
- Application Number
- CN202410735162.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-06
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2044-06-06
AI Technical Summary
Traditional Elasticsearch cluster operations rely on monitoring and alerts and manual expansion, resulting in high latency and resource waste, making it difficult to effectively cope with fluctuations and expansions in the scale of business systems.
By collecting usage data of cluster nodes on the cloud platform, scaling strategies are determined based on data analysis, and node scaling operations are automatically performed to dynamically adjust the cluster size.
It enables automated scaling up and down of the cluster, improving operational efficiency and resource utilization, reducing maintenance costs and the need for manual intervention, and ensuring high availability and performance stability of the system.
Smart Images

Figure CN118714012B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computers, and in particular to a cluster expansion and contraction method and device, electronic equipment and a computer readable medium. BACKGROUND
[0002] With the development of society, people's demand for computer systems has become diversified and complex, requiring the integration of multiple devices and services. To meet these challenges, enterprises have adopted distributed architecture and microservices mode, which splits the system into independent components or services to improve the flexibility and scalability of the system. Splitting and optimization strategies help improve system stability and responsiveness to meet user needs and adapt to rapidly changing environments.
[0003] In log management scenarios, Elasticsearch, a distributed search and analysis engine, is used as a distributed search and analysis engine to effectively collect, store, search and visualize logs. By analyzing log data, capacity planning and system performance optimization can be performed to ensure that the system has sufficient capacity and performance to meet business needs.
[0004] However, in the face of fluctuations and expansion of business system size, traditional Elasticsearch cluster (ES cluster) operation and maintenance relies on monitoring alarms and manual cluster expansion operations, resulting in high latency and availability problems. In addition, logs are not always saved and may cause resource waste after deletion. SUMMARY
[0005] Therefore, the embodiments of the present application provide a cluster expansion and contraction method, device, electronic equipment and computer readable medium to overcome the above problems or at least partially solve the above problems.
[0006] The first aspect of the embodiments of the present application provides a cluster expansion and contraction method applied to a cloud platform, wherein a plurality of nodes of a cluster are deployed on the cloud platform, and the method comprises:
[0007] Collecting usage data of the plurality of nodes in the cluster;
[0008] Determining the usage of the cluster based on the usage data of the plurality of nodes in the cluster, and determining the expansion and contraction strategy of the cluster based on the usage of the cluster;
[0009] According to the expansion and contraction strategy, the number of nodes of the cluster is expanded or contracted.
[0010] Optionally, the cloud platform is a Kubernetes cloud platform, the cluster is an Elasticsearch cluster, the Elasticsearch cluster contains a plurality of data nodes, and the usage of the cluster is determined based on usage data of the plurality of nodes in the cluster, including:
[0011] In each cycle, usage data of a plurality of data nodes contained in the Elasticsearch cluster collected in a preset time period is obtained, wherein the usage data of each data node includes a plurality of resource usages;
[0012] An average value of each resource usage of the Elasticsearch cluster in the preset time period is calculated;
[0013] The average value of each resource usage is compared with a preset threshold value corresponding to each resource usage to obtain the usage of the Elasticsearch cluster;
[0014] The preset threshold value of each resource usage includes a preset upper threshold value and a preset lower threshold value.
[0015] Optionally, before the expansion and contraction strategy of the cluster is determined based on the usage of the cluster, the following steps are further included:
[0016] A trigger condition is determined, and the trigger condition at least includes any index trigger;
[0017] The expansion and contraction strategy of the cluster is determined based on the usage of the cluster, including:
[0018] When the trigger condition is any index trigger, it is determined whether the average value of at least one resource usage in the usage of the Elasticsearch cluster exceeds the preset threshold value corresponding to the at least one resource usage;
[0019] When the average value of at least one resource usage in the usage of the Elasticsearch cluster in the preset time period is greater than the preset upper threshold value corresponding to the at least one resource usage, it is determined that the expansion and contraction strategy of the Elasticsearch cluster is the expansion operation;
[0020] When the average value of at least one resource usage in the usage of the Elasticsearch cluster in the preset time period is less than the preset lower threshold value corresponding to the at least one resource usage, it is determined that the expansion and contraction strategy of the Elasticsearch cluster is the contraction operation.
[0021] Optionally, before the determining the scaling strategy of the cluster based on the usage of the cluster, the method further comprises:
[0022] determining a trigger condition, the trigger condition comprising at least an all-index trigger;
[0023] the determining the scaling strategy of the cluster based on the usage of the cluster comprises:
[0024] when the trigger condition is the all-index trigger, determining whether an average value of all resource usages in the usage of the Elasticsearch cluster exceeds a preset threshold corresponding to the all resource usages;
[0025] when the average value of all resource usages in the usage of the Elasticsearch cluster in the preset time period is greater than an upper limit of the preset threshold corresponding to the all resource usages, determining that the scaling strategy of the Elasticsearch cluster is the expansion operation;
[0026] when the average value of all resource usages in the usage of the Elasticsearch cluster in the preset time period is less than a lower limit of the preset threshold corresponding to the all resource usages, determining that the scaling strategy of the Elasticsearch cluster is the contraction operation.
[0027] Optionally, the determining the scaling strategy of the cluster based on the usage of the cluster comprises:
[0028] determining whether a first duration, during which an average value of at least one resource usage in the usage of the Elasticsearch cluster in the preset time period is greater than an upper limit of a preset threshold corresponding to the at least one resource usage, is greater than a first preset duration, and whether a second duration, during which the average value of the at least one resource usage is less than a lower limit of the preset threshold corresponding to the at least one resource usage, is greater than a second preset duration;
[0029] when the first duration is greater than the first preset duration, determining that the scaling strategy of the Elasticsearch cluster is the expansion operation;
[0030] when the second duration is greater than the second preset duration, determining that the scaling strategy of the Elasticsearch cluster is the contraction operation.
[0031] Optionally, the performing the expansion operation or the contraction operation on the number of nodes of the cluster according to the scaling strategy comprises:
[0032] When it is determined that the scaling strategy of the Elasticsearch cluster is an expansion operation, a Kubernetes controller on the Kubernetes cloud platform is requested to increase the number of data nodes in the Elasticsearch cluster through the Kubernetes controller;
[0033] When it is determined that the scaling strategy of the Elasticsearch cluster is an expansion operation, a Kubernetes controller on the Kubernetes cloud platform is requested to increase the number of data nodes in the Elasticsearch cluster through the Kubernetes controller;
[0034] Optionally, after the number of nodes of the cluster is expanded or reduced according to the scaling strategy, the method further comprises:
[0035] determining whether the total number of data nodes after the number of data nodes of the Elasticsearch cluster is expanded is greater than a preset maximum number of data nodes, and when the total number of data nodes after the expansion operation is greater than the preset maximum number of data nodes, the expansion operation is no longer continued;
[0036] determining whether the total number of data nodes after the number of data nodes of the Elasticsearch cluster is reduced is less than a preset minimum number of data nodes, and when the total number of data nodes after the reduction operation is less than the preset maximum number of data nodes, the reduction operation is no longer continued.
[0037] The second aspect of the embodiments of the present application provides a cluster scaling device applied to a cloud platform, wherein a plurality of nodes of a cluster are deployed on the cloud platform, and the device comprises:
[0038] a data collection module configured to collect usage data of the plurality of nodes in the cluster;
[0039] a cluster analysis module configured to determine a usage condition of the cluster based on the usage data of the plurality of nodes in the cluster, and determine a scaling strategy of the cluster based on the usage condition of the cluster;
[0040] a cluster scaling control module configured to perform an expansion operation or a reduction operation on the number of nodes of the cluster according to the scaling strategy.
[0041] The third aspect of the embodiments of the present application provides an electronic device, including a memory, a processor and a computer program stored in the memory, wherein the processor executes the computer program to implement the cluster expansion and contraction method according to the first aspect.
[0042] The fourth aspect of the embodiments of the present application provides a computer readable medium having a computer program stored thereon, wherein the computer program is executed by a processor to implement the cluster expansion and contraction method according to the first aspect.
[0043] The beneficial effects of the present application are as follows:
[0044] The embodiments of the present application provide a cluster expansion and contraction method, device, electronic device and computer readable medium, which are applied to a cloud platform, the cloud platform has a plurality of nodes of a cluster deployed thereon, and the method comprises: collecting usage data of the plurality of nodes in the cluster; determining a usage condition of the cluster based on the usage data of the plurality of nodes in the cluster, and determining an expansion and contraction strategy of the cluster based on the usage condition of the cluster; and performing an expansion operation or a contraction operation on the number of nodes of the cluster according to the expansion and contraction strategy.
[0045] The cluster containing a plurality of nodes can be deployed on the cloud platform, and the usage conditions of the nodes in the cluster can be monitored and data collected, further, the usage data of the cluster is analyzed to determine the usage condition of the entire cluster, and the expansion and contraction strategy of the cluster is determined, and the expansion or contraction operation of the number of nodes is automatically performed. Therefore, the size of the cluster can be dynamically adjusted according to the usage condition of the nodes of the cluster, and the automatic expansion and contraction of the cluster is realized. By dynamically adjusting according to the actual load condition, the operation efficiency and resource utilization rate of the cluster can be improved, and the operation and maintenance cost and the demand for manual intervention can be reduced. BRIEF DESCRIPTION OF DRAWINGS
[0046] The accompanying drawings, which form a part of the present application, are intended to provide further understanding of the present application, and the illustrative embodiments of the present application and their description serve the purpose of explaining the present application. The accompanying drawings do not constitute an inappropriate limitation on the present application.
[0047] In order to more clearly illustrate the technical solutions of the present application, the accompanying drawings needed to be used in the description of the present application will be briefly introduced as follows. Obviously, the accompanying drawings in the following description are only some embodiments of the present application, and other accompanying drawings can be obtained by those skilled in the art without any creative labor.
[0048] Figure 1 is a flow diagram of a cluster expansion and contraction method provided by an embodiment of the present application;
[0049] Figure 2is a schematic diagram of managing an Elasticsearch cluster on a Kubernetes cloud platform in a cluster scaling method provided by an embodiment of the present application.
[0050] Figure 3 is a framework schematic diagram of a cluster scaling device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0051] It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict.
[0052] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.
[0053] Figure 1 is a flow schematic diagram of a cluster scaling method provided by an embodiment of the present application, as Figure 1 shown, a cluster scaling method provided by an embodiment of the present application is applied to a cloud platform, the cloud platform has multiple nodes of a cluster deployed thereon, and the method comprises the following steps.
[0054] In step S101, usage data of the multiple nodes in the cluster is collected.
[0055] In step S102, based on the usage data of the multiple nodes in the cluster, the usage of the cluster is determined, and based on the usage of the cluster, a scaling strategy of the cluster is determined.
[0056] In step S103, according to the scaling strategy, a capacity expansion operation or a capacity reduction operation is performed on the number of nodes of the cluster.
[0057] The present application is a cluster system composed of multiple nodes, the cluster is composed of multiple servers, multiple nodes run on each server, each node is an instance on the server, and the cluster is deployed on a cloud platform of a cloud computing service provider to run. The cloud platform refers to various services of containerized management based on cloud computing technology, including virtualization environments of computing resources, storage, network, etc., and users can access and manage through the Internet.
[0058] First, in step S101, usage data of multiple nodes in the cluster is collected. In the embodiment of the present application, the usage data of multiple nodes in the cluster on the cloud platform includes at least CPU usage, memory usage, disk usage, network traffic, load condition, etc. The usage data of each node can be counted to obtain the usage data of the cluster. The data collection of the cluster on the cloud platform can be achieved by the following ways:
[0059] Agent collection: Install an agent program or agent service on each node of the cluster, which is responsible for data collection and transmission. The agent program or agent service can monitor various indicators of the node and regularly send data to the designated data storage or monitoring system.
[0060] Log collection: The cloud platform usually provides log collection tools that can collect log data generated by the cluster nodes. These logs can contain node usage data.
[0061] API interface: The cloud platform provides a series of API interfaces that developers can use to obtain node usage data. Through the API, various indicators of the node such as CPU utilization and memory consumption can be obtained.
[0062] Monitoring service: The cloud platform usually provides monitoring services that can automatically collect and monitor cluster node data by configuring monitoring strategies and alarm rules. These monitoring services can regularly obtain node performance data and display charts or send alarm notifications.
[0063] Third-party tools: Use third-party monitoring tools to collect cluster node data. These tools can monitor and collect data from nodes through various protocols and methods.
[0064] Further, in step S102, based on the usage data of multiple nodes in the cluster, the usage of the cluster is determined, and based on the usage of the cluster, the expansion and contraction strategy of the cluster is determined.
[0065] In the embodiment of the present application, after the usage data of the plurality of nodes in the cluster is acquired, data analysis is performed on the collected usage data of the plurality of nodes in the cluster (including capacity planning and system performance optimization analysis of the cluster, etc.). For example, by observing the CPU usage of each node in the cluster, it is determined whether the node load is too high or too low, the memory usage of the cluster nodes is monitored to ensure that there is no memory shortage, network traffic data is viewed to determine whether the network is a bottleneck, and the disk usage of the cluster nodes is checked to avoid disk space shortage. Based on this, the overall usage of the cluster is determined, and according to the usage of the cluster, the expansion and contraction strategy suitable for the cluster is further determined, which is a pre-set strategy for flexibly adjusting the size of the cluster.
[0066] Finally, in step S103, according to the expansion and contraction strategy, the number of nodes of the cluster is expanded or contracted.
[0067] In the embodiment of the present application, after the expansion and contraction strategy suitable for the cluster is determined, the data of the nodes of the current cluster is expanded or contracted according to the expansion and contraction strategy. For example, if the resource utilization of some nodes in the cluster is very high, the cluster can be expanded to increase more nodes to share the load and improve the performance and stability of the cluster. If there is resource waste in the cluster, the cluster size can be reduced to shut down some idle nodes to save costs.
[0068] Through the above embodiment, the cluster containing a plurality of nodes can be deployed on the cloud platform, and the usage of each node in the cluster can be monitored and data collected. Further, the usage of the entire cluster is determined by analyzing the usage data of the cluster, and the expansion and contraction strategy of the cluster is determined, and the number of nodes is automatically expanded or contracted. Therefore, the size of the cluster can be dynamically adjusted according to the usage of the nodes of the cluster, and the automatic expansion and contraction of the cluster is realized. By dynamically adjusting according to the actual load, the running efficiency and resource utilization of the cluster can be improved, the operation and maintenance cost and the demand for manual intervention can be reduced, and the stability and performance of the cluster can be improved to meet the business requirements.
[0069] Kubernetes: K8s is a short name for Kubernetes, which is a short name for "ubernete" with 8 instead of the 8 characters in the middle. It is an open source that is used to manage containerized applications on multiple hosts in the cloud platform. The goal of Kubernetes is to make it simple and efficient to deploy containerized applications. Kubernetes provides a mechanism for application deployment, planning, updating, and maintenance.
[0070] Elasticsearch: Elasticsearch, commonly referred to as ES, is an open-source, highly scalable distributed full-text search engine that can store and retrieve data in near real-time. It is well-suited for scaling to hundreds of servers and handling petabytes of data. ES is developed in Java and uses Lucene as its core to implement all indexing and search functionalities. However, its purpose is to hide the complexity of Lucene through a simple RESTful API, making full-text search simple.
[0071] As society continues to develop, people's demand for computer systems has become increasingly diverse and complex. From the past simple single-machine processing mode to the current cluster processing, systems also need to integrate various types of devices and services, such as Internet of Things devices, mobile applications, cloud computing resources, etc. In order to cope with these challenges, enterprises have split many systems into independent components or services, adopting distributed architecture and microservices mode. Such splitting can make the system more flexible, scalable and easy to maintain. This splitting and optimization strategy helps improve the stability, reliability and responsiveness of the system, so as to better meet the needs of users and cope with the rapidly changing technology and market environment.
[0072] Due to the improvement of system complexity, ordinary manpower alone is difficult to cope with, so centralized management systems can well cope with this situation.
[0073] In the log management scenario, Elasticsearch (ES) is a distributed search and analysis engine commonly used for log management and analysis, especially suitable for large-scale log data collection, storage, search and visualization.
[0074] And based on log data analysis in Elasticsearch, capacity planning and system performance optimization can be carried out. By monitoring the growth trend of log data and query performance, optimizing cluster configuration and resource allocation, ensuring that the system has sufficient capacity and performance to meet business needs.
[0075] ES cluster as an auxiliary business system can well meet the needs of log collection, storage, analysis and other aspects, but the size of the business system has ups and downs, and as time grows, the size of the system is constantly expanding, leading to the difficulty of planning the size of the corresponding auxiliary system. The initial ES cluster is too small, and as the business grows, it needs to manually expand the capacity. If the initial cluster is too large, it is also a waste of resources.
[0076] Currently, the operation and maintenance of a traditional ES cluster relies on monitoring and alarming of the ES cluster. When it is found that the ES cluster cannot meet the scale, the operation and maintenance personnel will receive an alarm prompt, and then manually expand the cluster scale to meet the needs of the business system. However, manual operation has high latency, and with a sudden surge in traffic, the system may become unavailable. Moreover, logs are not saved all the time, and after deletion, the scale may be too large, causing waste of cluster resources.
[0077] Figure 2 An embodiment of the present application provides a schematic diagram of managing an Elasticsearch cluster on a Kubernetes cloud platform in a cluster expansion and contraction method, as shown in Figure 2 An embodiment of the present application provides a cluster expansion and contraction method, which can manage an Elasticsearch cluster on a Kubernetes cloud platform, dynamically expand or reduce the scale of the Elasticsearch cluster according to the scale of the Elasticsearch cluster itself, fully meet the availability of the system, and greatly facilitate the work of operation and maintenance personnel.
[0078] Optionally, the cloud platform is a Kubernetes cloud platform, the cluster is an Elasticsearch cluster, the Elasticsearch cluster includes a plurality of data nodes, and the step S102 includes:
[0079] In each period, usage data of the plurality of data nodes included in the Elasticsearch cluster collected in a preset time period is acquired, wherein the usage data of each data node includes a plurality of resource usages;
[0080] An average value of each resource usage of the Elasticsearch cluster in the preset time period is calculated;
[0081] The average value of each resource usage is compared with a preset threshold value corresponding to each resource usage, to obtain a usage condition of the Elasticsearch cluster;
[0082] The preset threshold value of each resource usage includes a preset threshold upper limit and a preset threshold lower limit.
[0083] Specifically, in the embodiments of the present application, the cluster is an Elasticsearch cluster, the cloud platform is a Kubernetes cloud platform, the Elasticsearch cluster includes multiple data nodes, in addition, the Elasticsearch cluster also includes a master node and multiple coordination nodes, first, based on the Kubernetes cloud platform, a CNC separated Elasticsearch cluster including multiple data nodes is built, since the Elasticsearch cluster does not require a large amount of resources at the beginning, the initial state of the Elasticsearch cluster is smaller than the preset size, further, a business system is connected to the Elasticsearch cluster, log data generated in the business system needs to be stored in each node of the Elasticsearch cluster, as time goes on, more and more log data is generated in the business system, therefore, the size of the Elasticsearch cluster needs to be dynamically adjusted.
[0084] Firstly, when each cycle comes, a unified interface provided by the Elasticsearch cluster is called to collect the usage data of the multiple data nodes of the Elasticsearch cluster in a preset time period, the usage data of each data node includes multiple resource usages, the multiple resource usages can be CPU usage, memory usage, disk usage, network traffic, load condition, etc., further, the resource usages of each data node in the preset time period are averaged to obtain the average values of the resource usages of the Elasticsearch cluster in the time period, that is, the average value of the CPU usage of each data node is taken as the CPU usage of the Elasticsearch cluster, the average value of the memory usage of each data node is taken as the memory usage of the Elasticsearch cluster, the average value of the network traffic of each data node is taken as the network traffic of the Elasticsearch cluster, the average value of the disk usage of each data node is taken as the disk usage of the Elasticsearch cluster, and the average value of the load condition of each data node is taken as the load condition of the Elasticsearch cluster. Further, the average values of the resource usages of the cluster are compared with the preset threshold values corresponding to the resource usages to obtain the usage of the Elasticsearch cluster, that is, which of the average values of the resource usages exceeds the preset threshold value and which is normal, wherein, the preset threshold values of the resource usages include a preset threshold upper limit and a preset threshold lower limit. The average value of each resource usage needs to be compared with the preset threshold upper limit and the preset threshold lower limit included in the preset threshold value to obtain the usage of the Elasticsearch cluster.
[0085] Through the above embodiment, the usage of the Elasticsearch cluster is evaluated according to the usage data of the Elasticsearch cluster and the preset threshold.
[0086] Optionally, before the step S102, further comprising:
[0087] determining a trigger condition, the trigger condition at least including any index trigger;
[0088] The step S102 comprises:
[0089] When the trigger condition is the any index trigger, it is judged whether the average value of at least one resource usage in the usage of the Elasticsearch cluster exceeds the preset threshold corresponding to the at least one resource usage;
[0090] When the average value of at least one resource usage in the usage of the Elasticsearch cluster in the preset time period is greater than the upper limit of the preset threshold corresponding to the at least one resource usage, it is determined that the expansion and contraction strategy of the Elasticsearch cluster is the expansion operation;
[0091] When the average value of at least one resource usage in the usage of the Elasticsearch cluster in the preset time period is less than the lower limit of the preset threshold corresponding to the at least one resource usage, it is determined that the expansion and contraction strategy of the Elasticsearch cluster is the contraction operation.
[0092] Specifically, in the embodiments of the present application, before determining the scaling strategy applicable to the Elasticsearch cluster, it is necessary to determine the triggering condition for triggering the scaling strategy. As an example, the triggering condition includes any metric trigger, which means that when any resource usage exceeds the preset threshold, the corresponding scaling strategy is triggered directly. Therefore, it is necessary to determine whether the average value of at least one resource usage in the usage of the Elasticsearch cluster exceeds the preset threshold corresponding to the at least one resource usage. As long as the average value of one resource usage exceeds the preset threshold corresponding to the resource usage, the scaling strategy is triggered. Further, when the average value of at least one resource usage in the usage of the Elasticsearch cluster in a preset time period is greater than the upper limit of the preset threshold corresponding to the at least one resource usage, it is determined that the scaling strategy of the Elasticsearch cluster is a scaling operation, wherein the scaling operation is to increase the number of data nodes or to allocate more resources to the existing data nodes, wherein the allocated resources can be allocated according to the part of the resource shortage in the usage of the cluster. When the average value of at least one resource usage in the usage of the Elasticsearch cluster in a preset time period is less than the lower limit of the preset threshold corresponding to the at least one resource usage, it is determined that the scaling strategy of the Elasticsearch cluster is a scaling operation. Wherein the scaling operation is to reduce the number of allocated data nodes or to release part of the resources of the existing data nodes, wherein the released resources can be released according to the part of the resource idle in the usage of the cluster.
[0093] Through the above embodiments, when the triggering condition is any metric trigger, the scaling operation or the scaling operation can be triggered and executed according to the preset threshold. The purpose of the scaling strategy is to dynamically adjust the size of the Elasticsearch cluster according to the load and performance requirements of the Elasticsearch cluster, so as to realize the optimal utilization of resources and ensure the high availability and performance stability of the Elasticsearch cluster.
[0094] Optionally, before the step S102, it further includes:
[0095] determining a triggering condition, wherein the triggering condition at least includes all metric triggers;
[0096] The step S102 includes:
[0097] When the triggering condition is all metric triggers, it is determined whether the average value of all resource usages in the usage of the Elasticsearch cluster exceeds the preset threshold corresponding to the all resource usages;
[0098] When the average value of all resource usages in the usage of the Elasticsearch cluster in the preset time period is greater than the preset upper threshold of the all resource usages, it is determined that the scaling strategy of the Elasticsearch cluster is the expansion operation.
[0099] When the average value of all resource usages in the usage of the Elasticsearch cluster in the preset time period is less than the preset lower threshold of the all resource usages, it is determined that the scaling strategy of the Elasticsearch cluster is the shrink operation.
[0100] Specifically, in the embodiments of the present application, before determining the scaling strategy applicable to the Elasticsearch cluster, it is necessary to determine which trigger condition triggers the scaling strategy. As an example, the trigger condition includes all-index triggering, which means that when all resource usages of the Elasticsearch cluster exceed the preset threshold, the corresponding scaling strategy is triggered. Therefore, it is necessary to determine whether the average value of all resource usages in the usage of the Elasticsearch cluster exceeds the preset threshold corresponding to all resource usages. As long as the average value of all resource usages exceeds the preset threshold corresponding to all resource usages, the scaling strategy is triggered. Further, when the average value of all resource usages in the usage of the Elasticsearch cluster in the preset time period is greater than the preset upper threshold of the all resource usages, it is determined that the scaling strategy of the Elasticsearch cluster is the expansion operation, wherein the expansion operation is to increase the number of data nodes or allocate more resources to the existing data nodes, wherein the allocated resources can be allocated according to the part of the resource shortage in the usage of the cluster. When the average value of all resource usages in the usage of the Elasticsearch cluster in the preset time period is less than the preset lower threshold of the all resource usages, it is determined that the scaling strategy of the Elasticsearch cluster is the shrink operation. Wherein, the shrink operation is to reduce the number of allocated data nodes or release part of the resources of the existing data nodes, wherein the released resources can be released according to the part of the resource idle in the usage of the cluster.
[0101] Through the above embodiments, when the trigger condition is all-index triggering, the expansion operation or the shrink operation strategy can be triggered and executed according to the preset threshold. The purpose of the scaling strategy is to dynamically adjust the size of the Elasticsearch cluster according to the load condition and performance requirement of the Elasticsearch cluster, so as to realize the optimal utilization of system resources and ensure the high availability and performance stability of the Elasticsearch cluster.
[0102] Optionally, the step S102 comprises:
[0103] determining whether a first duration, in which an average value of at least one resource usage in the usage of the Elasticsearch cluster in the preset time period is greater than an upper limit of a preset threshold corresponding to the at least one resource usage, is greater than a first preset duration, and a second duration, in which the average value of the at least one resource usage is less than a lower limit of the preset threshold corresponding to the at least one resource usage, is greater than a second preset duration;
[0104] when the first duration is greater than the first preset duration, determining that the scaling strategy of the Elasticsearch cluster is a capacity expansion operation;
[0105] when the second duration is greater than the second preset duration, determining that the scaling strategy of the Elasticsearch cluster is a capacity reduction operation.
[0106] Optionally, the step S103 comprises:
[0107] when it is determined that the scaling strategy of the Elasticsearch cluster is the capacity expansion operation, requesting a Kubernetes controller on the Kubernetes cloud platform to increase the number of data nodes in the Elasticsearch cluster through the Kubernetes controller;
[0108] when it is determined that the scaling strategy of the Elasticsearch cluster is the capacity expansion operation, requesting a Kubernetes controller on the Kubernetes cloud platform to reduce the number of data nodes in the Elasticsearch cluster through the Kubernetes controller, the method comprising: determining a target data node corresponding to the capacity reduction operation, migrating data on the target data node to other data nodes, and then removing the target data node.
[0109] Specifically, as another embodiment, before determining the scaling strategy of the Elasticsearch cluster, it is needed to judge whether a first duration, during which an average value of at least one resource usage is greater than an upper limit of a preset threshold corresponding to the at least one resource usage, is greater than a first preset duration, and whether a second duration, during which the average value of the at least one resource usage is less than a lower limit of the preset threshold corresponding to the at least one resource usage, is greater than a second preset duration, that is, it is needed to judge whether there is a duration, during which only one resource usage exceeds the preset threshold, exceeding the preset duration, in the usage of the Elasticsearch cluster obtained in the preset time period. There are two cases. In a first case, the average value of the resource usage A is greater than the first duration, during which the average value of the resource usage A is greater than the upper limit of the preset threshold corresponding to the resource usage A, is greater than the first preset duration. At this time, it is determined that the scaling strategy of the Elasticsearch cluster is the expansion operation, and the Kubernetes controller on the Kubernetes cloud platform is requested to increase the number of data nodes in the Elasticsearch cluster through the Kubernetes controller. If the first duration is not greater than the first preset duration, no processing is needed. In a second case, the average value of the resource usage B is less than the second duration, during which the average value of the resource usage B is less than the lower limit of the preset threshold corresponding to the resource usage B, is greater than the second preset duration. At this time, it is determined that the scaling strategy of the Elasticsearch cluster is the shrinkage operation, and the Kubernetes controller on the Kubernetes cloud platform is requested to reduce the number of data nodes in the Elasticsearch cluster through the Kubernetes controller. Meanwhile, before reducing the number of data nodes, the data on the target data node to be removed needs to be migrated to other data nodes, and then the target data node is removed. If the second duration is not greater than the second preset duration, no processing is needed.
[0110] It should be noted that the first duration, the second duration, the first preset duration and the second preset duration are all not greater than the preset time period, and the first preset duration and the second preset duration can be set according to actual needs.
[0111] Through the above embodiment, whether to trigger the scaling strategy can be determined by the duration during which the resource usage of the Elasticsearch cluster exceeds the preset threshold, so that the dynamic adjustment process of the Elasticsearch cluster is more flexible.
[0112] Optionally, after the step S103, the method further includes:
[0113] determining whether the total number of data nodes of the Elasticsearch cluster after the expansion operation is greater than the preset maximum number of data nodes, and when the total number of data nodes after the expansion operation is greater than the preset maximum number of data nodes, the expansion operation is no longer continued;
[0114] determining whether the total number of data nodes of the Elasticsearch cluster after the shrink operation is less than the preset minimum number of data nodes, and when the total number of data nodes after the shrink operation is less than the preset maximum number of data nodes, the shrink operation is no longer continued.
[0115] Specifically, in the embodiments of the present application, after the expansion and shrink operations are performed or during the expansion and shrink operations, it is necessary to determine the relationship between the total number of data nodes of the Elasticsearch cluster after the expansion operation or before the shrink operation and the maximum number of data nodes and the latest number of data nodes, respectively. When the total number of data nodes after the expansion operation is greater than the preset maximum number of data nodes, the expansion operation is no longer continued. When the total number of data nodes after the shrink operation is less than the preset maximum number of data nodes, the shrink operation is no longer continued.
[0116] The maximum number of data nodes and the latest number of data nodes are set based on the basic requirements of the Elasticsearch cluster and can be dynamically adjusted as needed.
[0117] Through the above embodiments, it can be ensured that the number of data nodes of the Elasticsearch cluster is controllable within the preset range, the business needs are guaranteed, and the performance problems or other unpredictable effects caused by excessive expansion or shrink are avoided.
[0118] As another example:
[0119] The preset threshold of resource usage and the recommended value of each resource usage are set as follows:
[0120] CPU usage: the upper limit of the preset threshold is 40%, the lower limit of the preset threshold is 5%, and the recommended value is 20%;
[0121] Memory usage: the lower limit of the preset threshold is 60%, the upper limit of the preset threshold is 90%, and the recommended value is 80%;
[0122] Disk usage: the lower limit of the preset threshold is 40%, the upper limit of the preset threshold is 65%, and the recommended value is 55%;
[0123] Throughput: the lower limit of the preset threshold is 8 MB / s, the upper limit of the preset threshold is 20 MB / s, and the recommended value is 15 MB / s;
[0124] Write / search rejection rate: the recommended value is 0;
[0125] API node delay: the recommended value is 1500ms;
[0126] Number of shards of a single data node: the recommended value is 600.
[0127] Preferably, the resource usage can be distinguished into periodic usage and non-periodic usage, for the periodic usage, the trend and peak value of the preset time period can be analyzed, and for the non-periodic usage, the average value of the preset time period can be analyzed.
[0128] Further, the number of data nodes corresponding to the scaling strategy of the Elasticsearch cluster that needs to be adjusted can be set based on the following methods:
[0129] Recommended data node number = resource usage * current data node number / recommended value;
[0130] At this time, the scenario also needs to be classified to determine the final target data node number that needs to be adjusted, when the use case scenario is Logging (log storage), the value of the final target data node number that needs to be adjusted is the maximum value that meets the disk usage and throughput requirements. When the use case scenario is Searching (searching), under the condition of meeting the disk usage, the value of the final target data node number that needs to be adjusted is the maximum value that meets the CPU usage requirement and the minimum response time requirement. When the use case scenario is data analysis, under the condition of meeting the disk usage, the value of the final target data node number that needs to be adjusted is the maximum value that meets the CPU and memory usage requirements and the minimum response time requirement.
[0131] Optionally, in order to ensure the stability of the Elasticsearch cluster, the same Elasticsearch cluster will not be scaled in size in two consecutive periods, and at the same time, when the number of data nodes corresponding to the scaling strategy that needs to be adjusted exceeds the preset number, the team is also alarmed.
[0132] Optionally, before removing the target data node, it is necessary to determine whether the target data node to be removed has a hot node problem, that is, more than 10% of the target data nodes have a disk usage rate of more than 80%, and some target data nodes have MEM / CPU usage overheating.
[0133] Optionally, after the capacity expansion operation, the data nodes that have been allocated need to be re-allocated resources, after the capacity reduction operation, after the data nodes are removed, the stability of the Elasticsearch cluster should be determined, after waiting for a period of time, after determining that the Elasticsearch cluster is stable, the next capacity reduction operation is performed.
[0134] Optionally, the team can also be alerted about unreasonable index design (field mapping, shard size, number of shards), and the team can be alerted about low CPU usage but hard disk usage is full, such Elasticsearch clusters need to change the model and be equipped with larger disks.
[0135] Figure 3 is a framework schematic diagram of a cluster expansion and contraction device provided by an embodiment of the present application, as shown in Figure 3 The cluster expansion and contraction device provided by an embodiment of the present application is applied to a cloud platform, and a plurality of nodes of a cluster are deployed on the cloud platform, and the device comprises:
[0136] A data collection module 11 is configured to collect usage data of the plurality of nodes in the cluster.
[0137] A cluster analysis module 12 is configured to determine a usage condition of the cluster based on the usage data of the plurality of nodes in the cluster, and determine an expansion and contraction strategy of the cluster based on the usage condition of the cluster.
[0138] A cluster expansion and contraction control module 13 is configured to perform a capacity expansion operation or a capacity reduction operation on the number of nodes of the cluster according to the expansion and contraction strategy.
[0139] Optionally, the cloud platform is a Kubernetes cloud platform, the cluster is an Elasticsearch cluster, the Elasticsearch cluster comprises a plurality of data nodes, and the cluster analysis module 12 comprises:
[0140] An acquisition module is configured to acquire, in each period, usage data of the plurality of data nodes included in the Elasticsearch cluster collected in a preset time period, wherein the usage data of each data node comprises a plurality of resource usages.
[0141] A calculation module is configured to calculate average values of the plurality of resource usages of the Elasticsearch cluster in the preset time period.
[0142] A comparison module is configured to compare the average values of the plurality of resource usages with preset threshold values corresponding to the plurality of resource usages to obtain the usage condition of the Elasticsearch cluster.
[0143] The preset threshold of each resource usage includes a preset upper threshold and a preset lower threshold.
[0144] Optionally, the apparatus further comprises:
[0145] The first trigger condition determining module is configured to determine a trigger condition before determining the expansion and contraction strategy of the cluster based on the usage of the cluster, the trigger condition at least including any-index trigger.
[0146] The cluster analysis module 12 comprises:
[0147] The first determining module is configured to determine whether the average value of at least one resource usage in the usage of the Elasticsearch cluster exceeds the preset threshold corresponding to the at least one resource usage when the trigger condition is any-index trigger.
[0148] The first expansion operation determining module is configured to determine that the expansion and contraction strategy of the Elasticsearch cluster is the expansion operation when the average value of at least one resource usage in the usage of the Elasticsearch cluster in the preset time period is greater than the preset upper threshold corresponding to the at least one resource usage.
[0149] The first contraction operation determining module is configured to determine that the expansion and contraction strategy of the Elasticsearch cluster is the contraction operation when the average value of at least one resource usage in the usage of the Elasticsearch cluster in the preset time period is less than the preset lower threshold corresponding to the at least one resource usage.
[0150] Optionally, the apparatus further comprises:
[0151] The second trigger condition determining module is configured to determine a trigger condition before determining the expansion and contraction strategy of the cluster based on the usage of the cluster, the trigger condition at least including all-index trigger.
[0152] The cluster analysis module 12 comprises:
[0153] The second determining module is configured to determine whether the average value of all resource usages in the usage of the Elasticsearch cluster exceeds the preset threshold corresponding to all resource usages when the trigger condition is all-index trigger.
[0154] The second expansion operation determination module is configured to determine that the expansion strategy of the Elasticsearch cluster is the expansion operation when the average value of all resource usages in the usage of the Elasticsearch cluster within the preset time period is greater than the preset upper threshold value corresponding to the all resource usages.
[0155] The second expansion operation determination module is configured to determine that the expansion strategy of the Elasticsearch cluster is the shrink operation when the average value of all resource usages in the usage of the Elasticsearch cluster within the preset time period is less than the preset lower threshold value corresponding to the all resource usages.
[0156] Optionally, the cluster analysis module 12 comprises:
[0157] The third determination module is configured to determine whether a first duration, during which the average value of at least one resource usage in the usage of the Elasticsearch cluster within the preset time period is greater than a preset upper threshold value corresponding to the at least one resource usage, is greater than a first preset duration, and whether a second duration, during which the average value of the at least one resource usage is less than a preset lower threshold value corresponding to the at least one resource usage, is greater than a second preset duration.
[0158] The third expansion operation determination module is configured to determine that the expansion strategy of the Elasticsearch cluster is the expansion operation when the first duration is greater than the first preset duration.
[0159] The third expansion operation determination module is configured to determine that the expansion strategy of the Elasticsearch cluster is the shrink operation when the second duration is greater than the second preset duration.
[0160] Optionally, the cluster scaling control module 13 comprises:
[0161] The first operation module is configured to request a Kubernetes controller on the Kubernetes cloud platform to increase the number of data nodes in the Elasticsearch cluster through the Kubernetes controller when it is determined that the expansion strategy of the Elasticsearch cluster is the expansion operation.
[0162] The second operation module is configured to, when it is determined that the scaling strategy of the Elasticsearch cluster is an expansion operation, request a Kubernetes controller on the Kubernetes cloud platform to reduce the number of data nodes in the Elasticsearch cluster by the Kubernetes controller, and the method comprises: determining target data nodes corresponding to the scaling operation, migrating data on the target data nodes to other data nodes, and then removing the target data nodes.
[0163] Optionally, the apparatus further comprises:
[0164] The third operation module is configured to, after the number of nodes of the cluster is expanded or scaled according to the scaling strategy, determine whether the total number of data nodes after the number of data nodes of the Elasticsearch cluster is expanded is greater than a preset maximum number of data nodes, and when the total number of data nodes after the expansion is greater than the preset maximum number of data nodes, the expansion operation is no longer performed.
[0165] The fourth operation module is configured to determine whether the total number of data nodes after the number of data nodes of the Elasticsearch cluster is scaled is less than a preset minimum number of data nodes, and when the total number of data nodes after the scaling is less than the preset maximum number of data nodes, the scaling operation is no longer performed.
[0166] Based on the same inventive concept, another embodiment of the present application also provides an electronic device comprising a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the cluster scaling method according to any one of the above embodiments.
[0167] Based on the same inventive concept, another embodiment of the present application also provides a computer program product comprising a computer program, wherein the computer program is executed by a processor to implement the cluster scaling method according to any one of the above embodiments.
[0168] Based on the same inventive concept, another embodiment of the present application also provides a computer readable medium having a computer program stored thereon, wherein the program is executed by a processor to implement the cluster scaling method according to any one of the above embodiments.
[0169] For the apparatus, since it is basically similar to the method embodiment, the description is relatively simple, and the related parts can be referred to the part of the method embodiment.
[0170] The various embodiments in the specification are described in progressive manner, and each embodiment focuses on the difference from other embodiments, and the same or similar parts between the embodiments can be referred to each other.
[0171] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, device, or computer program product. Therefore, the embodiments of the present application can adopt a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the embodiments of the present application can adopt a computer program product in the form of being implemented on one or more computer usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer usable program codes.
[0172] The embodiments of the present application are described with reference to flowcharts and / or block diagrams according to the method, terminal device (system), and computer program product of the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of the flows and / or blocks can be implemented by computer program instructions. These computer program instructions can be provided to a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, so that the instructions executed by the computer or other programmable data processing terminal device produce a device for implementing the functions specified in the flowcharts and / or block diagrams. Figure 1 The functions specified in one or more flows and / or blocks Figure 1 The functions specified in one or more flows and / or blocks
[0173] These computer program instructions can also be stored in a computer readable storage medium that can guide the computer or other programmable data processing terminal device to work in a specific manner, so that the instructions stored in the computer readable storage medium produce a product including instruction devices that implement the functions specified in the flowcharts and / or block diagrams. Figure 1 The functions specified in one or more flows and / or blocks Figure 1 The functions specified in one or more flows and / or blocks
[0174] These computer program instructions can also be loaded into a computer or other programmable data processing terminal device, so that a series of operation steps are performed on the computer or other programmable terminal device to produce a computer implemented process, so that the instructions executed on the computer or other programmable terminal device provide a process for implementing the functions specified in the flowcharts and / or block diagrams. Figure 1 The functions specified in one or more flows and / or blocks Figure 1 The functions specified in one or more flows and / or blocks
[0175] While preferred embodiments of the application have been described, a wide variety of modifications, alterations, and permutations of these embodiments can become apparent to those skilled in the art in light of the foregoing detailed description. Accordingly, it is to be understood that other embodiments can be utilized, and that the scope of the application is not limited to the specific embodiments described herein. The specification and drawings should be regarded as illustrative only and should not be considered restrictive in any sense. The accompanying drawings are included to provide a further understanding of the application and are incorporated in and constitute a part of this specification.
[0176] Finally, it should be noted that, in this document, the term "only" is used to set off at least one particular feature of a claim from other features of the claim. However, the use of "only" in a claim has no bearing on the claim's scope or the claim's interpretation. In other words, the use of "only" in a claim does not limit the claim's scope or the claim's interpretation.
[0177] The above provides a cluster expansion and contraction method, device, electronic equipment and computer readable medium. The principle and implementation of the application are described by applying specific examples in the present document. The above description of the embodiments is only used to help understand the method and its core idea of the application. Meanwhile, for those skilled in the art, according to the idea of the application, the specific implementation and application range can be changed. In summary, the content of the specification should not be understood as a limitation of the application.
Claims
1. A cluster scaling method, characterized by, The method is applied to a cloud platform, wherein a plurality of nodes of a cluster are deployed on the cloud platform, and the method comprises the following steps: collecting usage data of the plurality of nodes in the cluster; determining a usage condition of the cluster based on the usage data of the plurality of nodes in the cluster, and determining a scaling strategy of the cluster based on the usage condition of the cluster; performing a scaling operation or a de-scaling operation on the number of nodes of the cluster according to the scaling strategy; the cloud platform is a Kubernetes cloud platform, the cluster is an Elasticsearch cluster, the Elasticsearch cluster comprises a plurality of data nodes, and the step of determining the usage condition of the cluster based on the usage data of the plurality of nodes in the cluster comprises the following steps: in each period, obtaining usage data of the plurality of data nodes included in the Elasticsearch cluster collected in a preset time period, wherein the usage data of each data node comprises a plurality of resource usages; calculating average values of the resource usages of the Elasticsearch cluster in the preset time period; comparing the average values of the resource usages with preset threshold values corresponding to the resource usages to obtain the usage condition of the Elasticsearch cluster; wherein the preset threshold values of the resource usages comprise a preset upper threshold value and a preset lower threshold value; the step of determining the scaling strategy of the cluster based on the usage condition of the cluster comprises the following steps: determining whether a first duration, in which an average value of at least one resource usage in the usage condition of the Elasticsearch cluster in the preset time period is greater than the preset upper threshold value corresponding to the at least one resource usage, is greater than a first preset duration, and whether a second duration, in which the average value of the at least one resource usage is less than the preset lower threshold value corresponding to the at least one resource usage, is greater than a second preset duration; when the first duration is greater than the first preset duration, determining that the scaling strategy of the Elasticsearch cluster is the scaling operation; when the second duration is greater than the second preset duration, determining that the scaling strategy of the Elasticsearch cluster is the de-scaling operation.
2. The cluster scaling method of claim 1, wherein, Before the step of determining the scaling strategy of the cluster based on the usage condition of the cluster, the following step is further included: determining a trigger condition, wherein the trigger condition at least comprises any index trigger; the step of determining the scaling strategy of the cluster based on the usage condition of the cluster comprises the following steps: when the trigger condition is the any index trigger, determining whether an average value of at least one resource usage in the usage condition of the Elasticsearch cluster exceeds the preset threshold value corresponding to the at least one resource usage; when the average value of the at least one resource usage in the usage condition of the Elasticsearch cluster in the preset time period is greater than the preset upper threshold value corresponding to the at least one resource usage, determining that the scaling strategy of the Elasticsearch cluster is the scaling operation; determining the scaling strategy of the Elasticsearch cluster as the scaling-in operation when the average value of at least one resource usage in the usage of the Elasticsearch cluster in the preset time period is less than a preset lower threshold corresponding to the at least one resource usage.
3. The cluster scaling method of claim 1, wherein, Before determining the scaling strategy of the cluster based on the usage of the cluster, the method further comprises: determining a trigger condition, the trigger condition comprising at least an all-indicator trigger; determining the scaling strategy of the cluster based on the usage of the cluster, comprising: when the trigger condition is the all-indicator trigger, judging whether the average value of all resource usages in the usage of the Elasticsearch cluster exceeds a preset threshold corresponding to the all resource usages; determining the scaling strategy of the Elasticsearch cluster as the scaling-in operation when the average value of all resource usages in the usage of the Elasticsearch cluster in the preset time period is less than a preset lower threshold corresponding to the all resource usages. determining the scaling strategy of the Elasticsearch cluster as the scaling-in operation when the average value of all resource usages in the usage of the Elasticsearch cluster in the preset time period is less than a preset lower threshold corresponding to the all resource usages.
4. The cluster scaling method of claim 1, wherein, the scaling operation or the scaling operation on the number of nodes of the cluster according to the scaling strategy, comprising: when it is determined that the scaling strategy of the Elasticsearch cluster is the scaling-in operation, requesting a Kubernetes controller on the Kubernetes cloud platform to increase the number of data nodes in the Elasticsearch cluster through the Kubernetes controller; when it is determined that the scaling strategy of the Elasticsearch cluster is the scaling-in operation, requesting a Kubernetes controller on the Kubernetes cloud platform to increase the number of data nodes in the Elasticsearch cluster through the Kubernetes controller; 5. The cluster scaling method according to any one of claims 1-4, c h a r a c t e r i z e d b y after the scaling operation or the scaling operation on the number of nodes of the cluster according to the scaling strategy, the method further comprises: determining whether the total number of data nodes after the scaling operation on the number of data nodes of the Elasticsearch cluster is greater than a preset maximum number of data nodes, and when the total number of data nodes after the scaling operation is greater than the preset maximum number of data nodes, the scaling operation is no longer performed; determining whether the total number of data nodes after the scaling operation on the number of data nodes of the Elasticsearch cluster is greater than a preset maximum number of data nodes, and when the total number of data nodes after the scaling operation is greater than the preset maximum number of data nodes, the scaling operation is no longer performed; Determine whether the total number of data nodes of the Elasticsearch cluster after the shrink operation is less than the preset minimum number of data nodes. When the total number of data nodes after the shrink operation is less than the preset maximum number of data nodes, the shrink operation is no longer performed.
6. A cluster scaling apparatus, characterized by, The application is applied to a cloud platform, wherein a plurality of nodes of a cluster are deployed on the cloud platform, and the device comprises: a data collection module configured to collect usage data of the plurality of nodes in the cluster; a cluster analysis module configured to determine a usage condition of the cluster based on the usage data of the plurality of nodes in the cluster, and determine a scaling strategy of the cluster based on the usage condition of the cluster; a cluster scaling control module configured to perform a scaling operation or a shrink operation on the number of nodes of the cluster according to the scaling strategy; The cloud platform is a Kubernetes cloud platform, the cluster is an Elasticsearch cluster, the Elasticsearch cluster comprises a plurality of data nodes, and the cluster analysis module comprises: an acquisition module configured to acquire, in each period, usage data of the plurality of data nodes included in the Elasticsearch cluster collected in a preset time period, wherein the usage data of each data node comprises a plurality of resource usages; a calculation module configured to calculate average values of the resource usages of the Elasticsearch cluster in the preset time period; a comparison module configured to compare the average values of the resource usages with preset threshold values corresponding to the resource usages to obtain a usage condition of the Elasticsearch cluster; The preset threshold values of the resource usages comprise a preset upper threshold value and a preset lower threshold value. The cluster analysis module comprises: a third determination module configured to determine whether a first duration, during which at least one resource usage of the usage condition of the Elasticsearch cluster in the preset time period is greater than the preset upper threshold value corresponding to the at least one resource usage, is greater than a first preset duration, and whether a second duration, during which the at least one resource usage is less than the preset lower threshold value corresponding to the at least one resource usage, is greater than a second preset duration; a third scaling operation determination module configured to determine that the scaling strategy of the Elasticsearch cluster is a scaling operation when the first duration is greater than the first preset duration; a third scaling operation determination module configured to determine that the scaling strategy of the Elasticsearch cluster is a shrink operation when the second duration is greater than the second preset duration.
7. An electronic device, comprising: A computer program is stored in a memory, and a processor executes the computer program to implement the cluster scaling method according to any one of claims 1-5.
8. A computer readable medium characterized by A computer program is stored in a memory, and a processor executes the computer program to implement the cluster scaling method according to any one of claims 1-5.
Citation Information
Patent Citations
Container cloud elastic scaling method and device
CN113395178A
Data cluster computing node expansion and contraction method and device, equipment and medium
CN114816753A