Cluster deployment method and system
By using virtual networks and MaxScale in Kubernetes clusters, simplified MySQL cluster deployment and management are achieved, solving single point of failure and complex IP configuration issues, improving deployment efficiency and system stability, and supporting dynamic expansion and high availability.
Patent Information
- Application Number
- CN202410674330.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-29
- Publication Date
- 2024-09-10
AI Technical Summary
Cluster deployment methods in the existing technology have problems such as single points of failure, complex IP configuration, and cumbersome deployment processes, making it difficult to meet the needs of high availability and automated management.
Using the virtual network features of Kubernetes and MaxScale as the connection entry, one-click deployment and dynamic expansion are achieved by defining and submitting CRD resource declarations, simplifying the configuration process, reducing the probability of human errors, improving the reliability and stability of deployment, and supporting multi-node deployment. Separate from reading and writing.
It achieves high availability, load balancing and automated management, reduces deployment complexity and error possibilities, improves resource utilization and system continuity and reliability, simplifies IP configuration steps, and supports dynamic expansion and one-click deployment.
Smart Images

Figure CN118626098A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a cluster deployment method and a system thereof. Background Art
[0002] In today's digital age, data management is becoming increasingly important. With the popularization of the Internet and the acceleration of the information process, a large amount of data is constantly generated, stored and applied. As a key component for storing and managing data, the role of databases in all walks of life is becoming increasingly prominent. However, with the continuous growth of data volume and the complexity of business needs, traditional single-point databases often cannot meet the requirements of high availability, scalability and fault tolerance. Therefore, cluster deployment has become a common solution.
[0003] Cluster deployment combines multiple nodes into a cluster, which work together to provide services. This approach can achieve load balancing, high availability, and fault tolerance, thereby ensuring the stability and reliability of the system. In a cluster deployment, each node can cooperate with each other to process requests together. Even if one of the nodes fails, the cluster can still maintain normal operation without affecting the stability of the entire system.
[0004] One of the cluster deployment methods in the prior art is to deploy the MySQL database on a bare metal machine and configure the server IP. This method is to directly install and configure the MySQL database on the physical server, and then manually set the server's IP address. Deploying the MySQL database on a bare metal machine requires obtaining the server IP information and manually updating it to the MySQL configuration file, which increases the complexity of deployment and the possibility of human error. In addition, the master-slave switching of the MySQL database needs to be completed through a script, which increases the workload of maintenance and management, and may cause delays or errors during the switching process. In addition, since the connection entry is the server IP, the entire system is at risk of a single point of failure and does not meet the requirements of high availability. When a single server fails, the entire system may become unavailable, affecting the continuity and stability of the business.
[0005] Another cluster deployment method in the prior art is to deploy a MySQL cluster using a Kubernetes native controller and a Shell script. However, this method requires manual writing and maintenance of Shell scripts, which means that a certain level of technical skills and workload are required, and lacks the convenience of one-click deployment and automated management. Especially for complex deployment scenarios, writing and debugging scripts is time-consuming and difficult. The implementation of high-availability functions such as failover also requires self-writing of logic and scripts, which is not very stable and reliable. In short, this method increases the complexity of deployment and the possibility of errors, especially for inexperienced users. Summary of the invention
[0006] The present invention provides a cluster deployment method and system, aiming to solve the problems of single point failure, complex IP configuration and cumbersome deployment process in the prior art deployment. It is mainly composed of Replication-manager, MaxScale, MySQL and Kubernetes. The present invention uses Service in Kubernetes to correspond to multiple MaxScales as connection entrances, solving the single point problem that can only use IP connection before; secondly, the entire system uses the virtual network characteristics of Kubernetes, so there is no need to configure IP information additionally; in addition, the deployment process is also simplified, and it only needs to submit the CRD resource declaration of the cluster to the Kubernetes cluster, one-click deployment, and dynamic expansion, which greatly improves the deployment efficiency and flexibility.
[0007] In a first aspect, the present invention provides a cluster deployment method, characterized in that the method comprises:
[0008] Define resource declarations based on requirements;
[0009] Submit the resource declaration to the cluster to be deployed;
[0010] The cluster deploys required components and their services according to the resource declaration, wherein the components include MaxScale.
[0011] In a second aspect, the present invention further provides a cluster deployment system, characterized in that the system comprises:
[0012] A definition device for defining resource declarations according to requirements;
[0013] A submission device, which is used to submit the resource declaration to the cluster to be deployed;
[0014] An application device is used for the cluster to deploy required components and services according to the resource declaration, wherein the components include MaxScale.
[0015] The cluster deployment method and system provided by the present invention: first, only the CRD resource declaration of the cluster needs to be submitted to the Kubernetes cluster to complete the deployment, which greatly simplifies the configuration process, reduces the probability of human errors, and improves the reliability and stability of the deployment; second, it supports dynamic expansion, and can flexibly adjust the cluster scale according to needs, make full use of server resources, and improve resource utilization; third, using MaxScale as the entrance to the cluster, read-write separation is realized, and the pressure of the main library is effectively shared. At the same time, it supports multi-node deployment and improves the load balancing capability of the cluster. Fourth, MaxScale supports multi-node deployment. Even if a node fails, it will not affect the use of the entire cluster, ensuring the continuity and reliability of the system; fifth, the entire cluster is built using the network capability of Kubernetes virtualization, and there is no need to manually configure the IP address, which means that when deploying the cluster, there is no need to modify it according to the specific environment, and the cluster can be built by using a one-click deployment method. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0017] Figure 1 is a flow chart of a cluster deployment method provided by an embodiment of the present invention;
[0018] Figure 2 It is a block diagram of a cluster deployment system provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0019] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. SUMMARY OF THE INVENTION
[0021] As mentioned above, the present invention provides a cluster deployment method and system, which simplifies the configuration process, supports dynamic expansion, and improves the utilization of server resources; at the same time, MaxScale is used to achieve read-write separation, which reduces the pressure on the main library, supports multi-node deployment, and improves the stability of the cluster; in addition, the Kubernetes virtualized network capability is used for construction, which eliminates the step of manually configuring the IP and improves the convenience of cluster deployment.
[0022] Exemplary Methods
[0023] Figure 1It is a flow chart of the cluster deployment method provided by an embodiment of the present invention, wherein the cluster is a Kubernetes cluster, which is an open source container orchestration engine for automatically deploying, expanding, and managing containerized applications. In the present invention, Kubernetes is responsible for managing the entire deployment environment, including the deployment of MySQL, Replication-manager, and MaxScale. It provides a unified access portal for external clients through Service objects, monitors and adjusts the operating status of the entire system, ensures high availability and automated management, and realizes high availability, dynamic expansion, and self-repair of the MySQL database. The Kubernetes cluster provides features such as automated resource scheduling, service discovery, and load balancing, providing a reliable infrastructure for the present invention, so that the MySQL database can run in a cluster in an efficient and stable manner.
[0024] More specifically, Kubernetes provides a virtual network feature that can assign virtual IP addresses to containers and services and provide service discovery and load balancing capabilities. When deploying a MySQL high-availability cluster, there is no need to manually configure the IP address of each component. Instead, you can use Kubernetes' service discovery mechanism to automatically manage communications between services.
[0025] Due to the virtual network characteristics of Kubernetes, it can ensure that the communication between components is carried out through service names instead of specific IP addresses, which simplifies the deployment process, reduces the complexity of configuration, and improves the maintainability of the system. When deploying a cluster, there is no need to modify it according to the specific environment, and you can complete the cluster construction by using a one-click deployment method.
[0026] By using Kubernetes resource declarations, you can define the configuration of a MySQL high-availability cluster and submit it to the Kubernetes cluster. The Kubernetes controller automatically creates and manages the required resources based on these declarations, thereby simplifying the deployment process, reducing manual errors, and improving the consistency and reliability of deployment.
[0027] Kubernetes allows you to dynamically scale the number of MySQL databases for an application based on demand. Through horizontal scaling, you can automatically increase or decrease the number of MySQL databases based on load conditions to meet different workload requirements.
[0028] This embodiment includes the following steps:
[0029] S101: Define resource declarations according to requirements.
[0030] The requirements include, but are not limited to, database size and capacity requirements, data persistence requirements, service access requirements, fault handling requirements, and scalability requirements.
[0031] Among them, the database scale and capacity requirements determine the required scale and capacity of the database according to the actual business needs, including the requirements for storage space, memory, CPU and other resources. For example, determine how many nodes the database cluster needs and the hardware configuration of each node based on the estimated data volume and access volume. Data persistence requirements refer to ensuring that data can still be retained and restored after a failure or restart, including selecting a suitable storage solution, such as using a persistent storage volume (PersistentVolume) or a cloud storage service, and configuring the database backup and recovery strategy. Service access requirements refer to determining the access method and interface provided by the database service to the outside, including network protocols, access rights, security and other requirements. For example, determine the network protocol (such as TCP, HTTP) used by the database service, access control strategy (such as whitelist based on IP address, username and password authentication), etc. Fault handling requirements include the handling strategy of the database when a failure occurs, such as automatic fault detection and recovery, failover and failover, etc. For example, determine the fault detection mechanism (such as heartbeat detection) of the database cluster, the conditions and strategy of failover (such as automatic switching or manual switching), etc. Scalability requirements refer to the ability of database services to scale in the face of business growth and increased load, including horizontal expansion (such as adding nodes) and vertical expansion (such as upgrading hardware). For example, determine the scalability plan of the database cluster (such as automatic expansion, manual expansion), the load balancing strategy during expansion, etc.
[0032] According to these requirements, resource declarations can be written. The resource declaration is a CRD resource declaration. CRD (CustomResource Definition) is a mechanism for extending APIs in Kubernetes, allowing users to customize resource types. By defining CRD, users can introduce their own custom resources into the Kubernetes cluster and manage and operate them in Kubernetes like native resources. CRD allows users to define the structure and behavior of resources according to their own needs, and write custom controllers to implement the management logic of these resources. In this way, users can define and use various custom resources according to their actual business needs, thereby achieving more flexible and customized Kubernetes application deployment and management.
[0033] The resource declaration includes the configuration information and quantity of each component. The configuration information of each component refers to the detailed configuration parameters and settings of each component required when deploying a MySQL high-availability cluster, as follows:
[0034] The configuration information of MySQL database includes database version, storage type, resource request and restriction; the configuration information of Service includes the name, type, port and label of the service; the configuration information of MaxScale includes the maximum number of connections, load balancing rules (defining load balancing strategies and rules, such as polling, minimum number of connections, etc.) and master-slave switching rules (setting the failover rules of master-slave replication, including monitoring interval, switching conditions, etc.); the configuration information of Replication-manager includes master-slave replication parameters (configuring master-slave replication parameters, such as replication mode, synchronization delay, etc.), monitoring interval and failover triggering conditions (defining failover triggering conditions, such as automatic switching strategy when the primary database is unavailable, verification after switching, etc.).
[0035] S102: Submit the resource declaration to the cluster to be deployed.
[0036] By submitting resource declarations to the Kubernetes cluster, the cluster can be automatically deployed and managed, which improves deployment efficiency and reliability while reducing management costs and complexity.
[0037] S103: The cluster deploys required components and their services according to the resource declaration.
[0038] The components include MySQL database, Service, MaxScale and Replication-manager. The cluster will create and configure the corresponding components and services in the cluster according to the submitted resource declaration and pre-defined configuration requirements. MySQL database is the core of data storage and processing, Service provides a unified access portal, MaxScale is responsible for load balancing and traffic control, and Replication-manager is responsible for managing the master-slave replication and fault handling of the database. Through the deployment and configuration of these components, a complete and highly available MySQL database cluster can be built to meet business needs.
[0039] More specifically, the service of the Service is to provide a virtual IP address and port as a unified access portal, map multiple MaxScales to the access portal, and route client requests to the MySQL database through multiple MaxScales.
[0040] Service acts as the entry point for clients to access the MySQL cluster. Through Service, clients can use a unified virtual IP address and port to communicate with the MySQL cluster without having to know the actual IP address or port of each MaxScale. The benefit of this is that it simplifies the client configuration and makes the entire cluster more flexible in subsequent changes, because the client only needs to connect to a fixed virtual address without having to worry about actual changes in the backend.
[0041] The client request types include read requests and write requests. A read request refers to an operation in which a client requests a database to read data, while a write request refers to an operation in which a client requests a database to modify or insert data.
[0042] The MySQL database includes a master database (Master) and at least one slave database (Slave). In the master-slave replication architecture, the master database is responsible for processing write operations and synchronizing its changes to one or more slave databases. The slave database is responsible for replicating the data of the master database to provide read operation services, and can be promoted to a new master database when the master database fails to ensure high availability of the system and data persistence.
[0043] The MaxScale supports multi-node deployment, deploying multiple MaxScales in a cluster and configuring them into a group of collaborative nodes. Multi-node deployment can achieve load balancing, that is, distributing client requests to multiple MaxScale nodes, thereby balancing the load of each node in the cluster. At the same time, when a MaxScale node fails, other nodes can continue to process requests without affecting the normal operation of the entire cluster, ensuring high availability of the service. In addition, the number of MaxScale nodes can be dynamically increased or decreased as needed, thereby achieving horizontal expansion of the cluster, flexibly adjusting the size of the cluster according to traffic changes, and improving the elasticity and scalability of the system.
[0044] The MaxScale service distributes the client request to the corresponding MySQL database according to the client request type and load balancing rules, realizing read-write separation. Specifically, the read request is distributed to multiple slave databases for load balancing to reduce the pressure on the master database, and the write request is sent to the master database to ensure data consistency and persistence.
[0045] The service of the Replication-manager is to manage the master-slave replication of the MySQL database, monitor the status of the MySQL database and perform fault switching.
[0046] The master-slave replication is to synchronize the changes of the master database to the slave database. The basic principle of master-slave replication is to replay the update operations (such as insert, update, and delete) of the master database on the slave database, so that the data of the slave database is synchronized with the master database. This synchronization is achieved by recording the update operations of the master database into logs and transferring these logs to the slave database. For example, configure replication-related parameters on the master database and allow the slave database to connect to the master database; before starting replication, the slave database will obtain a data snapshot from the master database to ensure the consistency of the initial data; the master database will record the update operations in the replication log (such as a binary log), and then transfer these logs to the slave database; after receiving the logs transferred by the master database, the slave database will apply these logs to its own data set, so that its own data is synchronized with the master database; the slave database will continuously receive and apply the update operations transferred by the master database to keep synchronization with the master database.
[0047] Master-slave replication can provide the following advantages: If the master database fails, you can quickly switch to the slave database, thereby achieving rapid recovery of the system; read operations can be distributed to the slave database, thereby reducing the load on the master database and improving the performance and scalability of the system; the slave database can be used as a backup of the master database to prevent data loss.
[0048] Specifically, the MySQL database status is monitored through real-time heartbeat detection. Heartbeat detection can be done by monitoring agents or monitoring tools running on the database server. These monitoring agents periodically send query requests to the MySQL database to check the availability and response time of the database. If the database does not respond or the response time exceeds the preset threshold, the agent will trigger further investigation and processing.
[0049] The failover is to promote one of the slave databases to the new master database when the master database fails. For example, once a master database failure is detected, the automatic failover process will be triggered. During the failover process, the Replication-manager will select a healthy slave database and promote it to the new master database, while updating the configuration of the database cluster to ensure the continuity and stability of business services.
[0050] In summary, the client request processing flow is as follows: the client request is first routed through the Service; the Service forwards the request to MaxScale; MaxScale distributes the request to the corresponding database according to the type of request (read or write); the MySQL database processes the request and returns the result to MaxScale; MaxScale returns the result to the client; the Replication-manager manages the master-slave replication of the MySQL database, monitors the status of the MySQL database, and performs failover. If the master database is found to be unavailable, a failover is performed to switch the master database to a healthy slave database to ensure high availability and data consistency.
[0051] After the deployment is completed, the cluster can be dynamically expanded by modifying the resource declaration. That is, the scale of the MySQL cluster can be expanded at any time according to demand. Just submit the CRD resource declaration of the new MySQL high-availability cluster to the Kubernetes cluster, and Kubernetes will automatically handle the corresponding deployment and management tasks. This dynamic expansion method is very flexible and can increase or decrease the number of MySQL databases or other components at any time according to actual needs without additional manual deployment operations. It not only improves the utilization of server resources, but also simplifies management and operation work, making cluster management more convenient and efficient.
[0052] Exemplary Systems
[0053] Correspondingly, an embodiment of the present invention also provides a cluster deployment system. Figure 2 is a block diagram of a cluster deployment system provided by an embodiment of the present invention, such as Figure 2 As shown, the system 100 provided in this embodiment includes:
[0054] Definition means 101, which is used to define resource declarations according to requirements;
[0055] A submitting device 102, which is used to submit the resource declaration to the cluster to be deployed;
[0056] Application means 103 is used for the cluster to deploy the required components and services according to the resource declaration.
[0057] The cluster is a Kubernetes cluster;
[0058] The components include MySQL database, Service, MaxScale and Replication-manager.
[0059] The service of the Service is to provide a virtual IP address and port as a unified access entry, map multiple MaxScales to the access entry, and route client requests to the MySQL database through multiple MaxScales.
[0060] The client request types include read requests and write requests.
[0061] The MySQL database includes a master database and at least one slave database.
[0062] The MaxScale supports multi-node deployment;
[0063] The MaxScale service distributes the client request to the corresponding MySQL database according to the client request type and load balancing rules.
[0064] The MaxScale service distributes the read request to the multiple slave databases for load balancing and sends the write request to the master database.
[0065] The service of the Replication-manager is to manage the master-slave replication of the MySQL database, monitor the status of the MySQL database and perform fault switching.
[0066] The master-slave replication is to synchronize the changes of the master database to the slave database.
[0067] The failover is to promote one of the slave databases to be a new master database when a failure occurs in the master database.
[0068] The system 100 further includes:
[0069] The expansion device 104 is used to dynamically expand the cluster by modifying the resource declaration.
[0070] The resource declaration includes configuration information and quantity of each component;
[0071] Configuration information for the MySQL database includes database version, storage type, resource requests, and limits;
[0072] The configuration information of the Service includes the name, type, port, and label of the service;
[0073] MaxScale configuration information includes the maximum number of connections, load balancing rules, and master-slave switching rules;
[0074] The configuration information of Replication-manager includes the master-slave replication parameters, monitoring interval, and failover trigger conditions.
[0075] The requirements include database size and capacity requirements, data persistence requirements, service access requirements, fault handling requirements, and scalability requirements.
[0076] It should be noted that although the operations of the cluster deployment method of the present invention are described in a specific order in the accompanying drawings, this does not require or imply that the operations must be performed in this specific order, or that all the operations shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps.
[0077] In addition, although several devices, units, or modules of the cluster deployment system are mentioned in the above detailed description, this division is only exemplary and not mandatory. In fact, according to an embodiment of the present invention, the features and functions of two or more modules described above can be embodied in one module. Conversely, the features and functions of one module described above can be further divided into multiple modules to be embodied.
[0078] Although the spirit and principle of the present invention have been described with reference to several specific embodiments, it should be understood that the present invention is not limited to the disclosed specific embodiments, and the division of various aspects does not mean that the features in these aspects cannot be combined to benefit, and such division is only for the convenience of expression. The present invention is intended to cover various modifications and equivalent arrangements included in the spirit and scope of the attached claims.
[0079] The present invention provides: 1. A cluster deployment method, characterized in that the method comprises: Define resource declarations based on requirements; Submit the resource declaration to the cluster to be deployed; The cluster deploys required components and their services according to the resource declaration, wherein the components include MaxScale. 2. The cluster deployment method according to item 1, characterized in that the cluster is a Kubernetes cluster; The components also include MySQL database, Service and Replication-manager. 3. The cluster deployment method according to item 2 is characterized in that the service of the Service provides a virtual IP address and port as a unified access portal, maps multiple MaxScales to the access portal, and routes client requests to the MySQL database through multiple MaxScales. 4. The cluster deployment method according to item 3 is characterized in that the client request type includes a read request and a write request. 5. The cluster deployment method according to item 4 is characterized in that the MySQL database includes a master database and at least one slave database. 6. The cluster deployment method according to item 5, characterized in that the MaxScale supports multi-node deployment; The MaxScale service distributes the client request to the corresponding MySQL database according to the client request type and load balancing rules. 7. The cluster deployment method according to item 6 is characterized in that, according to the client request type and load balancing rules, distributing the client request to the corresponding MySQL database is specifically: The read request is distributed to the multiple slave databases for load balancing, and the write request is sent to the master database. 8. The cluster deployment method according to item 5 is characterized in that the service of the Replication-manager is to manage the master-slave replication of the MySQL database, monitor the status of the MySQL database and perform fault switching. 9. The cluster deployment method according to item 8 is characterized in that the master-slave replication is to synchronize changes of the master database to the slave database. 10. The cluster deployment method according to item 8 is characterized in that the failover is to promote one of the slave databases to a new master database when a failure occurs in the master database. 11. The cluster deployment method according to any one of items 1 to 10, characterized in that after the cluster to be deployed deploys the components and services required by the resource declaration, it also includes: The cluster is dynamically expanded by modifying the resource declaration. 12. The cluster deployment method according to any one of items 1 to 10, wherein the resource declaration includes configuration information and quantity of each component; Configuration information for the MySQL database includes database version, storage type, resource requests, and limits; The configuration information of the Service includes the name, type, port, and label of the service; MaxScale configuration information includes the maximum number of connections, load balancing rules, and master-slave switching rules; The configuration information of Replication-manager includes the master-slave replication parameters, monitoring interval, and failover trigger conditions. 13. The cluster deployment method according to any one of items 1 to 10, characterized in that the requirements include database scale and capacity requirements, data persistence requirements, service access requirements, fault handling requirements and scalability requirements. 14. A cluster deployment system, characterized in that the system comprises: A definition device for defining resource declarations according to requirements; A submission device, which is used to submit the resource declaration to the cluster to be deployed; An application device is used for the cluster to deploy required components and services according to the resource declaration, wherein the components include MaxScale. 15. The cluster deployment system according to item 14, wherein the cluster is a Kubernetes cluster; The components also include MySQL database, Service and Replication-manager. 16. The cluster deployment system according to item 15 is characterized in that the service of the Service provides a virtual IP address and port as a unified access portal, maps multiple MaxScales to the access portal, and routes client requests to the MySQL database through multiple MaxScales. 17. The cluster deployment system according to item 16 is characterized in that the client request type includes a read request and a write request. 18. The cluster deployment system according to item 17 is characterized in that the MySQL database includes a master database and at least one slave database. 19. The cluster deployment system according to item 18, wherein the MaxScale supports multi-node deployment; The MaxScale service distributes the client request to the corresponding MySQL database according to the client request type and load balancing rules. 20. The cluster deployment system according to item 19 is characterized in that the MaxScale service distributes the read request to multiple slave databases for load balancing and sends the write request to the master database. 21. The cluster deployment system according to item 18 is characterized in that the service of the Replication-manager is to manage the master-slave replication of the MySQL database, monitor the status of the MySQL database and perform fault switching. 22. The cluster deployment system according to item 21 is characterized in that the master-slave replication is to synchronize changes of the master database to the slave database. 23. The cluster deployment system according to item 21 is characterized in that the failover is to promote one of the slave databases to a new master database when a failure occurs in the master database. 24. The cluster deployment system according to any one of items 14 to 23, wherein the system further comprises: An expansion device is used to dynamically expand the cluster by modifying the resource declaration. 25. The cluster deployment system according to any one of items 14 to 23, wherein the resource declaration includes configuration information and quantity of each component; Configuration information for the MySQL database includes database version, storage type, resource requests, and limits; The configuration information of the Service includes the name, type, port, and label of the service; MaxScale configuration information includes the maximum number of connections, load balancing rules, and master-slave switching rules; The configuration information of Replication-manager includes the master-slave replication parameters, monitoring interval, and failover trigger conditions. 26. A cluster deployment system according to any one of items 14 to 23, characterized in that the requirements include database scale and capacity requirements, data persistence requirements, service access requirements, fault handling requirements, and scalability requirements.
Claims
1. A cluster deployment method, characterized in that: The method comprises: Define resource declarations based on requirements; Submit the resource declaration to the cluster to be deployed; The cluster deploys required components and their services according to the resource declaration, wherein the components include MaxScale.
2. The cluster deployment method according to claim 1, characterized in that: The cluster is a Kubernetes cluster; The components also include MySQL database, Service and Replication-manager.
3. The cluster deployment method according to claim 2, characterized in that: The service of the Service is to provide a virtual IP address and port as a unified access entry, map multiple MaxScales to the access entry, and route client requests to the MySQL database through multiple MaxScales.
4. The cluster deployment method according to claim 3, characterized in that: The client request types include read requests and write requests.
5. The cluster deployment method according to claim 4, characterized in that: The MySQL database includes a master database and at least one slave database.
6. The cluster deployment method according to claim 5, characterized in that: The MaxScale supports multi-node deployment; The MaxScale service distributes the client request to the corresponding MySQL database according to the client request type and load balancing rules.
7. The cluster deployment method according to claim 6, characterized in that: According to the client request type and load balancing rules, the client request is distributed to the corresponding MySQL database as follows: The read request is distributed to the multiple slave databases for load balancing, and the write request is sent to the master database.
8. The cluster deployment method according to claim 5, characterized in that: The service of the Replication-manager is to manage the master-slave replication of the MySQL database, monitor the status of the MySQL database and perform fault switching.
9. The cluster deployment method according to claim 8, characterized in that: The master-slave replication is to synchronize the changes of the master database to the slave database.
10. A cluster deployment system, characterized in that: The system comprises: A definition device for defining resource declarations according to requirements; A submission device, which is used to submit the resource declaration to the cluster to be deployed; An application device is used for the cluster to deploy required components and services according to the resource declaration, wherein the components include MaxScale.
