A method, system, medium, and device for automatic disaster tolerance and scheduling of traffic
Patent Information
- Application Number
- CN202110804018.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-16
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2041-07-16
AI Technical Summary
[0004]现有技术中,kubernetes系统提供的cloudprovider接口实现了接入容器到网络负载均衡的功能,但是仅仅提供了接口,并没有实现相关的与负载均衡系统的对接
[0040] A method, system, medium and electronic device for automatic disaster tolerance and scheduling of traffic provided by an embodiment of the present application obtain user task configuration description information; obtain a monitoring system address from the user task configuration description information, and obtain monitoring data from the monitoring system according to the monitoring system address; schedule the working status of the kubernetes cluster according to the monitoring data, and/or schedule the working status of multiple service clusters according to the monitoring data; according to the working status of the kubernetes cluster, trigger the load balancing system to update the ip address of the kubernetes cluster corresponding to the virtual ip address in the load balancing system, and/or update the ip addresses of multiple service clusters corresponding to the virtual ip address in the load balancing system according to the working status of multiple service clusters, so as to complete the disaster tolerance and scheduling of traffic. In an embodiment of the present invention, only through one controller, the monitoring data of multiple monitoring systems is automatically obtained, the working status of the kubernetes cluster and multiple service clusters is automatically scheduled according to the monitoring data, and the traffic of the load balancing system is triggered to be scheduled through the working status of the kubernetes cluster and multiple service clusters.
Smart Images

Figure CN113656168B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular, to a method, system, medium, and device for automatic disaster tolerance and scheduling of traffic. Background Art
[0002] Currently, in Internet applications, network load balancing is required to implement the function of coping with large-scale traffic access. Ordinary load balancing systems cannot achieve automatic traffic scheduling and switching among multiple computer rooms, cannot access container traffic scheduling, etc., or can only implement some of the above functions.
[0003] The inventors found in the process of implementing the present invention that:
[0004] In the prior art, the cloudprovider interface provided by the kubernetes system realizes the function of accessing containers to the network load balancer, but only provides the interface and does not implement the docking with the load balancing system.
[0005] In addition, open-source load balancing systems such as lvs / nginx proxy / haproxy and other load balancing software can achieve traffic load balancing according to the status of servers, but cannot perform automatic traffic scheduling for multiple clusters and multi-dimensional availability judgment. Summary of the Invention
[0006] In view of this, the purpose of the embodiments of the present application is to provide a method, system, medium, and electronic device for automatic disaster tolerance and scheduling of traffic, so as to be able to automatically obtain monitoring data of multiple monitoring systems to schedule load balancing traffic and automatically perform disaster tolerance and scheduling of traffic.
[0007] To achieve the above object, in a first aspect, the embodiments of the present application provide a method for automatic disaster tolerance and scheduling of traffic, including:
[0008] Obtain user task configuration description information;
[0009] Obtain the monitoring system address from the user task configuration description information, and obtain monitoring data from the monitoring system according to the monitoring system address;
[0010] Schedule the working status of the kubernetes cluster according to the monitoring data, and / or schedule the working status of multiple service clusters according to the monitoring data;
[0011] Based on the working status of the Kubernetes cluster, trigger the load balancing system to update the IP address of the Kubernetes cluster corresponding to the virtual IP address in the load balancing system, and / or based on the working status of the multiple service clusters, trigger the load balancing system to update the IP address of the multiple service clusters corresponding to the virtual IP address in the load balancing system, to complete automatic disaster tolerance and scheduling of traffic.
[0012] In some possible implementation manners, the scheduling of the working status of the Kubernetes cluster according to the monitoring data may specifically include:
[0013] Compare the monitoring data with a first preset data threshold corresponding to the Kubernetes cluster,
[0014] When the monitoring data is greater than the first preset data threshold corresponding to the Kubernetes cluster, reduce the number of pods in the Kubernetes cluster;
[0015] When the monitoring data is less than the first preset data threshold corresponding to the Kubernetes cluster, increase the number of pods in the Kubernetes cluster.
[0016] In some possible implementation manners, the scheduling of the working status of the multiple service clusters according to the monitoring data may specifically include:
[0017] Compare the monitoring data with a second preset data threshold corresponding to the multiple service clusters,
[0018] When the monitoring data is greater than the second preset data threshold corresponding to the multiple service clusters, reduce the number of service clusters;
[0019] When the monitoring data is less than the second preset data threshold corresponding to the multiple service clusters, increase the number of service clusters.
[0020] In some possible implementation manners, the triggering of the load balancing system to update the IP address of the Kubernetes cluster corresponding to the virtual IP address in the load balancing system may specifically include:
[0021] When the number of pods in the Kubernetes cluster decreases, trigger the load balancing system to delete the IP address of the pod corresponding to the virtual IP address in the load balancing system;
[0022] When the number of pods in the Kubernetes cluster increases, trigger the load balancing system to increase the IP address of the pod corresponding to the virtual IP address in the load balancing system.
[0023] In some possible embodiments, triggering the load balancing system to update the IP addresses of the multiple service clusters corresponding to the virtual IP address in the load balancing system may specifically include:
[0024] When the number of service clusters decreases, triggering the load balancing system to delete the IP addresses of the service clusters corresponding to the virtual IP address in the load balancing system;
[0025] When the number of service clusters increases, triggering the load balancing system to add the IP addresses of the service clusters corresponding to the virtual IP address in the load balancing system.
[0026] In some possible embodiments, the monitoring data may include any one or more of the response time of the queries per second (QPS), the usage rate of the central processing unit (CPU), and the usage rate of the memory.
[0027] In some possible embodiments, after obtaining the user task configuration description information, it may further include:
[0028] Storing, parsing, and version-marking the user task configuration description information to facilitate version management or rollback operations on the user task configuration description information.
[0029] In a second aspect, the present invention provides a system for automatic disaster tolerance and scheduling of traffic, including:
[0030] An acquisition unit for acquiring user task configuration description information;
[0031] A monitoring unit for obtaining a monitoring system address from the user task configuration description information and obtaining monitoring data from the monitoring system according to the monitoring system address;
[0032] A control unit for scheduling the working state of the kubernetes cluster according to the monitoring data, and / or scheduling the working state of multiple service clusters according to the monitoring data;
[0033] A scheduling unit for triggering the load balancing system to update the IP addresses of the kubernetes cluster corresponding to the virtual IP address in the load balancing system according to the working state of the kubernetes cluster; and / or, for triggering the load balancing system to update the IP addresses of the multiple service clusters corresponding to the virtual IP address in the load balancing system according to the working state of the multiple service clusters, to complete disaster tolerance and scheduling of traffic.
[0034] Thirdly, the present application provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, it implements the method for automatic disaster tolerance and scheduling of any of the above-mentioned traffic.
[0035] Fourthly, the present application provides an electronic device, which includes:
[0036] A processor;
[0037] A memory for storing executable instructions of the processor;
[0038] wherein, the processor is configured to execute the instructions to implement the method for automatic disaster tolerance and scheduling of any of the above-mentioned traffic.
[0039] The above technical solutions have the following beneficial effects:
[0040] A method, system, medium and electronic device for automatic disaster tolerance and scheduling of traffic provided by an embodiment of the present application obtain user task configuration description information; obtain a monitoring system address from the user task configuration description information, and obtain monitoring data from the monitoring system according to the monitoring system address; schedule the working status of the kubernetes cluster according to the monitoring data, and / or schedule the working status of multiple service clusters according to the monitoring data; according to the working status of the kubernetes cluster, trigger the load balancing system to update the ip address of the kubernetes cluster corresponding to the virtual ip address in the load balancing system, and / or update the ip addresses of multiple service clusters corresponding to the virtual ip address in the load balancing system according to the working status of multiple service clusters, so as to complete the disaster tolerance and scheduling of traffic. In an embodiment of the present invention, only through one controller, the monitoring data of multiple monitoring systems is automatically obtained, the working status of the kubernetes cluster and multiple service clusters is automatically scheduled according to the monitoring data, and the traffic of the load balancing system is triggered to be scheduled through the working status of the kubernetes cluster and multiple service clusters. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained according to these drawings.
[0042] Figure 1 is a flowchart of a method for automatic disaster tolerance and scheduling of traffic according to an embodiment of the present application;
[0043] Figure 2It is the overall process deployment diagram of a method for automatic disaster tolerance and scheduling of traffic in an embodiment of the present application;
[0044] Figure 3 It is the structural diagram of a system for automatic disaster tolerance and scheduling of traffic in an embodiment of the present application;
[0045] Figure 4 It is the functional block diagram of a computer-readable storage medium in an embodiment of the present application;
[0046] Figure 5 It is the functional block diagram of an electronic device in an embodiment of the present application. Detailed implementation manners
[0047] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application. Embodiment 1
[0048] Figure 1 It is the flowchart of a method for automatic disaster tolerance and scheduling of traffic in an embodiment of the present application. As Figure 1 shown, through a controller, this method can automatically discover and obtain monitoring data, compare the monitoring data with a preset threshold, and trigger the load balancing system according to the comparison result to automatically schedule the traffic of the load balancing system. The specific steps are as follows:
[0049] S110, obtain user task configuration description information.
[0050] Specifically, the user submits user task configuration description information to the controller through the user interface. At the same time, tasks and task configuration description information can be added, deleted, queried, and modified, so that the tasks can be centrally managed. The user interface is the only entry for the user to operate tasks.
[0051] The user task configuration description information is the basis for the user to communicate with the entire system. The user task configuration description information indicates what the scheduling strategy is for the execution process, what the disaster tolerance rule is for the execution process, what the monitoring address is, and the monitoring metrics for comparing the threshold with the current data, etc.
[0052] As an example, a complete user task configuration description includes the following parts:
[0053] Disaster tolerance rule name. The system will provide multiple disaster tolerance rules, and the user can select one;
[0054] The name of the scheduling rule. This system will provide multiple scheduling rules, and the user can select one.
[0055] The type of monitor, such as the zabbix system, the prometheus system.
[0056] The monitor address.
[0057] The metrics that need to be monitored by the monitor, such as the average response time (avgtime), the status code (httpcode), etc.
[0058] The values that trigger the scheduling rule, such as 100ms, 200ms, etc.
[0059] The load balancer ID, the resource IP of the load balancer system, such as slb12345xxxxx.
[0060] The secret key, which is used for the verification of the load balancer system, such as tokenxxxxxx.
[0061] The name of the product line, such as the test product line.
[0062] The load balancer protocol and port, for example, the protocol is http and the port is 80.
[0063] The load balancer area ID.
[0064] The type of load balancer (internal network or external network), for example, internet represents the external network.
[0065] The IP protocol version of the load balancer (v4 or v6), for example, v4 represents ipv4.
[0066] In some embodiments, the user task configuration description can also be stored in the storage through the controller, and the task configuration description is parsed and the version is incremented to facilitate the version management of the user task configuration description information and perform rollback operations, etc. By centrally managing the user task configuration description information and storing the tasks uniformly, and at the same time adding multi-dimensional descriptions of the tasks, the management efficiency of the tasks is improved.
[0067] S120: Obtain the monitor system address from the user task configuration description information, and obtain the monitor data from the monitor system according to the monitor system address.
[0068] In this embodiment, the controller can obtain the monitoring system address, the type of monitor, the disaster recovery rule, the scheduling rule, the metrics that need to be monitored by the monitor and the corresponding data, the load balancing type and protocol version, etc. from the user task configuration description information. At the same time, the controller can accept multiple different types of monitoring systems provided by the user, comprehensively execute the user task configuration description based on multiple monitoring systems, and can parse multiple monitoring metrics. This system can automatically discover and obtain monitoring data through only one controller, trigger the scheduling of the working status of pods and service clusters in the kubernetes cluster according to the monitoring data, and interact with the load balancing system at the same time to automatically schedule the traffic of the load balancing system.
[0069] S130, schedule the working status of the kubernetes cluster according to the monitoring data, and / or schedule the working status of multiple service clusters according to the monitoring data.
[0070] In this embodiment, the working status of the kubernetes cluster is scheduled according to the monitoring data obtained from the monitoring system, and / or the working status of multiple service clusters is scheduled according to the monitoring data. Among them, Kubernetes is an open-source platform for the automated deployment, scaling, and operation and maintenance of container clusters. Through the Kubernetes cluster, you can quickly and effectively respond to user needs, deploy your applications quickly and predictably, expand your applications extremely fast, seamlessly dock new application functions, save resources and optimize the use of hardware resources, providing a complete open-source solution for container orchestration management. The service cluster refers to multiple clusters of servers that provide the same service, such as a group of servers that provide access services.
[0071] In some embodiments, the monitoring data of a specified monitoring system can be obtained, and multi-dimensional calculations can be performed according to the obtained monitoring data and the information in the user task configuration description. For example, the response time of the queries per second (QPS), the usage rate of the central processing unit (CPU), and the usage rate of the memory, etc. When it is monitored that the service quality is abnormal or the traffic increases to more than twice the current value, it is determined as a business failure, and the working status of the kubernetes cluster or multiple service clusters is automatically scheduled. Specifically, when it is determined that the business quality is abnormal, such as too long response time, error status code, etc., or the traffic increases rapidly, such as the traffic increases to more than twice the current value, etc., according to the multi-dimensional calculation results, the working status of the kubernetes cluster or multiple service clusters is automatically scheduled.
[0072] In some embodiments, the controller compares the monitoring data obtained by the monitoring system with the first preset data threshold corresponding to the Kubernetes cluster in the user task configuration description information. When the monitoring data is greater than the first preset data threshold corresponding to the Kubernetes cluster, the number of Pods in the Kubernetes cluster is reduced; when the monitoring data is less than the first preset data threshold corresponding to the Kubernetes cluster, the number of Pods in the Kubernetes cluster is increased. Among them, in the Kubernetes cluster, a Pod is the basis of all business types and also the smallest unit level managed by K8S. It is a combination of one or more containers. These containers share storage, network, and namespace, as well as specifications on how to run. In a Pod, all containers are uniformly arranged and scheduled and run in a shared context. For specific applications, a Pod is their logical host, and a Pod contains multiple application containers related to the business.
[0073] In some embodiments, when it is monitored that the number of corresponding Pods in the Kubernetes cluster decreases, or the Pod is not in the normal running state, or there is an event that the health check of the Pod fails, that is, as long as one of these situations occurs, it is determined as a business failure, and the working state of the Kubernetes cluster is automatically scheduled. Specifically, when it is monitored that the number of Pods corresponding to the business in the Kubernetes cluster decreases, or the Pod is not in the normal running state (the running state is the normal label of the Pod in the Kubernetes cluster), or there is an event that the health check of the Pod fails, that is, as long as one of these situations occurs, the Kubernetes cluster is scheduled to increase or replace Pods.
[0074] In some embodiments, the working states of multiple service clusters are scheduled according to the monitoring data. The monitoring data is compared with the second preset data threshold corresponding to the multiple service clusters. When the monitoring data is greater than the second preset data threshold corresponding to the multiple service clusters, the number of service clusters is reduced; when the monitoring data is less than the second preset data threshold corresponding to the service clusters, the number of service clusters is increased.
[0075] It should be noted that this application can control the Kubernetes cluster alone, or control multiple service clusters alone, or control the Kubernetes cluster and multiple service clusters simultaneously.
[0076] S140. Trigger the load balancing system to update the IP address of the Kubernetes cluster corresponding to the virtual IP address in the load balancing system, and / or trigger the load balancing system to update the IP addresses of multiple service clusters corresponding to the virtual IP address in the load balancing system according to the working status of the Kubernetes cluster, so as to complete the automatic disaster tolerance and scheduling of traffic.
[0077] The user task configuration description information defines the conditions for the controller to judge and the rules to execute. The controller obtains data from the monitoring system specified by the user, compares it with the thresholds defined by the user. If it is found that the threshold is exceeded, it immediately interacts with the load balancing system, selects an available virtual IP according to the virtual IP list provided by the interface of the load balancing system, and replaces the virtual IP address corresponding to the domain name resolution.
[0078] As an example, when it is detected that a pod in the Kubernetes cluster changes, such as when a user launches a new version of the program, the pod will perform a rolling update. The rolling update will stop the original pod and then start a new version of the pod to replace it. During this process, the IP address of the pod changes, and it is necessary to trigger an operation on the load balancing system to update the backend service corresponding to the virtual IP of the load balancing system in real time, that is, to immediately update the IP address of the pod, and automatically execute the disaster tolerance rules and scheduling rules of traffic to complete the disaster tolerance and scheduling of traffic.
[0079] In some possible implementation manners, when the IP address of a certain cluster in multiple service clusters changes, trigger the load balancing system to immediately update the IP address of the changed service cluster corresponding to the virtual IP address of the load balancing system. As an example, when the IP address of one or more service clusters in multiple service clusters changes, it is necessary to trigger an operation on the load balancing system to implement an update of the IP address of the changed service cluster corresponding to the virtual IP of the load balancing system, and automatically execute the disaster tolerance rules and scheduling rules of traffic to complete the disaster tolerance and scheduling of traffic.
[0080] As an example, the scheduling rules may include one or any combination of the following, or may also be user-defined rules:
[0081] Restart the pod;
[0082] Increase the number of pods;
[0083] Roll back the version of the pod to the previous version;
[0084] The pod returns to the default data;
[0085] The pod returns the reason for the error;
[0086] Execute user-defined script programs, etc.
[0087] As an example, the disaster recovery rules may include one or any combination of the following:
[0088] Switch the traffic of one of the virtual IPs of the service to other virtual IPs;
[0089] Change the IP address of one Kubernetes cluster to the IP address of another Kubernetes cluster;
[0090] A scheduling rule script program defined by the user himself.
[0091] To enable those skilled in the art to better understand the technical solutions provided by the embodiments of the present application, the following will provide a detailed description of the automatic disaster recovery and scheduling method for traffic provided by the embodiments of the present invention. Attached Figure 2 Is the overall process deployment diagram of an automatic disaster recovery and scheduling method for traffic provided by the embodiments of the present invention.
[0092] As Figure 2 As shown, the user submits a user task configuration description to the controller through the user interface. At the same time, tasks and task configuration descriptions can be added, deleted, queried, and modified. The user interface is the only entry for the user to operate tasks, enabling centralized management of tasks.
[0093] The controller stores the user task configuration description information in the storage, and parses and adds versions to the task configuration description information for version management of the user task configuration description information, performing rollback operations, etc. By centrally managing the user task configuration description information and storing the tasks uniformly, while adding multi-dimensional descriptions of the tasks, the management efficiency of the tasks is improved.
[0094] The controller can obtain the monitoring system address, the type of monitor, disaster recovery rules, scheduling rules, metrics that need to be monitored by the monitor, and the thresholds of the data corresponding to the metrics, the type of load balancing, and the protocol version, etc. from the user task configuration description. The controller can also accept multiple different types of monitoring systems provided by the user, comprehensively use multiple monitoring systems to execute the user task configuration description, and can parse multiple monitoring metrics. This system can automatically discover and obtain monitoring data through only one controller, trigger the load balancing system according to the monitoring data, and automatically schedule the load balancing traffic.
[0095] The controller runs in the Kubernetes cluster and multiple service clusters, and can observe the changes of pods in the Kubernetes cluster and the changes of multiple service clusters at any time. According to the user task configuration description, the Kubernetes cluster and multiple service clusters are respectively coordinated with the load balancing system. When a pod in the Kubernetes cluster changes, the interface of the load balancing system is triggered to immediately update the IP address of the pod corresponding to the virtual IP of the load balancing system. When the IP address of a certain service cluster changes, the interface of the load balancing system is triggered to immediately update the IP address of the service cluster corresponding to the virtual IP address of the load balancing system.
[0096] In this application, only one controller can obtain various types of data from the monitoring system, uniformly store the user task configuration description information, and can parse multiple monitoring metrics. At the same time, it can accept multiple different types of monitoring systems provided by the user. According to the data of multiple monitoring systems, the traffic is scheduled between multiple Kubernetes clusters or multiple service clusters. The execution of the user task configuration description is integrated with multiple monitoring systems. According to the user description, the IP address of the pod corresponding to the virtual IP address of the network load balancing system or the IP address of multiple service clusters is automatically created, deleted, or updated. Only through one controller, the traffic of the load balancing system is scheduled according to the monitoring data, and the disaster tolerance and scheduling of the traffic are automatically executed. Embodiment 2
[0097] As Figure 3 shown, Embodiment 1 of this application provides a system 300 for automatic disaster tolerance and scheduling of traffic, including:
[0098] An obtaining unit 310, configured to obtain user task configuration description information.
[0099] Specifically, the user submits user task configuration description information to the obtaining unit 310 in the controller through the user interface. At the same time, tasks and task configuration descriptions can be added, deleted, queried, and modified, so that the tasks can be centrally managed. The user interface is the only entry for the user to operate tasks.
[0100] The user task configuration description information is the basis for the user to communicate with the entire system. The user task configuration description information indicates what the scheduling rules are, what the execution process is, what the disaster tolerance rules are, what the execution process is, what the monitoring address is, and the monitoring metrics used to compare the threshold with the current data, etc.
[0101] In some embodiments, the controller can also store the user task configuration description information in the storage, and parse and increment the version of the task configuration description information, so as to manage the version of the user task configuration description information and perform rollback operations, etc. By centrally managing the user task configuration description information and storing the tasks uniformly, and at the same time adding multi-dimensional descriptions of the tasks, the management efficiency of the tasks is improved.
[0102] The monitoring unit 320 is configured to obtain the monitoring system address from the user task configuration description information, and obtain monitoring data from the monitoring system according to the monitoring system address.
[0103] In this embodiment, the controller can obtain the monitoring system address, the type of the monitor, the disaster recovery rule, the scheduling rule, the metrics that need to be monitored by the monitor and the corresponding data, the load balancing type and protocol version, etc. from the user task configuration description information. The controller can also accept multiple different types of monitoring systems provided by the user, and comprehensively use multiple monitoring systems to execute the user task configuration description. And it can parse multiple monitoring metrics. This system can automatically discover and obtain monitoring data through only one controller, trigger the working status of pods and multiple service clusters in the kubernetes cluster according to the monitoring data, and trigger the load balancing system to automatically schedule the traffic of the load balancing system.
[0104] The control unit 330 is configured to schedule the working status of the kubernetes cluster according to the monitoring data, and / or schedule the working status of multiple service clusters according to the monitoring data.
[0105] In this embodiment, the controller schedules the working status of the kubernetes cluster according to the monitoring data obtained from the monitoring system, and / or schedules the working status of multiple service clusters according to the monitoring data. Among them, Kubernetes is an open-source platform for the automated deployment, scaling, and operation and maintenance of container clusters. With Kubernetes, you can quickly and effectively respond to user needs, deploy your applications quickly and predictably, scale your applications extremely fast, seamlessly dock new application functions, save resources and optimize the use of hardware resources, providing a complete open-source solution for container orchestration management. A service cluster refers to a cluster of multiple servers that provide the same service, such as a group of servers that provide access services.
[0106] In some embodiments, the controller may obtain the monitoring data of a specified monitoring system, and perform multi-dimensional calculations based on the obtained monitoring data and the information described in the user task configuration. For example, calculate the response time of the queries per second (QPS), the utilization rate of the central processing unit (CPU), and the utilization rate of the memory, etc. When it is monitored that the service quality is abnormal or the traffic increases to more than twice the current value, it is determined as a business failure, and the working status of the Kubernetes cluster or multiple service clusters is automatically scheduled. Specifically, when it is determined that the service quality is abnormal, such as too long response time, error status code, etc., or the traffic surges, such as the traffic increases to more than twice the current value, etc., according to the multi-dimensional calculation results, the working status of the Kubernetes cluster or the service cluster is automatically scheduled.
[0107] In some embodiments, the controller compares the monitoring data obtained by the monitoring system with the first preset data threshold corresponding to the Kubernetes cluster in the user task configuration description information. When the monitoring data is greater than the first preset data threshold corresponding to the Kubernetes cluster, the number of pods in the Kubernetes cluster is reduced; when the monitoring data is less than the first preset data threshold corresponding to the Kubernetes cluster, the number of pods in the Kubernetes cluster is increased. Among them, in the Kubernetes cluster, a Pod is the basis of all business types and the smallest unit level managed by K8S. It is a combination of one or more containers. These containers share storage, network, and namespace, as well as specifications on how to run. In a Pod, all containers are uniformly arranged and scheduled and run in a shared context.
[0108] In some embodiments, according to the monitoring data, the working status of multiple service clusters is scheduled. The monitoring data is compared with the second preset data threshold corresponding to the multiple service clusters. When the monitoring data is greater than the second preset data threshold corresponding to the multiple service clusters, the number of service clusters is reduced; when the monitoring data is less than the second preset data threshold corresponding to the multiple service clusters, the number of service clusters is increased.
[0109] In some embodiments, the first preset data threshold corresponding to the Kubernetes cluster and the second preset data threshold corresponding to the multiple service clusters can be set separately according to actual needs. The first preset threshold and the second preset threshold can be the same or different, and there is no limitation here.
[0110] In some embodiments, when it is monitored that the number of corresponding pods in the Kubernetes cluster decreases, or the pods are not in the normal running state, or there is an event that the health check of the pods fails, that is, as long as one of these situations occurs, it is determined as a service failure, and the working state of the Kubernetes cluster is automatically scheduled. Specifically, when it is monitored that the number of pods of the corresponding service in the Kubernetes cluster decreases, or the pods are not in the normal running state (the running state is the normal mark of the pods in the Kubernetes cluster), or there is an event that the health check of the pods fails, that is, as long as one of these situations occurs, the Kubernetes cluster is scheduled to increase pods or replace pods.
[0111] In this embodiment, the monitoring unit 330 in the controller can obtain the monitoring system address, the type of the monitor, the disaster recovery rule, the scheduling rule, the metrics that need to be monitored by the monitor, the threshold of the data corresponding to the metrics, the load balancing type and the protocol version, etc. from the user task configuration description information. The controller can also accept multiple different types of monitoring systems provided by the user, comprehensively execute the user task configuration description by combining multiple monitoring systems, and can parse multiple monitoring metrics. This system can automatically discover and obtain monitoring data only through one controller, trigger the load balancing system according to the monitoring data, and automatically schedule the load balancing traffic. The embodiment of the present invention can obtain data of multiple types of monitoring systems, can parse multiple monitoring metrics, and can also receive multiple different types of monitoring systems provided by the user, and comprehensively execute the user task configuration by combining multiple monitoring systems.
[0112] The scheduling unit 340 is used to trigger the load balancing system to update the IP address of the Kubernetes cluster corresponding to the virtual IP address in the load balancing system according to the working state of the Kubernetes cluster, and / or trigger the load balancing system to update the IP addresses of multiple service clusters corresponding to the virtual IP address in the load balancing system according to the working states of multiple service clusters, so as to complete the disaster recovery and scheduling of traffic.
[0113] The user task configuration description information defines the conditions and execution rules for the controller to judge. The controller obtains data from the monitoring system specified by the user, compares it with the threshold defined by the user. If it is found that the threshold is exceeded, it immediately interacts with the load balancing system, and selects an available virtual IP from the list of virtual IPs provided by the interface of the load balancing system to replace the virtual IP address corresponding to the domain name resolution.
[0114] As an example, when a change occurs in a pod in Kubernetes, such as when a user deploys a new version of a program, the pod will undergo a rolling update. The rolling update will stop the original pod and then start a new version of the pod to replace it. During this process, the IP address of the pod changes, and it is necessary to trigger an operation on the load balancing system to update the backend service corresponding to the virtual IP of the load balancing system in real time, that is, to immediately update the IP address of the pod, and automatically execute the disaster recovery rules and scheduling rules for traffic to complete traffic disaster recovery and scheduling.
[0115] In some embodiments, when the IP address of a certain service cluster changes, the load balancing system is triggered to immediately update the IP address of the service cluster corresponding to the virtual IP address of the load balancing system. As an example, if the IP address of one or more service clusters changes, it is necessary to trigger an operation on the load balancing system to implement the update of the IP address of the service cluster corresponding to the virtual IP of the load balancing system, and automatically execute the disaster recovery rules and scheduling rules for traffic to complete traffic disaster recovery and scheduling.
[0116] In the present invention, only one controller can obtain various types of data from the monitoring system, uniformly store the user task configuration description information, and can parse multiple monitoring metrics. At the same time, it can accept multiple different types of monitoring systems provided by the user. According to the data of multiple monitoring systems, the traffic is scheduled between the Kubernetes cluster or multiple service clusters, and the execution of the user task configuration description is integrated with multiple monitoring systems. According to the user description, the IP address of the pod corresponding to the virtual IP address of the network load balancing system or the IP addresses of multiple service clusters is automatically created, deleted, or updated. Only through one controller, the traffic of the load balancing system is scheduled according to the monitoring data, and the disaster recovery and scheduling of traffic are automatically executed.
[0117] Those skilled in the art can clearly understand that, for the sake of convenience and brevity of description, only the above-mentioned division of each functional unit and module is used as an example. In actual applications, the above functions can be allocated to different functional units and modules according to needs, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiments can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit. In addition, the specific names of each functional unit and module are only for the convenience of mutual distinction and do not limit the protection scope of the present application. The specific working process of the units and modules in the above system can refer to the corresponding process in the foregoing method embodiments and will not be elaborated here. Embodiment III
[0118] As shown Figure 4 in the figure, the embodiment of the present application also provides a computer-readable storage medium 400. A computer program 410 is stored in the computer-readable storage medium 400. When the computer program 410 is executed by a processor, it realizes:
[0119] Obtain user task configuration description information;
[0120] Obtain the monitoring system address from the user task configuration description information, and obtain monitoring data from the monitoring system according to the monitoring system address;
[0121] Schedule the working status of the kubernetes cluster according to the monitoring data, and / or schedule the working status of multiple service clusters according to the monitoring data;
[0122] According to the working status of the kubernetes cluster, trigger the load balancing system to update the IP address of the kubernetes cluster corresponding to the virtual IP address in the load balancing system, and / or update the IP addresses of multiple service clusters corresponding to the virtual IP address in the load balancing system according to the working status of multiple service clusters, so as to complete disaster tolerance and scheduling of traffic.
[0123] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, to implement all or part of the processes in the above-mentioned embodiment methods of the present application, it can also be completed by instructing relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, the steps of the above-mentioned method embodiments can be realized. Among them, the computer program includes computer program code, and the computer program code can be in the form of source code, object code, executable file or some intermediate form, etc. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disc, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal, and software distribution medium, etc. Of course, there are other ways of readable storage media, such as quantum memory, graphene memory, etc. It should be noted that the content included in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electrical carrier signals and telecommunication signals. Embodiment IV
[0124] Please refer to Figure 5 , this embodiment of the present application also provides an electronic device. Figure 5 It is a schematic structural diagram of an electronic device according to an embodiment of the present application. Please refer to Figure 5 , at the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and a memory. Among them, the memory may include internal memory, such as high-speed random access memory (Random-Access Memory, RAM), and may also include non-volatile memory, such as at least one disk memory, etc. Of course, the electronic device may also include other hardware required for other services.
[0125] The processor, network interface, and memory can be interconnected through an internal bus, and the internal bus can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of representation, Figure 5 only a bidirectional arrow is used in
[0126] to represent, but it does not mean that there is only one bus or one type of bus.
[0127] Obtain user task configuration description information;
[0128] Obtain the monitoring system address from the user task configuration description information, and obtain monitoring data from the monitoring system according to the monitoring system address;
[0129] Schedule the working status of the kubernetes cluster according to the monitoring data, and / or schedule the working status of multiple service clusters according to the monitoring data;
[0130] According to the working status of the Kubernetes cluster, trigger the load balancing system to update the IP address of the Kubernetes cluster corresponding to the virtual IP address in the load balancing system, and / or update the IP addresses of multiple service clusters corresponding to the virtual IP address in the load balancing system according to the working status of multiple service clusters, so as to complete the disaster tolerance and scheduling of traffic.
[0131] The above, such as in the present invention Figure 1 and Figure 2 The execution method of the automatic disaster tolerance and scheduling system for traffic disclosed in the embodiments shown can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the integrated logic circuit in the hardware of the processor or the instructions in the form of software. The above processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. It can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in combination with the embodiments of the present application can be directly embodied as being executed and completed by a hardware decoding processor, or executed and completed by a combination of the hardware and software modules in the decoding processor. The software module can be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. This storage medium is located in the memory, and the processor reads the information in the memory and combines its hardware to complete the steps of the above method.
[0132] The electronic device can also execute Figure 1 the method, and implement the functions of the automatic disaster tolerance and scheduling system for traffic in Figure 1 the embodiments shown. The embodiments of the present application will not be elaborated here.
[0133] Of course, in addition to the software implementation, the electronic device of the present application does not exclude other implementation manners, such as logic devices or a combination of software and hardware, etc. That is to say, the execution subject of the following processing flow is not limited to each logic unit, and may also be hardware or a logic device. The systems, devices, modules or units illustrated in the above embodiments may be specifically implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, an in-vehicle human-machine interaction device, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0134] Although the present application provides method operation steps as described in the embodiments or flowcharts, more or fewer operation steps may be included based on conventional or non-creative means. The step sequences listed in the embodiments are only one of the execution sequences of numerous steps and do not represent the only execution sequence. When the actual device or terminal product is executed, it may be executed in the order of the methods shown in the embodiments or the drawings or in parallel (for example, in a parallel processor or multi-threaded processing environment, or even in a distributed data processing environment).
[0135] The present application is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of flows and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate a device for implementing the functions specified in Figure 1 one or more of the flows Figure 1 or blocks or multiple blocks.
[0136] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured article including an instruction device, and the instruction device implements the functions specified in Figure 1 one or more of the flows Figure 1 or blocks or multiple blocks.
[0137] These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process, and thus the instructions executed on the computer or other programmable device provide for implementing the process Figure 1 one process or multiple processes and / or blocks Figure 1 steps for the functions specified in one block or multiple blocks.
[0138] It should be noted that, in this document, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or device comprising the said element.
[0139] Each embodiment in this specification is described in a related manner. For the same or similar parts among the embodiments, reference can be made to each other. Each embodiment focuses on the differences from other embodiments. In particular, for the embodiments of the apparatus, electronic device and readable storage medium, since they are basically similar to the method embodiments, the description is relatively simple, and reference can be made to the partial description of the method embodiments for the relevant parts.
[0140] The above are only the preferred embodiments of the present application and are not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.
Claims
1. An automatic disaster tolerance and scheduling method for traffic, characterized in that The method described above includes: Obtaining user task configuration description information; Obtaining the monitoring system address from the user task configuration description information, and obtaining monitoring data from the monitoring system according to the monitoring system address; Scheduling the working state of the kubernetes cluster according to the monitoring data, and / or scheduling the working states of multiple service clusters according to the monitoring data; According to the working state of the kubernetes cluster, triggering the load balancing system to update the IP address of the kubernetes cluster corresponding to the virtual IP address in the load balancing system, and / or according to the working states of the multiple service clusters, triggering the load balancing system to update the IP addresses of the multiple service clusters corresponding to the virtual IP address in the load balancing system, to complete automatic disaster tolerance and scheduling of traffic; The scheduling of the working state of the kubernetes cluster according to the monitoring data specifically includes: Comparing the monitoring data with a first preset data threshold corresponding to the kubernetes cluster, When the monitoring data is greater than the first preset data threshold corresponding to the kubernetes cluster, reducing the number of pods in the kubernetes cluster; When the monitoring data is less than the first preset data threshold corresponding to the kubernetes cluster, increasing the number of pods in the kubernetes cluster; The scheduling of the working states of multiple service clusters according to the monitoring data specifically includes: Comparing the monitoring data with a second preset data threshold corresponding to multiple service clusters, When the monitoring data is greater than the second preset data threshold corresponding to the multiple service clusters, reducing the number of service clusters; When the monitoring data is less than the second preset data threshold corresponding to the multiple service clusters, increasing the number of service clusters.
2. The method according to claim 1, characterized in that, The triggering of the load balancing system to update the IP address of the kubernetes cluster corresponding to the virtual IP address in the load balancing system specifically includes: When the number of pods in the kubernetes cluster decreases, triggering the load balancing system to delete the IP address of the pod corresponding to the virtual IP address in the load balancing system; When the number of pods in the kubernetes cluster increases, triggering the load balancing system to add the IP address of the pod corresponding to the virtual IP address in the load balancing system.
3. The method according to claim 1, wherein The triggering of the load balancing system to update the IP addresses of the multiple service clusters corresponding to the virtual IP address in the load balancing system specifically includes: When the number of service clusters decreases, triggering the load balancing system to delete the IP address of the service cluster corresponding to the virtual IP address in the load balancing system; When the number of service clusters increases, triggering the load balancing system to add the IP address of the service cluster corresponding to the virtual IP address in the load balancing system.
4. The method according to any one of claims 1 to 3, characterized in that The monitoring data described above includes any one or more of the response time of queries per second (QPS), the utilization rate of the central processing unit (CPU), and the utilization rate of memory.
5. The method according to any one of claims 1 to 3, characterized in that After obtaining the user task configuration description information described above, it further includes: Storing, parsing, and version marking the user task configuration description information to facilitate version management or rollback operations on the user task configuration description information.
6. An automatic disaster recovery and scheduling system for traffic, characterized in that, It includes: An acquisition unit for acquiring user task configuration description information; A monitoring unit for obtaining the monitoring system address from the user task configuration description information and acquiring monitoring data from the monitoring system according to the monitoring system address; A control unit for scheduling the working status of the kubernetes cluster according to the monitoring data, and / or scheduling the working status of multiple service clusters according to the monitoring data; A scheduling unit for triggering the load balancing system to update the IP address of the kubernetes cluster corresponding to the virtual IP address in the load balancing system according to the working status of the kubernetes cluster; And / or, for triggering the load balancing system to update the IP addresses of the multiple service clusters corresponding to the virtual IP address in the load balancing system according to the working status of the multiple service clusters, to complete traffic disaster tolerance and scheduling; Among them, the control unit is specifically configured to: compare the monitoring data with a first preset data threshold corresponding to the kubernetes cluster, and when the monitoring data is greater than the first preset data threshold corresponding to the kubernetes cluster, reduce the number of pods in the kubernetes cluster; when the monitoring data is less than the first preset data threshold corresponding to the kubernetes cluster, increase the number of pods in the kubernetes cluster; The control unit is also specifically configured to: compare the monitoring data with a second preset data threshold corresponding to multiple service clusters, and when the monitoring data is greater than the second preset data threshold corresponding to the multiple service clusters, reduce the number of service clusters; When the monitoring data is less than the second preset data threshold corresponding to the multiple service clusters, increase the number of service clusters.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When this program is executed by a processor, it implements a method for automatic traffic disaster tolerance and scheduling as described in any one of claims 1-5.
8. An electronic device, characterized in that, It includes: A processor; A memory for storing instructions executable by the processor; Among them, the processor is configured to execute the instructions to implement a method for automatic traffic disaster tolerance and scheduling as described in any one of claims 1-5.
Citation Information
Patent Citations
Method for realizing flow distribution based on front-end scheduling, device and system thereof
CN104852934A
Containerized application request copying method and system based on Kubernetes, medium and equipment
CN112860375A