A cluster-based load balancing configuration method, device, equipment and medium

By automatically adding and adjusting node information and weights when starting virtual and real server nodes in the cluster, the problem of complex and error-prone load balancer configuration is solved, automatic and efficient load balancing is achieved, and flexible expansion and high availability of nodes in the cluster are supported.

CN115460212BActive Publication Date: 2025-09-16CETC CYBERSPACE SECURITY TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202211034522.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-26
Publication Date
2025-09-16
Estimated Expiration
2042-08-26

AI Technical Summary

Technical Problem

In the prior art, the configuration of a load balancer requires manual operation, which is particularly complex and error-prone when adding or deleting service nodes, making it difficult to achieve automatic and efficient load balancing configuration.

Method used

By automatically adding and adjusting node information and weights when starting virtual server nodes and real server nodes in the cluster, load balancing configuration is achieved using notification services and LBConf components, including adding the first node information of the real server node to the load service of the virtual server node and adding the VIP address information of the virtual server node to the preset interface of the real server node.

Benefits of technology

It implements automatic and efficient load balancing configuration in the cluster, supports elastic scaling of nodes within the cluster, and improves configuration convenience and availability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115460212B_ABST
    Figure CN115460212B_ABST
Patent Text Reader

Abstract

The present application discloses a cluster-based load balancing configuration method, apparatus, device, and medium, relating to the field of information technology. The method comprises: starting virtual server nodes and real server nodes in a cluster; when the virtual server node is started, controlling each virtual server node to automatically add the first node information of each real server node to its own load service, and setting a corresponding weight for each first node information, so that the virtual server node sends the business load in the load service to the real server node based on the weight; when the real server node is started, controlling each real server node to automatically add the VIP address information in the second node information of the virtual server node to its own preset interface, so that the real server node receives and processes the business load sent by the virtual server node based on the VIP address information in the second node information. The present application can automatically and efficiently complete load balancing configuration in a cluster.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of information technology, and in particular to a cluster-based load balancing configuration method, device, equipment and medium. Background Art

[0002] Currently, information systems are often faced with the requirements of high-traffic and elastic transaction services. To meet the above requirements, a solution is usually composed of multiple service nodes and a load balancer: multiple service nodes provide transaction services, and the load balancer distributes transaction services to different service nodes. Among them, the load balancer can be hardware (such as F5) or software (such as LVS). Regardless of the type of load balancer used, it needs to be manually configured so that it can correctly distribute transaction services to service nodes. In addition to providing services for the first time, the load balancer also needs to be manually configured when adding or deleting service nodes. In particular, when using the TUN and DR modes of LVS (Linux Virtual Server), the configuration is more complicated and prone to errors.

[0003] In summary, how to automatically and efficiently implement load balancing configuration is an urgent problem that needs to be solved. Summary of the Invention

[0004] In view of this, the purpose of the present invention is to provide a cluster-based load balancing configuration method, apparatus, device, and medium that can automatically and efficiently complete load balancing configuration in a cluster. The specific solution is as follows:

[0005] In a first aspect, the present application discloses a cluster-based load balancing configuration method, comprising:

[0006] Start the virtual server nodes and real server nodes in the cluster;

[0007] When the virtual server node is started, controlling each virtual server node to automatically add the first node information of each real server node to its own load service, and setting a corresponding weight for each first node information, so that the virtual server node sends the business load in the load service to the corresponding real server node based on the weight;

[0008] When the real server node is started, each real server node is controlled to automatically add the VIP address information in the second node information of the virtual server node in its own preset interface, so that the real server node receives and processes the business load sent by the corresponding virtual server node based on the VIP address information in the second node information; wherein, the VIP is a virtual IP.

[0009] Optionally, before controlling each virtual server node to automatically add the first node information of each real server node to its own load service, the method further includes:

[0010] Each virtual server node is controlled to automatically create the corresponding load service for its own service port according to the load balancing policy template stored in the virtual server node, and add the load service to the corresponding service port.

[0011] Optionally, setting a corresponding weight for each piece of first node information includes:

[0012] A corresponding weight is set for each piece of first node information using the specification information in each piece of first node information.

[0013] Optionally, the cluster-based load balancing configuration method further includes:

[0014] When detecting that the node state of the real server node in the cluster changes, controlling the virtual server node to automatically adjust the first node information in its own load service;

[0015] When it is detected that the node state of the virtual server node in the cluster changes, the real server node is controlled to automatically adjust the VIP address information in the second node information in the preset interface of the real server node.

[0016] Optionally, when detecting that the node status of the real server node in the cluster changes, controlling the virtual server node to automatically adjust the first node information in its own load service includes:

[0017] When detecting that a new or re-online real server node appears in the cluster, sending a first notification message to all other server nodes, and controlling the virtual server node to automatically add the first node information of the real server node to its own load service based on the first notification message, and setting the corresponding weight for the first node information;

[0018] When it is detected that the real server node in the cluster is offline, a second notification message is sent to all other server nodes, and the virtual server node is controlled to automatically delete the first node information of the real server node in the load service based on the second notification message.

[0019] Optionally, when detecting that the node state of the virtual server node in the cluster changes, controlling the real server node to automatically adjust the address information in its own preset interface includes:

[0020] When detecting that a new or re-online virtual server node appears in the cluster, sending a third notification message to all other server nodes, and controlling the real server node to automatically add the VIP address information in the second node information of the virtual server node to its own preset interface based on the third notification message;

[0021] When it is detected that the virtual server node in the cluster is offline, a fourth notification message is sent to all other server nodes, and the real server node is controlled to automatically delete the VIP address information in the second node information of the virtual server node in its own preset interface based on the fourth notification message.

[0022] Optionally, after starting the virtual server nodes and real server nodes in the cluster, the process further includes:

[0023] Control the real server node to register its first node information in the cluster and control the virtual server node to register its second node information in the cluster, and then control the real server node and the virtual server node to obtain all the first node information and the second node information from the cluster.

[0024] In a second aspect, the present application discloses a cluster-based load balancing configuration device, comprising:

[0025] Node startup module, used to start the virtual server nodes and real server nodes in the cluster;

[0026] a virtual server node configuration module, configured to control each virtual server node to automatically add the first node information of each real server node to its own load service when the virtual server node is started, and to set a corresponding weight for each first node information, so that the virtual server node sends the business load in the load service to the corresponding real server node based on the weight;

[0027] A real server node configuration module is used to control each real server node to automatically add the VIP address information in the second node information of the virtual server node to its own preset interface when the real server node is started, so that the real server node receives and processes the business load sent by the corresponding virtual server node based on the VIP address information in the second node information; wherein, the VIP is a virtual IP.

[0028] In a third aspect, the present application discloses an electronic device comprising a processor and a memory; wherein, when the processor executes a computer program stored in the memory, the aforementioned cluster-based load balancing configuration method is implemented.

[0029] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the aforementioned disclosed cluster-based load balancing configuration method is implemented.

[0030] It can be seen that the present application starts the virtual server nodes and real server nodes in the cluster; when the virtual server node is started, each virtual server node is controlled to automatically add the first node information of each real server node in its own load service, and set a corresponding weight for each first node information, so that the virtual server node sends the business load in the load service to the corresponding real server node based on the weight; when the real server node is started, each real server node is controlled to automatically add the VIP address information in the second node information of the virtual server node in its own preset interface, so that the real server node receives and processes the business load sent by the corresponding virtual server node based on the VIP address information in the second node information; wherein the VIP is a virtual IP. It can be seen that the present application controls each virtual server node to automatically add the first node information of each real server node in its own load service, and set a corresponding weight for each first node information, and controls each real server node to automatically add the VIP address information in the second node information of the virtual server node in its own preset interface. In this way, the load balancing configuration within the cluster is completed automatically and efficiently. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.

[0032] Figure 1 A flow chart of a cluster-based load balancing configuration method provided in this application;

[0033] Figure 2 A flow chart of a specific cluster-based load balancing configuration method provided in this application;

[0034] Figure 3 A schematic diagram of a load balancing configuration structure provided for this application;

[0035] Figure 4 A schematic diagram of the structure of a cluster-based load balancing configuration device provided in this application;

[0036] Figure 5 This is a structural diagram of an electronic device provided in this application. DETAILED DESCRIPTION

[0037] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0038] Currently, manual configuration is required for the load balancer. In order to overcome the above problem, the present application provides a cluster-based load balancing configuration solution that can automatically and efficiently implement load balancing configuration.

[0039] See also Figure 1 As shown, the embodiment of the present application discloses a cluster-based load balancing configuration method, which includes:

[0040] Step S11: Start the virtual server nodes and real server nodes in the cluster.

[0041] In the real-time example of this application, the real server node can be represented by the RS (Real Server) node, and the virtual server node can be represented by the LVS (Linux Virtual Server); since the existing technology requires manual configuration for load balancing configuration, the method in this application is proposed; it should be pointed out that load balancing means balancing the load (work task) and distributing it to multiple operating units for operation, so as to complete the work task in a coordinated manner. Load balancing is built on the original network structure. It provides a transparent, cheap and effective method to expand the bandwidth of servers and network devices, enhance network data processing capabilities, increase throughput, and improve network availability and flexibility; LVS (Linux Virtual Server), that is, Linux Virtual Server, LVS is a high-performance four-layer (transport layer TCP / UDP) and seven-layer (application layer) load balancer. It does not directly process requests, but forwards requests to the real server at its back end. Among them, TCP (Transmission Control Protocol) is the transmission control protocol, and UDP (User Datagram Protocol) is the user datagram protocol. Specifically, the LVS working mode is divided into NAT mode, TUN mode, and DR mode. Before introducing the LVS operating mode, let's first discuss several IP (Internet Protocol) protocols related to LVS: VIP (Virtual IP), the IP address of the network card on the LVS server that receives external network packets. DIP (Director IP), the IP address of the network card on the LVS server that forwards packets to the real server. RIP (Real IP), the IP address of the real server (often referred to as RS) that receives packets forwarded by the Director in the figure, i.e., the IP address of the server providing the service. CIP (Client IP), the IP address of the client.

[0042] In an embodiment of the present application, the virtual server node and the real server node in the cluster both include a notification service and a tool for performing load balancing configuration and connecting to the notification service, and the tool is an LBConf component. In addition, the virtual server node also includes an LVS component and a load balancing policy template. Specifically, the notification service is responsible for establishing a message notification mechanism within the cluster, and registering or publishing the node information of the node where the notification service is located to the cluster. The LBConf component is used to connect to the notification service of the node where it is located, receive the node information of all nodes in the cluster through the notification service, and perform load balancing configuration on the virtual server node based on the node information, and perform network configuration on the real server node. In addition, the real server nodes in the cluster run the notification service and LBConf components, and provide real business transaction services; the virtual server node exposes the business IP address to the outside, and the LVS component distributes the received business load to the real server node.

[0043] In an embodiment of the present application, after starting the virtual server node and the real server node in the cluster, the real server node is controlled to register its own first node information in the cluster and the virtual server node is controlled to register its own second node information in the cluster, and then the real server node and the virtual server node are controlled to obtain all the first node information and the second node information from the cluster. Specifically, after starting the virtual server node and the real server node in the cluster, the real server node is controlled to start its own notification service, and then register its own first node information in the cluster through the notification service, and the virtual server node is controlled to start its own notification service, and then register its own second node information in the cluster through the notification service. Specifically, the real server node and the virtual server node obtain all the first node information and the second node information from the cluster in the form of a target node list.

[0044] It should be pointed out that the first node information includes the IP address information, type information and specification information of the real server node, the type information indicates whether the node is a real server node or a virtual server node, and the specification information is the business processing capability of the real server node (generally represented by the CPU (central processing unit) computing power); the second node information includes the IP address information, VIP address information, type information and specification information of the virtual server node, the type information indicates whether the node is a real server node or a virtual server node, and the specification information is the business processing capability of the virtual server node (generally represented by the CPU computing power).

[0045] It should be noted that when starting a node in the cluster, the node in the cluster needs to determine whether it is a real server node or a virtual server node to determine the operation to be performed.

[0046] Step S12: When the virtual server node is started, each virtual server node is controlled to automatically add the first node information of each real server node in its own load service, and set a corresponding weight for each first node information, so that the virtual server node sends the business load in the load service to the corresponding real server node based on the weight.

[0047] In the embodiment of the present application, when the virtual server node is started, each virtual server node is first controlled to automatically configure the LVS component according to the load balancing policy template saved by itself, and each virtual server node is controlled to automatically create the corresponding load service for its own service port according to the load balancing policy template saved by itself, and add the load service to the corresponding service port. It should be noted that each service port has a corresponding balancing policy.

[0048] It should be noted that the balancing strategy includes but is not limited to a hash algorithm, a round-robin algorithm, and the like.

[0049] In an embodiment of the present application, the first node information of all the real server nodes is filtered out from the node information of all nodes obtained from the virtual server node, and each virtual server node is controlled to automatically add the first node information of each real server node to its own load service, and the specification information in each first node information is used to set a corresponding weight for each first node information, so that the virtual server node uses the LVS component and sends the business load in the load service to the corresponding real server node based on the weight. It should be noted that the LVS component is configured according to the load balancing policy template.

[0050] It should be noted that the node information of all nodes can be saved in list form, and the first node information of all real server nodes can be filtered out from the node information of all nodes obtained from the virtual server node, which can be the process of filtering out the real server node list from the list of all nodes.

[0051] Step S13: When the real server node is started, each real server node is controlled to automatically add the VIP address information in the second node information of the virtual server node in its own preset interface, so that the real server node receives and processes the business load sent by the corresponding virtual server node based on the VIP address information in the second node information; wherein, the VIP is a virtual IP.

[0052] In an embodiment of the present application, when the real server node is started, the second node information of all the virtual server nodes is filtered out from the node information of all nodes obtained from the real server node, and the VIP address information is filtered out from the second node information, and then each of the real server nodes is controlled to automatically add the VIP address information in the second node information of the virtual server node to its own preset interface, so that the real server node receives and processes the business load sent by the corresponding virtual server node based on the VIP address information in the second node information.

[0053] It should be noted that the node information of all nodes can be saved in list form, and the first node information of all virtual server nodes can be filtered out from the node information of all nodes obtained from the real server node, which can be the virtual server node list filtered out from the list of all nodes.

[0054] It can be seen that the present application starts the virtual server nodes and real server nodes in the cluster; when the virtual server node is started, each virtual server node is controlled to automatically add the first node information of each real server node in its own load service, and a corresponding weight is set for each first node information, so that the virtual server node sends the business load in the load service to the corresponding real server node based on the weight; when the real server node is started, each real server node is controlled to automatically add the VIP address information in the second node information of the virtual server node in its own preset interface, so that the real server node receives and processes the business load sent by the corresponding virtual server node based on the VIP address information in the second node information; wherein the VIP is a virtual IP. It can be seen that the present application controls each virtual server node to automatically add the first node information of each real server node in its own load service through the notification service and LBConf components, and sets a corresponding weight for each first node information, and controls each real server node to automatically add the VIP address information in the second node information of the virtual server node in its own preset interface. In this way, the load balancing configuration within the cluster is automatically and efficiently completed.

[0055] See also Figure 2 As shown, the embodiment of the present application discloses a specific cluster-based load balancing configuration method, which includes:

[0056] Step S21: Start the virtual server nodes and real server nodes in the cluster.

[0057] For a more specific processing procedure of step S21 , reference may be made to the corresponding contents disclosed in the aforementioned embodiments, which will not be described in detail here.

[0058] Step S22: When the virtual server node is started, each virtual server node is controlled to automatically add the first node information of each real server node in its own load service, and set a corresponding weight for each first node information, so that the virtual server node sends the business load in the load service to the corresponding real server node based on the weight.

[0059] For a more specific processing procedure of step S22, reference may be made to the corresponding contents disclosed in the aforementioned embodiments, which will not be described in detail here.

[0060] Step S23: When the real server node is started, each real server node is controlled to automatically add the VIP address information in the second node information of the virtual server node in its own preset interface, so that the real server node receives and processes the business load sent by the corresponding virtual server node based on the VIP address information in the second node information; wherein, the VIP is a virtual IP.

[0061] For a more specific processing procedure of step S23, reference may be made to the corresponding contents disclosed in the aforementioned embodiment, which will not be described in detail here.

[0062] Step S24: When it is detected that the node status of the real server node in the cluster changes, the virtual server node is controlled to automatically adjust the first node information in its own load service; when it is detected that the node status of the virtual server node in the cluster changes, the real server node is controlled to automatically adjust the VIP address information in the second node information in its own preset interface.

[0063] In an embodiment of the present application, when the node status of the virtual server node and the real server node in the cluster changes, it is necessary to adjust the completed load balancing settings, that is, to control the virtual server node to automatically adjust the first node information in its own load service and control the real server node to automatically adjust the VIP address information in the second node information in its own preset interface. Specifically, when it is detected that a new or re-online real server node appears in the cluster, a first notification message is sent to all other server nodes, and the virtual server node is controlled to automatically add the first node information of the real server node to its own load service based on the first notification message, and set the corresponding weight for the first node information; when it is detected that the real server node in the cluster is offline, a second notification message is sent to all other server nodes, and the virtual server node is controlled to automatically delete the first node information of the real server node in the load service based on the second notification message. When it is detected that a new virtual server node appears in the cluster or is brought back online, a third notification message is sent to all other server nodes, and the real server node is controlled to automatically add the VIP address information in the second node information of the virtual server node to its own preset interface based on the third notification message; when it is detected that the virtual server node in the cluster is offline, a fourth notification message is sent to all other server nodes, and the real server node is controlled to automatically delete the VIP address information in the second node information of the virtual server node in its own preset interface based on the fourth notification message.

[0064] It should be pointed out that when a new or re-online real server node is detected in the cluster, it is also necessary to start and register the first node information of the real server node to the cluster through the notification service of the real server node, and obtain the first node information of other real server nodes in the cluster and the second node information of the virtual server node from the cluster, and then perform step S23 to control each real server node to automatically add the VIP address information in the second node information of the virtual server node to its own preset interface, so that the real server node receives and processes the business load sent by the corresponding virtual server node based on the VIP address information in the second node information.

[0065] It should be pointed out that when a new or re-online virtual server node is detected in the cluster, it is also necessary to start and register the second node information of the virtual server node with the cluster through the notification service of the virtual server node, and obtain the first node information of other real server nodes in the cluster from the cluster, and then perform step S24 to control each virtual server node to automatically add the first node information of each real server node in its own load service, and set a corresponding weight for each first node information, so that the virtual server node sends the business load in the load service to the corresponding real server node based on the weight.

[0066] It can be seen that the virtual server nodes and real server nodes in the cluster are started; when the virtual server node is started, each virtual server node is controlled to automatically add the first node information of each real server node in its own load service, and a corresponding weight is set for each first node information, so that the virtual server node sends the business load in the load service to the corresponding real server node based on the weight; when the real server node is started, each real server node is controlled to automatically add the VIP address information in the second node information of the virtual server node in its own preset interface, so that the real server node receives and processes the business load sent by the corresponding virtual server node based on the VIP address information in the second node information; wherein, the VIP is a virtual IP; when it is detected that the node status of the real server node in the cluster changes, the virtual server node is controlled to automatically adjust the first node information in its own load service; when it is detected that the node status of the virtual server node in the cluster changes, the real server node is controlled to automatically adjust the VIP address information in the second node information in its own preset interface. It can be seen that this application controls each virtual server node through the notification service and LBConf component to automatically add the first node information of each real server node to its own load service, and sets a corresponding weight for each first node information, and controls each real server node to automatically add the VIP address information in the second node information of the virtual server node to its own preset interface, thereby automatically and efficiently completing the load balancing configuration within the cluster. When adding or deleting real server nodes and virtual server nodes within the cluster, this application controls each node to automatically update the load balancing configuration, which is more convenient and quick, and makes this solution elastic, efficient and highly available.

[0067] See also Figure 3As shown, this is a schematic diagram of a load balancing configuration structure provided by the present application, which includes a client, two virtual server nodes (LVS nodes) and three real server nodes (RS nodes). Each LVS node and each RS node has a notification service and an LBConf component. Each LVS node also has a policy template, an LVS component and multiple load services. Each RS node also includes a loopback (Lo) / tunl0 interface and multiple network services. When performing business processing, the client first initiates a business request and sends the business request to the load service of the corresponding service port in any virtual server node. Then, according to the weight and balancing strategy, the business load is forwarded to the corresponding network service in the corresponding real server node, and processed in the real server node. The business processing result is then returned to the client. It should be pointed out that there is a master node in the real server node, which controls the notification of other nodes to perform node registration, obtain the node list and obtain update information (i.e., notification information) after the node status changes.

[0068] See also Figure 4 As shown, the embodiment of the present application discloses a cluster-based load balancing configuration device, including:

[0069] A node startup module 11 is used to start the virtual server nodes and real server nodes in the cluster;

[0070] a virtual server node configuration module 12, configured to control each virtual server node to automatically add the first node information of each real server node to its own load service when the virtual server node is started, and to set a corresponding weight for each first node information, so that the virtual server node sends the business load in the load service to the corresponding real server node based on the weight;

[0071] The real server node configuration module 13 is used to control each real server node to automatically add the VIP address information in the second node information of the virtual server node to its own preset interface when the real server node is started, so that the real server node receives and processes the business load sent by the corresponding virtual server node based on the VIP address information in the second node information; wherein, the VIP is a virtual IP.

[0072] Among them, for more specific working processes of the above modules, please refer to the corresponding contents disclosed in the aforementioned embodiments, which will not be repeated here.

[0073] It can be seen that the present application starts the virtual server nodes and real server nodes in the cluster; when the virtual server node is started, each virtual server node is controlled to automatically add the first node information of each real server node in its own load service, and set a corresponding weight for each first node information, so that the virtual server node sends the business load in the load service to the corresponding real server node based on the weight; when the real server node is started, each real server node is controlled to automatically add the VIP address information in the second node information of the virtual server node in its own preset interface, so that the real server node receives and processes the business load sent by the corresponding virtual server node based on the VIP address information in the second node information; wherein the VIP is a virtual IP. It can be seen that the present application controls each virtual server node to automatically add the first node information of each real server node in its own load service, and set a corresponding weight for each first node information, and controls each real server node to automatically add the VIP address information in the second node information of the virtual server node in its own preset interface. In this way, the load balancing configuration within the cluster is completed automatically and efficiently.

[0074] Furthermore, an embodiment of the present application also provides an electronic device, Figure 5 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram should not be considered as any limitation to the scope of application of the present application.

[0075] Figure 5 This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may include: at least one processor 21, at least one memory 22, a power supply 23, an input / output interface 24, a communication interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps of the cluster-based load balancing configuration method disclosed in any of the aforementioned embodiments.

[0076] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 25 can create a data transmission channel between the electronic device 20 and the external device. The communication protocol it follows is any communication protocol that can be applied to the technical solution of this application and is not specifically limited here; the input and output interface 24 is used to obtain external input data or output data to the outside world. Its specific interface type can be selected according to specific application needs and is not specifically limited here.

[0077] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The memory 22 can include a random access memory as a running memory and a non-volatile memory for storage purposes of an external memory. The storage resources thereon include an operating system 221, a computer program 222, etc., and the storage method can be temporary storage or permanent storage.

[0078] The operating system 221 is used to manage and control the hardware devices on the electronic device 20 on the source host, as well as the computer program 222. The operating system 221 can be Windows, Unix, Linux, etc. In addition to including a computer program capable of implementing the cluster-based load balancing configuration method performed by the electronic device 20 as disclosed in any of the aforementioned embodiments, the computer program 222 can further include computer programs capable of performing other specific tasks.

[0079] In this embodiment, the input and output interface 24 may specifically include but is not limited to a USB interface, a hard disk reading interface, a serial interface, a voice input interface, a fingerprint input interface, and the like.

[0080] Furthermore, an embodiment of the present application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the aforementioned cluster-based load balancing configuration method is implemented.

[0081] For the specific steps of this method, please refer to the corresponding contents disclosed in the aforementioned embodiments, which will not be repeated here.

[0082] The computer-readable storage medium referred to herein includes random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disks, magnetic disks, optical disks, or any other form of storage medium known in the art. When executed by a processor, the computer program implements the aforementioned cluster-based load balancing configuration method. For the specific steps of this method, reference can be made to the corresponding content disclosed in the aforementioned embodiments and will not be repeated here.

[0083] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from the other embodiments. References to the same or similar portions of the various embodiments will be sufficient. The device disclosed in the embodiments corresponds to the cluster-based load balancing configuration method disclosed in the embodiments, so the description is relatively simple. For relevant details, refer to the method description.

[0084] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0085] The steps of the algorithm described in conjunction with the embodiments disclosed herein can be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module can be placed in random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.

[0086] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only 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 terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or device comprising the element.

[0087] The above is a detailed introduction to the cluster-based load balancing configuration method, device, equipment and medium provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core ideas. At the same time, for those skilled in the art, according to the ideas of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present invention.

Claims

1. A cluster-based load balancing configuration method, characterized in that: include: Start the virtual server nodes and real server nodes in the cluster; When the virtual server node is started, each virtual server node is controlled to automatically add the first node information of each real server node to its own load service, and a corresponding weight is set for each first node information, so that the virtual server node uses its own LVS component to send the business load in the load service to the corresponding real server node based on the weight; When the real server node is started, each real server node is controlled to automatically add the VIP address information in the second node information of the virtual server node to its own preset interface, so that the real server node receives and processes the business load sent by the corresponding virtual server node based on the VIP address information in the second node information; wherein the VIP is a virtual IP; The step of setting a corresponding weight for each piece of first node information includes: Setting a corresponding weight for each first node information using specification information in each first node information; the specification information represents the service processing capability of the real server node; The cluster-based load balancing configuration method further includes: When detecting that the node state of the real server node in the cluster changes, controlling the virtual server node to automatically adjust the first node information in its own load service by using its own LBConf component; When detecting that the node state of the virtual server node in the cluster changes, controlling the real server node to automatically adjust the VIP address information in the second node information in its own preset interface by using its own LBConf component; The master node realizes the control operation by notifying the corresponding node; the master node is a node selected from all the real server nodes to transmit messages with other nodes.

2. The cluster-based load balancing configuration method according to claim 1, characterized in that: Before controlling each virtual server node to automatically add the first node information of each real server node to its own load service, the method further includes: Each virtual server node is controlled to automatically create the corresponding load service for its own service port according to the load balancing policy template stored in the virtual server node, and add the load service to the corresponding service port.

3. The cluster-based load balancing configuration method according to claim 1, characterized in that: When detecting that the node state of the real server node in the cluster changes, controlling the virtual server node to automatically adjust the first node information in its own load service includes: When detecting that a new or re-online real server node appears in the cluster, sending a first notification message to all other server nodes, and controlling the virtual server node to automatically add the first node information of the real server node to its own load service based on the first notification message, and setting the corresponding weight for the first node information; When it is detected that the real server node in the cluster is offline, a second notification message is sent to all other server nodes, and the virtual server node is controlled to automatically delete the first node information of the real server node in the load service based on the second notification message.

4. The cluster-based load balancing configuration method according to claim 1, characterized in that: When detecting that the node state of the virtual server node in the cluster changes, controlling the real server node to automatically adjust the VIP address information in the second node information in the preset interface of the real server node includes: When detecting that a new or re-online virtual server node appears in the cluster, sending a third notification message to all other server nodes, and controlling the real server node to automatically add the VIP address information in the second node information of the virtual server node to its own preset interface based on the third notification message; When it is detected that the virtual server node in the cluster is offline, a fourth notification message is sent to all other server nodes, and the real server node is controlled to automatically delete the VIP address information in the second node information of the virtual server node in its own preset interface based on the fourth notification message.

5. The cluster-based load balancing configuration method according to any one of claims 1 to 4, characterized in that: After starting the virtual server nodes and real server nodes in the cluster, the method further includes: Control the real server node to register its first node information in the cluster and control the virtual server node to register its second node information in the cluster, and then control the real server node and the virtual server node to obtain all the first node information and the second node information from the cluster.

6. A cluster-based load balancing configuration device, characterized in that: include: Node startup module, used to start the virtual server nodes and real server nodes in the cluster; a virtual server node configuration module, configured to control each virtual server node to automatically add the first node information of each real server node to its own load service when the virtual server node is started, and to set a corresponding weight for each first node information, so that the virtual server node uses its own LVS component to send the business load in the load service to the corresponding real server node based on the weight; a real server node configuration module, configured to control each real server node to automatically add the VIP address information in the second node information of the virtual server node to its own preset interface when the real server node is started, so that the real server node receives and processes the business load sent by the corresponding virtual server node based on the VIP address information in the second node information; wherein the VIP is a virtual IP; The virtual server node configuration module is configured to set a corresponding weight for each first node information using specification information in each first node information; the specification information represents the service processing capability of the real server node; Wherein, the cluster-based load balancing configuration device is further used to control the virtual server node to automatically adjust the first node information in its own load service using its own LBConf component when detecting a change in the node status of the real server node in the cluster; and to control the real server node to automatically adjust the VIP address information in the second node information in its own preset interface using its own LBConf component when detecting a change in the node status of the virtual server node in the cluster; The master node realizes the control operation by notifying the corresponding node; the master node is a node selected from all the real server nodes to transmit messages with other nodes.

7. An electronic device, characterized in that: The system comprises a processor and a memory; wherein, when the processor executes the computer program stored in the memory, the cluster-based load balancing configuration method according to any one of claims 1 to 5 is implemented.

8. A computer-readable storage medium, characterized in that Used to store a computer program; wherein, when the computer program is executed by a processor, the cluster-based load balancing configuration method according to any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Load balancing method and load balancing service device

    CN110417921A

  • Distributed service adaptive load balancing method and device

    CN112764919A

  • Container load balancing method and device, equipment and storage medium

    CN114374696A