Database cluster expansion method and system

By containerizing the database and grouping it according to load type, and filtering and scaling up target container groups, the performance of containerized database clusters under burst traffic is solved, and dynamic scaling and load balancing are achieved.

CN115510018BActive Publication Date: 2026-01-23CHINA MOBILE QUANTONG SYST INTEGRATION CO LTD +2
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110696694.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-23
Publication Date
2026-01-23
Estimated Expiration
2041-06-23

AI Technical Summary

Technical Problem

Existing containerized database clusters suffer from performance issues after reaching their read and write speed bottlenecks, especially in terms of difficulty in dynamically scaling up when dealing with sudden traffic surges.

Method used

By containerizing the database and dividing it into read container groups and write container groups according to the business load type of the containers, target container groups that meet the preset conditions are selected for expansion. Dynamic expansion is achieved using the Kubernetes system, and the legality of expansion is ensured through RBAC authentication.

Benefits of technology

It enables dynamic scaling of the database to cope with sudden traffic surges, improving the database's performance and load balancing capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115510018B_ABST
    Figure CN115510018B_ABST
Patent Text Reader

Abstract

The application provides a database cluster expansion method and system, the method comprising: containerizing each database in a database cluster in turn; determining a container group to which a container belongs according to a business load type of the container; screening a target container group meeting a preset condition from a plurality of container groups, and expanding the target container group; wherein the preset condition comprises that a time spent in performing a read operation or a write operation in a business load process exceeds a preset first target time threshold, or a number of containers in which a time spent in performing the read operation or the write operation in the business load process exceeds a preset second target time threshold exceeds a preset target number threshold. The system is used for executing the above method. The application realizes dynamic expansion of a database for business traffic by containerizing the database, and improves the ability of the database to cope with burst traffic.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and in particular to a method and system for expanding a database cluster. Background Technology

[0002] Containerized database clusters mainly include container networking and global configuration of the container cluster, as detailed below:

[0003] Cluster configuration file: Deploying global configuration in a container cluster

[0004] The container cluster's internal network is a flat network that uses Calico to issue internal IP addresses to containers.

[0005] High availability can be achieved using keepalived or HAproxy.

[0006] Existing containerized database clusters suffer from performance limitations once the read and write speed of the containers reaches its bottleneck. Furthermore, the lack of a unified read and write interface after the database container cluster publishes its services makes dynamic scaling of the database container cluster difficult, resulting in insufficient performance when dealing with sudden traffic surges. Summary of the Invention

[0007] The database cluster expansion method and system provided by the present invention are used to solve at least one of the above-mentioned problems in the prior art. By containerizing the database, the database can be dynamically expanded in response to business traffic, thereby improving the database's ability to cope with sudden traffic surges.

[0008] This invention provides a method for expanding a database cluster, comprising:

[0009] Containerize each database in the database cluster in turn;

[0010] Determine the container group to which the container belongs based on the container's workload type;

[0011] Select a target container group that meets the preset conditions from the multiple container groups, and expand the capacity of the target container group;

[0012] The preset conditions include the time spent performing read or write operations during a business load exceeding a preset first target time threshold; or

[0013] The number of containers whose time spent performing the read or write operations during a business load exceeds a preset second target time threshold exceeds a preset target number threshold.

[0014] According to a database cluster expansion method provided by the present invention, the step of determining the container group to which the container belongs based on the service load type of the container includes:

[0015] If the container's service load type is a read operation, then the container group to which the container belongs is determined to be a read container group;

[0016] If the service load type of the container is a write operation, then the container group to which the container belongs is determined to be a write container group.

[0017] According to a database cluster expansion method provided by the present invention, the time spent on the read or write operation is determined in the following manner:

[0018] The time taken for the read operation is determined based on the time taken for the containers in the container group to execute the target read operation statement;

[0019] The time taken for the write operation is determined based on the time taken for the container to execute the target write operation statement.

[0020] According to a database cluster expansion method provided by the present invention, the time spent by the container executing the target read operation statement or the target write operation statement is obtained in the following manner:

[0021] Based on the read and write interfaces deployed to the outside of the container cluster, obtain the time spent by the container in the container group executing the target read operation statement or the target write operation statement;

[0022] The container cluster is obtained by containerizing each database in the database cluster.

[0023] According to a database cluster expansion method provided by the present invention, the step of selecting a target container group that meets preset conditions from the container group and expanding the target container group includes:

[0024] Select target container groups that meet preset conditions from the container groups, and perform role-based access control (RBAC) authentication on the expansion requests of the target container groups.

[0025] If the RBAC authentication is successful, then the expansion permission for the target container group is obtained, and the target container group is expanded based on the expansion permission.

[0026] The present invention also provides a database cluster expansion system, comprising: a container creation module, a container grouping module, and a container expansion module;

[0027] The container creation module is used to containerize each database in the database cluster sequentially.

[0028] The container grouping module is used to determine the container group to which the container belongs based on the service load type of the container;

[0029] The container expansion module is used to select a target container group that meets preset conditions from multiple container groups and expand the capacity of the target container group.

[0030] The preset conditions include the time spent performing read or write operations during a business load exceeding a preset first target time threshold; or

[0031] The number of containers whose time spent performing read or write operations during business load exceeds the preset second target time threshold exceeds the preset target number threshold.

[0032] According to a database cluster expansion system provided by the present invention, the container grouping module is further configured to:

[0033] If the container's service load type is a read operation, then the container group to which the container belongs is determined to be a read container group;

[0034] If the service load type of the container is a write operation, then the container group to which the container belongs is determined to be a write container group.

[0035] According to a database cluster expansion system provided by the present invention, the container expansion module is further configured to:

[0036] Select target container groups that meet preset conditions from the container groups, and perform role-based access control (RBAC) authentication on the expansion requests of the target container groups.

[0037] If RBAC authentication is successful, then the target container group is granted expansion permission, and the target container group is expanded based on the expansion permission.

[0038] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of any of the database cluster expansion methods described above.

[0039] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the above-described database cluster expansion methods.

[0040] The database cluster expansion method and system provided by this invention enables dynamic expansion of the database in response to business traffic by containerizing the database, thereby improving the database's ability to cope with sudden traffic surges. Attached Figure Description

[0041] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0042] Figure 1 This is a flowchart illustrating the database cluster expansion method provided by the present invention;

[0043] Figure 2 This is a schematic diagram of the database cluster expansion system provided by the present invention;

[0044] Figure 3 This is a schematic diagram of the physical structure of the electronic device provided by the present invention. Detailed Implementation

[0045] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0046] Figure 1 This is a flowchart illustrating the database cluster expansion method provided by the present invention, as follows: Figure 1 As shown, the method includes:

[0047] S1. Containerize each database in the database cluster in sequence;

[0048] S2. Determine the container group to which the container belongs based on the container's workload type;

[0049] S3. Select a target container group that meets the preset conditions from multiple container groups, and expand the capacity of the target container group;

[0050] The preset conditions include the time spent performing read or write operations during a business load exceeding a preset first target time threshold; or

[0051] The number of containers whose time spent performing read or write operations during business load exceeds the preset second target time threshold exceeds the preset target number threshold.

[0052] It should be noted that the above method can be implemented by computer equipment.

[0053] Optionally, when the database cluster is handling traffic load and data read / write operations are performed, if the time consumed by the read or write operation is detected to be long during the load process, the database cluster corresponding to the read or write operation will be scaled up after communicating with the authentication module in the data cluster. Specifically:

[0054] Each database in the database cluster (e.g., a MySQL database) is containerized sequentially. The MySQL database cluster mainly consists of multiple master databases and multiple slave databases. The master databases support write operations, while the slave databases only support read operations. Data synchronization between the master and slave databases is achieved through MySQL's own BinLog replication mechanism.

[0055] The MySQL database is deployed in a stateful cluster. A Kubernetes cluster service is created for both the master and slave databases. The master service acts as a proxy service for the master database and supports database write operations; the slave service acts as a proxy service for the slave database and supports database read operations.

[0056] MySQL databases primarily use two data storage solutions: local storage and shared storage. Local storage offers higher performance but is more difficult to manage, while shared storage offers higher reliability but lower performance.

[0057] (1) Persistent Volume (PV)

[0058] Persistent shared storage stores database data in backend network storage, which can be shared by different database servers. It utilizes the storage cluster's own mechanisms to ensure high data availability and is mainly used for reliable storage of single-instance databases.

[0059] (2) Persistent Local Volume (PLV)

[0060] Persistent local storage allows direct use of local storage on Kubernetes nodes to save database data. Kubernetes 1.9 provides a mechanism for Local Volume Management (LVM) as a unified cluster resource for high-speed storage of database data in database clusters.

[0061] Kubernetes is a system for running and coordinating containerized applications on a set of hosts, providing mechanisms for application deployment, planning, updating, and maintenance. Applications run on Kubernetes clusters, enabling service scaling up and down, performing rolling updates, and scheduling traffic between different application versions to test functionality or roll back problematic deployments. Kubernetes manages service functions by defining various types of resources, such as deployments, pods, services, and volumes.

[0062] A Pod is the basic unit of the Kubernetes system. It is the smallest component created or deployed by a user and is also a resource object for running containerized applications on the Kubernetes system.

[0063] The database is packaged into a Pod and run sequentially. Load balancing of database access is achieved through Kubernetes' standard Service mechanism, thus realizing the containerized deployment of the database cluster and obtaining the container cluster corresponding to the database cluster.

[0064] Based on the service load type of the containers in the container cluster, determine the container group to which each container belongs, so as to classify the containers in the container cluster. Then, select the target container group that meets the preset conditions from the multiple classified container groups, and add new containers to the target container group to realize the expansion of the target container group.

[0065] The preset conditions can specifically include:

[0066] The time taken to perform a read or write operation during a business load exceeds a preset first target time threshold; or

[0067] The number of containers whose time spent performing read or write operations during business load exceeds the preset second target time threshold exceeds the preset target number threshold.

[0068] Optionally, based on the type of business load carried by the containers in the container cluster, the containers are divided into read container groups and write container groups. The read container groups perform data read operations, and the write container groups perform data write operations. When the container cluster is under business load, the time spent by all containers in the read containers performing read operations and the time spent by all containers in the write containers performing write operations are detected in real time. By determining whether the time spent performing read or write operations exceeds a preset first target time threshold, the target container group that needs to be expanded is determined.

[0069] For example, suppose the total time spent by all containers in the read operation container group to perform read operations is t1, and the total time spent by all containers in the write operation container group to perform write operations is t2. A first target threshold is preset to T. If t1 > T and t2 < T, then the target container group that needs to be expanded is the read container group; if t2 > T and t1 < T, then the target container group that needs to be expanded is the write container group; if t1 and t2 < T, then it is determined that neither the read nor the write container group needs to be expanded; if t1 and t2 > T, then both the read and write container groups need to be expanded.

[0070] Alternatively, by determining whether the number of containers whose time spent performing read or write operations exceeds a preset second target time threshold exceeds a preset target number threshold, the target container group to be expanded is determined.

[0071] For example, suppose the read container group contains n1 containers and the write container group contains n2 containers. The time taken for the read container group n1 containers to perform a read operation is t. i Where i = 1, 2, ..., n1, and the time t is taken for the write operation to be performed on the n2 containers in the write container group. j Where j = 1, 2, ..., n2, the preset time threshold for the second target is T′, and the preset threshold for the number of targets is num. The statistics for t are calculated respectively. i and t j The number of values ​​greater than the preset second target time threshold T′, assuming t i There is a value num1 greater than the preset second target time threshold T′, t j If num2 is greater than the preset second target time threshold T′, and num1 > num and num2 < num, then the target container group that needs to be expanded is determined to be the read container group; if num2 > num and num1 < num, then the target container group that needs to be expanded is determined to be the write container group; if num1, num2 < num, then it is determined that neither the read container group nor the write container group needs to be expanded; if num1, num2 > num, then it is determined that both the read container group and the write container group need to be expanded.

[0072] It should be noted that when a new container is added to the target container group, the newly added container is tagged according to the type of business workload carried by the containers in the target container group, thus distinguishing its business workload type. For example, if the business workload carried by the containers in the target container group is read operation, the newly added container is tagged as a read operation container; if the business workload carried by the containers in the target container group is write operation, the newly added container is tagged as a write operation container.

[0073] The database cluster expansion method provided by this invention enables dynamic expansion of the database in response to business traffic by containerizing the database, thereby improving the database's ability to cope with sudden traffic surges.

[0074] Furthermore, in one embodiment, step S2 may specifically include:

[0075] S21. If the container's business load type is a read operation, then determine that the container group to which the container belongs is a read container group;

[0076] S22. If the business load type of the container is write operation, then the container group to which the container belongs is determined to be the write container group.

[0077] Optionally, each container in the container cluster is classified according to the type of business load carried by the container in the container cluster. If the business load type of the container is a read operation, the container is assigned to the read container group; if the business load type of the container is a write operation, the container is assigned to the write container group. Based on this, the classification of all clusters in the container cluster is completed.

[0078] The database cluster expansion method provided by this invention can separate the read and write operations of the database cluster and achieve load balancing between read and write operations.

[0079] Furthermore, in one embodiment, the time taken for a read or write operation is determined as follows:

[0080] Determine the time taken for the read operation based on the time taken for each container in the container group to execute the target read operation statement;

[0081] The time taken for a write operation is determined based on the time taken for the container to execute the target write operation statement.

[0082] Optionally, for the MySQL master database, after containerization, its container group is the write container group, and the time spent by each container in the write container group to execute the target write operation statement, such as the write operation SQL statement, can be used as the time spent on the write operation; for the MySQL slave database, after containerization, its container group is the read container group, and the time spent by each container in the read container group to execute the target read operation statement, such as the read operation SQL statement, can be used as the time spent on the read operation.

[0083] The database cluster expansion method provided by this invention can determine the target container group that needs to be expanded by detecting the time spent executing SQL statements in the container group, thus laying the foundation for subsequent load balancing by dynamically expanding the target container group.

[0084] Furthermore, in one embodiment, the time spent by the container executing the target read operation statement or the target write operation statement is obtained in the following manner:

[0085] Based on the read and write interfaces deployed to the outside of the container cluster, obtain the time spent by the container in the container group executing the target read operation statement or the target write operation statement;

[0086] The container cluster is obtained by containerizing each database in the database cluster.

[0087] Optionally, based on Kubernetes Service, the containers in the Pod can be deployed to expose services. For example, the ports of the containers can be directly routed to the ports on the scheduled nodes, so that the Pod can be accessed through the host's IP address. A unified read and write interface can be provided to obtain the time spent executing the target read operation statement or the target write operation statement.

[0088] In Kubernetes, a Service defines a logical set of Pods and the protocol for accessing them. Services enable loose coupling between dependent Pods. Like other Kubernetes objects, Services are defined using YAML or JSON. A group of Pods under a Service is typically labeled with a LabelSelector.

[0089] Although each Pod has a unique IP address, these IP addresses are not exposed outside the container cluster if there is no Service. By using these IP addresses as read and write interfaces and listening to the read and write interfaces, we can obtain the time spent by containers in the container group when executing the target read operation statement or the target write operation statement.

[0090] The database cluster expansion method provided by this invention can detect in real time the time spent by each container in the container group performing read and write operations through the externally deployed read and write interface. This lays the foundation for determining the target container group that needs to be expanded based on the time spent on read and write operations, and for dynamically expanding the target container group.

[0091] Furthermore, in one embodiment, step S4 may specifically include:

[0092] S41. Select target container groups that meet the preset conditions from the container groups, and perform role-based access control (RBAC) authentication on the expansion requests of the target container groups.

[0093] S42. If RBAC authentication is successful, then the expansion permission for the target container group is obtained, and the target container group is expanded based on the expansion permission.

[0094] Optionally, the gateway of the Kubernetes cluster system is the sole entry point for accessing and managing resource objects. All other components and kubectl commands must access and manage the cluster (e.g., scaling up the container cluster) through the Kubernetes cluster system's gateway. Each access request from each component and client must be validated by the gateway, including identity verification and operation permission verification.

[0095] There are typically three ways for a client to access an API service: kubectl, a client library, and a REST interface. The entities that execute API requests, such as scaling requests, are typically of two types: regular users (User Account) and service accounts (Service Account).

[0096] User Account: This typically refers to a user account managed by services outside of Kubernetes, such as administrator-issued keys or user storage like Keystone. Kubernetes does not have objects to identify such user accounts; therefore, they cannot be directly added to the Kubernetes system. This account is usually used for complex business logic management, and its name must be globally unique.

[0097] Service Account: An account managed by the Kubernetes API, used to provide identity for service processes in a Pod when accessing the Kubernetes API.

[0098] User groups are logical collections of user accounts. They do not have operational permissions themselves, but the permissions attached to a group are inherited by all users within it, enabling an efficient authorization management mechanism. Kubernetes comes with some built-in groups for special purposes. When Kubernetes uses authentication plugins to authenticate API requests, it supports authentication methods including client authentication, bearer tokens, authenticating proxy, and HTTP-based authentication. The API Server supports multiple authentication mechanisms simultaneously, but at least one authentication plugin must be enabled for each Service Account and User Account.

[0099] Once a target container group that meets the above preset conditions is selected from the container group, the deployed control module communicates with the container cluster authentication module (e.g., one or more authentication plugins configured by the gateway of the Kubernetes cluster system) and sends a scaling request. The container cluster authentication module performs role-based access control (RBAC) authentication on the scaling request to grant permissions for scaling, monitoring and other operations.

[0100] RBAC (Restricted Access Control) is a new, flexible, and widely used access control mechanism. In RBAC, a user is an independent entity that can access data resources. A role refers to a job or position within an organization or task, representing a right, qualification, and responsibility. Permission is the operation that is allowed to be performed on one or more objects.

[0101] RBAC is used to define which subjects can or cannot operate on which object or type of object.

[0102] The RBAC authorization plugin supports two types of roles: Role and ClusterRole. Role is at the namespace level and is used to define the set of resource permissions within a namespace. ClusterRole is used to organize the set of resource permissions at the cluster level. Authorizing these two types of roles requires two resource types: RoleBinding and ClusterRoleBinding.

[0103] RoleBingding is used to bind permissions on a Role to one or a group of users. It belongs to and can only operate on one namespace. When binding, you can apply Roles with the same name or ClusterRole at the cluster level.

[0104] ClusterRoleBingding binds the permissions defined in ClusterRole to one or a group of users, allowing them to reference only the cluster-level ClusterRole.

[0105] If RBAC authentication is successful, expansion permissions, monitoring permissions, etc., will be granted to the role.

[0106] When a user is created, by binding the user to a role with scaling and monitoring permissions, the user is given the permission to scale up the containers inside a Kubernetes Pod, and to scale up the target container group based on the scaling permissions.

[0107] The database cluster expansion method provided by this invention ensures the stability of the container cluster by authorizing and authenticating expansion requests and allowing users with expansion permissions to perform expansion operations on container groups in the container cluster.

[0108] The database cluster expansion system provided by this invention is described below. The database cluster expansion system described below can be referred to in correspondence with the database cluster expansion method described above.

[0109] Figure 2This is a schematic diagram of the database cluster expansion system provided by the present invention, as shown below. Figure 2 As shown, it includes: a container creation module 210, a container grouping module 211, and a container expansion module 212;

[0110] Container creation module 210 is used to containerize each database in the database cluster in turn.

[0111] Container grouping module 211 is used to determine the container group to which a container belongs based on the service load type of the container;

[0112] The container expansion module 212 is used to select a target container group that meets preset conditions from multiple container groups and expand the target container group.

[0113] The preset conditions include the time spent performing read or write operations during a business load exceeding a preset first target time threshold; or

[0114] The number of containers whose time spent performing read or write operations during business load exceeds the preset second target time threshold exceeds the preset target number threshold.

[0115] The database cluster expansion system provided by this invention enables dynamic expansion of the database in response to business traffic by containerizing the database, thereby improving the database's ability to cope with sudden traffic surges.

[0116] Furthermore, in one embodiment, the container grouping module 211 is also used for:

[0117] If the container's workload type is a read operation, then the container group to which the container belongs is determined to be a read container group;

[0118] If the container's workload type is write operation, then the container group to which the container belongs is determined to be the write container group.

[0119] The database cluster expansion system provided by this invention can separate the read and write operations of the database cluster and achieve load balancing between read and write operations.

[0120] Furthermore, in one embodiment, the container expansion module 212 may specifically include:

[0121] The time determination submodule is used to determine the time spent on a read operation based on the time spent by the container in the container group executing the target read operation statement, and to determine the time spent on a write operation based on the time spent by the container executing the target write operation statement.

[0122] The database cluster expansion system provided by this invention can determine the target container group that needs to be expanded by detecting the time spent by the container group executing SQL statements, thus laying the foundation for subsequent load balancing by dynamically expanding the target container group.

[0123] Furthermore, in one embodiment, the time determination submodule can also be used for:

[0124] Based on the read and write interfaces deployed to the outside of the container cluster, obtain the time spent by the container in the container group executing the target read operation statement or the target write operation statement;

[0125] The container cluster is obtained by containerizing each database in the database cluster.

[0126] The database cluster expansion system provided by this invention can detect in real time the time spent by each container in the container group performing read and write operations through the externally deployed read and write interface. This lays the foundation for determining the target container group that needs to be expanded based on the time spent on read and write operations, and for dynamically expanding the target container group.

[0127] Furthermore, in one embodiment, the container expansion module 212 can also be used for:

[0128] Select target container groups that meet preset conditions from the container groups, and perform role-based access control (RBAC) authentication on the expansion requests of the target container groups.

[0129] If RBAC authentication is successful, then the target container group is granted expansion permission, and the target container group is expanded based on the expansion permission.

[0130] The database cluster expansion system provided by this invention ensures the stability of the container cluster by authorizing and authenticating expansion requests and allowing users with expansion permissions to perform expansion operations on container groups within the container cluster.

[0131] Figure 3 This is a schematic diagram of the physical structure of an electronic device provided by the present invention, such as... Figure 3 As shown, the electronic device may include a processor 310, a communication interface 311, a memory 312, and a bus 313, wherein the processor 310, the communication interface 311, and the memory 312 communicate with each other via the bus 313. The processor 310 can call logical instructions in the memory 312 to execute the following methods:

[0132] Containerize each database in the database cluster in turn;

[0133] Determine the container group to which the container belongs based on the container's workload type;

[0134] Select the target container group that meets the preset conditions from multiple container groups, and expand the target container group;

[0135] The preset conditions include the time spent performing read or write operations during a business load exceeding a preset first target time threshold; or

[0136] The number of containers whose time spent performing read or write operations during business load exceeds the preset second target time threshold exceeds the preset target number threshold.

[0137] Furthermore, the logical instructions in the aforementioned memory can be implemented as software functional units and sold or used as independent products, and can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer power supply (which may be a personal computer, server, or network power supply, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0138] Furthermore, this invention discloses a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium. The computer program includes program instructions, and when these instructions are executed by a computer, the computer can execute the database cluster expansion method provided in the above-described method embodiments, for example including:

[0139] Containerize each database in the database cluster in turn;

[0140] Determine the container group to which the container belongs based on the container's workload type;

[0141] Select the target container group that meets the preset conditions from multiple container groups, and expand the target container group;

[0142] The preset conditions include the time spent performing read or write operations during a business load exceeding a preset first target time threshold; or

[0143] The number of containers whose time spent performing read or write operations during business load exceeds the preset second target time threshold exceeds the preset target number threshold.

[0144] On the other hand, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, is implemented to perform the database cluster expansion methods provided in the above embodiments, including, for example:

[0145] Containerize each database in the database cluster in turn;

[0146] Determine the container group to which the container belongs based on the container's workload type;

[0147] Select the target container group that meets the preset conditions from multiple container groups, and expand the target container group;

[0148] The preset conditions include the time spent performing read or write operations during a business load exceeding a preset first target time threshold; or

[0149] The number of containers whose time spent performing read or write operations during business load exceeds the preset second target time threshold exceeds the preset target number threshold.

[0150] The system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0151] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., including several instructions to cause a computer power supply (which may be a personal computer, server, or network power supply, etc.) to execute the methods described in various embodiments or some parts of the embodiments.

[0152] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for expanding the capacity of a database cluster, characterized in that, include: Containerize each database in the database cluster in turn; Determine the container group to which the container belongs based on the container's workload type; Select a target container group that meets the preset conditions from the multiple container groups, and expand the capacity of the target container group; The preset conditions include the time spent performing read or write operations during a business load exceeding a preset first target time threshold. or The number of containers whose time spent performing the read or write operations during a business load exceeds a preset second target time threshold exceeds a preset target number threshold.

2. The database cluster expansion method according to claim 1, characterized in that, The step of determining the container group to which the container belongs based on the container's service load type includes: If the service load type of the container is a read operation, then the container group to which the container belongs is determined to be a read container group; If the service load type of the container is a write operation, then the container group to which the container belongs is determined to be a write container group.

3. The database cluster expansion method according to claim 1, characterized in that, The time taken for the read or write operation is determined in the following way: The time taken for the read operation is determined based on the time taken for the containers in the container group to execute the target read operation statement; The time taken for the write operation is determined based on the time taken for the container to execute the target write operation statement.

4. The database cluster expansion method according to claim 3, characterized in that, The time taken for the container to execute the target read operation statement or the target write operation statement is obtained in the following way: Based on the read and write interfaces deployed to the outside of the container cluster, obtain the time spent by the container in the container group executing the target read operation statement or the target write operation statement; The container cluster is obtained by containerizing each database in the database cluster.

5. The database cluster expansion method according to claim 1, characterized in that, The step of selecting target container groups that meet preset conditions from the container groups and expanding the capacity of the target container groups includes: Select target container groups that meet preset conditions from the container groups, and perform role-based access control (RBAC) authentication on the expansion requests of the target container groups. If the RBAC authentication is successful, then the expansion permission for the target container group is obtained, and the target container group is expanded based on the expansion permission.

6. A database cluster expansion system, characterized in that, include: Container creation module, container grouping module, and container expansion module; The container creation module is used to containerize each database in the database cluster sequentially. The container grouping module is used to determine the container group to which the container belongs based on the service load type of the container; The container expansion module is used to select a target container group that meets preset conditions from multiple container groups and expand the capacity of the target container group. The preset conditions include the time spent performing read or write operations during a business load exceeding a preset first target time threshold. or The number of containers whose time spent performing the read or write operations during a business load exceeds a preset second target time threshold exceeds a preset target number threshold.

7. The database cluster expansion system according to claim 6, characterized in that, The container grouping module is also used for: If the service load type of the container is a read operation, then the container group to which the container belongs is determined to be a read container group; If the service load type of the container is a write operation, then the container group to which the container belongs is determined to be a write container group.

8. The database cluster expansion system according to claim 6, characterized in that, The container expansion module is also used for: Select target container groups that meet preset conditions from the container groups, and perform role-based access control (RBAC) authentication on the expansion requests of the target container groups. If RBAC authentication is successful, then the target container group is granted expansion permission, and the target container group is expanded based on the expansion permission.

9. An electronic device comprising a processor and a memory storing a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the database cluster expansion method according to any one of claims 1 to 5.

10. A processor-readable storage medium, characterized in that, The processor-readable storage medium stores a computer program that causes the processor to perform the steps of the database cluster expansion method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Method, device and system for expanding application cluster

    CN108076082A

  • Containerization-based PaaS platform network architecture and implementation method thereof

    CN112698917A