Aiming at the defects of localized MySQL database cluster that cannot be migrated,and taking advantage of rapid deployment and dynamic migration on container cloud platform,the MySQL master-slave cluster is built on the Kubernetes container cloud platform.The main research content is to solve the load balancing problem of the MySQL master-slave container cluster on Kubernetes container cloud platform in the high concurrency scenario,with the aim of improving the concurrency efficiency.The native reverse proxy with load balancing called kube-proxy on the container cloud platform uses a static random load balancing strategy,single and simple.And kube-proxy cannot dynamically adjust the policy according to the load status of the back-end node.There is a defect in the load balancing of the MySQL master-slave container cluster.In view of the defects of kube-proxy on load balancing,A dynamic smoothing weight polling load balancing strategy based on dynamic feedback is implemented.In order to realize the load balancing strategy,the client load balancing agent is designed to replace the load balancing function of kube-proxy.The client load balancing agent mainly includes a communication module,a monitoring module,a calculation module,a decision module,and a task distribution module.The communication module communicates with the client and collects SQL tasks.The monitoring module and the computing module dynamically calculate the weights of each node by monitoring the load resource occupation of the back node node,and provide dynamic weight input for the decision-making module.Feedback to the back end node,the decision module uses the load balancing strategy of dynamic smoothing weight polling to adjust and select the appropriate execution node for the SQL task request.The task distribution module distributes the task request to the execution node selected by the decision module.And the dynamic expansion module is designed and implemented on the Kubernetes container cloud platform,and the slave nodes of MySQL master-slave cluster are added to improve the concurrent task volume and response speed.Finally,the experimental comparison proves that the load balancing strategy of the dynamic smooth weight polling of the client load balancing agent is better than the load balancing effect of the simple random polling strategy of the native agent kube-proxy.At the same time,the experiment verified that dynamic capacity expansion can solve the problem of load sharing,which makes a qualitative improvement in the concurrency and concurrent efficiency of MySQL master-slave container clusters. |