CN115510018A - Database cluster capacity expansion method and system - Google Patents

Database cluster capacity expansion method and system Download PDF

Info

Publication number
CN115510018A
CN115510018A CN202110696694.7A CN202110696694A CN115510018A CN 115510018 A CN115510018 A CN 115510018A CN 202110696694 A CN202110696694 A CN 202110696694A CN 115510018 A CN115510018 A CN 115510018A
Authority
CN
China
Prior art keywords
container
target
capacity expansion
container group
database
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110696694.7A
Other languages
Chinese (zh)
Inventor
孙海涛
刘鹏成
蔡伟
窦毅
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Mobile Communications Group Co Ltd
China Mobile Xiongan ICT Co Ltd
China Mobile System Integration Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Xiongan ICT Co Ltd
China Mobile System Integration Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Mobile Communications Group Co Ltd, China Mobile Xiongan ICT Co Ltd, China Mobile System Integration Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN202110696694.7A priority Critical patent/CN115510018A/en
Publication of CN115510018A publication Critical patent/CN115510018A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • G06F16/275Synchronous replication

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a database cluster capacity expansion method and a system, wherein the method comprises the following steps: each database in the database cluster is containerized in sequence; determining a container group to which the container belongs according to the service load type of the container; screening out a target container group meeting preset conditions from the container groups, and expanding the capacity of the target container group; the preset condition comprises that the time spent on executing read operation or write operation in the process of the service load exceeds a preset first target time threshold; or the number of containers whose time spent performing the read operation or the write operation during the traffic load exceeds a preset second target time threshold exceeds a preset target number threshold. The system is used for executing the method. The invention realizes the dynamic capacity expansion of the database aiming at the service flow by containerizing the database, and improves the capability of the database in dealing with the burst flow.

Description

Database cluster capacity expansion method and system
Technical Field
The invention relates to the technical field of computers, in particular to a database cluster capacity expansion method and a database cluster capacity expansion system.
Background
The containerized database cluster mainly comprises a container network, container cluster global configuration and the like, and specifically comprises the following steps:
cluster configuration files: deploying global configurations in a container cluster
Container cluster internal network: flattening the network, using Calico to issue cluster internal IP addresses for containers
High available implementation: and (3) realizing by using keepalived or Haproxy.
The containerized database cluster in the prior art has insufficient performance after a read-write container reaches a read-write speed bottleneck, and has no uniform read-write interface after the database container cluster issues service to the outside, so that the dynamic capacity expansion of the database container cluster is difficult, and the performance of the database container cluster is insufficient when dealing with burst traffic.
Disclosure of Invention
The database cluster capacity expansion method and system provided by the invention are used for solving at least one problem in the prior art, and the dynamic capacity expansion of the database aiming at the service traffic is realized by containerizing the database, so that the capacity of the database for dealing with the burst traffic is improved.
The invention provides a database cluster capacity expansion method, which comprises the following steps:
each database in the database cluster is containerized in sequence;
determining a container group to which the container belongs according to the service load type of the container;
screening out a target container group meeting preset conditions from the container groups, and expanding the capacity of the target container group;
the preset condition comprises that the time spent on executing read operation or write operation in the process of the service load exceeds a preset first target time threshold; or
The number of containers for which the time taken to perform the read operation or the write operation during the traffic load exceeds a preset second target time threshold exceeds a preset target number threshold.
According to the database cluster capacity expansion method provided by the invention, the determining of the container group to which the container belongs according to the service load type of the container comprises the following steps:
if the container is read according to the service load type of the container, determining that the container group to which the container belongs is a read container group;
and if the service load type of the container is write operation, determining that the container group to which the container belongs is a write container group.
According to the database cluster capacity expansion method provided by the invention, the time spent by the read operation or the write operation is determined by the following method:
determining the time spent on the read operation according to the time spent on the container in the container group executing the target read operation statement;
and determining the time spent on the write operation according to the time spent on the container to execute the target write operation statement.
According to the database cluster capacity expansion method provided by the invention, the time spent by the container to execute the target read operation statement or the target write operation statement is obtained in the following way:
acquiring time spent by a container in the container group in executing a target read operation statement or a target write operation statement according to a read-write interface externally deployed by the container cluster;
the container cluster is obtained by containerizing each database in the database cluster.
According to the database cluster capacity expansion method provided by the invention, the step of screening out a target container group meeting preset conditions from the container groups and expanding the capacity of the target container group comprises the following steps:
screening out a target container group meeting preset conditions from the container groups, and performing role-based access control (RBAC) authentication on a capacity expansion request of the target container group;
and if the RBAC authentication is passed, acquiring the capacity expansion authority of the target container group, and expanding the capacity of the target container group based on the capacity expansion authority.
The invention also provides a database cluster capacity expansion system, which comprises: the system comprises a container establishing module, a container grouping module and a container capacity expansion module;
the container establishing module is used for sequentially containerizing each database in the database cluster;
the container grouping module is used for determining a container group to which the container belongs according to the service load type of the container;
the container capacity expansion module is used for screening out a target container group meeting preset conditions from the plurality of container groups and expanding the capacity of the target container group;
the preset condition comprises that the time spent on executing read operation or write operation in the process of the service load exceeds a preset first target time threshold; or
The number of containers for which the time taken to perform a read operation or a write operation during the traffic load exceeds the preset second target time threshold exceeds the preset target number threshold.
According to the database cluster capacity expansion system provided by the present invention, the container grouping module is further configured to:
if the container is read according to the service load type of the container, determining that the container group to which the container belongs is a read container group;
and if the service load type of the container is write operation, determining that the container group to which the container belongs is a write container group.
According to the database cluster expansion system provided by the present invention, the container expansion module is further configured to:
screening out a target container group meeting preset conditions from the container groups, and performing role-based access control (RBAC) authentication on a capacity expansion request of the target container group;
and if the RBAC authentication is passed, acquiring the capacity expansion authority of the target container group, and expanding the capacity of the target container group based on the capacity expansion authority.
The present invention further provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any one of the above database cluster capacity expansion methods when executing the program.
The present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the database cluster capacity expansion method as described in any of the above.
According to the database cluster capacity expansion method and system provided by the invention, the database is containerized, so that the dynamic capacity expansion of the database aiming at the service flow is realized, and the capacity of the database for dealing with the burst flow is improved.
Drawings
In order to more clearly illustrate the present invention or the technical solutions in the prior art, the drawings used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a schematic flowchart of a database cluster capacity expansion method provided by the present invention;
FIG. 2 is a schematic structural diagram of a database cluster capacity expansion system provided by the present invention;
fig. 3 is a schematic physical structure diagram of an electronic device provided in the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is obvious that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a schematic flowchart of a database cluster capacity expansion method provided by the present invention, and as shown in fig. 1, the method includes:
s1, sequentially containerizing each database in a database cluster;
s2, determining a container group to which the container belongs according to the service load type of the container;
s3, screening out a target container group meeting preset conditions from the plurality of container groups, and expanding the capacity of the target container group;
the preset condition comprises that the time spent on executing read operation or write operation in the process of the service load exceeds a preset first target time threshold; or
The number of containers for which the time taken to perform a read operation or a write operation during the traffic load exceeds the preset second target time threshold exceeds the preset target number threshold.
It should be noted that the execution subject of the method may be a computer device.
Optionally, when performing data read-write operation in a process in which the database cluster bears a traffic load, if it is detected that the time consumed by the read operation or the write operation in the process of the load is long, that is, after communicating with the authentication module in the data cluster, performing capacity expansion processing on the database cluster corresponding to the read operation or the write operation, specifically:
each database (such as MySQL database) in the database cluster is containerized in sequence, the MySQL database cluster mainly comprises a plurality of master databases and a plurality of slave databases, the master databases are written, the slave databases only support reading, and data synchronization between the master databases and the slave databases is realized through a BinLog replication mechanism of MySQL.
The MySQL database adopts state cluster deployment, service of a Kubernetes cluster system is respectively established for a master database and a slave database, and the master database Service is used as proxy Service of the master database and supports database writing operation; the slave library service acts as a proxy service for the slave database, supporting database read operations.
The data storage of the MySQL database mainly comprises two schemes of local storage and shared storage, wherein the local storage has higher performance but is difficult to manage, and the shared storage has higher reliability but has poorer performance.
(1) Persistent Volume (Persistent Volume, PV)
The persistent shared storage is used for storing the data of the database in the network storage at the back end, can be shared by different database servers, ensures the high availability of the data by utilizing the self mechanism of a storage cluster, and is mainly used for the reliable storage of a single-instance database.
(2) Persistent logical Volume (Persistent Local Volume, PLV)
The database data storage method comprises the steps of persistent Local storage, wherein database data are stored by directly using Local storage on Kubernetes nodes, and Kubernetes1.9 provides a mechanism which can be used for unified Management of Local Volume Management (LVM) as cluster resources and is mainly used for high-speed storage of database data of a database cluster.
Kubernets is a system for running and coordinating containerized applications on a set of hosts, providing mechanisms for application deployment, planning, update maintenance. The application runs on a Kubernetes cluster, the capacity expansion and the capacity reduction of the service are realized, the rolling update is executed, and the flow is scheduled among application programs of different versions to test the function or rollback the problematic deployment. Kubernets implements the functions of management services by defining various types of resources, such as deployment, pod, service, volume, etc.
Pod is the fundamental unit of kubernets system, the smallest component created or deployed by users, and is also the resource object for running containerized applications on kubernets system.
And packaging the databases to Pod for operation in sequence, realizing load balance of database access through a standard Service mechanism of Kubernetes, realizing containerized deployment of the database cluster, and obtaining a container cluster corresponding to the database cluster.
And determining the container group to which each container belongs according to the service load type of the container in the set-up container cluster so as to classify the containers in the container cluster, screening out a target container group meeting preset conditions from the classified container groups, and adding a new container to the target container group so as to realize capacity expansion of the target container group.
The preset conditions may specifically include:
the time spent in executing the read operation or the write operation in the process of the service load exceeds a preset first target time threshold; or
The number of containers for which the time taken to perform a read operation or a write operation during the traffic load exceeds a preset second target time threshold exceeds a preset target number threshold.
Optionally, the containers are divided into a read container group and a write container group according to the service load type carried by the containers in the container cluster, where the read container group performs data read operation, the write container group performs data write operation, and when the container cluster performs the service load, the time spent by all the containers in the read container to perform read operation and the time spent by all the containers in the write container to perform write operation are detected in real time, and a target container group which needs to be expanded is determined by judging whether the time spent by performing read operation or write operation exceeds a preset first target time threshold.
For example, assume that the total time it takes for all containers in a read group to perform a read is t 1 The total time taken for all the containers in the write group to perform the write operation is t 2 Presetting a first target threshold value as T, if T 1 > T and T 2 If the target container group is less than T, determining the target container group needing capacity expansion as a read container group; if t is 2 > T and T 1 If the target container group is less than T, determining the target container group needing capacity expansion as a write container group; if t is 1 ,t 2 If the value is less than T, determining that the capacity expansion of the read container group and the write container group is not needed; if t 1 ,t 2 If the value is more than T, determining that the capacity of the read container group and the capacity of the write container group are required to be expanded.
Or; and determining a target container group for capacity expansion by judging whether the container quantity of the time spent on executing the read operation or the write operation exceeds a preset second target time threshold exceeds a preset target quantity threshold.
For example, assume that a read container group includes n in total 1 A plurality of writing containers, wherein the writing container group comprises n 2 A container, a read container group n 1 The time taken for a container to perform a read operation is t i Wherein i =1,2,. Cndot.n 1 Write capacitor group n 2 The time taken for a container to perform a write operation is t j Wherein j =1, 2.. Multidot.n 2 Presetting a second target time threshold as T' and a target number threshold as num, respectively counting T i And t j Is greater than a predetermined second target time threshold of T', assuming T i Middle size of num 1 Is greater than a preset second target time threshold T', T j Middle size of num 2 Is greater than a preset second target time threshold T', if num 1 Num > num and num 2 If num is less than num, determining the target container group needing capacity expansion as a read container group; if num 2 Num > num and num 1 If num is less than num, determining the target container group needing capacity expansion as a write container group; if num 1 ,num 2 If num is less than num, determining that capacity expansion is not needed for the read container group and the write container group; if num 1 ,num 2 And if num is greater than num, determining that the capacity of the read container group and the capacity of the write container group are required to be expanded.
It should be noted that, when a new container is added to the target container group, a corresponding label is marked for the newly added container according to the service load type borne by the container in the target container group, and the service load types borne by the newly added container are distinguished. For example, if the traffic load type carried by the container in the target container group is a read operation, the label of the read operation container is marked on the newly added container, and if the traffic load type carried by the container in the target container group is a write operation, the label of the write operation container is marked on the newly added container.
According to the database cluster capacity expansion method provided by the invention, the dynamic capacity expansion of the database aiming at the service flow is realized by containerizing the database, and the capacity of the database for dealing with the burst flow is improved.
Further, in an embodiment, the step S2 may specifically include:
s21, if the container is read according to the service load type, determining that the container group to which the container belongs is a read container group;
and S22, if the service load type of the container is write operation, determining that the container group to which the container belongs is a write container group.
Optionally, each container in the container cluster is classified according to the service load type borne by the container in the container cluster, if the service load type of the container is read operation, the container is classified into a read container group, and if the service load type of the container is write operation, the container is classified into a write container group, and based on this, classification of all the clusters in the container cluster is completed.
The database cluster capacity expansion method provided by the invention can separate the read-write operation of the database cluster and realize the load balance of read-write.
Further, in one embodiment, the time taken for a read operation or a write operation is determined by:
determining the time spent on the read operation according to the time spent on the container in the container group executing the target read operation statement;
and determining the time spent on the write operation according to the time spent on the container to execute the target write operation statement.
Optionally, for the MySQL master database, after containerizing the MySQL master database, the container group to which the MySQL master database belongs is a write container group, and the time spent by each container in the write container group to execute a target write operation statement, for example, a write operation sql statement, may be taken as the time spent by the write operation; for MySQL slave databases, after containerizing the slave databases, the containers belonging to the slave databases are read container groups, and the time spent by each container in the read container groups to execute a target read operation statement, for example, a target sql statement, may be taken as the time spent on the read operation.
The database cluster capacity expansion method provided by the invention can determine the target container group needing capacity expansion by detecting the time spent by the container group to execute the sql statement, and lays a foundation for realizing load balance by dynamically expanding the target container group in the follow-up process.
Further, in one embodiment, the time taken by the container to execute the target read operation statement or the target write operation statement is obtained by:
acquiring time spent by a container in a container group to execute a target read operation statement or a target write operation statement according to a read-write interface externally deployed by the container cluster;
the container cluster is obtained by containerizing each database in the database cluster.
Optionally, the container in the Pod is deployed to the outside based on the kubernets Service, for example, a port of the container may be directly routed with a port on a scheduled node, so that a unified read-write interface may be provided by accessing the Pod through an IP of the host to obtain time taken to execute the target read operation statement or the target write operation statement.
Service in Kubernetes defines the logical set of Pod and the protocol for accessing Pod. Service makes loose coupling possible between slave Pod. Like other Kubernets objects, service is defined by YAML or JSON. A group of Pod under Service is usually labeled by a label selector.
Although each Pod has a unique IP address, if there is no Service, these IP addresses are not exposed outside the container cluster, and these IP addresses are used as the read-write interface, and by monitoring the read-write interface, the time spent by the container in the container group in executing the target read operation statement or the target write operation statement can be obtained.
According to the database cluster capacity expansion method provided by the invention, through the read-write interface which is deployed externally, the length of time spent when each container in the container group executes read-write operation can be detected in real time, and a foundation is laid for determining a target container group needing capacity expansion based on the time spent during read-write operation and dynamically expanding the target container group.
Further, in an embodiment, the step S4 may specifically include:
s41, screening out a target container group meeting preset conditions from the container groups, and performing Role-Based Access Control (RBAC) authentication on a capacity expansion request of the target container group;
and S42, if the RBAC authentication is passed, acquiring the capacity expansion authority of the target container group, and expanding the capacity of the target container group based on the capacity expansion authority.
Alternatively, the gateway of the kubernets cluster system is the only entrance for accessing and managing the resource object, and all other components and kubecect commands need to perform cluster access and management (for example, capacity expansion of the container cluster) through the gateway of the kubernets cluster system. And each access request of each component and each client needs to be subjected to legality verification by the gateway, including identity authentication, operation authority verification and the like.
The client accesses the API Service through three different paths, i.e., kubecect, client library, and REST interface, and the main body executing the API request, such as a capacity expansion request, is usually a regular User (User Account) and a Service Account (Service Account).
User Account: typically a user account managed independently of other services than Kubernetes, such as administrator distributed keys, a user store such as keytone, etc. There is no object in kubernets that identifies such user accounts and therefore cannot be added directly into the kubernets system. This account number is typically used for complex business logic governments, whose name must be globally unique.
Service Account: is an account managed by the kubernets API, and is used for providing identity for service processes in the Pod when accessing the kubernets API.
The user group is a logic set of user accounts and has no operation authority, but the authority attached to the group can be inherited by all users in the user group, so that an efficient authorization management mechanism is realized. Kubernets is accompanied by some built-in groups for special purposes. Authentication modes supported by Kubernetes when the identity authentication plug-in is used for performing identity authentication on the API request include client authentication, bearer token authentication (bearer tokens), authentication proxy (authentication proxy), http base authentication and the like. The API Server supports a plurality of authentication mechanisms at the same time, but at least one authentication plug-in is respectively started for each of the Service Account and the User Account.
After a target container group meeting the preset conditions is screened out from the container group, the deployed control module communicates with a container cluster authentication module (for example, one or more authentication plug-ins configured by a gateway of a kubernets cluster system) and sends a capacity expansion request, and the container cluster authentication module performs role-based access control (RBAC) authentication on the capacity expansion request to give authority to operations such as capacity expansion, monitoring and the like.
RBAC authentication is a new, flexible and widely used access control mechanism in which a user acts as a subject that has independent access to data resources, and a role refers to a work or place in an organization or task that represents a right, qualification, and responsibility. Permission is an operation that is allowed to be performed on one or more objects (objects).
RBACs are used to define which object or class of objects those subjects are or are not capable of manipulating.
The RBAC authorization plug-in supports two roles of Role and ClusterRole, wherein the Role is in the name space level and is used for defining a resource permission set in the name space, and the ClusterRole is used for organizing the resource permission set in the cluster level. Two resource types, namely RoleBinding and Cluster RoleBinding, are needed when the two roles are authorized.
RoleBingding is used to bind the permission rights on Role to one or a group of users, which are affiliated with and can only act on one namespace; when binding, role in the same name may be applied, or Cluster Role at cluster level may be applied.
Clusterrollingbinds the permission defined in clusterroll to one or a group of users, and can only refer to clusterroll at the cluster level.
And if the RBAC authentication is passed, the capacity expansion authority, the monitoring authority and the like are granted to the role.
When a user is created, the user is bound to roles with capacity expansion authority, monitoring authority and the like, so that the user has the authority of expanding the containers carried in the Pod of Kubernetes, and the target container group is expanded based on the capacity expansion authority.
According to the database cluster capacity expansion method provided by the invention, the capacity expansion request is authorized and authenticated, and the capacity expansion operation is performed on the container group in the container cluster by operating the user with capacity expansion authority, so that the stability of the container cluster is ensured.
The following describes the database cluster capacity expansion system provided by the present invention, and the database cluster capacity expansion system described below and the database cluster capacity expansion method described above may be referred to in correspondence with each other.
Fig. 2 is a schematic structural diagram of a database cluster capacity expansion system provided by the present invention, as shown in fig. 2, including: a container creation module 210, a container grouping module 211, and a container expansion module 212;
a container establishing module 210, configured to sequentially containerize each database in the database cluster;
a container grouping module 211, configured to determine, according to a traffic load type of a container, a container group to which the container belongs;
a container capacity expansion module 212, configured to screen out a target container group that meets a preset condition from the multiple container groups, and expand the capacity of the target container group;
the preset condition comprises that the time spent on executing reading operation or writing operation in the service load process exceeds a preset first target time threshold; or
The number of containers for which the time taken to perform a read operation or a write operation during the traffic load exceeds a preset second target time threshold exceeds a preset target number threshold.
The database cluster capacity expansion system provided by the invention realizes dynamic capacity expansion of the database aiming at the service flow by containerizing the database, and improves the capacity of the database for dealing with the burst flow.
Further, in one embodiment, the container grouping module 211 is further configured to:
if the container is read by the service load type, determining that the container group to which the container belongs is a read container group;
and if the service load type of the container is write operation, determining that the container group to which the container belongs is a write container group.
The database cluster capacity expansion system provided by the invention can separate the read-write operation of the database cluster and realize the load balance of read-write.
Further, in an embodiment, the container expansion module 212 may specifically include:
and the time determining submodule is used for determining the time spent on the read operation according to the time spent on the target read operation statement executed by the container in the container group, and determining the time spent on the write operation according to the time spent on the target write operation statement executed by the container.
The database cluster capacity expansion system provided by the invention can determine the target container group needing capacity expansion by detecting the time spent by the container group to execute the sql statement, and lays a foundation for realizing load balance by dynamically expanding the target container group in the follow-up process.
Further, in an embodiment, the time determination submodule may be further configured to:
acquiring the time spent by the containers in the container group to execute the target read operation statement or the target write operation statement according to the externally deployed read-write interface of the container cluster;
wherein, the container cluster is obtained by containerizing each database in the database cluster.
The database cluster capacity expansion system provided by the invention can detect the length of time spent in executing read-write operation by each container in the container group in real time through the read-write interface deployed externally, and lays a foundation for determining a target container group needing capacity expansion based on the time spent in the read-write operation and dynamically expanding the capacity of the target container group.
Further, in one embodiment, the container expansion module 212 may be further configured to:
screening out a target container group meeting preset conditions from the container group, and performing role-based access control (RBAC) authentication on a capacity expansion request of the target container group;
and if the RBAC authentication is passed, acquiring the capacity expansion authority of the target container group, and expanding the capacity of the target container group based on the capacity expansion authority.
According to the database cluster capacity expansion system provided by the invention, the capacity expansion request is authorized and authenticated, and the capacity expansion operation is performed on the container group in the container cluster by operating the user with capacity expansion authority, so that the stability of the container cluster is ensured.
Fig. 3 is a schematic physical structure diagram of an electronic device provided in the present invention, and as shown in fig. 3, the electronic device may include: a processor (processor) 310, a communication interface (communication interface) 311, a memory (memory) 312 and a bus (bus) 313, wherein the processor 310, the communication interface 311 and the memory 312 complete communication with each other through the bus 313. The processor 310 may call logic instructions in the memory 312 to perform the following method:
each database in the database cluster is containerized in sequence;
determining a container group to which the container belongs according to the service load type of the container;
screening out a target container group meeting preset conditions from the plurality of container groups, and expanding the capacity of the target container group;
the preset condition comprises that the time spent on executing read operation or write operation in the process of the service load exceeds a preset first target time threshold; or
The number of containers for which the time taken to perform a read operation or a write operation during the traffic load exceeds a preset second target time threshold exceeds a preset target number threshold.
In addition, the logic instructions in the memory may be implemented in the form of software functional units and may be stored in a computer readable storage medium when sold or used as a stand-alone product. Based on such understanding, the technical solution of the present invention or a part thereof which substantially contributes to the prior art may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer power screen (which may be a personal computer, a server, or a network power screen) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and various media capable of storing program codes.
Further, the present invention discloses a computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions, which when executed by a computer, the computer is capable of executing the database cluster capacity expansion method provided by the above-mentioned method embodiments, for example, the method comprises:
each database in the database cluster is containerized in sequence;
determining a container group to which the container belongs according to the service load type of the container;
screening out a target container group meeting preset conditions from the plurality of container groups, and expanding the capacity of the target container group;
the preset condition comprises that the time spent on executing reading operation or writing operation in the service load process exceeds a preset first target time threshold; or
The number of containers for which the time taken to perform a read operation or a write operation during the traffic load exceeds the preset second target time threshold exceeds the preset target number threshold.
In another aspect, the present invention further provides a non-transitory computer-readable storage medium, on which a computer program is stored, where the computer program is implemented to perform the database cluster capacity expansion method provided in the foregoing embodiments when executed by a processor, for example, the method includes:
each database in the database cluster is containerized in sequence;
determining a container group to which the container belongs according to the service load type of the container;
screening out a target container group meeting preset conditions from the plurality of container groups, and expanding the capacity of the target container group;
the preset condition comprises that the time spent on executing reading operation or writing operation in the service load process exceeds a preset first target time threshold; or
The number of containers for which the time taken to perform a read operation or a write operation during the traffic load exceeds a preset second target time threshold exceeds a preset target number threshold.
The above-described system embodiments are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment may be implemented by software plus a necessary general hardware platform, and may also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., and includes instructions for causing a computer power supply screen (which may be a personal computer, a server, or a network power supply screen, etc.) to execute the methods described in the embodiments or some portions of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, and not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A database cluster capacity expansion method is characterized by comprising the following steps:
each database in the database cluster is containerized in sequence;
determining a container group to which the container belongs according to the service load type of the container;
screening out a target container group meeting preset conditions from the container groups, and expanding the capacity of the target container group;
the preset condition comprises that the time spent on executing read operation or write operation in the process of the service load exceeds a preset first target time threshold; or
The number of containers for which the time taken to perform the read operation or the write operation during the traffic load exceeds a preset second target time threshold exceeds a preset target number threshold.
2. The database cluster capacity expansion method according to claim 1, wherein the determining, according to a traffic load type of a container, a container group to which the container belongs includes:
if the container is read according to the service load type of the container, determining that the container group to which the container belongs is a read container group;
and if the service load type of the container is write operation, determining that the container group to which the container belongs is a write container group.
3. The database cluster capacity expansion method according to claim 1, wherein the time spent on the read operation or the write operation is determined by:
determining the time spent on the read operation according to the time spent on the container in the container group executing the target read operation statement;
determining the time spent on the write operation according to the time spent on the container executing the target write operation statement.
4. The database cluster capacity expansion method according to claim 3, wherein the time taken by the container to execute a target read operation statement or a target write operation statement is obtained as follows:
acquiring time spent by a container in the container group in executing a target read operation statement or a target write operation statement according to a read-write interface externally deployed by the container cluster;
wherein the container cluster is obtained by containerizing each database in the database cluster.
5. The database cluster capacity expansion method according to claim 1, wherein the step of screening out a target container group that satisfies a preset condition from the container groups and expanding the capacity of the target container group includes:
screening out a target container group meeting preset conditions from the container groups, and performing role-based access control (RBAC) authentication on a capacity expansion request of the target container group;
and if the RBAC authentication is passed, acquiring the capacity expansion authority of the target container group, and expanding the capacity of the target container group based on the capacity expansion authority.
6. A database cluster capacity expansion system, comprising: the system comprises a container establishing module, a container grouping module and a container capacity expansion module;
the container establishing module is used for sequentially containerizing each database in the database cluster;
the container grouping module is used for determining a container group to which the container belongs according to the service load type of the container;
the container capacity expansion module is used for screening out a target container group meeting preset conditions from the plurality of container groups and expanding the capacity of the target container group;
the preset condition comprises that the time spent on executing read operation or write operation in the process of the service load exceeds a preset first target time threshold; or
The number of containers for which the time taken to perform the read operation or the write operation during the traffic load exceeds a preset second target time threshold exceeds a preset target number threshold.
7. The database cluster capacity expansion system of claim 6, wherein the container grouping module is further configured to:
if the container is read according to the service load type of the container, determining that a container group to which the container belongs is a read container group;
and if the service load type of the container is write operation, determining that the container group to which the container belongs is a write container group.
8. The database cluster capacity expansion system of claim 6, wherein the container capacity expansion module is further configured to:
screening out a target container group meeting preset conditions from the container group, and performing role-based access control (RBAC) authentication on a capacity expansion request of the target container group;
and if the RBAC authentication is passed, acquiring the capacity expansion authority of the target container group, and expanding the capacity of the target container group based on the capacity expansion authority.
9. An electronic device comprising a processor and a memory storing a computer program, wherein the processor implements the steps of the database cluster capacity expansion method according to any one of claims 1 to 5 when executing the computer program.
10. A processor-readable storage medium, characterized in that the processor-readable storage medium stores a computer program for causing a processor to perform the steps of the database cluster capacity expansion method of any one of claims 1 to 5.
CN202110696694.7A 2021-06-23 2021-06-23 Database cluster capacity expansion method and system Pending CN115510018A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110696694.7A CN115510018A (en) 2021-06-23 2021-06-23 Database cluster capacity expansion method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110696694.7A CN115510018A (en) 2021-06-23 2021-06-23 Database cluster capacity expansion method and system

Publications (1)

Publication Number Publication Date
CN115510018A true CN115510018A (en) 2022-12-23

Family

ID=84500453

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110696694.7A Pending CN115510018A (en) 2021-06-23 2021-06-23 Database cluster capacity expansion method and system

Country Status (1)

Country Link
CN (1) CN115510018A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118093121A (en) * 2024-01-23 2024-05-28 上海邮电设计咨询研究院有限公司 Database performance test method and system based on Kubernetes

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118093121A (en) * 2024-01-23 2024-05-28 上海邮电设计咨询研究院有限公司 Database performance test method and system based on Kubernetes
CN118093121B (en) * 2024-01-23 2024-08-09 上海邮电设计咨询研究院有限公司 Database performance test method and system based on Kubernetes

Similar Documents

Publication Publication Date Title
US11409712B2 (en) Small-file storage optimization system based on virtual file system in KUBERNETES user-mode application
CN109542611B (en) Database-as-a-service system, database scheduling method, device and storage medium
US9971823B2 (en) Dynamic replica failure detection and healing
US9678680B1 (en) Forming a protection domain in a storage architecture
US9524299B2 (en) Methods, systems, and computer readable media for modeling a workload
CN104050201A (en) Method and equipment for managing data in multi-tenant distributive environment
CN109213571B (en) Memory sharing method, container management platform and computer readable storage medium
CN109542861B (en) File management method, device and system
CN112714018B (en) Gateway-based ElasticSearch search service method, system, medium and terminal
US20100169289A1 (en) Two Phase Commit With Grid Elements
US20140082275A1 (en) Server, host and method for reading base image through storage area network
CN114706690B (en) Method and system for sharing GPU (graphics processing Unit) by Kubernetes container
US20140041053A1 (en) Data block access control
CN113946276A (en) Disk management method and device in cluster and server
CN105183799B (en) Authority management method and client
CN115510018A (en) Database cluster capacity expansion method and system
EP4425892A1 (en) Resource operating method and apparatus, electronic device, and storage medium
CN110659303A (en) Read-write control method and device for database nodes
CN116662426A (en) Database connection establishment method, device, equipment and medium
CN114172917B (en) Distributed cache system and deployment method thereof
CN114564466A (en) Database management system and method for managing database
CN106776055A (en) A kind of distributed lock method and system
CN109408485B (en) Distributed lock implementation method and system
CA3173093A1 (en) Secure data replication in distributed data storage environments
CN109791541A (en) Log serial number generation method, device and readable storage medium storing program for executing

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination