Database container scheduling method, device, electronic device and storage medium
Through calculating cluster magnification and scheduling methods based on magnification equalization rules, the problem of low resource utilization in highly available groups of distributed database containers is solved, and the optimal allocation of resources and operation and maintenance efficiency is improved.
Patent Information
- Application Number
- CN202011507220.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-18
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2040-12-18
AI Technical Summary
When building highly available groups of distributed database containers, the existing technology cannot effectively utilize server resources, resulting in waste of resources and increased operation and maintenance pressure.
By obtaining the number of database containers and the number of cluster servers, the cluster magnification is calculated, and the database container is scheduled to achieve the optimal configuration of resources according to the predetermined magnification equalization rules.
Make full use of database containers, reduce resource waste, improve resource utilization, reduce operation and maintenance pressure, and realize the rapid construction and supply of highly available groups of distributed databases.
Smart Images

Figure CN112631716B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of cloud computing, and in particular to a database container scheduling method, device, electronic device and storage medium. Background Art
[0002] With the rapid development of cloud computing, as an important part of cloud computing services, distributed database container services have also grown rapidly and become popular. For example, for MySQL database containers, the direct benefit brought by containers is resource saving. Traditional MySQL database deployment means that only one MySQL database can be deployed on a single server. After containerization, a single server can run multiple MySQL database containers of different specifications, which can effectively save resources.
[0003] Distributed databases generally provide services to the outside world in a high-availability cluster mode with one master and multiple slaves. The master-slave replication function provided by the database itself can easily realize multiple automatic backups of data and expand the database. Multiple data backups can not only enhance data security, but also further improve the load performance of the database by realizing read-write separation. In a database system with one master and multiple slaves, multiple slave servers use asynchronous methods to update changes in the master database. Multiple nodes form a high-availability group to provide stable data storage services to upper-level applications.
[0004] For reasons of high availability and fault switching, a distributed database (for example, MySQL) high availability group is usually built as a whole. It is inaccurate to rely solely on manual judgment to select a suitable cluster in the existing production cluster to deploy multiple nodes of the database high availability group. Especially for a large application, when hundreds of database high availability groups need to be built, it puts a lot of pressure on operation and maintenance. At the same time, database containers have different specifications, and large-scale applications also require larger-specification containers as database services. If a machine runs large-specification containers, the remaining resources will not be fully utilized, resulting in a waste of working node (i.e., server) resources. Summary of the invention
[0005] In view of this, the present invention provides a database container scheduling method, device, electronic device and storage medium to solve at least one of the above-mentioned problems.
[0006] According to a first aspect of the present invention, a database container scheduling method is provided, the method comprising:
[0007] Obtain information about the number of database containers that need to be scheduled and the number of servers in each of the multiple clusters;
[0008] Determine the multiplier information of the cluster according to the number information of database containers that need to be scheduled and the number information of servers in each cluster;
[0009] The database container is scheduled for each cluster according to a predetermined rate balancing rule, rate information of each cluster and specification information of the database container to be scheduled.
[0010] According to a second aspect of the present invention, a database container scheduling device is provided, the device comprising:
[0011] An information acquisition unit, used to acquire information on the number of database containers that need to be scheduled and information on the number of servers in each of the multiple clusters;
[0012] A multiplier determination unit, configured to determine the multiplier information of the cluster according to the number information of the database containers to be scheduled and the number information of the servers in each cluster;
[0013] The scheduling unit is used to schedule database containers for each cluster according to a predetermined rate balancing rule, rate information of each cluster and specification information of the database container to be scheduled.
[0014] According to a third aspect of the present invention, there is provided an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the program.
[0015] According to a fourth aspect of the present invention, there is provided a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the above method when executed by a processor.
[0016] It can be seen from the above technical solution that the multiplier information of the cluster is determined according to the acquired information on the number of database containers that need to be scheduled and the number of servers of each cluster, and based on the multiplier balancing rule, the database container is scheduled for each cluster according to the multiplier information of each cluster and the specification information of each database container. Since the multiplier information of the cluster, the specification information of the database container, and the multiplier balancing rule are taken into consideration, the database container can be fully utilized, the waste of resources can be reduced, and the utilization rate of resources can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0018] Figure 1is a flowchart of a database container scheduling method according to an embodiment of the present invention;
[0019] Figure 2 This is a flow chart of a K8s inter-cluster scheduling strategy based on rate balancing according to an embodiment of the present invention;
[0020] Figure 3 is a structural block diagram of a database container scheduling device according to an embodiment of the present invention;
[0021] Figure 4 It is a structural block diagram of a K8s inter-cluster scheduling strategy system based on MySQL rate balancing according to an embodiment of the present invention;
[0022] Figure 5 is a structural block diagram of a parameter processing device 1 according to an embodiment of the present invention;
[0023] Figure 6 is a structural block diagram of a scheduling execution device 2 according to an embodiment of the present invention;
[0024] Figure 7 is a structural block diagram of a scheduling strategy device 3 according to an embodiment of the present invention;
[0025] Figure 8 is a schematic diagram of the internal structure of the information collection device 4 according to an embodiment of the present invention;
[0026] Fig. 9 It is a schematic block diagram of the system structure of the electronic device 600 according to an embodiment of the present invention. DETAILED DESCRIPTION
[0027] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0028] Since the currently constructed distributed database container high availability group has the problem of resource waste, based on this, an embodiment of the present invention provides a database container scheduling solution, which can select the optimal cluster based on the database container specification information and improve resource utilization. The following is a detailed description of the embodiment of the present invention in conjunction with the accompanying drawings.
[0029] Figure 1 is a flowchart of a database (eg, MySQL) container scheduling method according to an embodiment of the present invention. Figure 1 As shown, the method includes:
[0030] Step 101, obtaining information on the number of database containers that need to be scheduled and information on the number of servers in each of a plurality of clusters.
[0031] Step 102: Determine the multiplier information of the cluster according to the number information of the database containers that need to be scheduled and the number information of the servers in each cluster.
[0032] The magnification information here can be obtained through the following formula:
[0033] Cluster ratio = total number of containers that need to be scheduled / total number of servers in the cluster.
[0034] Step 103 : Scheduling database containers for each cluster according to a predetermined rate balancing rule, rate information of each cluster, and specification information of the database container to be scheduled.
[0035] Specifically, each cluster may be sorted based on a predetermined rate balancing rule according to rate information of each cluster and specification information of a database container to be scheduled, where the database container to be scheduled is one of the database containers to be scheduled; and then, the database container to be scheduled is scheduled to a corresponding cluster according to the sorting information of each cluster.
[0036] In one embodiment, the database containers to be scheduled can be sorted according to the specification information of the database containers. Then, based on a predetermined multiplier balancing rule, the multiplier information of the cluster and the specification information of the sorted database containers to be scheduled are determined to be in an inverse relationship; then, based on the inverse relationship, the clusters are sorted, for example, the clusters can be sorted by scoring.
[0037] For example, the database containers to be scheduled are A, B, and C, with increasing specifications; the clusters are 1, 2, and 3, with increasing ratios. For database container A to be scheduled, compared with database containers B and C, database container A is a small-sized container. At this time, the cluster with a low ratio has a high score, and the cluster with a high ratio has a low score. The scores of clusters 1, 2, and 3 are from high to low. At this time, database container A to be scheduled is scheduled to cluster 1. For database container B to be scheduled, compared with database container C, database container B is a small-sized container. The scores of clusters 2 and 3 are from high to low. At this time, database container B is scheduled to cluster 2. Finally, database container C is scheduled to cluster 1.
[0038] In the specific implementation process, the resource usage of each server in the cluster can also be obtained. The above-mentioned scheduling of the database container to be scheduled to the corresponding cluster includes: scheduling the database container to be scheduled to a server in the corresponding cluster according to the resource usage of each server in the corresponding cluster.
[0039] Specifically, each server in the corresponding cluster may be sorted according to its resource usage; and then the database container to be scheduled is scheduled to the server with the best resource usage.
[0040] The multiplier information of the cluster is determined according to the acquired information on the number of database containers that need to be scheduled and the number of servers in each cluster, and based on the multiplier balancing rule, the database container is scheduled for each cluster according to the multiplier information of each cluster and the specification information of each database container. Since the multiplier information of the cluster, the specification information of the database container and the multiplier balancing rule are taken into consideration, the database container can be fully utilized, the waste of resources can be reduced, and the utilization rate of resources can be improved.
[0041] In one embodiment, before performing step 102, each cluster may be screened according to a predetermined strong rule to delete servers that do not comply with the strong rule, so that more accurate rate information may be obtained.
[0042] In order to better understand the present invention, an implementation example is given below based on K8s (i.e., Kubernetes, which is a container orchestration engine open sourced by Google, supporting automated deployment, large-scale scalability, and application containerized management) cluster scheduling. The K8s cluster here is a logical concept, consisting of a control node, a working node (i.e., a server), and a storage node. The control node is responsible for the scheduling and lifecycle management of the database container, the working node is responsible for the actual implementation, which is achieved by receiving commands from the control node, and the storage node is responsible for persisting the information of the database container.
[0043] Figure 2 is a flow chart of a K8s cluster scheduling strategy based on distributed database container rate balancing according to an embodiment of the present invention, such as Figure 2 As shown, the process includes:
[0044] Step 201: Initiate a request to build a distributed database container (e.g., MySQL) high availability group. Generally speaking, a distributed database service is a high availability group architecture. For example, for a MySQL database container, a high availability group contains multiple MySQL database containers, which can be divided into master nodes and slave nodes according to their functions. The master node is responsible for write operations, and the slave node is responsible for real-time synchronization of the master node's data, so that when the master node fails, the slave node can also provide external services in a highly available manner.
[0045] Step 202: Receive the build request from step 201.
[0046] Step 203: cyclically extract the database containers that need to be scheduled in the high availability group. Taking the MySQL database container as an example, the containers can be extracted in the order of master first and slave later as the containers to be scheduled.
[0047] Step 204: Select the scheduling strategy to be executed for this scheduling, including strong rule strategies, such as fault domain isolation, deleting servers that do not comply with the rules through strong rule strategies, ensuring high availability of database container services from the physical layer, and customizing the rate balancing scheduling strategy. The rate balancing strategy can be found in the following step 206.
[0048] Step 205: Filter servers according to the strong rules of the database container, where the strong rules include strategies such as high availability.
[0049] Step 206: Screen according to the cluster ratio balancing strategy. The overall ratio calculation formula for each cluster is: the number of database containers to be scheduled / the total number of servers in each cluster, and the cluster is scored according to the calculated value. For example, there are 100 servers in a cluster, and the number of containers to be scheduled is 30, then the ratio of the cluster is equal to 30 / 100=30%. The size of the container's demand for CPU (Central Processing Unit) and memory determines the size of the container. The larger the demand, the larger the size, and vice versa, the smaller the size (for example, large size: 32C64G, small size: 4C8G). The clusters are scored according to the ratio size. For large-size MySQL containers to be scheduled, clusters with high ratios have low scores, and clusters with low ratios have high scores. Conversely, for small-size containers to be scheduled, clusters with low ratios have high scores, and clusters with high ratios have low scores.
[0050] By implementing the database container size mismatch principle, the database container size mismatch running on a single server can be achieved, thereby making full use of computing, storage, and network resources and improving resource utilization.
[0051] Step 207: Obtain cluster information through the Kubernetes interface and pass it into the scheduling strategy as an input parameter.
[0052] Step 208: Schedule the current database container to be scheduled to the cluster with the highest score in step 206. For example, if cluster 1 scores 5 points, cluster 2 scores 3 points, and cluster 3 scores 6 points, then schedule the current database container to be scheduled to cluster 3.
[0053] Step 209: Determine whether the current database container is the last one in the high availability group. If yes, persist the scheduling result, and the distributed database container high availability group is built. If not, continue to schedule the next container in the high availability group until all scheduling is completed.
[0054] Step 210: After the above cluster is selected, the container is scheduled to a specific server according to the scheduling logic in the cluster. For example, the container can be scheduled to the server with the best resource utilization rate in the cluster. After that, the final scheduling result of the cluster can be persisted and saved in the database.
[0055] Step 211: The user queries the final result of the scheduling through the result feedback result.
[0056] The K8S inter-cluster scheduling strategy based on rate balancing provided by the embodiment of the present invention implements the mismatch of database container specifications and sizes running on a single server according to the principle of size mismatch, which can make full use of computing, storage, and network resources and improve resource utilization. If a single machine runs large-scale database containers, the remaining resources are limited and other containers cannot be run, resulting in a waste of resources. If the deployment is carried out according to the principle of size mismatch, a rate balancing goal can be achieved in the end. In this way, the computing, storage and other resources of the server can be fully utilized, reducing the waste of resources and excessive use of resources caused by improper scheduling.
[0057] Based on similar inventive concepts, an embodiment of the present invention further provides a database container scheduling device, which is preferably used to implement the process in the above method embodiment.
[0058] Figure 3 This is the structural diagram of the database container scheduling device, such as Figure 3 As shown, the device includes: an information acquisition unit 301, a multiplier determination unit 302 and a scheduling unit 303, wherein:
[0059] The information acquisition unit 301 is used to acquire the number of database containers that need to be scheduled and the number of servers in each of the multiple clusters;
[0060] A multiplier determination unit 302 is used to determine the multiplier information of the cluster according to the number information of the database containers that need to be scheduled and the number information of the servers in each cluster;
[0061] The scheduling unit 303 is used to schedule database containers for each cluster according to a predetermined rate balancing rule, rate information of each cluster and specification information of the database container to be scheduled.
[0062] The rate determination unit 302 determines the rate information of the cluster according to the number of database containers that need to be scheduled and the number of servers of each cluster obtained by the information acquisition unit 301. The scheduling unit 303 schedules the database container for each cluster based on the rate balancing rule according to the rate information of each cluster and the specification information of each database container. Since the cluster rate information, the specification information of the database container and the rate balancing rule are taken into consideration, the database container can be fully utilized, the waste of resources can be reduced, and the utilization rate of resources can be improved.
[0063] In actual operation, the above device further includes: a screening unit, which is used to perform screening operations on each cluster according to a predetermined strong rule to delete servers that do not meet the strong rule.
[0064] Specifically, the scheduling unit 303 includes: a sorting module and a scheduling module, wherein:
[0065] A sorting module, used to sort each cluster based on a predetermined rate balancing rule according to rate information of each cluster and specification information of a database container to be scheduled, wherein the database container to be scheduled is one of the above-mentioned database containers to be scheduled;
[0066] The scheduling module is used to schedule the database container to be scheduled to the corresponding cluster according to the sorting information of each cluster.
[0067] In one embodiment, the above device can also obtain resource usage of each server in the cluster, and then the scheduling module can schedule the database container to be scheduled to a server in the corresponding cluster according to the resource usage of each server in the corresponding cluster. Specifically, the scheduling module can sort the servers according to the resource usage of each server in the corresponding cluster, and then schedule the database container to be scheduled to the server with the best resource usage.
[0068] In one embodiment, the above-mentioned sorting module specifically includes: a container sorting submodule, an inverse relationship determination submodule and a sorting submodule, wherein:
[0069] A container sorting submodule, used to sort the database containers that need to be scheduled according to the specification information of the database containers;
[0070] An inverse relationship determination submodule, used to determine that the multiplier information of the cluster and the specification information of the sorted database containers to be scheduled are in an inverse relationship based on a predetermined multiplier balancing rule;
[0071] The sorting submodule is used to sort the clusters based on the inverse relationship.
[0072] The specific execution process of the above-mentioned units, modules and sub-modules can be found in the description of the above-mentioned method embodiment, which will not be repeated here.
[0073] In actual operation, the above-mentioned units, modules, and sub-modules may be provided in combination or individually, and the present invention is not limited thereto.
[0074] In order to better understand the embodiments of the present invention, a specific embodiment is given below.
[0075] In this embodiment, a K8s inter-cluster scheduling strategy system based on MySQL rate balancing is provided. Figure 4 As shown, the system includes: a parameter processing device 1, a scheduling execution device 2, a scheduling strategy device 3, and an information collection device 4. Among them, the parameter processing device 1 is connected to the scheduling execution device 2; the scheduling execution device 2 is connected to the scheduling strategy device 3; the scheduling execution device 3 is connected to the information collection device 4, and each device is described below.
[0076] (1) Parameter processing device 1, used to receive creation information and feedback of creation result information.
[0077] Figure 5 is a structural block diagram of the parameter processing device 1, such as Figure 5 As shown, the parameter processing device 1 includes: a request receiving unit 11 and a result feedback unit 12, wherein:
[0078] Request receiving unit: used to receive the creation request of MySQL high availability group and parse the request parameters.
[0079] Result feedback unit: used to feed back the final scheduling results to the user for review.
[0080] (2) Scheduling execution device 2, used for implementing scheduling and selecting scheduling strategies.
[0081] Figure 6 is a structural block diagram of the scheduling execution device 2, such as Figure 6 As shown, the scheduling execution device 2 includes: a strategy selection unit 21 and a specific scheduling unit 22, wherein:
[0082] Strategy selection unit: used to specify the scheduling strategy to be considered.
[0083] Specific scheduling unit: Screen the existing clusters according to the scheduling strategy and determine an optimal cluster for the MySQL database container.
[0084] (3) Scheduling strategy device 3, used to set scheduling strategies, including: strong rule strategy and custom MySQL multiplier balancing scheduling strategy.
[0085] Figure 7is a structural block diagram of the scheduling strategy device 3, such as Figure 7 As shown, the scheduling strategy device 3 includes: a strong rule strategy unit 31, a multiplier balancing strategy unit 32, wherein:
[0086] Strong rule policy unit: used to specify strong rules that the MySQL database container meets, such as physical isolation, which is isolated through the underlying physical resource domain of the server to achieve fault isolation and high availability.
[0087] Rate balancing strategy unit: used to specify the strategy for optimizing clusters, score and compare clusters, and select the cluster with the higher score as the optimal scheduler.
[0088] (4) Information collection device 4, used to collect specification information of cluster servers and containers.
[0089] Figure 8 It is a schematic diagram of the internal structure of the information collection device 4, such as Figure 8 As shown, the information collection device 4 includes: an information collection unit 41, an information processing unit 42, and an information aggregation unit 43, wherein:
[0090] Information collection unit: used to query information such as the total number of containers that need to be scheduled and the total number of servers in each cluster through the Kubernetes interface.
[0091] Information processing unit: used to process the information after obtaining it and calculate the clustering multiple.
[0092] Information aggregation unit: used to aggregate the multiples of a single cluster calculated by the information processing unit to form the multiples information of the MySQL cluster as a scheduling indicator.
[0093] This embodiment also provides an electronic device, which may be a desktop computer, a tablet computer, a mobile terminal, etc., but this embodiment is not limited thereto. In this embodiment, the electronic device may be implemented with reference to the above method embodiment and the embodiment of the database container scheduling device, the contents of which are incorporated herein, and the repeated parts are not repeated.
[0094] Fig. 9 FIG. 6 is a schematic block diagram of a system structure of an electronic device 600 according to an embodiment of the present invention. Fig. 9 As shown, the electronic device 600 may include a central processor 100 and a memory 140; the memory 140 is coupled to the central processor 100. It should be noted that this figure is exemplary; other types of structures may also be used to supplement or replace this structure to implement telecommunication functions or other functions.
[0095] In one embodiment, the database container scheduling function may be integrated into the central processor 100. The central processor 100 may be configured to perform the following control:
[0096] Obtain information about the number of database containers that need to be scheduled and the number of servers in each of the multiple clusters;
[0097] Determine the multiplier information of the cluster according to the number information of database containers that need to be scheduled and the number information of servers in each cluster;
[0098] The database container is scheduled for each cluster according to a predetermined rate balancing rule, rate information of each cluster, and specification information of each database container.
[0099] From the above description, it can be seen that the electronic device provided in the embodiment of the present application determines the multiplier information of the cluster to which it belongs according to the acquired information on the number of database containers that need to be scheduled and the information on the number of servers of each cluster, and based on the multiplier balancing rule, schedules the database container for each cluster according to the multiplier information of each cluster and the specification information of each database container. Since the multiplier information of the cluster, the specification information of the database container and the multiplier balancing rule are taken into consideration, the database container can be fully utilized, the waste of resources can be reduced, and the utilization rate of resources can be improved.
[0100] In another embodiment, the database container scheduling device may be configured separately from the central processor 100. For example, the database container scheduling device may be configured as a chip connected to the central processor 100, and the database container scheduling function is implemented under the control of the central processor.
[0101] like Fig. 9 As shown, the electronic device 600 may further include: a communication module 110, an input unit 120, an audio processing unit 130, a display 160, and a power supply 170. It is worth noting that the electronic device 600 does not necessarily have to include Fig. 9 In addition, the electronic device 600 may also include Fig. 9 For components not shown, reference may be made to the prior art.
[0102] like Fig. 9 As shown, the central processor 100 is sometimes also referred to as a controller or an operation control, and may include a microprocessor or other processor devices and / or logic devices. The central processor 100 receives inputs and controls the operations of various components of the electronic device 600.
[0103] The memory 140 may be, for example, one or more of a cache, a flash memory, a hard drive, a removable medium, a volatile memory, a non-volatile memory or other suitable devices. The above-mentioned information related to the failure may be stored, and a program for executing the relevant information may also be stored. The CPU 100 may execute the program stored in the memory 140 to implement information storage or processing.
[0104] The input unit 120 provides input to the CPU 100. The input unit 120 is, for example, a key or a touch input device. The power supply 170 is used to provide power to the electronic device 600. The display 160 is used to display display objects such as images and text. The display may be, for example, an LCD display, but is not limited thereto.
[0105] The memory 140 may be a solid-state memory, such as a read-only memory (ROM), a random access memory (RAM), a SIM card, etc. It may also be a memory that saves information even when the power is off, can be selectively erased, and is provided with more data, examples of which are sometimes referred to as EPROMs, etc. The memory 140 may also be some other type of device. The memory 140 includes a buffer memory 141 (sometimes referred to as a buffer). The memory 140 may include an application / function storage unit 142, which is used to store application programs and function programs or processes for executing the operation of the electronic device 600 through the central processor 100.
[0106] The memory 140 may also include a data storage unit 143 for storing data, such as contacts, digital data, pictures, sounds, and / or any other data used by the electronic device. The driver storage unit 144 of the memory 140 may include various drivers for communication functions of the electronic device and / or for executing other functions of the electronic device (such as messaging applications, address book applications, etc.).
[0107] The communication module 110 is a transmitter / receiver 110 that transmits and receives signals via an antenna 111. The communication module (transmitter / receiver) 110 is coupled to the central processor 100 to provide input signals and receive output signals, which may be the same as the case of a conventional mobile communication terminal.
[0108] Based on different communication technologies, multiple communication modules 110 may be provided in the same electronic device, such as a cellular network module, a Bluetooth module and / or a wireless LAN module. The communication module (transmitter / receiver) 110 is also coupled to a speaker 131 and a microphone 132 via an audio processor 130 to provide an audio output via the speaker 131 and receive an audio input from the microphone 132, thereby realizing a common telecommunication function. The audio processor 130 may include any suitable buffer, decoder, amplifier, etc. In addition, the audio processor 130 is also coupled to the central processor 100, so that the sound can be recorded on the local machine through the microphone 132, and the sound stored on the local machine can be played through the speaker 131.
[0109] An embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned database container scheduling method are implemented.
[0110] In summary, in order to solve the problem that the optimal cluster selection cannot be achieved by integrating the container specification information in the process of building a distributed database container high availability group, the embodiment of the present invention provides a K8S cluster scheduling strategy based on multiple balance, and the distributed database container is mismatched according to the principle of size mismatch, so as to achieve the mismatch of the size of the distributed database container running on a single server, which can make full use of computing, storage, and network resources and improve the utilization rate of resources. By implementing the deployment according to the principle of size mismatch, the goal of multiple balance is finally achieved, and the computing, storage and other resources of the server can be fully utilized, reducing the waste of resources and excessive use of resources caused by improper scheduling. For applications, faster delivery of distributed database high availability groups can be achieved. For operation and maintenance personnel, the workload caused by manual screening can be reduced, greatly reducing the pressure of operation and maintenance. Through the embodiment of the present invention, faster construction and supply of distributed database high availability groups are achieved; the scheduling strategy is customized for the specifications of distributed database containers, and the optimal scheduling for distributed databases is achieved, and the multiple balance of cluster servers is guaranteed as much as possible, and the utilization of cluster server resources is maximized.
[0111] The preferred embodiments of the present invention are described above with reference to the accompanying drawings. Many features and advantages of these embodiments are clear from this detailed description, and therefore the claims are intended to cover all such features and advantages of these embodiments that fall within their true spirit and scope. In addition, since many modifications and changes are easily conceivable to those skilled in the art, it is not intended to limit the embodiments of the present invention to the precise structure and operation illustrated and described, but all suitable modifications and equivalents falling within its scope may be covered.
[0112] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product 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 code.
[0113] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0114] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0115] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0116] The present invention uses specific embodiments to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A database container scheduling method, characterized in that: The method comprises: Obtain information about the number of database containers that need to be scheduled and the number of servers in each of the multiple clusters; Determine the multiplier information of the cluster according to the number information of the database containers that need to be scheduled and the number information of the servers in each cluster; Scheduling database containers for each cluster according to a predetermined rate balancing rule, rate information of each cluster, and specification information of the database container to be scheduled; Scheduling database containers for each cluster according to a predetermined rate balancing rule, rate information of each cluster, and specification information of the database container to be scheduled includes: Based on a predetermined rate balancing rule, the clusters are sorted according to the rate information of each cluster and the specification information of the database container to be scheduled, wherein the database container to be scheduled is one of the database containers to be scheduled; According to the sorting information of each cluster, the database container to be scheduled is scheduled to the corresponding cluster; Based on the predetermined rate balancing rule, the operation of sorting the clusters according to the rate information of each cluster and the specification information of the database container to be scheduled includes: Sorting the database containers that need to be scheduled according to the specification information of the database containers; Based on a predetermined rate balancing rule, the rate information of the cluster and the specification information of the sorted database containers that need to be scheduled are determined to be in an inverse relationship; the inverse relationship is that the larger the specification of the database container, the smaller the rate of the corresponding cluster; the smaller the specification of the database container, the larger the rate of the corresponding cluster; Based on the inverse relationship, a sorting operation is performed on the clusters.
2. The method according to claim 1, characterized in that Scheduling the to-be-scheduled database container to a corresponding cluster includes: Get the resource usage of each server in the cluster; According to the resource usage of each server in the corresponding cluster, the database container to be scheduled is scheduled to a server in the corresponding cluster.
3. The method according to claim 2, characterized in that Scheduling the to-be-scheduled database container to a server in the corresponding cluster according to resource usage of each server in the corresponding cluster includes: Sorting each server according to resource usage of each server in the corresponding cluster; The database container to be scheduled is scheduled to a server with optimal resource usage.
4. The method according to claim 1, characterized in that: Before determining the multiplier information of the cluster according to the database container quantity information that needs to be scheduled and the server quantity information of each cluster, the method further includes: According to the predetermined strong rules, each cluster is screened to delete servers that do not meet the strong rules.
5. The method according to claim 1, characterized in that Determining the multiplier information of the cluster according to the database container quantity information that needs to be scheduled and the server quantity information of each cluster includes: The quotient of the database container quantity information that needs to be scheduled and the server quantity information of each cluster is determined as the multiplication rate information of the cluster.
6. A database container scheduling device, characterized in that: The device comprises: An information acquisition unit, used to acquire information on the number of database containers that need to be scheduled and information on the number of servers in each of the multiple clusters; A multiplier determination unit, configured to determine the multiplier information of the cluster according to the number of database containers to be scheduled and the number of servers in each cluster; A scheduling unit, used to schedule database containers for each cluster according to a predetermined rate balancing rule, rate information of each cluster and specification information of the database container to be scheduled; Scheduling database containers for each cluster according to a predetermined rate balancing rule, rate information of each cluster, and specification information of the database container to be scheduled includes: Based on a predetermined rate balancing rule, the clusters are sorted according to the rate information of each cluster and the specification information of the database container to be scheduled, wherein the database container to be scheduled is one of the database containers to be scheduled; According to the sorting information of each cluster, the database container to be scheduled is scheduled to the corresponding cluster; Based on the predetermined rate balancing rule, the operation of sorting the clusters according to the rate information of each cluster and the specification information of the database container to be scheduled includes: Sorting the database containers that need to be scheduled according to the specification information of the database containers; Based on a predetermined rate balancing rule, the rate information of the cluster and the specification information of the sorted database containers that need to be scheduled are determined to be in an inverse relationship; the inverse relationship is that the larger the specification of the database container, the smaller the rate of the corresponding cluster; the smaller the specification of the database container, the larger the rate of the corresponding cluster; Based on the inverse relationship, a sorting operation is performed on the clusters.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the method according to any one of claims 1 to 5 are implemented.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Multi-cluster management method and device, server and storage medium
CN110389836A
Virtual machine distribution method and device under cloud computer, and server
CN111078369A