Nothing Special   »   [go: up one dir, main page]

WO2017114017A1 - Computer device, system and method for implementing load balancing - Google Patents

Computer device, system and method for implementing load balancing Download PDF

Info

Publication number
WO2017114017A1
WO2017114017A1 PCT/CN2016/105945 CN2016105945W WO2017114017A1 WO 2017114017 A1 WO2017114017 A1 WO 2017114017A1 CN 2016105945 W CN2016105945 W CN 2016105945W WO 2017114017 A1 WO2017114017 A1 WO 2017114017A1
Authority
WO
WIPO (PCT)
Prior art keywords
service
computer device
virtual machine
load balancing
load balancer
Prior art date
Application number
PCT/CN2016/105945
Other languages
French (fr)
Chinese (zh)
Inventor
黄登辉
康达祥
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to CN201910303925.6A priority Critical patent/CN110113441B/en
Priority to CN201680003074.8A priority patent/CN107078969B/en
Priority to EP16880807.9A priority patent/EP3316532B1/en
Priority to JP2017567446A priority patent/JP6544872B2/en
Publication of WO2017114017A1 publication Critical patent/WO2017114017A1/en
Priority to US16/020,960 priority patent/US10171567B2/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/70Virtual switches
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/10Mapping addresses of different types
    • H04L61/103Mapping addresses of different types across network layers, e.g. resolution of network layer into physical layer addresses or address resolution protocol [ARP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/58Caching of addresses or names
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1038Load balancing arrangements to avoid a single path through a load balancer
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/40Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass for recovering from a failure of a protocol instance or entity, e.g. service redundancy protocols, protocol state redundancy or protocol service redirection
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2101/00Indexing scheme associated with group H04L61/00
    • H04L2101/60Types of network addresses
    • H04L2101/618Details of network addresses
    • H04L2101/622Layer-2 addresses, e.g. medium access control [MAC] addresses

Definitions

  • the present invention relates to information technology, and more particularly to computer equipment, systems and methods for implementing load balancing.
  • Load balancing is a collection of servers in a symmetric manner by multiple servers. Each server has an equivalent status and can provide services separately without the assistance of other servers.
  • Through some load sharing technology externally sent requests are evenly distributed to a server in a symmetric structure, and the server receiving the request independently responds to the client's request.
  • the balanced load distributes client requests evenly to the server array, providing fast access to critical data and addressing a large number of concurrent access services. This clustering technology can achieve near-mainframe performance with minimal investment.
  • vLB virtual load balancer
  • the two vLBs are used to provide services in active/standby relationship.
  • the heartbeat information is transmitted between the active and standby vLBs through the Virtual Router Redundancy Protocol (VRRP).
  • VRRP Virtual Router Redundancy Protocol
  • the standby device finds that the host is down, the standby device takes over the host and continues to work.
  • the active/standby relationship implemented by VRRP takes place after the host is down.
  • the active/standby switchover takes a certain amount of time, causing traffic interruption during the handover process.
  • all load balancing services must perform load balancing to a load balancing node, when load balancing access
  • load balancing access When the volume is large, the bandwidth of the centralized load balancing node becomes a bottleneck, causing congestion and delay of the service.
  • the embodiments of the present invention provide a computer device, a system, and a method for implementing load balancing to solve the problem of traffic interruption caused by handover in the active/standby load balancing mode and congestion caused by centralized load balancing in the prior art.
  • an embodiment of the present invention provides a method for implementing load balancing, which is applied to a computer system including at least two computer devices, where each computer device includes a central processing unit and a memory, and the at least two computer devices are included.
  • the first computer device is a cloud management platform
  • the second computer device is a virtual machine that initiates a service, where the service is a load balancing service, including:
  • the first computer device obtains configuration information of a load balancer to be created in the second computer device, the configuration information of the load balancer includes an identifier of the load balancer, and a virtualized IP of the load balancer Address VIP, the VIP of the load balancer indicates the load balancing service;
  • the first computer device creates the load balancer on the second computer device according to the configuration information
  • the first computer device configures a forwarding mode of the load balancing service on the second computer device, the forwarding mode causing the load balancing initiated by the virtual machine initiating the service on the second computer device
  • the service packet of the service is forwarded to the load balancer.
  • the virtual machine that initiates the service on the second computer device sends the service packet to the load balancer according to the forwarding mode
  • the load balancer on the second computer device selects at least one backend server to execute the service, and the backend server is configured to execute the load balancing service.
  • the first computer device is on the second computer device
  • the forwarding mode of the load balancing service is as follows:
  • the first computer device configures a virtual switch deployed on the second computer device, and sends a MAC address of the load balancer to the virtual machine that initiates the service;
  • the sending the service packet to the load balancer according to the forwarding mode of the virtual machine that initiates the service on the second computer device includes:
  • the virtual machine that sends the service sends the MAC address of the load balancer as the service packet of the destination address, and the virtual switch sends the service packet to the load according to the destination address of the service packet. Equalizer.
  • the method before the virtual machine that initiates the service sends the MAC address of the load balancer as the service message of the destination address, the method further includes:
  • the virtual machine that initiates the service sends a control packet to the virtual switch, where the control packet carries the VIP;
  • the virtual switch sends a response message of the control packet to the virtual machine that initiates the service, where the response message carries the MAC address of the load balancer.
  • control message is an address resolution protocol ARP message or an Internet Control Message Protocol (ICMP) message.
  • ARP address resolution protocol
  • ICMP Internet Control Message Protocol
  • the first computer device configures a forwarding mode of the load balancing service on the second computer device, including:
  • the first computer device instructs the load balancer to send a MAC address of the load balancer to the virtual machine that initiates the service;
  • the first computer device configures a MAC address of the load balancer on the virtual machine that initiates the service
  • the sending, by the virtual machine of the initiating service on the second computer device, the sending the service packet to the load balancer according to the forwarding mode comprises:
  • the virtual machine that initiates the service sends the MAC address of the load balancer as the service packet of the destination address, and the virtual switch deployed on the second computer device is configured according to the service The destination address of the packet sends the service packet to the load balancer.
  • the creating, by the first computer device, the load balancer on the second computer device according to the configuration information includes:
  • the load equalizer is created.
  • the method further includes:
  • the method further includes:
  • the selected backend server directly returns the result of executing the service to the virtual machine that initiates the service;
  • the selected backend server returns an execution result of the service to the load balancer, and the load balancer returns the execution result to the virtual machine that initiates the service.
  • an embodiment of the present invention provides a method for implementing load balancing, which is applied to a computer system including at least three computer devices, wherein each computer device includes a central processing unit and a memory, and the at least three computer devices
  • the first computer device includes a first computer device as a cloud management platform, and the computer device other than the first computer device of the at least three computer devices operates as a business computer device on each business computer device
  • the first computer device respectively obtains configuration information of a load balancer to be created on each service computer device, where configuration information of the load balancer includes an identifier of the load balancer, and virtualization of the load balancer IP address VIP, the VIP of the load balancer indicates the load balancing service;
  • the first computer device creates a local load balancer of each of the service computer devices on each of the service computer devices according to the configuration information of the load balancer to be created in each of the service computer devices;
  • the service packet of the load balancing service is forwarded to the local load balancer, so that the local load balancer on each service computer device initiates a service packet to the virtual machine that initiates the service on the service computer device. Perform load balancing processing.
  • the forwarding mode of the first computer device configuring the load balancing service on each of the service computer devices includes:
  • the first computer device configures the virtual switch deployed on each of the service computer devices to send the MAC address of the local load balancer to the local virtual machine that initiates the service.
  • the first computer device configures a virtual switch deployed on each of the service computer devices, and sends the MAC address of the local load balancer to the local virtual machine of the originating service. It also includes:
  • the virtual machine that initiates the service on each of the service computer devices sends a control packet to the local virtual switch, and the control packet carries the VIP;
  • the local virtual switch on each of the service computer devices sends a response message of the control packet to the local virtual machine that initiates the service, where the response message carries the MAC address of the local load balancer.
  • the first computer device before creating the load balancer on each of the service computer devices, according to the configuration information, further includes:
  • the first computer device learns that the first virtual machine of the first service computer device is created on the first service computer device, and the load balancer of the first service computer device is created on the first service computer device until A local load balancer on each of the business computer devices is created on each business computer device.
  • the load balancer includes a load balancing virtual machine, a load balancing container, or a load balancing namespace.
  • an embodiment of the present invention provides a method for implementing load balancing, which is applied to a computer system including at least two computer devices, wherein each computer device includes a central processing unit and a memory, and the at least two computer devices The first computer device and the second computer device are included, the first computer device is a cloud management platform, and the second computer device is running a virtual machine that initiates a service, where the service is a load balancing service, including:
  • the first computer device obtains configuration information of a load balancer to be created in the second computer device, the configuration information of the load balancer includes an identifier of the load balancer, and a virtualized IP of the load balancer Address VIP, the VIP of the load balancer indicates the load balancing service;
  • the first computer device creates the load balancer on the second computer device according to the configuration information
  • the first computer device configures a forwarding mode of the load balancing service on the second computer device, the forwarding mode causing the load balancing initiated by the virtual machine initiating the service on the second computer device
  • the service packet of the service is forwarded to the load balancer, so that the load balancer selects the backend server that executes the service after receiving the service packet.
  • the first computer device configures a forwarding mode of the load balancing service on the second computer device, including:
  • the first computer device configures a virtual switch deployed on the second computer device to send a MAC address of the load balancer to the virtual machine that initiates the service, so that the virtual machine that initiates the service sends the load
  • the MAC address of the equalizer is used as the service packet of the destination address.
  • the method further includes:
  • the virtual machine that initiates the service sends a control packet to the virtual switch, and the control packet Carrying the VIP;
  • the virtual switch sends a response message of the control packet to the virtual machine that initiates the service, where the response message carries the MAC address of the load balancer.
  • the first computer device creates the load balancing on the second computer device according to the configuration information, including:
  • the load equalizer is created.
  • the method further includes:
  • an embodiment of the present invention provides a computer system for implementing load balancing, including at least two computer devices, wherein each computer device includes a central processing unit and a memory, and the at least two computer devices include a first one. a computer device and a second computer device, the first computer device as a cloud management platform, the second computer device running a virtual machine that initiates a service, and the service is a load balancing service, wherein
  • the first computer device obtains configuration information of a load balancer to be created in the second computer device, the configuration information of the load balancer includes an identifier of the load balancer, and a virtualized IP of the load balancer Address VIP, the VIP of the load balancer indicates the load balancing service;
  • the first computer device creates the load balancer on the second computer device according to the configuration information
  • the first computer device configures a forwarding mode of the load balancing service on the second computer device, the forwarding mode causing the load balancing initiated by the virtual machine initiating the service on the second computer device
  • the service packet of the service is forwarded to the load balancer.
  • the virtual machine that initiates the service on the second computer device sends the service packet to the load balancer according to the forwarding mode
  • the load balancer on the second computer device selects at least one backend server to execute the service, and the backend server is configured to execute the load balancing service.
  • the forwarding mode of the first computer device configuring the load balancing service on the second computer device includes:
  • the first computer device configures a virtual switch deployed on the second computer device, and sends a MAC address of the load balancer to the virtual machine that initiates the service;
  • the sending the service packet to the load balancer according to the forwarding mode of the virtual machine that initiates the service on the second computer device includes:
  • the virtual machine that sends the service sends the MAC address of the load balancer as the service packet of the destination address, and the virtual switch sends the service packet to the load according to the destination address of the service packet. Equalizer.
  • the method before the virtual machine that sends the service sends the MAC address of the load balancer as the service message of the destination address, the method further includes:
  • the virtual machine that initiates the service sends a control packet to the virtual switch, where the control packet carries the VIP;
  • the virtual switch sends a response message of the control packet to the virtual machine that initiates the service, where the response message carries the MAC address of the load balancer.
  • control message is an address resolution protocol ARP message or an Internet Control Message Protocol (ICMP) message.
  • ARP address resolution protocol
  • ICMP Internet Control Message Protocol
  • the first computer device configures a forwarding mode of the load balancing service on the second computer device, including:
  • the first computer device instructs the load balancer to send a MAC address of the load balancer to the virtual machine that initiates the service;
  • the first computer device configures a MAC address of the load balancer on the virtual machine that initiates the service
  • the sending, by the virtual machine of the initiating service on the second computer device, the sending the service packet to the load balancer according to the forwarding mode comprises:
  • the virtual machine that initiates the service sends the MAC address of the load balancer as the service packet of the destination address, and the virtual switch deployed on the second computer device sends the service according to the destination address of the service packet.
  • the message is sent to the load balancer.
  • the creating, by the first computer device, the load balancer on the second computer device according to the configuration information includes:
  • the load equalizer is created.
  • the first computer device deletes the created load balancer after the last virtual machine created on the second computer device that initiates the load balancing service is deleted.
  • the selected backend server directly returns the result of executing the service to the virtual machine that initiated the service;
  • the selected backend server returns an execution result of the service to the load balancer, and the load balancer returns the execution result to the virtual machine that initiates the service.
  • an embodiment of the present invention provides a computer system for implementing load balancing, the computer system including at least three computer devices, wherein each computer device includes a central processing unit and a memory, and the at least three computer devices
  • the first computer device includes a first computer device as a cloud management platform, and the computer device other than the first computer device of the at least three computer devices operates as a business computer device on each business computer device
  • the first computer device respectively obtains configuration information of a load balancer to be created on each service computer device, where configuration information of the load balancer includes an identifier of the load balancer, and virtualization of the load balancer IP address VIP, the VIP of the load balancer indicates the load balancing service;
  • the first computer device creates a local load balancer of each of the service computer devices on each of the service computer devices according to the configuration information of the load balancer to be created in each of the service computer devices;
  • the service packet of the load balancing service is forwarded to the local load balancer, so that the local load balancer on each service computer device initiates a service packet to the virtual machine that initiates the service on the service computer device. Perform load balancing processing.
  • the forwarding mode of the first computer device configuring the load balancing service on each of the service computer devices includes:
  • the first computer device configures the virtual switch deployed on each of the service computer devices to send the MAC address of the local load balancer to the local virtual machine that initiates the service.
  • the first computer device configures a virtual switch deployed on each of the service computer devices, and sends the MAC address of the local load balancer to the local virtual machine of the originating service. It also includes:
  • the virtual machine that initiates the service on each of the service computer devices sends a control packet to the local virtual switch, and the control packet carries the VIP;
  • the local virtual switch on each of the service computer devices sends a response message of the control packet to the local virtual machine that initiates the service, where the response message carries the MAC address of the local load balancer.
  • the first computer device before creating the load balancer on each of the service computer devices, according to the configuration information, further includes:
  • the first computer device learns that the first virtual machine of the first service computer device is created on the first service computer device, and the load balancer of the first service computer device is created on the first service computer device until Create each of the business calculations on each business computer device Local load balancer on the machine.
  • the load balancer includes a load balancing virtual machine, a load balancing container, or a load balancing namespace.
  • an embodiment of the present invention provides a computer system for implementing load balancing, where the computer system includes at least two computer devices, wherein each computer device includes a central processing unit and a memory, and the at least two computer devices The first computer device and the second computer device are included, the first computer device is a cloud management platform, and the second computer device is running a virtual machine that initiates a service, where the service is a load balancing service, where
  • the first computer device obtains configuration information of a load balancer to be created in the second computer device, the configuration information of the load balancer includes an identifier of the load balancer, and a virtualized IP of the load balancer Address VIP, the VIP of the load balancer indicates the load balancing service;
  • the first computer device creates the load balancer on the second computer device according to the configuration information
  • the first computer device configures a forwarding mode of the load balancing service on the second computer device, the forwarding mode causing the load balancing initiated by the virtual machine initiating the service on the second computer device
  • the service packet of the service is forwarded to the load balancer, so that the load balancer selects the backend server that executes the service after receiving the service packet.
  • the first computer device configures a forwarding mode of the load balancing service on the second computer device, including:
  • the first computer device configures a virtual switch deployed on the second computer device to send a MAC address of the load balancer to the virtual machine that initiates the service, so that the virtual machine that initiates the service sends the load
  • the MAC address of the equalizer is used as the service packet of the destination address.
  • the first computer device configures the second computer device After the virtual switch deployed on the virtual switch sends the MAC address of the load balancer to the virtual machine that initiates the service, the method further includes:
  • the virtual machine that initiates the service sends a control packet to the virtual switch, where the control packet carries the VIP;
  • the virtual switch sends a response message of the control packet to the virtual machine that initiates the service, where the response message carries the MAC address of the load balancer.
  • the first computer device creates the load balancing on the second computer device according to the configuration information, including:
  • the load equalizer is created.
  • the method further includes:
  • a first aspect of the embodiments of the present invention provides a computer device, including a central processing unit CPU, a memory, and a storage device, where the computer device further includes a first virtual machine, a load balancing virtual machine, and a virtual switch.
  • the first virtual machine and the load balancing virtual machine are virtual machines created in the computer device;
  • the first virtual machine is configured to send a service packet
  • the virtual switch is configured to receive the service packet sent by the first virtual machine, and only forward the service packet to the load balancing virtual machine when the service packet needs load balancing processing;
  • the load balancing virtual machine is configured to receive the service packet forwarded by the virtual switch, and forward the service packet according to a load balancing manner.
  • the load balancing virtual machine After the load balancing virtual machine forwards the service packet based on the load balancing mode, the load balancing virtual machine first determines whether a backend server has been allocated for the service packet after receiving the service packet. Its service, if the backend server has been assigned, then the industry The service message is sent to the backend server that has been assigned. If a backend server has not been assigned, select a backend server to serve it through a load balancing algorithm.
  • the load balancing algorithms include, but are not limited to, polling, weighted polling, random, minimum or source-to-ground hashing, location-based weighted polling, and the like.
  • the location-prioritized weighted polling mode can preferentially select the back-end server in the computer device where the virtual machine that initiates the service packet is located, which can save the speed of the back-end server processing the service packet and save the network bandwidth.
  • the that the virtual switch only forwards the service packet to the load balancing virtual machine includes:
  • the virtual switch sends the MAC address of the load balancing virtual machine to the first virtual machine, so that the first virtual machine sends the service packet based on the obtained MAC address of the load balancing virtual machine. Transmitting, by the virtual switch, the service packet to the load balancing virtual machine; or
  • the load balancing virtual machine sends its MAC address to the first virtual machine, so that the first virtual machine sends the service packet based on the acquired load balancing virtual machine MAC address, and the virtual switch will Transmitting the service packet to the load balancing virtual machine;
  • the first virtual machine sends the service packet based on the pre-configured MAC address of the load balancing virtual machine, and the virtual switch forwards the service packet to the load balancing virtual machine.
  • the virtual switch sends the MAC address of the load balancing virtual machine to the first Virtual machines include:
  • the virtual switch receives the control packet sent by the first virtual machine, and returns a control response packet to the first virtual machine, where the control response packet includes a MAC address of the load balancing virtual machine. That is, the virtual switch can perform the directional processing on the service packet of the first virtual machine according to the configured forwarding mode, so that the first virtual switch forwards the service packet to the first load balancing virtual machine.
  • the control packet is an address resolution protocol ARP packet or an Internet control message protocol ICMP packet.
  • the control packet may be an address resolution protocol ARP packet
  • the forwarding mode may be an ARP pickup mode
  • the first virtual machine may use the ARP pickup mode to set the MAC address of the first load balancing virtual machine. Sent to the first virtual machine.
  • the forwarding mode may also be a neighbor discovery protocol NDP pickup mode.
  • the computer device further includes a virtual load Equalization agent unit;
  • the virtual load balancing agent unit is configured to receive configuration information for creating a load balancing virtual machine, control creation or deletion of the load balancing virtual machine, and control establishment of a connection between the load balancing virtual machine and the virtual switch. .
  • the virtual load balancing agent unit sends the notification information to the virtual machine management unit when the virtual machine management unit is instructed to create the first load balancing virtual machine according to the configuration information of the created load balancing virtual machine,
  • the notification information includes the virtual machine parameter information of the first load balancing virtual machine, where the virtual machine parameter information of the first load balancing virtual machine includes, but is not limited to, the number of virtual central processing units, the size of the virtual memory, and
  • the load balancing information such as a logical network where the virtual machine is located.
  • the configuration information of the load balancing virtual machine is delivered by the user through the cloud management platform (the second computer device), and the configuration information includes but is not limited to: the identifier of the load balancing virtual machine, and the IP of the load balancing virtual machine.
  • the information of the back-end server includes, but is not limited to, an identifier of the back-end server, an IP protocol (Internet protocol) address of the back-end server, and a method for checking the health of the back-end server.
  • the health check method of the backend server refers to a method in which the load balancing virtual machine checks the health status of the backend server.
  • the back-end server is a server that provides a specific service, and the load balancing virtual machine calculates the service packet according to the received load balance.
  • a load balancing method such as a method selects one of the back-end servers as a server that processes the service message.
  • the backend server may be a virtual machine or a specific physical server.
  • the first virtual machine is a user-created virtual machine that creates the load balancing virtual machine configuration information
  • the first virtual machine is the first user created by the user on the first computer device.
  • the virtual load balancing agent unit starts the creation of the load balancing virtual machine.
  • the last virtual machine configured by the user of the virtual load balancing service is deleted, the first virtual load balancing agent unit starts the deletion of the load balancing virtual machine.
  • a second virtual machine having the capability of processing the service message of the first virtual machine
  • the second virtual machine receives the service forwarded by the load balancing server. Sending a message to the load balancing virtual machine by processing the result of processing the service packet;
  • the load balancing virtual machine is further configured to send, by the virtual switch, the result of processing the service packet by the second virtual machine to the first virtual machine.
  • a second aspect of the embodiments of the present invention provides a computer system including a first computer device and a second computer device, wherein the first computer device and the second computer device respectively include a central processing unit CPU, a memory, and a storage device, the first computer device further includes a first virtual machine, a first load balancing virtual machine, and a first virtual switch, where the first virtual machine and the first load balancing virtual machine are in the first a virtual machine created in a computer device;
  • the first virtual machine is configured to send a service packet
  • the first virtual switch is configured to receive the service packet sent by the first virtual machine, When the service packet needs to be load balanced, the service packet is forwarded only to the first load balancing virtual machine;
  • the first load balancing virtual machine is configured to receive the service packet forwarded by the first virtual switch, and forward the service packet according to a load balancing manner.
  • the first load balancing virtual machine After the first load balancing virtual machine forwards the service packet based on the load balancing manner, the first load balancing virtual machine first determines whether a service packet has been allocated for the service packet after receiving the service packet.
  • the backend server serves it, and if a backend server has been assigned, the service message is sent to the already assigned backend server. If a backend server has not been assigned, select a backend server to serve it through a load balancing algorithm.
  • the load balancing algorithms include, but are not limited to, polling, weighted polling, random, minimum or source-to-ground hashing, location-based weighted polling, and the like.
  • the location-prioritized weighted polling mode can preferentially select the back-end server in the computer device where the virtual machine that initiates the service packet is located, which can save the speed of the back-end server processing the service packet and save the network bandwidth.
  • the second computer device may be a cloud platform management device in the computer system, and implement management and configuration of the first computer device, including configuring and managing a virtual machine in the first computer device.
  • the first virtual switch that forwards the service packet to the first load balancing virtual machine includes:
  • the first virtual switch sends, by the first virtual switch, the MAC address of the first load balancing virtual machine to the first virtual machine, so that the first virtual machine sends the MAC address of the first load balancing virtual machine based on the obtained MAC address
  • the first virtual switch forwards the service packet to the first load balancing virtual machine;
  • the first load balancing virtual machine sends its MAC address to the first virtual machine, so that the first virtual machine sends the service packet based on the MAC address of the first load balancing virtual machine. Transmitting the service packet to the first load balancing virtual machine by a virtual switch; or
  • the first virtual machine sends the service packet based on the pre-configured MAC address of the first load balancing virtual machine, and the first virtual switch forwards the service packet to the first load balancing virtual machine.
  • the sending, by the first virtual switch, the MAC address of the first load balancing virtual machine to the first virtual machine includes: receiving, by the first virtual switch, a control packet sent by the first virtual machine, to the The first virtual machine returns a control response message, where the control response message includes a MAC address of the first load balancing virtual machine.
  • the forwarding mode of the first virtual switch is configured by the virtual machine management unit, and the first virtual switch performs a directional processing on the service packet of the first virtual machine according to the configured forwarding mode, so that the first virtual The switch forwards the service packet to the first load balancing virtual machine.
  • the control packet is an address resolution protocol ARP packet or an Internet control message protocol ICMP packet.
  • the control packet may be an address resolution protocol ARP packet
  • the forwarding mode may be an ARP pickup mode
  • the first virtual machine may use the ARP pickup mode to set the MAC address of the first load balancing virtual machine. Sent to the first virtual machine.
  • the forwarding mode may also be a neighbor discovery protocol NDP pickup mode.
  • the first computer device further includes a first virtual load balancing agent unit, the second computer device further comprising a virtual load balancing management unit and a virtual machine management unit;
  • the virtual load balancing management unit is configured to receive configuration information for creating the first load balancing virtual machine, and send the configuration information for creating the first load balancing virtual machine to the first virtual load balancing proxy unit;
  • the first virtual load balancing agent unit is configured to receive the configuration information for creating the first load balancing virtual machine, and instruct the virtual machine management unit to Creating configuration information of the first load balancing virtual machine creates the first load balancing virtual machine.
  • the first virtual load balancing agent unit sends the notification information to the virtual machine management unit when the virtual machine management unit is instructed to create the first load balancing virtual machine according to the configuration information of the created load balancing virtual machine.
  • the notification information includes the virtual machine parameter information of the first load balancing virtual machine, where the virtual machine parameter information of the first load balancing virtual machine includes but is not limited to: the number of virtual central processing units, and the size of the virtual memory. And information such as the logical network where the load balancing virtual machine is located.
  • the virtual load balancing management unit may directly instruct the virtual machine management unit to create the first load balancing virtual machine according to the configuration information for creating the first load balancing virtual machine.
  • the configuration information of the first load balancing virtual machine is sent by the user through the cloud management platform (the second computer device), and the configuration information includes but is not limited to: the identifier of the load balancing virtual machine, and the load balancing virtual machine IP address and information about the backend server associated with the load balancing virtual machine.
  • the information of the back-end server includes, but is not limited to, an identifier of the back-end server, an IP protocol (Internet protocol) address of the back-end server, and a method for checking the health of the back-end server.
  • the health check method of the backend server refers to a method in which the load balancing virtual machine checks the health status of the backend server.
  • the back-end server is a server that provides a specific service.
  • the load balancing virtual machine selects one of the back-end servers in a load balancing manner, such as a load balancing algorithm, according to the received service packet, as a server that processes the service packet.
  • the backend server may be a virtual machine or a specific physical server.
  • the first virtual load balancing proxy unit is further configured to indicate the virtual machine management unit And configuring a first virtual network card for the first load balancing virtual machine and establishing a connection between the first virtual network card and the first virtual switch.
  • the virtual machine management unit establishes a connection between the first virtual network card and the first virtual switch.
  • the network identifier of the virtual switch is configured to be implemented, where the network identifier is an identifier of a network interface of the virtual switch.
  • the virtual machine management unit is configured to create the first virtual network card according to the indication of the first virtual load balancing proxy unit, and further configured to create the first virtual network card according to the configuration information of the load balancing virtual machine.
  • the virtual network card assigns an IP address and a MAC address.
  • the first virtual machine is configured to create the first load balancing virtual machine a virtual machine created by the user of the configuration information; the virtual load balancing management unit is further configured to receive configuration information for creating the first virtual machine, and determine that the first virtual machine is the user at the first Notifying the first virtual load balancing agent unit of the information of the first virtual machine when the first virtual machine is created on the computer device; the first virtual load balancing agent unit is configured to receive the When the notification of the first virtual machine is sent by the virtual load balancing management unit, the virtual machine management unit is instructed to create the first load balancing virtual machine.
  • the virtual load balancing management unit may also directly notify the virtual machine management unit to create the first load balancing virtual machine.
  • the virtual load balancing management unit notifies the first virtual load balancing agent unit to instruct the virtual machine management unit to delete the The first load balancing virtual machine, or directly notifying the virtual machine management unit to delete the first load balancing virtual machine.
  • the first computer device further includes a second a virtual machine, the second virtual machine having the capability of processing the service packet of the first virtual machine;
  • the second virtual machine receives the first load balancing virtual machine. Forwarding the service packet, and sending the result of processing the service packet to the first load balancing virtual machine;
  • the first load balancing virtual machine is further configured to send, by the second virtual machine, the result of processing the service packet to the first virtual machine by using the first virtual switch.
  • the computer system further includes a third computer device
  • the third computer device includes a second virtual load balancing agent unit, a second virtual switch, and a third virtual machine
  • the second virtual load balancing proxy unit is configured to receive configuration information that is sent by the virtual load balancing management unit to create a second load balancing virtual machine, and to indicate the configuration information based on the configuration information of the second load balancing virtual machine.
  • the virtual machine management unit creates the second load balancing virtual machine, and instructs the virtual machine management unit to configure a second virtual network card for the second load balancing virtual machine and establish the second virtual network card and the second virtual The connection between the switches;
  • the second virtual switch is configured to receive the second service packet initiated by the third virtual machine, and when the second service packet needs load balancing processing, only forward the second service packet to the a second load balancing virtual machine;
  • the second load balancing virtual machine is configured to receive the second service packet that is forwarded by the second virtual switch, and forward the second service packet according to a load balancing manner.
  • the virtual machine management unit configures the first IP address of the first load balancing virtual machine And configuring a second IP address and a second MAC address for the second load balancing virtual machine; wherein the first IP address is the same as the second IP address, or the first MAC address The address is the same as the second MAC address.
  • the first computer device may include hardware devices such as network hardware in addition to the CPU, memory, and storage device; the network hardware may be a switching device (such as a network card), a router, and/or other network.
  • a device is used to implement communication between multiple devices. Multiple devices can be connected by wireless or wired connection.
  • the second computer device further includes a virtual load balancing storage device, configured to store configuration information for creating a load balancing virtual machine.
  • the virtual load balancing storage device may be a storage device in the second computer device, or may be a storage device independent of the second computer device.
  • a third aspect of the embodiments of the present invention provides a computer system, including a first computer device, a second computer device, and a third computer device, wherein the first computer device, the second computer device, and the third computer device respectively
  • the central computer includes a CPU, a memory, and a storage device, the second computer device configuring and managing a virtual machine on the first computer device and the third computer device, the first computer device including a first virtual a switch, the third computer device includes a second virtual switch, the second computer device configured to receive configuration information for creating a load balancing virtual machine on the first computer device, created in the first computer device First, load balancing the virtual machine, and establishing a connection between the first load balancing virtual machine and the first virtual switch; and receiving configuration information for creating a load balancing virtual machine on the third computer device, where Creating a second load balancing virtual machine in the three computer devices, and establishing the second load balancing virtual machine The virtual switch connected to the second;
  • the first virtual switch is configured to receive a first service packet sent by the first virtual machine in the first computer device, and only forward the first service packet when the first service packet needs load balancing processing Transmitting a service packet to the first load balancing virtual machine;
  • the second virtual switch is configured to receive a second service packet sent by the second virtual machine in the third computer device, and only forward the second service packet when the second service packet needs load balancing processing The service packet is sent to the second load balancing virtual machine.
  • the first virtual switch that forwards the first service packet to the first load balancing virtual machine includes:
  • the first virtual switch Sending, by the first virtual switch, the MAC address of the first load balancing virtual machine to the first virtual machine, so that the first virtual machine is based on the acquired first load balancing virtual
  • the MAC address of the machine sends the service packet, and the first virtual switch forwards the service packet to the first load balancing virtual machine;
  • the first load balancing virtual machine sends its MAC address to the first virtual machine, so that the first virtual machine sends the service packet based on the MAC address of the first load balancing virtual machine. Transmitting the service packet to the first load balancing virtual machine by a virtual switch; or
  • the first virtual machine sends the service packet based on the pre-configured MAC address of the first load balancing virtual machine, and the first virtual switch forwards the service packet to the first load balancing virtual machine.
  • the first virtual switch sends the MAC address of the first load balancing virtual machine to The first virtual machine includes:
  • the forwarding mode of the first virtual switch is configured by the virtual machine management unit, and the first virtual switch performs a directional processing on the service packet of the first virtual machine according to the configured forwarding mode, so that the first virtual The switch forwards the service packet to the first load balancing virtual machine.
  • the control packet is an address resolution protocol ARP packet or an Internet control message protocol ICMP packet.
  • the control packet may be an address resolution protocol ARP packet
  • the forwarding mode may be an ARP pickup mode
  • the first virtual machine may use the ARP pickup mode to set the MAC address of the first load balancing virtual machine. Sent to the first virtual machine.
  • the forwarding mode may also be a neighbor discovery protocol NDP pickup mode.
  • the first computer device further includes a second a virtual machine, the second virtual machine having the service report for processing the first virtual machine Ability of the text;
  • the second virtual machine receives the first load balancing server for forwarding.
  • the service packet, and the result of processing the service packet is sent to the first load balancing virtual machine;
  • the first load balancing virtual machine is further configured to send, by the second virtual machine, the result of processing the service packet to the first virtual machine by using the first virtual switch.
  • the IP address of the first load balancing virtual machine is the same as the IP address of the second load balancing virtual machine; or
  • the MAC address of the first load balancing virtual machine is the same as the MAC address of the second load balancing virtual machine.
  • an embodiment of the present invention provides a method for implementing load balancing, including:
  • the second computer device receives configuration information for creating the load balancing virtual machine on the first computer device, the first computer device including a central processing unit CPU, a memory, and a storage device, the first computer device further including a first virtual Machine and virtual switch;
  • the second computer device creates a load balancing virtual machine on the first computer device according to the configuration information, and establishes a connection between the load balancing virtual machine and a virtual switch in the first computer device;
  • the virtual switch receives the service packet sent by the first virtual machine, and only forwards the service packet to the load balancing virtual machine when the service packet needs load balancing processing;
  • the load balancing virtual machine receives the service packet forwarded by the first virtual switch, and forwards the service packet according to a load balancing manner.
  • the load balancing virtual machine forwards the service packet based on the load balancing mode.
  • the load balancing virtual machine first determines whether the service packet is the service packet after receiving the service packet.
  • a backend server is assigned to serve it, and if a backend server has been assigned, the service message is sent to the already assigned backend server. If a backend server has not been assigned, select a backend server to serve it through a load balancing algorithm.
  • the load balancing algorithms include, but are not limited to, polling, weighted polling, random, minimum or source-to-ground hashing, location-based weighted polling, and the like.
  • the location-prioritized weighted polling mode can preferentially select the back-end server in the computer device where the virtual machine that initiates the service packet is located, which can save the speed of the back-end server processing the service packet and save the network bandwidth.
  • the that the virtual switch only forwards the service packet to the load balancing virtual machine includes:
  • the virtual switch sends the MAC address of the load balancing virtual machine to the first virtual machine, so that the first virtual machine sends the service packet based on the obtained MAC address of the load balancing virtual machine. Transmitting, by the virtual switch, the service packet to the load balancing virtual machine; or
  • the load balancing virtual machine sends its MAC address to the first virtual machine, so that the first virtual machine sends the service packet based on the obtained MAC address of the load balancing virtual machine, where the virtual switch Forwarding the service packet to the load balancing virtual machine; or
  • the first virtual machine sends the service packet based on the pre-configured MAC address of the load balancing virtual machine, and the virtual switch forwards the service packet to the load balancing virtual machine.
  • the virtual switch sends the MAC address of the load balancing virtual machine to the first Virtual machines include:
  • the virtual switch receives the control packet sent by the first virtual machine, and returns a control response packet to the first virtual machine, where the control response packet includes a MAC address of the load balancing virtual machine.
  • the forwarding mode of the virtual switch is configured, and the virtual switch performs directional processing on the service packet of the first virtual machine according to the configured forwarding mode, so that the first The virtual switch forwards the service packet to the load balancing virtual machine.
  • the control packet is an address resolution protocol ARP packet or an Internet control message protocol ICMP packet.
  • the control packet may be an address resolution protocol ARP packet
  • the forwarding mode may be an ARP pickup mode
  • the first virtual machine may use the ARP pickup mode to set the MAC address of the first load balancing virtual machine. Sent to the first virtual machine.
  • the forwarding mode may also be a neighbor discovery protocol NDP pickup mode.
  • any one of the first to the third possible implementation manners of the fourth aspect, the fourth possible implementation manner of the fourth aspect of the embodiments of the present invention further includes: before the creating a load balancing virtual machine on the first computer device, the method further includes:
  • the first computer device receives configuration information for creating a load balancing virtual machine, instructing the second computer device to create the load balancing virtual machine.
  • the second computer device may directly create the load balancing virtual machine on the second computer device according to the configuration information.
  • the configuration information of the load balancing virtual machine is delivered by the user through the cloud management platform (the second computer device), and the configuration information includes but is not limited to: the identifier of the load balancing virtual machine, and the IP of the load balancing virtual machine.
  • the information of the back-end server includes, but is not limited to, an identifier of the back-end server, an IP protocol (Internet protocol) address of the back-end server, and a method for checking the health of the back-end server.
  • the health check method of the backend server refers to a method in which the load balancing virtual machine checks the health status of the backend server.
  • the back-end server is a server that provides a specific service.
  • the load balancing virtual machine selects one of the back-end servers in a load balancing manner, such as a load balancing algorithm, according to the received service packet, as a server that processes the service packet.
  • the backend server may be a virtual machine or a Physical server.
  • the second computer device further includes the second a virtual machine, the second virtual machine is capable of processing the service packet of the first virtual machine, and the method further includes:
  • the second virtual machine receives the service forwarded by the load balancing server. Sending a message to the load balancing virtual machine by processing the result of processing the service packet;
  • the load balancing virtual machine sends the result of processing the service packet by the second virtual machine to the first virtual machine by using the virtual switch.
  • the computer device, the system, and the load balancing method provided by the embodiments of the present invention when a load balancing virtual machine is created in each computer device, when the service of the virtual machine in the computer device needs load balancing processing, the related service packet is only A load balancing virtual machine that is sent to the computer device performs load balancing processing. Since the load balancing related service packets are implemented in the computer device, the service packets on the plurality of computer devices are not concentrated to one load balancing node, thereby avoiding the processing delay caused by the centralized load balancing congestion. Moreover, when the computer device fails, the virtual machine in the computer device will also go offline, and there will be no need for load balancing. Therefore, the load balancing virtual machine failure caused by the failure of a single computer device does not affect the load balancing virtual machine on other computer devices, and there is no service interruption caused by the load balancing virtual machine failure. .
  • FIG. 1 is a schematic diagram of implementing a load balancing architecture in the prior art
  • FIG. 2 is a schematic structural diagram of implementing an implementation of virtual load balancing according to an embodiment of the present invention
  • FIG. 3 is a schematic structural diagram of a computer device according to an embodiment of the present invention.
  • FIG. 4 is a structural diagram of a specific implementation structure of a computer device according to an embodiment of the present invention.
  • FIG. 5 is a schematic structural diagram of an implementation of a first computer system according to an embodiment of the present invention.
  • FIG. 6 is a structural diagram of a specific implementation structure of a computer system in a first embodiment of the present invention.
  • FIG. 7 is a structural diagram showing another specific implementation structure of the first computer system according to an embodiment of the present invention.
  • FIG. 8 is a schematic flowchart of a method for implementing load balancing according to an embodiment of the present invention.
  • FIG. 9 is a schematic flowchart of another method for implementing load balancing according to an embodiment of the present invention.
  • FIG. 1 is a schematic diagram of implementing a load balancing architecture in the prior art.
  • 1 includes a computer device 101, a computer device 102, a computer device 103, a primary virtual load balancer 104, and a standby virtual load balancer 105.
  • the computer device 101 functions as a cloud management platform, including a central processing unit (CPU) 1011 and a storage device 1012 (such as a hard disk, a solid state hard disk, etc.), and runs a cloud management platform related program to implement the pair of computer devices 102. Management and configuration of nodes such as computer device 103.
  • the computer device 102 and the computer device 103 are connected by a network, and the computer device 101 can create a corresponding virtual machine at the computer device 102 or the computer device 103 according to the received configuration information about creating a virtual machine.
  • FIG. 1 illustrates an example in which each computer device includes two virtual machines.
  • computer device 102 includes virtual machines 10211 and 10212
  • computer device 103 includes virtual machines 10311 and 10312.
  • the primary load balancer 104 and the backup load balancer 105 provide load balancing services for service messages sent by the virtual machines in the computer device 102 or the computer device 103 in a master-slave manner.
  • the primary load balancer 104 and the backup load balancer 105 are connected by heartbeat detection. When the primary load balancer 104 fails, the backup load balancer 105 takes over the primary load balancer 104 to continue to provide load balancing services for the virtual machine's request.
  • load balancing mode when the primary load balancing node 104 needs to be switched to the standby load balancing node, the load balancing service is not provided by the load balancing device, and the service packet that needs to be load balanced cannot be processed.
  • only one load balancer (load balancer 104 or 105) processes the service packets of all the virtual machines, which is easy to cause overload and congestion of the virtual load balancer, and the timely processing of the affected request services reduces the user experience.
  • the method, device, and system for virtual load balancing are provided by creating a distribution, in order to solve the problem that the virtual load balancing uses the interruption caused by the active/standby mode during the handover, and the congestion caused when the virtual load balancing node is centralized.
  • the load balancing function is used to offload the load balancing function to the device side of each node.
  • the centralized load balancing mode of the active/standby switchover is not required to avoid the interruption caused by the active/standby switchover and the congestion caused by centralized load balancing.
  • FIG. 2 is a schematic diagram of an implementation architecture for implementing virtual load balancing according to an embodiment of the present invention.
  • the computer device 201 functions as a cloud management platform to implement management and configuration of the virtualization of the computer device 202 and the computer device 203.
  • two computer devices are taken as an example to describe the solution of the embodiment of the present invention.
  • the computer device 201 as a cloud platform can also configure and manage two or more computer devices. The example does not limit the number of specific computer devices.
  • the computer device 202 can include a hardware resource layer 2023 comprised of computing hardware 20231, storage hardware 20232, and network hardware 20233.
  • Computing hardware 20231 can be a dedicated processor or a general purpose processor for providing processing and computing functions.
  • the storage hardware 20232 is configured to provide storage capabilities, which may be provided by the storage hardware 20232 itself (for example, a server's local memory or a local hard disk), or may be provided through a network (for example, the server connects to a network storage device through a network).
  • the network hardware 20233 may be a switching device (network card, etc.), a router, and/or other network device.
  • the network hardware 20233 is used to implement communication between a plurality of devices, and the plurality of devices are connected by wireless or wired.
  • the virtualization layer in computer device 202 is used to abstract the hardware resources of the hardware resource layer to provide virtual resources.
  • the operating system 2022 in the computer device 202 includes, but is not limited to, a virtualization layer Hypervisor 20221 and a virtual switch 20222 running virtualization management.
  • the virtualization layer Hypervisor 20221 manages virtual machines (e.g., virtual machines 20213, etc.) in the computer device 202.
  • the virtual switch 20222 provides a network connection function between the virtual machines managed by the Hypervisor 20221 and between the virtual machine and the physical network.
  • the virtual load balancing agent unit 20211 connects the load balancing virtual machine 20212 in the computer device 202 through the virtualization layer Hypervisor 20221. Configure and manage.
  • the computer device 201 functions as a cloud management platform, runs a cloud management platform related program, implements management and configuration of the computer device 202 and the computer device 203, and includes configuring and managing virtual machines in the computer device 202 and the computer device 203.
  • the computer device 202 and the computer device 203 serve as device nodes under the control of the cloud management platform, and provide related services or services such as virtual machines.
  • the computer device 201 includes a hardware resource layer 2013 composed of a computing hardware 20131, a storage hardware 20132, and a network hardware 20133.
  • the computing hardware 20131 can be a dedicated processor or a general purpose processor for providing processing and computing functions.
  • the storage hardware 20132 is used to provide storage capacity, which may be provided by the storage hardware 20132 itself (for example, a server's local memory or a local hard disk), or may be provided through a network (for example, a service) Connect a network storage device through the network).
  • the network hardware 20133 may be a switching device (network card, etc.), a router, and/or other network devices.
  • the network hardware 20133 is used to implement communication between multiple devices, and multiple devices are connected by wireless or wired.
  • the virtualization layer in computer device 201 is used to abstract the hardware resources of the hardware resource layer to provide virtual resources.
  • the operating system 2012 in the computer device 201 includes, but is not limited to, a virtualization layer Hypervisor 20121 running virtualization management.
  • the following describes the implementation of the load balancing provided by the embodiment of the present invention by using the cloud management platform to apply for a virtual machine on the computer device 202 and load balancing the service packets of the applied virtual machine.
  • the load balancer can perform load balancing processing on the service packets of the applied virtual machine, that is, the load balancer is configured to perform load balancing processing on the service packets of the applied virtual machine.
  • the load balancer includes, but is not limited to, a virtual machine, a namespace, or a container.
  • the embodiment of the present invention uses a virtual machine as a load balancer as an example for description. It can be understood that the implementation of using a namespace or a container as a load balancer can be implemented by referring to an implementation in which a virtual machine is used as a load balancer.
  • the cloud management platform implements unified scheduling management of resources such as network, storage, and computing, and the business automation orchestration on the above, realizes the operation functions of charging, process, log, and application delivery, and finally presses A pay-as-you-go model that provides users, administrators with available, convenient, on-demand network access, giving users and administrators access to a configurable pool of computing resources (resources including network, server, storage, application software, Service, etc.).
  • the computer device 201 as a cloud management platform includes a virtual load balancing management unit 20111 and a virtual machine management unit 20112.
  • the virtual load balancing management unit 20111 is configured to receive configuration information for creating a load balancing virtual machine, and store the configuration information of the created load balancing virtual machine into the virtual load balancing data device 20114.
  • the virtual load balancing management unit 20111 may further send the configuration information of the created load balancing virtual machine to the virtual load balancing proxy unit 20211.
  • the virtual machine management unit 20112 is configured to create or delete the load balancing virtual machine 20212 according to the configuration information of the created load balancing virtual machine.
  • the configuration information of the load balancing virtual machine is delivered by the user through the cloud management platform, and the configuration information includes, but is not limited to, an identifier of the load balancing virtual machine, and an IP address of the load balancing virtual machine, such as a virtualized IP address. (VIP, Virutal IP Address) address, and information about the backend server associated with the load balancing virtual machine.
  • VIP Virutal IP Address
  • the VIP address of the load balancing virtual machine is an IP address of the load balancing virtual machine.
  • the information of the back-end server includes, but is not limited to, an identifier of the back-end server, an IP protocol (Internet protocol) address of the back-end server, and a method for checking the health of the back-end server.
  • the health check method of the backend server refers to a method in which the load balancing virtual machine checks the health status of the backend server.
  • the back-end server is a server that provides a specific service.
  • the load balancing virtual machine selects one of the back-end servers in a load balancing manner, such as a load balancing algorithm, according to the received service packet, as a server that processes the service packet.
  • the backend server may be a virtual machine or a specific physical server.
  • the virtual load balancing data device 20114 is configured to store configuration information for creating a load balancing virtual machine, which may be a storage device in the computer device 201, or may be a storage device independent of the computer device 201, and the present invention
  • the embodiment does not limit the specific manner of saving the configuration information of the created load balancing virtual machine.
  • the virtual machine management unit 20112 may directly create or delete the load balancing virtual machine 20212 according to the instruction of the virtual load balancing management unit 20111; or may create or delete according to the instruction of the virtual load balancing agent unit 20211 in the computer device 202.
  • the load balancing virtual machine 20212 may directly create or delete the load balancing virtual machine 20212 according to the instruction of the virtual load balancing management unit 20111; or may create or delete according to the instruction of the virtual load balancing agent unit 20211 in the computer device 202.
  • the load balancing virtual machine 20212 may directly create or delete the load balancing virtual machine 20212 according to the instruction of the virtual load balancing management unit 20111; or may create or delete according to the instruction of the virtual load balancing agent unit 20211 in the computer device 202.
  • the virtual machine management unit 20112 is further configured to create a corresponding virtual machine according to the configuration information that is created by the user and create a virtual machine in the computer device 202. For example, when the computer device 201 receives a virtual machine created by the user in the computer device 202, the virtual machine management unit 20112 creates a virtual machine 20213 in the computer device 202. Similarly, when the meter When the computer device 201 receives the configuration information of the virtual machine created by the user as the backend server in the computer device 202, the virtual machine management unit 20112 creates a corresponding virtual machine as a backend server, for example, creates a virtual machine 20214. .
  • the computer device 202 may further include a virtual load balancing proxy unit 20211, where the virtual load balancing proxy unit 20211 is configured to obtain the created load balancing virtuality from the virtual load balancing management unit 20111.
  • the configuration information of the machine instructs the virtual machine management unit 20112 to create a load balancing virtual machine 20212 according to the configuration information of the created load balancing virtual machine.
  • the virtual load balancing agent unit 20211 when the virtual machine management unit 20112 is instructed to create the load balancing virtual machine 20212 according to the configuration information of the created load balancing virtual machine, sends the load balancing virtual machine 20212 to the virtual machine management unit 20112. Notification information, the notification information further including virtual machine parameter information for creating a load balancing virtual machine 20212.
  • the virtual machine parameter information of the load balancing virtual machine 20212 includes, but is not limited to, the number of virtual central processing units, the size of the virtual memory, and the logical network in which the load balancing virtual machine 20212 is located.
  • the process of creating the load balancing virtual machine 20212 by the virtual machine management unit 20112 may be: the virtual machine management unit 20112 specifies an image with a load balancing module by calling an application programming interface (API) of the created virtual machine.
  • a load balancing virtual machine 20212 is created.
  • Virtual machine parameter information is used when calling the API to create a virtual machine to create a virtual machine based on virtual machine parameter information.
  • the mirror with the load balancing module is specified, so that the created virtual machine has a load balancing module, and then the configuration information is configured to the load balancing module in the virtual machine.
  • the virtual load balancing management unit 20111 When the virtual load balancing management unit 20111 directly notifies the virtual machine management unit 20112 to create the load balancing virtual machine 20212, the virtual load balancing management unit 20111 sends a notification message to the virtual machine management unit 20112, where the notification message includes creating the The configuration information and virtual machine parameter information required by the virtual machine 20212 are load balanced to notify the virtual machine management unit 20112 to start creating the load balancing virtual machine 20212.
  • the load balancing virtual machine 20212 is configured to receive a virtual machine in the computer device 202, for example, the virtual machine 20213, and the service packet sent by the virtual switch 20222 is received based on the load balancing manner.
  • the business message is processed.
  • the load balancing virtual machine 20212 processes the service packet of the virtual machine in the computer device 202 based on the load balancing mode.
  • the load balancing virtual machine 20212 first determines whether it is already after receiving the service packet.
  • the service packet is assigned a backend server for its service. If the backend server has been allocated, the service packet is sent to the already assigned backend server. If a backend server has not been assigned, select a backend server to serve it through a load balancing algorithm.
  • the load balancing algorithms include, but are not limited to, polling, weighted polling, random, minimum or source-to-ground hashing, location-based weighted polling, and the like.
  • the location-prioritized weighted polling mode can preferentially select the back-end server in the computer device where the virtual machine that initiates the service packet is located, which can save the speed of the back-end server processing the service packet and save the network bandwidth.
  • a polling algorithm is taken as an example, and a manner in which the load balancing virtual machine 20212 selects a backend server is described.
  • the load balancing virtual machine 20212 groups all the backend servers (the virtual machine 20214 and the virtual machine 20314) into a list, taking turns in the list. Allocate business messages that need to be processed.
  • the virtual machine 20214 When the load balancing virtual machine 20212 receives the first service packet sent by the virtual machine 20213, the virtual machine 20214 is used as the backend server for providing the service, and sends the first service packet to the virtual machine 20214; When the second service message from the virtual machine 20213 is received, the virtual machine 20314 is used as the back-end server for providing the service, and then the second service message is sent to the virtual machine 20314; when the load balancing virtual machine 20212 receives The third service packet sent by the virtual machine 20213 is used as the backend server for providing the service, and the third service packet is sent to the virtual machine 20214 for circulation.
  • the user applies for a virtual machine for initiating a service in the computer device 202 through the cloud management platform, and needs to load the service request of the applied virtual machine.
  • the equalization process is described as an example. It can be understood that when a user applies for a virtual machine for initiating a service in the computer device 203 through the cloud management platform, and needs to perform load balancing processing on the service request of the applied virtual machine, the implementation manner is similar. Since the load balancing unit is distributed in each computer device, there is no centralized load balancing node, and the service packets related to load balancing are load-balanced in each computer device, and there is no congestion caused by service packets. Processing delay.
  • a load balancer is deployed in both the computer device 202 and the computer device 203.
  • the virtual machine in the computing system is also offline, and no load balancing requirement is generated;
  • the failure of the load balancing unit caused by the failure of a single computer device does not affect the processing of other load balancing services, and there is no service interruption caused by the active/standby switchover caused by the failure of the load balancing node.
  • the configuration information of the load balancing virtual machine 20212 obtained by the virtual load balancing proxy unit 2011 from the virtual load balancing management unit 20111 may further include network information of the load balancing virtual machine 20212.
  • the virtual load balancing agent unit 20211 is further configured to instruct the virtual machine management unit 20112 to establish a virtual network card for the load balancing virtual machine 20212 according to the network information in the configuration information of the load balancing virtual machine, and indicate the virtual The machine management unit 20112 establishes a connection between the virtual network card and the virtual switch 20222.
  • the virtual machine management unit 20112 may also allocate an IP address to the created virtual network card according to the configuration information of the load balancing virtual machine when the virtual network card is established according to the instruction of the virtual load balancing agent unit 20211. MAC address.
  • the virtual machine management unit 20111 may be instructed by the virtual load balancing management unit 20111 to establish a virtual network card for the load balancing virtual machine 20212, and establish a connection between the virtual network card and the virtual switch 20222.
  • Establishing a connection between the virtual network card and the virtual switch 20222 can be implemented by configuring a network identifier of the virtual switch.
  • the network identifier of the virtual switch is an identifier of the network interface of the virtual switch.
  • the virtual machine and the virtual switch can establish a connection.
  • the virtual The machine management unit 20112 establishes a connection between the load balancing virtual machine 20212 and the virtual switch 20222 by configuring the network identifier of the virtual switch 20222.
  • the virtual switch 20222 has three network interfaces, and the network identifier is 100.
  • the virtual machine 20213 can be identified by the network as an interface of 100.
  • the communication with the interface of the load balancing virtual machine 20212 having the network identifier of 100 is implemented.
  • the virtual machine management unit 20112 may configure a network identifier for the virtual switch 20222 according to the virtual load balancing proxy unit 20211 or the virtual load balancing management unit 20111. It can be understood that the three network interfaces of the virtual switch 20222 are only examples. In a specific implementation, the virtual switch 20222 may further include other network interfaces.
  • the virtual switch 20222 includes 100 network interfaces, and the network identifier of the three network interfaces is 100.
  • the virtual load balancing agent unit 20211 is further configured to instruct the virtual machine management unit.
  • the configuration of the virtual switch 20222 is configured to forward the service packet of the virtual machine 20213 according to the forwarding mode, so that the virtual machine 20213 sends the service packet to the The load balancing virtual machine 20212.
  • the virtual machine management unit 20112 may be instructed by the virtual load balancing management unit 20111 to configure a forwarding mode of the virtual switch 20222.
  • the forwarding mode of the virtual switch 20222 may be an ARP address resolution protocol (ARP) or a NDP Neighbor Discovery Protocol (NDP) mode, that is, the virtual switch 20222 is configured to the service packet.
  • ARP ARP address resolution protocol
  • NDP NDP Neighbor Discovery Protocol
  • the way to perform directional forwarding processing is ARP or NDP pickup mode.
  • the embodiment of the present invention uses a cloud platform supporting OpenStack as an example to describe the implementation manner of the ARP pickup technology.
  • the ARP pickup technology is implemented by a flow table.
  • the flow table technology generally consists of two parts, one is the matching condition and the other is the action.
  • the matching condition of the flow table of the ARP pickup is: the protocol type is ARP, the destination protocol address of the ARP is the virtualized IP address (VIP, Virutal IP Address), which is the IP address that the load balancing virtual machine can access, and the ARP operation type is the ARP request.
  • the action includes: 1. Modifying the destination media access control (MAC, Media Access Control) address of the received ARP packet as the source MAC address of the packet; 2. Modifying the source MAC address of the received ARP packet as load balancing. The MAC address of the virtual machine 20212; 3.
  • MAC Media Access Control
  • the ARP operation type of the modified ARP packet is an ARP response; 4.
  • the ARP destination protocol address of the received ARP packet is the ARP source protocol address of the ARP packet, where The protocol address is the term in the ARP protocol, that is, the IP address. 5.
  • the ARP source protocol address of the received ARP packet is the IP address of the load balancing virtual machine 20212. 6.
  • the ARP destination of the received ARP packet is modified.
  • the hardware address is the ARP source hardware address of the packet.
  • the hardware address is the term in the ARP protocol, that is, the MAC address.
  • the ARP source hardware address of the received ARP packet is the MAC address of the load balancing virtual machine 20212. .
  • the modified ARP packet is sent to the virtual machine 20213 by the virtual switch 20222.
  • the ARP proxy mode of the virtual switch 20222 enables the virtual machine 20213 to obtain the MAC address corresponding to the VIP, and sends a service packet based on the obtained MAC address, so that the virtual machine in the computer device 202 needs to perform load balancing processing.
  • the message is only sent to the load balancing virtual machine 20212 on the computer device 202.
  • the virtual machine 20213 constructs a service request packet.
  • the IP address of the service request packet is a VIP address
  • the MAC address is the load obtained from the ARP response of the virtual switch 20222.
  • the MAC address of the virtual machine 20212 is equalized.
  • the virtual machine 20213 sends the configured service request message to the virtual switch 20222.
  • the virtual switch 20222 sends the service request message to the load balancing virtual machine 20212 according to the IP address and the MAC address of the service request message.
  • the IP address is not a VIP address, and the virtual switch 20222 can forward according to the normal forwarding mode.
  • the virtual switch 20222 needs to enter the service packet initiated by the virtual machine 20213.
  • the virtual switch 20222 sends the service message of the virtual machine 20213 to the load balancing virtual machine 20212 and the load balancing virtual machine on other computer devices (such as the computer device 203) through the ARP pickup technology ( If the load balancing virtual machine 20312 does not receive the ARP request, the service packet sent by the virtual machine 2013 in the computer device 202 is not received, and the service packet of the virtual machine in each computer device needs load balancing. When processed, it is only implemented on a load balancing virtual machine within the computer device.
  • a load balancing virtual machine 20312 can also be created in the computer device 203. Since the service packets sent by the virtual machine in each computer device that require load balancing processing are forwarded only to the load balancing virtual machine created in the computer device, they are not forwarded to the load balancing virtual machine in other computer devices for processing.
  • the IP address of the load balancing virtual machine 20212 in the computer device 202 may be the same as the IP address of the load balancing virtual machine 20312 in the computer device 203.
  • the MAC address of the load balancing virtual machine 20212 in the computer device 202 may be associated with the computer device.
  • the MAC address of the load balancing virtual machine 20312 is the same in 203. In this way, IP address resources and/or MAC address resources in the network formed by the computer devices can be saved.
  • the virtual load balancing proxy unit 20211 may instruct the virtual machine management unit 20112 to create a load balancing virtual machine when the user deploying the load balancing service creates the first virtual machine in the computer device 202. 20212.
  • This can save resources of the computer device 202 and avoid waste of hardware resources caused by creating a load balancing virtual machine when the load balancing service is not required.
  • the timing of creating the first virtual machine in the computer device 202 by the user deploying the load balancing service may be the virtual load balancing management when the virtual machine management unit 20112 creates a virtual machine (for example, the virtual machine 20213).
  • the unit 20111 determines whether the created virtual machine is the first virtual machine configured by the user who has configured the virtual load balancing service.
  • the virtual load balancing management unit 20111 notifies the virtual load balancing agent unit to instruct the virtual machine management unit 20112 to create the load balancing virtual machine 20212.
  • the virtual load balancing management unit 20111 may directly notify the virtual machine management unit 20112.
  • a load balancing virtual machine 20212 is created.
  • the virtual load balancing management unit 20111 notifies the virtual load balancing agent unit to instruct the virtual machine management unit 20112 to delete the load balancing virtual The machine 20212, or directly notifying the virtual machine management unit 20112, deletes the load balancing virtual machine 20212.
  • the load balancing virtual machine 20212 is created when the user who has configured the virtual load balancing service creates the first virtual machine, and the load balancing virtual machine 20212 is deleted when the last virtual machine configured by the same user is deleted, thereby saving computer equipment.
  • the virtual resources in 202 increase the utilization of resources in computer device 202.
  • the creation and configuration of the load balancing virtual machine 20212 described above is that the virtual load balancing agent unit 20211 in the computer device 202 instructs the virtual machine management unit 20112 in the computer device 201 to create.
  • the virtual load balancing agent unit 20211 may not be included in the computer device 202.
  • the virtual load balancing management unit 20111 in the computer device 201 receives the configuration information for creating the load balancing virtual machine 20212, The virtual machine management unit 20112 is directly instructed to create a load balancing virtual machine 20212.
  • the embodiment of the present invention does not limit the manner in which the specific load balancing virtual machine 20212 is created.
  • a user applies for the virtual machine 20213 through the cloud management platform, and accesses the video service through the virtual machine 20213.
  • the video service can be provided by the back end server such as the virtual machine 20214 or the virtual machine 20314 as an example to illustrate the implementation of load balancing in the embodiment of the present invention. .
  • the back end server such as the virtual machine 20214 or the virtual machine 20314 as an example to illustrate the implementation of load balancing in the embodiment of the present invention.
  • the cloud management platform (computer device 201) creates a load balancing virtual machine 20212 in the computer device 202, and creates a load balancing virtual machine 20312 in the computer device 203; when the virtual machine 20213 initiates access to the video service,
  • the service message is forwarded only by the virtual switch 20222 to the load balancing virtual machine 20212 in the computer device 202, and the load balancing virtual machine 20312 in the computer device 203 connected to the computer device 202 through the network does not receive the service message.
  • the service packet sent by the virtual machine 20213 causes the service packet initiated by the computer device 202 to be load balanced to perform load balancing processing only in the computer device 202.
  • Load balancing virtual machine 20212 After receiving the service packet of the virtual machine 20213 forwarded by the virtual switch 20222 for the video service, the service packet is processed by the load balancing algorithm.
  • the virtual machine 20214 or the virtual machine 20314 may be selected as the virtual machine 20213.
  • the load balancing virtual machine 20212 can select the virtual machine 20214 as a backend server to provide a video service to the virtual machine 20213. This can save network bandwidth and improve the efficiency of the backend server in responding to service messages.
  • FIG. 3 is a schematic structural diagram of a computer device 300 according to an embodiment of the present invention.
  • the computer device 300 includes a central processing unit CPU 3031, a memory 3032, and a storage device 3033, and further includes a first virtual machine 304, a load balancing virtual machine 301, and a virtual switch that are generated after virtualization on the hardware of the computer device 300. 3022.
  • the first virtual machine 304 and the load balancing virtual machine are 301 virtual machines created in the computer device 300.
  • the first virtual machine 304 is configured to send a service packet.
  • the virtual switch 3022 is configured to receive the service packet sent by the first virtual machine 304, and only forward the service packet to the load balancing virtual machine when the service packet needs load balancing processing. 301;
  • the load balancing virtual machine 301 is configured to receive the service packet forwarded by the virtual switch 3022, and forward the service packet according to a load balancing manner.
  • the load balancing virtual machine 301 is included in the computer device 300.
  • the virtual machine in the computer device 300 initiates a service and needs to perform load balancing processing
  • the related service message is only sent to the load balancing virtual machine 301 in the computer device 300.
  • Perform load balancing processing Since the load balancing related service packets are implemented in the computer device, the service packets on the plurality of computer devices are not concentrated to one load balancing node, thereby avoiding the processing delay caused by the centralized load balancing congestion.
  • the virtual machine in the computer device 300 will also go offline, and there is no need for load balancing. Therefore, the failure of the load balancing virtual machine caused by the failure of a single computer device does not affect the load balancing virtual machine on other computer devices, and there is no active/standby switchover caused by the load balancing virtual machine failure. The business disruption.
  • the computer device 300 may include hardware devices such as network hardware (not shown) in addition to the central processing unit CPU 3031, the memory 3032, and the storage device 3033.
  • the network hardware may be a switching device (such as a network card). ), routers, and/or other network devices are used to implement communication between multiple devices, and multiple devices can be connected by wireless or wired connection.
  • the forwarding, by the virtual switch 3022, the service packet to the load balancing virtual machine 301 may include:
  • the virtual switch 3022 sends the MAC address of the load balancing virtual machine 301 to the first virtual machine 304, so that the first virtual machine 304 sends the MAC address based on the acquired MAC address of the load balancing virtual machine 301.
  • the service packet, the virtual switch 3022 forwards the service packet to the load balancing virtual machine 301; or
  • the load balancing virtual machine 301 sends the MAC address to the first virtual machine 304, so that the first virtual machine 304 sends the service packet based on the obtained MAC address of the load balancing virtual machine 301.
  • the virtual switch 3022 forwards the service packet to the load balancing virtual machine 301; or
  • the first virtual machine 304 sends the service packet based on the pre-configured MAC address of the load balancing virtual machine 301, and the virtual switch 3022 forwards the service packet to the load balancing virtual machine 301.
  • the sending, by the virtual switch 3022, the MAC address of the load balancing virtual machine 301 to the first virtual machine 304 may include:
  • the virtual switch 3022 receives the control packet sent by the first virtual machine 304, and returns a control response packet to the first virtual machine 304, where the control response packet includes the MAC address of the load balancing virtual machine 301. .
  • the control packet may be an ARP packet or an Internet Control Message Protocol (ICMP) packet, and the ICMP packet may be the sixth version of ICMPv6.
  • ICMP Internet Control Message Protocol
  • the MAC address of the machine 301 is sent to the first virtual machine 304.
  • the first virtual machine 304 combines the MAC address of the load balancing virtual machine 301 with the information such as the IP address of the load balancing virtual machine 301 that has been acquired. It is sent to the load balancing virtual machine 301 through the virtual switch 3022. In this manner, the service packet sent by the first virtual machine 304 is sent only to the load balancing virtual machine 301 in the computer device 300 when load balancing processing is required.
  • FIG. 4 is a structural diagram of a specific implementation structure of a computer device 300 according to an embodiment of the present invention.
  • the operating system 302 in the computer device 300 runs the virtualization layer hypervisor 3021 and the virtual switch 3022 of the virtualization management, and the virtualization layer Hypervisor 20221 performs the virtual machine (eg, the first virtual machine 304, etc.) in the computer device 300.
  • the virtual switch 3022 provides a network connection function between the virtual machines managed by the Hypervisor 3021 and between the virtual machine and the physical network
  • the virtual load balancing agent unit 3023 virtualizes the load in the computer device 300 through the virtualized layer hypervisor 3021.
  • the machine 301 is configured and managed.
  • the virtual load balancing agent unit 3023 is configured to receive configuration information for creating a load balancing virtual machine 301, control creation or deletion of the load balancing virtual machine 301, and control the load balancing virtual machine 301 and the virtual switch 3022. The establishment of a connection between.
  • the virtual load balancing agent unit 3023 may start the load balancing virtual machine 301 when the user who creates the load balancing virtual machine 301 creates the first virtual machine (for example, the first virtual machine 304) in the computer device 300. Created; when the last virtual machine created by the user who created the load balancing virtual machine 301 in the computer device 300 is deleted, the virtual load balancing agent unit 3023 instructs to delete the load balancing virtual machine 301. This can save resources of the computer device 300 and avoid waste of hardware resources caused by creating a load balancing virtual machine when the load balancing service is not required.
  • the virtual load balancing agent unit 3023 can refer to The implementation of the virtual load balancing proxy unit 20211 in FIG. 2 is implemented, and details are not described herein.
  • the computer device 3022 further includes a second virtual machine 305, where the second virtual machine 305 is configured to process the service message of the first virtual machine 304;
  • the second virtual machine 305 receives the load balancing server 301. Transmitting the service packet, and sending the result of processing the service packet to the load balancing virtual machine 301;
  • the load balancing virtual machine 301 is further configured to send the result of processing the service packet by the second virtual machine 305 to the first virtual machine 304 through the virtual switch 3022.
  • the second virtual machine 305 may directly send the result of processing the service packet to the first virtual machine 304, that is, the second virtual machine 305 does not pass the
  • the load balancing virtual machine 301 sends the result of processing the service message to the first virtual machine 304.
  • the load balancing virtual machine 301 forwards the service packet of the first virtual machine 304 to the backend server (the second virtual machine 305) by using a load balancing algorithm, and sends the result of the backend server processing to the first virtual
  • the machine 304 realizes the purpose of realizing the load balancing service on the self-device by using the load balancing virtual machine created by the computer device 300, and improves the processing efficiency of the load balancing.
  • FIG. 5 is a schematic structural diagram of an implementation of a first computer system according to an embodiment of the present invention.
  • the system includes a first computer device 502 and a second computer device 501, wherein the second computer device 501 includes a central processing unit CPU 50131.
  • the first computer device 502 includes a central processing unit CPU 50231, a memory 50232, and a storage device 50233.
  • the first computer device 502 further includes a first virtual machine generated after being virtualized on a hardware basis. 50213.
  • the first virtual machine 50213 and the first load balancing virtual machine 50212 are virtual machines created in the computer device 502.
  • the first virtual machine 50213 is configured to send a service packet.
  • the first virtual switch 50222 is configured to receive the service packet sent by the first virtual machine 50213, and only forward the service packet to the first packet when the service packet needs load balancing processing.
  • the first load balancing virtual machine 50212 is configured to receive the service packet forwarded by the first virtual switch 50222, and forward the service packet according to a load balancing manner.
  • the first computer device 502 includes the first load balancing virtual machine 50212.
  • the first load balancing virtual machine 50212 performs load balancing processing. Since the load balancing related service packets are implemented in the computer device, the service packets on the plurality of computer devices are not concentrated to one load balancing node, thereby avoiding the processing delay caused by the centralized load balancing congestion. Moreover, when the first computer device 502 fails, the virtual machine in the first computer device 502 is also offline, and there is no need for load balancing. Therefore, the load balancing virtual machine failure caused by the failure of a single computer device does not affect the load balancing virtual machine on other computer devices, and there is no service interruption caused by the load balancing virtual machine failure. .
  • the second computer device 501 may include hardware devices such as network hardware (not shown) in addition to the central processing unit CPU 50131, the memory 50132, and the storage device 50133; the network hardware may be exchanged.
  • Devices network cards, etc.
  • routers, and/or other network devices are used to implement communication between multiple devices, and multiple devices can be connected by wireless or wired connection.
  • the first virtual switch 50222 to forward the service packet to the first load balancing virtual machine 50212 may include:
  • the first virtual switch 50222 sends the MAC address of the first load balancing virtual machine 50212 to the first virtual machine 50213, so that the first virtual machine 50213 is based on the acquired first load balancing virtual machine.
  • the 50212 MAC address sends the service packet, and the first virtual switch 50222 forwards the service packet to the first load balancing virtual machine 50212; or
  • the first load balancing virtual machine 50212 sends its MAC address to the first virtual machine 50213, so that the first virtual machine 50213 sends the service packet based on the first load balancing virtual machine 50212 MAC address.
  • the first virtual switch 50222 forwards the service packet to the first load balancing virtual machine 50212; or
  • the first virtual machine 50213 sends the service packet based on the pre-configured MAC address of the first load balancing virtual machine 50212, and the first virtual switch 50222 forwards the service packet to the first Load balancing virtual machine 50212.
  • the sending, by the first virtual switch 50222, the MAC address of the first load balancing virtual machine 50212 to the first virtual machine 50213 includes:
  • the first virtual switch 50222 receives the control packet sent by the first virtual machine 50213, and returns a control response message to the first virtual machine 50213, where the control response message includes the first load balancing virtual machine. 50212's MAC address.
  • the control packet can be an ARP packet or an ICMPv6 packet.
  • the first virtual machine 50214 first sends an ARP packet to the first virtual switch 50222, and the first virtual switch 50222 performs the ARP generation.
  • the MAC address of the load balancing virtual machine 301 is sent to the first virtual machine 50213.
  • the first virtual machine 50213 combines the acquired first load balancing virtual machine 50212 according to the MAC address of the first load balancing virtual machine 50212.
  • the information such as the IP address is sent to the first load balancing virtual machine 50212 through the first virtual switch 50222. In this manner, the service packet sent by the first virtual machine 50213 is sent only to the first load balancing virtual machine 50212 in the first computer device 502 when load balancing processing is required.
  • FIG. 6 is a structural diagram of a specific implementation structure of a computer system in a first embodiment of the present invention.
  • the operating system 5022 in the second computer device 502 runs the virtualization layer hypervisor 50221 and the first virtual switch 50222 of the virtualization management, and the virtualization layer Hypervisor 50221 pairs the virtual machine in the first computer device 502 (for example, the first The virtual machine 50213 or the like performs management of the first virtual switch 50222 managed by the Hypervisor 50221.
  • the network connection function is provided between the virtual machines and between the virtual machine and the physical network, and the virtual load balancing agent unit 50111 configures and manages the first load balancing virtual machine 50212 in the first computer device 502 through the virtual machine layer Hypervisor 50221.
  • the second computer device 501 functions as a cloud management platform in the computer system, and its operating system 5012 runs a virtualization layer hypervisor 50121 of virtualization management.
  • the second computer device 501 further includes a virtual machine management unit 50112 and a virtual load balancing management unit 50111.
  • the virtual machine management unit 50112 implements configuration and management of a virtual machine in the second computer device 502.
  • the virtual load balancing management unit 50111 The configuration information for creating a load balancing virtual machine or the configuration information of the virtual machine is created, and the related configuration information is saved, and the configuration information for creating the load balancing virtual machine is saved in the virtual load balancing data device 50114.
  • the first computer device 502 also includes a first virtual load balancing agent unit 50211.
  • the virtual load balancing management unit 50111 is configured to receive configuration information for creating the first load balancing virtual machine 50212, and send the configuration information of the first load balancing virtual machine 50212 to the first virtual load balancing.
  • the first virtual load balancing agent unit 50211 is configured to receive the configuration information of the first load balancing virtual machine 50212, and instruct the virtual machine management unit to create the configuration information according to the first load balancing virtual machine 50212.
  • the first load balancing virtual machine 50212 is configured to receive the configuration information of the first load balancing virtual machine 50212, and instruct the virtual machine management unit to create the configuration information according to the first load balancing virtual machine 50212.
  • the first load balancing virtual machine 50212 is configured to receive the configuration information of the first load balancing virtual machine 50212, and instruct the virtual machine management unit to create the configuration information according to the first load balancing virtual machine 50212.
  • the first virtual load balancing agent unit 50211 may indicate when the user who created the first load balancing virtual machine 50212 creates the first virtual machine (for example, the first virtual machine 50213) in the first computer device 502.
  • the virtual machine management unit 50112 creates the first load balancing virtual machine 50212; when the last virtual machine created by the user who created the first load balancing virtual machine 50212 in the first computer device 502 is deleted,
  • the first virtual load balancing proxy unit 50211 instructs the virtual machine management unit 50112 to delete the first load balancing virtual machine 50212. This can save resources of the first computer device 502 and avoid waste of hardware resources caused by creating a load balancing virtual machine when the load balancing service is not required.
  • the first virtual load balancing proxy unit 50211 can refer to the virtual load in FIG. 2 above.
  • the implementation of the balancing agent unit 20211 is implemented and will not be described again.
  • the first virtual load balancing proxy unit 50211 is further configured to instruct the virtual machine management unit 50112 to configure a first virtual network card for the first load balancing virtual machine 50212 and establish the first virtual network card. A connection with the first virtual switch 50222.
  • the virtual machine management unit 50112 establishes that the connection between the virtual network card and the first virtual switch 50222 can be implemented by configuring a network identifier of the first virtual switch 50222.
  • the first virtual switch 50222 has three network interfaces, and the network identifier is 100.
  • the first virtual The machine 50213 can communicate with the interface of the load balancing virtual machine 20212 with the network identifier of 100 through an interface with a network identifier of 100.
  • the virtual machine management unit 50112 may configure a network identifier for the first virtual switch 50222 according to the first virtual load balancing proxy unit 50211 or the virtual load balancing management unit 50111.
  • the first virtual machine 50213 is a virtual machine created by a user who creates configuration information of the first load balancing virtual machine 50212; the virtual load balancing management unit 50111 receives the first virtual machine 50213. Configuration information, and when it is determined that the first virtual machine 50213 is the first virtual machine created by the user on the first computer device 502, notifying the information that the first virtual machine 50213 is created a first virtual load balancing agent unit 50211; the first virtual load balancing agent unit 50211 instructing the virtual machine management unit when receiving the notification of creating the first virtual machine 50213 sent by the virtual load balancing management unit The first load balancing virtual machine 50212 is created 50112.
  • the resources of the computer device 502 can be saved, and the occupation and waste of hardware resources caused by the creation of the load balancing virtual machine are avoided when the load balancing service is not required.
  • the virtual load balancing management unit 50111 notifies the first virtual load balancing.
  • the proxy unit 50211, the first virtual load balancing proxy unit 50211 instructs the virtual machine management unit 50112 to create the first load balancing virtual machine 50212. This also saves resources of the computer device 502 and avoids When load balancing services are not required, hardware resources are occupied and wasted due to load balancing virtual machines.
  • the above is the virtual load balancing management unit 50111 notifying the first virtual load balancing agent unit 50211 to instruct the virtual machine management unit 50112 to create or delete the first load balancing virtual machine 50212.
  • the virtual load balancing management unit 50111 notifies the virtual machine management unit 50112 to create or delete the first load balancing virtual machine 50212, and details are not described herein.
  • the first computer device 502 further includes a second virtual machine 50214, where the second virtual machine 50214 is configured to process the service message of the first virtual machine 50213;
  • the equalization virtual machine 50212 determines that the second virtual machine 50214 processes the service packet of the first virtual machine 50213 by using a load balancing manner
  • the second virtual machine 50214 receives the first load balancing virtual machine 50212 for forwarding.
  • the service packet, and the result of processing the service packet is sent to the first load balancing virtual machine 50212;
  • the first load balancing virtual machine 5021 processes the service by the second virtual machine 50214
  • the result of the message is sent to the first virtual machine 50213 through the first virtual switch 50222.
  • the first load balancing virtual machine 50212 forwards the service packet of the first virtual machine 50213 to the backend server (the second virtual machine 50214) through a load balancing algorithm, and sends the result of the backend server processing to the first server.
  • the first virtual machine 50213 implements the purpose of realizing the load balancing service on the device by using the load balancing virtual machine created by the computer device 502, and improves the processing efficiency of the load balancing.
  • the first computer system of the embodiments of the present invention may further include a third computer device.
  • the third computer device 503 is similar to the computer device 502, and includes a second virtual load balancing proxy unit 50311, a second virtual switch 50322, and a third virtual machine 50313;
  • the second virtual load balancing proxy unit 50312 is configured to receive the configuration information of the second load balancing virtual machine 50312 sent by the virtual load balancing management unit 50111, and create configuration information of the second load balancing virtual machine 50312 based on the configuration information. Instructing the virtual machine management unit 50112 to create the second load balancing virtual machine 50312, and instructing the virtual machine management unit
  • the second virtual network card is configured for the second load balancing virtual machine 50312 and establishes a connection between the second virtual network card and the second virtual switch 50322.
  • the second virtual switch 50322 is configured to receive the second service packet initiated by the third virtual machine 50313. When the second service packet needs to be load balanced, the second service packet is forwarded only to the second service packet.
  • the second load balancing virtual machine 50312 is configured to receive the second service packet forwarded by the second virtual switch 50322, and forward the second service packet according to a load balancing manner.
  • the virtual machine management unit 50112 may configure a first IP address and a first MAC address for the first load balancing virtual machine 50212, and configure a second IP address and a second for the second load balancing virtual machine.
  • MAC address The first IP address may be the same as the second IP address, and the first MAC address may also be the same as the second MAC address, so that the IP address resource in the network formed by the computer device may be saved or MAC address resource to improve the utilization of IP address resources or MAC address resources.
  • FIG. 5, FIG. 6, and FIG. 7 can also be implemented by referring to the specific implementation manner in FIG. 2, and details are not described herein again.
  • the embodiment of the present invention further provides a second computer system, including a first computer device (such as computer device 202 in FIG. 2 or computer device 502 in FIG. 7), and a second computer device (as shown in FIG. 2).
  • Computer device 201 or computer device 501 in FIG. 7 and a third computer device such as computer device 203 in FIG. 2 or computer device 503 in FIG. 7
  • the first computer device, the second computer device And the third computer device respectively include a central processing unit CPU, a memory and a storage device, the second computer device configuring and managing the virtual machine on the first computer device and the third computer device, the first
  • the computer device includes a first virtual switch
  • the third computer device includes a second virtual switch;
  • the second computer device is configured to receive configuration information for creating a load balancing virtual machine on the first computer device, create a first load balancing virtual machine in the first computer device, and establish the first load Balancing the connection of the virtual machine to the first virtual switch; and receiving Creating configuration information of the load balancing virtual machine on the third computer device, creating a second load balancing virtual machine in the third computer device, and establishing the second load balancing virtual machine and the second virtual switch Connection;
  • the first virtual switch is configured to receive a first service packet sent by the first virtual machine in the first computer device, and only forward the first service packet when the first service packet needs load balancing processing Transmitting a service packet to the first load balancing virtual machine;
  • the second virtual switch is configured to receive a second service packet sent by the second virtual machine in the third computer device, and only forward the second service packet when the second service packet needs load balancing processing The service packet is sent to the second load balancing virtual machine.
  • the second computer system includes the first computer device, the second computer device, and the third computer device, and the second computer device respectively creates a first load balancing virtual machine in the first computer device, where The second load balancing virtual machine is created in the third computer device, so that each load balancing virtual machine in each computer device processes the load balancing service in the respective computer device, and the service message sent by the virtual machine in each computer device is only The load balancing virtual machine in the computer device is used for load balancing processing. In this way, service packets on multiple computer devices are not concentrated into one load balancing node, which avoids the processing delay caused by centralized load balancing congestion.
  • the second computer system, the first virtual switch forwarding the first service packet to the first load balancing virtual machine includes:
  • the first virtual switch sends, by the first virtual switch, the MAC address of the first load balancing virtual machine to the first virtual machine, so that the first virtual machine sends the first load balancing virtual machine MAC address based on the acquired
  • the first virtual switch forwards the service packet to the service packet The first load balancing virtual machine;
  • the first load balancing virtual machine sends its MAC address to the first virtual machine, so that the first virtual machine sends the service packet based on the first load balancing virtual machine MAC address, the first The virtual switch forwards the service packet to the first load balancing virtual machine;
  • the first virtual machine sends the service packet based on the pre-configured MAC address of the first load balancing virtual machine, and the first virtual switch forwards the service packet to the first load balancing virtual machine.
  • the sending, by the first virtual switch, the MAC address of the first load balancing virtual machine to the first virtual machine includes:
  • the control packet can be an ARP packet or an ICMPv6 packet.
  • the first computer device further includes a second virtual machine, where the second virtual machine is configured to process the service packet of the first virtual machine;
  • the second virtual machine receives the first load balancing server for forwarding.
  • the service packet, and the result of processing the service packet is sent to the first load balancing virtual machine;
  • the first load balancing virtual machine is further configured to send, by the second virtual machine, the result of processing the service packet to the first virtual machine by using the first virtual switch.
  • the IP address of the first load balancing virtual machine is the same as the IP address of the second load balancing virtual machine; or the MAC address of the first load balancing virtual machine and the second load balancing The virtual machine has the same MAC address. In this way, the address resource of the IP address or the MAC address in the second computer system can be saved, and the resource utilization rate can be improved.
  • FIG. 8 is a schematic flowchart of a method for implementing load balancing according to an embodiment of the present invention. As shown in FIG. 8, the method includes:
  • Step 800 The second computer device receives configuration information for creating the load balancing virtual machine on the first computer device, where the first computer device includes a central processing unit CPU, a memory, and a storage device, and the first computer device further includes The first virtual machine and the virtual switch;
  • the first computer device includes a central processing unit CPU, a memory, and a storage device, and the first computer device further includes The first virtual machine and the virtual switch;
  • Step 802 The second computer device creates a load balancing virtual machine on the first computer device according to the configuration information, and establishes a connection between the load balancing virtual machine and a virtual switch in the first computer device. ;
  • Step 804 The virtual switch receives the service packet sent by the first virtual machine, and only forwards the service packet to the load balancing virtual machine when the service packet needs to be load balanced.
  • Step 806 The load balancing virtual machine receives the service packet forwarded by the first virtual switch, and forwards the service packet according to a load balancing manner.
  • the first computer device includes a load balancing virtual machine, and when the virtual machine in the first computer device initiates a service, and the load balancing process is required, the related service packet is only sent to the load in the first computer device.
  • Balance the virtual machine for load balancing Since the load balancing related service packets are implemented in the computer device, the service packets on the plurality of computer devices are not concentrated to one load balancing node, thereby avoiding the processing delay caused by the centralized load balancing congestion.
  • the first computer device fails, the virtual machine in the first computer device will also go offline, and there is no need for load balancing. Therefore, the load balancing virtual machine failure caused by the failure of a single computer device does not affect the load balancing virtual machine on other computer devices, and there is no service interruption caused by the load balancing virtual machine failure. .
  • the virtual switch only forwards the service packet to the load balancing virtual machine, including:
  • the virtual switch sends the MAC address of the load balancing virtual machine to the first virtual machine, so that the first virtual machine sends the service packet based on the obtained load balancing virtual machine MAC address.
  • the virtual switch forwards the service packet to the load balancing virtual Machine; or,
  • the load balancing virtual machine sends its MAC address to the first virtual machine, so that the first virtual machine sends the service packet based on the acquired load balancing virtual machine MAC address, and the virtual switch will Transmitting the service packet to the load balancing virtual machine;
  • the first virtual machine sends the service packet based on the pre-configured MAC address of the load balancing virtual machine, and the virtual switch forwards the service packet to the load balancing virtual machine.
  • the sending, by the virtual switch, the MAC address of the load balancing virtual machine to the first virtual machine may include:
  • the virtual switch receives the control packet sent by the first virtual machine, and returns a control response packet to the first virtual machine, where the control response packet includes a MAC address of the load balancing virtual machine.
  • the control packet can be an ARP packet or an ICMPv6 packet.
  • the method further includes:
  • the first computer device receives configuration information for creating a load balancing virtual machine, instructing the second computer device to create the load balancing virtual machine.
  • the second computer device further includes a second virtual machine, where the second virtual machine has the capability of processing the service packet of the first virtual machine, and the method further includes:
  • the second virtual machine receives the service forwarded by the load balancing server. Sending a message to the load balancing virtual machine by processing the result of processing the service packet;
  • the load balancing virtual machine sends the result of processing the service packet by the second virtual machine to the first virtual machine by using the virtual switch.
  • the second virtual machine and the first virtual machine are in one computer device, which can save industry It can handle the bandwidth occupation caused by cross-computer equipment and improve the efficiency of business processing.
  • the user applies for the virtual machine 20213 in the computer device 202 through the cloud management platform, and implements a specific service (for example, accessing a video service) through the virtual machine 20213, and the service may be performed by the computer device 202.
  • the virtual machine 20214 or the virtual machine 20314 in the computer device 203 is processed by the back-end server, and the load balancing of the service initiated by the virtual machine 20213 between the virtual machine 20214 and the virtual machine 20314 is required as an example, which is implemented in the embodiment of the present invention.
  • the implementation method of the load balancing service is described in detail.
  • FIG. 9 is a schematic flow chart of the implementation process. It should be noted that the implementation process shown in FIG. 9 is still described by using a virtual machine with load balancing function as a load balancer. For implementing the load balancer in a container or a namespace, the implementation of the virtual machine as a load balancer can be implemented as follows.
  • a method for implementing load balancing services includes:
  • Step 900 The computer device 201 acquires configuration information for creating a load balancing virtual machine in the computer device 202.
  • Step 902 The computer device 201 creates a load balancing virtual machine 20212 in the computer device 202 according to the acquired configuration information of the load balancing virtual machine.
  • Step 904 Configure a forwarding mode of the load balancing service in the computer device 202, so that the service initiated by the virtual machine 20213 is only forwarded to the load balancing virtual machine 20212 created in the computer device 202 for load balancing processing;
  • the service initiated by the virtual machine 20213 is a load balancing service, and the load balancing service is a service that needs to perform load balancing processing.
  • Step 906 The load balancing virtual machine 20212 receives the service sent by the virtual machine 20213, and selects a backend server to process the service initiated by the virtual machine 20213.
  • Step 908 The backend server returns the processed service initiated by the virtual machine 20213. Give virtual machine 20213.
  • the computer device 201 can obtain the configuration information of the load balancing virtual machine that needs to be created, for example, the load balancing virtual machine delivered by the user through the software related to the cloud management platform running on the computer device 201.
  • the computer device 201 may also acquire configuration information of other service virtual machines, such as the virtual machine 20213 in the computer device 202.
  • the manner in which the computer device 201 obtains the configuration information of the service virtual machine includes receiving configuration information delivered by the user through the cloud management platform related software or configuration information pre-stored in the computer device 201.
  • the embodiment of the present invention is that the user requests the virtual machine 20213 in the computer device 202 through the cloud management platform, and the service request initiated by the virtual machine 20213 needs to perform load balancing processing.
  • the embodiment of the present invention creates a load balancing virtual machine 20212 in the computer device 202, and the load balancing virtual machine 20212 processes the need initiated by the virtual machine 20213. Service request for load balancing processing.
  • step 900 the computer device 201 needs to acquire the configuration information of the load balancing virtual machine created in the computer device 202, that is, the configuration information of the load balancing virtual machine 20212, and according to the acquired configuration information of the load balancing virtual machine.
  • a load balancing virtual machine is configured in the computer device 202.
  • the configuration information of the load balancing virtual machine includes, but is not limited to, an identifier of the load balancing virtual machine 20212, and a VIP address of the load balancing virtual machine 20212.
  • the VIP of the load balancing virtual machine 20212 indicates a load balancing service.
  • the configuration information of the load balancing virtual machine further includes information about a backend server related to the load balancing virtual machine 20212.
  • the configuration information may further include virtual machine parameter information, where the virtual machine parameter information includes, but is not limited to, the number of virtual central processing units, the size of the virtual memory, and the load.
  • the information such as the logical network where the virtual machine 20212 is located is equalized.
  • the parameter information of the virtual machine may be a pre-configured parameter list, and different parameter lists may be selected according to different requirements.
  • the parameter list may be specified when the user sends the configuration information, or may be obtained by the computer device 201 in the stored configuration information list according to the previous policy.
  • the embodiment of the present invention does not limit the virtual machine parameter of the load balancing virtual machine 20212.
  • the way information is.
  • step 902 the computer device 201 creates a load balancing virtual machine 20212 according to the acquired configuration information of the load balancing virtual machine.
  • the computer device 201 can create a normal virtual machine in the computer device 202, and can also create a load balancing virtual machine.
  • the computer device 201 can create a load balancing virtual machine 20212 in the computer device 202 based on the acquired configuration information of the load balancing virtual machine 20212.
  • the foregoing method may further include the step 901: the computer device 201 creates the virtual machine 20213 in the computer device 202.
  • the virtual machine 20213 is a service virtual machine created by a user, and the virtual machine 20213 is a virtual machine that initiates a service.
  • the service initiated by the virtual machine 20213 includes a load balancing service, that is, a load balancing service initiated by the virtual machine 20213, which is a service that needs to perform load balancing processing.
  • the computer device 201 When the user who created the load balancing virtual machine configuration information creates the first virtual machine on the computer device 202, for example, when the first virtual machine 20213 that initiates the load balancing service is created, the computer device 201 creates the load balancing virtual machine 20212. When the last virtual machine created by the user is deleted, for example, the last virtual machine 20213 that initiated the load balancing service is deleted, the computer device 201 deletes the load balancing virtual machine 20212. In this way, the load balancing virtual machine 20212 is created only when the user creates the virtual machine that initiates the load balancing service, which can avoid the problem that the resources of the computer device 202 caused by the creation of the load balancing virtual machine are occupied when the user does not create the virtual machine. The resource utilization of computer device 202 is increased.
  • the computer device 201 determines whether the created virtual machine is the first service virtual machine created by the user who has configured the virtual load balancing service, and may use the information according to the user, for example, The identification information of the user, etc., determines whether it is the first service virtual machine created by the user who has configured the virtual load balancing service.
  • the user information may be determined according to the information of the user, and details are not described herein.
  • the computer device 201 creates a load balancing virtual machine 20212 according to the acquired configuration information of the load balancing virtual machine, and further includes the computer device 201 as the load balancing virtual network according to the network information in the configuration information of the load balancing virtual machine.
  • the machine 20212 configures a virtual network card.
  • a forwarding mode in which the load balancing service is configured in the computer device 202 by the computer device 201 may be used.
  • the forwarding mode forwards the service packet of the load balancing service initiated by the virtual machine that initiates the service on the computer device 202, such as the virtual machine 20213, to the load balancer.
  • the computer device 201 configures the forwarding mode of the load balancing service in the computer device 202, which can be implemented by configuring the forwarding mode of the virtual switch in the computer device 202.
  • the virtual switch in the computer device 202 is a virtual switch 20222.
  • the forwarding mode of the virtual switch 20222 is configured to perform a directional forwarding process on the service packet that needs to be load-balanced and sent by the virtual machine 20213.
  • the service message sent for load balancing processing is sent only to the load balancing virtual machine 20212 in the computer device 202.
  • the forwarding mode of the virtual switch 20222 may be an ARP or NDP pickup mode, that is, the virtual switch 20222 performs directional forwarding of the service packet by using an ARP or NDP pickup mode.
  • the virtual machine 20213 When the virtual machine 20213 initiates a service packet of the load balancing service, the virtual machine 20213 sends the service packet of the load balancing service to the load balancing virtual machine 20212 according to the forwarding mode of the load balancing service. Specifically, when the virtual machine 20213 initiates a load balancing service that needs to perform load balancing processing, the control device may first send a control packet with the VIP as the destination IP, and the control packet may be a broadcast packet of the load balancing service. In the normal case, the virtual machine 20213 initiates a control packet with the VIP as the destination IP, and is forwarded to all IP addresses.
  • a load balancing node (such as a load balancer, etc.) that is a VIP.
  • the virtual switch 20222 in the computer device 202 only balances the load after receiving the control packet sent by the virtual machine 20213.
  • the MAC address of the virtual machine 20212 is sent to the virtual machine 20213.
  • the virtual machine 20213 sends the service packet of the load balancing service to the load balancing virtual machine 20212 according to the obtained MAC address of the load balancing virtual machine 20212.
  • the services initiated by the virtual machine 20213 are only forwarded to the load balancing virtual machine 20212 created in the computer device 202 for load balancing processing.
  • control packet sent to the virtual switch 20222 may be an ARP packet or an ICMP packet.
  • the embodiment of the present invention uses a cloud platform supporting OpenStack as an example to describe the implementation manner of the ARP pickup technology.
  • the control packet is sent to the virtual switch 20222, for example, an ARP request packet is sent to the virtual switch 20222, and the virtual switch 20222 performs ARP pickup.
  • the virtual machine 20213 initiates the load balancing processing service for the first time, the virtual machine 20213 does not know the MAC address of the load balancing virtual machine that processes the load balancing service, and only knows the VIP address of the load balancing service. Therefore, when the virtual machine 20213 initiates the load balancing processing service for the first time, it first sends an ARP request to obtain the MAC address of the load balancing virtual machine that processes the load balancing service.
  • the destination IP address of the ARP request packet is a VIP, and the VIP is an IP address that the load balancing virtual machine can access.
  • the destination MAC address of the ARP request packet may be a MAC address of a general load balancing virtual machine.
  • the MAC address is not a MAC address of a specific load balancing virtual machine, and the destination MAC address may also be empty.
  • the ARP pickup technology is implemented by a flow table.
  • the flow table technology generally consists of two parts, one is the matching condition and the other is the action.
  • the matching condition of the flow table of the ARP pickup is: the protocol type is ARP, the target protocol address of the ARP For the VIP, the VIP is the IP address that the load balancing virtual machine can be accessed, and the ARP operation type is the ARP request.
  • the virtual switch 20222 performs ARP pickup on the ARP request sent by the virtual machine 20213, the load balancing virtual machine 20212 The MAC address is returned to the virtual machine 20213.
  • the virtual machine 20213 After the virtual switch 20222 sends the ARP reply packet to the virtual machine 20213, the virtual machine 20213 sends a service packet that needs load balancing processing.
  • the IP address of the service packet is a VIP address
  • the MAC address is an ARP response from the virtual switch 20222.
  • the MAC of the load balancing virtual machine 20212 obtained in .
  • the virtual machine 20213 sends the service packet to the virtual switch 20222.
  • the virtual switch 20202 After receiving the service packet sent by the virtual machine 20213, the virtual switch 20202 sends the service packet to the load balancing virtual machine 20212 according to the MAC address carried in the service packet.
  • the virtual switch 20222 receives the service packet sent by the virtual machine 20213, and sends the service packet to the load balancing virtual machine 20212 according to the IP address and the MAC address of the service packet.
  • the load balancing virtual machine (such as the load balancing virtual machine 20312) on the other computer device (such as the computer device 203) does not receive the service packet of the virtual machine 20213, and does not process the service packet that needs to be load balanced and sent by the virtual machine 20213. .
  • the purpose of realizing the service message of the virtual machine in each computer device is only implemented on the load balancing virtual machine in the computer device when load balancing processing is required.
  • the forwarding mode of the load balancing service configured by the computer device 201 on the computer device 202 can also be implemented by:
  • the computer device 201 instructs the load balancing virtual machine 20212 to send the MAC address of the load balancing virtual machine 20212 to the virtual machine (eg, the virtual machine 20213) that initiates the service; or
  • the computer device 201 configures the MAC address of the load balancing virtual machine 20212 on the virtual machine (eg, virtual machine 20213) that initiates the service.
  • the virtual machine that initiates the service receives the MAC address of the load balancing virtual machine 20212 as the destination MAC address when initiating the load balancing service.
  • the MAC address of the load balancing virtual machine 20212 is the destination MAC address when the virtual machine (for example, the virtual machine 20213) that initiates the service sends the load balancing service.
  • the load balancing virtual machine 20212 receives the service sent by the virtual machine 20213, and selects a backend server to process the service initiated by the virtual machine 20213.
  • the method may include the following steps: the load balancing virtual machine 20212 receives the service. After the packet is received, it is first determined whether a service is sent to the service server by the backend server. If the backend server has been allocated, the service packet is sent to the already assigned backend server. If a backend server has not been assigned, select a backend server to serve it through a load balancing algorithm.
  • the load balancing algorithms include, but are not limited to, polling, weighted polling, random, minimum or source-to-ground hashing, location-based weighted polling, and the like.
  • the location-prioritized weighted polling mode may preferentially select the back-end server in the computer device where the virtual machine that originated the service message is located, that is, the virtual machine 20214 in the computer device 202 as the back-end server that processes the virtual machine 20213 service. This can save the speed of the back-end server processing service packets and save network bandwidth.
  • the load balancing virtual machine 20212 may also process the service request of the virtual machine 20213 through the load balancing algorithm, and then send it to the virtual machine 20314 in the computer device 203, and the virtual machine 20314 serves as the processing virtual machine 20213.
  • the backend server processes the services initiated by the virtual machine 20213.
  • step 906 in FIG. 9 indicates that the load balancing virtual machine 20212 can forward the service initiated by the virtual machine 20213 to the backend server in the computer device 202, that is, the virtual machine 20214, and can also forward the service.
  • the backend server and virtual machine 20314 in the computer device 203 are provided.
  • the manner in which the backend server returns the processed service request to the virtual machine 20213 may include two types:
  • Method 1 The backend server processing the virtual machine 20213 service request, and returning the processed result to the virtual machine 20213 through the load balancing virtual machine 20212;
  • Manner 2 The back-end server that processes the service request of the virtual machine 20213 does not pass the load balancing virtual machine 20212, and directly returns the processed result to the virtual machine 20213.
  • the load balancing virtual machine 20212 writes the source address (including the IP address and the MC address, etc.) of the service request as load balancing when forwarding the service request of the virtual machine 20213 to the backend server that processes the virtual machine 20213 service request.
  • the address of the virtual machine 20212 writes the destination address as the address of the backend server that processes the virtual machine 20213 service request.
  • the backend server processing the service request of the virtual machine 20213 returns the result of processing the service request to the load balancing virtual machine 20212 according to the source address carried in the service request, and the load balancing virtual machine 20212 returns the service request received. Sent to virtual machine 20213.
  • the load balancing virtual machine 20212 writes the source address (including the IP address, the MC address, and the like) as the address of the virtual machine 20213 when forwarding the service request of the virtual machine 20213 to the backend server that processes the virtual machine 20213 service request.
  • the destination address is written as the address of the backend server that processes the virtual machine 20213 service request.
  • the backend server that processes the virtual machine 20213 service request returns the result of processing the service request to the virtual machine 20213 according to the source address carried when receiving the service request.
  • step 908 in FIG. 9 indicates that the load balancing virtual machine 20212 forwards the service initiated by the virtual machine 20213 to the backend server in the computer device 202, that is, the virtual machine 20214.
  • the processed service request is returned by the virtual machine 20214 to the virtual machine 20213.
  • the load balancing virtual machine 20212 forwards the service initiated by the virtual machine 20213 to the backend server in the computer device 203, that is, the virtual machine 20314
  • the virtual machine 20314 returns the processed service request to the virtual machine 20213.
  • the computer device 202 and the computer device 203 are also referred to as service computer devices.
  • a virtual machine running on computer device 202 and/or computer device 203, such as virtual machine 20213, is also referred to as a virtual machine that initiates a service, and the services initiated by the computer device 202 include load balancing services.
  • the implementation process of the above steps 900- 908 is described by taking the computer device 201 as the cloud management platform to create the load balancing virtual machine 20212 in the computer device 202 as an example. It can be understood that the process for the computer device 201 to create the load balancing virtual machine 20312 in the computer device 203 is similar to the above process and will not be described again.
  • computer device 201 can create a load balancing virtual machine in computer device 202 and computer device 203, respectively.
  • the service packets of the load balancing service initiated by the service virtual machine (for example, the virtual machine 20213 or the virtual machine 20313) on each of the business computer devices (for example, the computer device 202 and the computer device 203) are forwarded to the local load balancing virtual machine. That is, the load balancing service initiated by the service virtual machine 20213 in the business computer device 202 is only forwarded to the load balancing virtual machine (ie, the load balancing virtual machine 20212) local to the computer device 202 to implement the load balancing service.
  • the load balancing service initiated by the service virtual machine 20313 in the service computer device 203 is only forwarded to the load balancing virtual machine (ie, the load balancing virtual machine 20312) local to the computer device 203 to implement the load balancing service.
  • the load balancing service initiated by the service virtual machine 20213 in the service computer device 202 is only forwarded to the load balancing virtual machine (ie, the load balancing virtual machine 20212) local to the computer device 202 to implement the load balancing service; in the service computer device 203
  • the load balancing service initiated by the service virtual machine 20313 is only forwarded to the load balancing virtual machine (ie, the load balancing virtual machine 20312) local to the computer device 203 to implement the load balancing service.
  • the IP address of the load balancing virtual machine 20212 in the business computer device 202 can be the same as the IP address of the load balancing virtual machine 20312 in the business computer device 203; likewise, the MAC address of the load balancing virtual machine 20212 in the business computer device 202.
  • the MAC address of the load balancing virtual machine 20312 in the business computer device 203 can be the same. In this way, IP address resources and/or MAC address resources in the network formed by the computer devices can be saved.
  • the disclosed systems, devices, and methods may be implemented in other manners.
  • the device embodiments described above are merely illustrative.
  • the division of the unit is only a logical function division.
  • there may be another division manner for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored or not executed.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, or an electrical, mechanical or other form of connection.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the embodiments of the present invention.
  • each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may 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.
  • the integrated unit if implemented in the form of a software functional unit and sold or used as a standalone product, may be stored in a computer readable storage medium.
  • the technical solution of the present invention contributes in essence or to the prior art, or all or part of the technical solution may be embodied in the form of a software product stored in a storage medium.
  • Including a number of instructions for causing a computer device (which may be a personal computer, server, or network device, etc.) to perform the methods of the various embodiments of the present invention All or part of the steps.
  • the foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like. .

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Computer And Data Communications (AREA)

Abstract

Disclosed are a computer device, a system and a method for load balancing, solving the problems in the art of service interruption caused by the switching of master and backup load balancing modes, and congestion caused by centralized load balancing. By creating a load balancing virtual machine in each computer device, when load balancing processing needs to be performed on a service of the virtual machine in the computer device, a relevant service message is only sent to the load balancing virtual machine in the computer device for load balancing processing, thereby avoiding a processing delay caused by congestion of centralized load balancing. Moreover, when the computer device fails, the virtual machine in the computer device also goes offline, without generating a demand for load balancing. Therefore, in a load balancing virtual machine fault caused by a single computer device fault, there is no service interruption brought about by master-backup switching caused by the load balancing virtual machine fault.

Description

实现负载均衡的计算机设备、系统和方法Computer device, system and method for realizing load balancing 技术领域Technical field
本发明涉及信息技术,特别涉及实现负载均衡的计算机设备、系统和方法。The present invention relates to information technology, and more particularly to computer equipment, systems and methods for implementing load balancing.
背景技术Background technique
负载均衡是由多台服务器以对称的方式组成一个服务器集合,每台服务器都具有等价的地位,都可以单独对外提供服务而无须其他服务器的辅助。通过某种负载分担技术,将外部发送来的请求均匀分配到对称结构中的某一台服务器上,而接收到请求的服务器独立地回应客户的请求。均衡负载能够平均分配客户请求到服务器列阵,籍此提供快速获取重要数据,解决大量并发访问服务问题。这种群集技术可以用最少的投资获得接近于大型主机的性能。Load balancing is a collection of servers in a symmetric manner by multiple servers. Each server has an equivalent status and can provide services separately without the assistance of other servers. Through some load sharing technology, externally sent requests are evenly distributed to a server in a symmetric structure, and the server receiving the request independently responds to the client's request. The balanced load distributes client requests evenly to the server array, providing fast access to critical data and addressing a large number of concurrent access services. This clustering technology can achieve near-mainframe performance with minimal investment.
随着云计算技术的发展,各种业务迁移到云环境中,对负载均衡器也提出了云化的需求,虚拟化负载均衡器(vLB,Virtual Load Balancer)应运而生。With the development of cloud computing technology, various services have migrated to the cloud environment, and the demand for cloud load has also been put forward for the load balancer. The virtual load balancer (vLB) has emerged.
目前虚拟化负载均衡器大部分是传统负载均衡器的虚拟化和软件化,这些都无法满足云计算的对vLB在高可靠性,水平扩展,高带宽方面的需求。为提高vLB服务的可靠性,往往通过两台vLB以主备关系提供服务。主备vLB之间通过虚拟路由冗余协议(VRRP,Virtual Router Redundancy Protocol)协议传递心跳信息,当备机发现主机宕机,备机接替主机继续进行工作。这种通过VRRP实现的主备关系,在主机宕机后,备机接着工作,主备切换需要一定的时间,造成切换过程中流量的中断。并且,所有的负载均衡业务都要到一个负载均衡节点执行负载均衡,当负载均衡的访 问量大的时候,集中的负载均衡节点带宽会成为瓶颈,造成业务的拥塞和延迟。At present, most of the virtualized load balancers are virtualized and softwareized by traditional load balancers, which cannot meet the requirements of cloud computing for high reliability, horizontal expansion and high bandwidth. To improve the reliability of the vLB service, the two vLBs are used to provide services in active/standby relationship. The heartbeat information is transmitted between the active and standby vLBs through the Virtual Router Redundancy Protocol (VRRP). When the standby device finds that the host is down, the standby device takes over the host and continues to work. The active/standby relationship implemented by VRRP takes place after the host is down. The active/standby switchover takes a certain amount of time, causing traffic interruption during the handover process. Moreover, all load balancing services must perform load balancing to a load balancing node, when load balancing access When the volume is large, the bandwidth of the centralized load balancing node becomes a bottleneck, causing congestion and delay of the service.
发明内容Summary of the invention
本发明实施例提供一种实现负载均衡的计算机设备、系统和方法,以解决现有技术中主备负载均衡模式因切换造成的业务中断,以及集中式的负载均衡造成的拥塞的问题。The embodiments of the present invention provide a computer device, a system, and a method for implementing load balancing to solve the problem of traffic interruption caused by handover in the active/standby load balancing mode and congestion caused by centralized load balancing in the prior art.
一方面,本发明实施例提供了一种实现负载均衡的方法,应用于包括至少两台计算机设备的计算机系统,其中,每台计算机设备包括中央处理器和内存,所述至少两台计算机设备中包括第一计算机设备和第二计算机设备,所述第一计算机设备作为云管理平台,所述第二计算机设备运行有发起业务的虚拟机,所述业务为负载均衡业务,包括:In one aspect, an embodiment of the present invention provides a method for implementing load balancing, which is applied to a computer system including at least two computer devices, where each computer device includes a central processing unit and a memory, and the at least two computer devices are included. The first computer device is a cloud management platform, and the second computer device is a virtual machine that initiates a service, where the service is a load balancing service, including:
所述第一计算机设备获得待创建在所述第二计算机设备的负载均衡器的配置信息,所述负载均衡器的配置信息包括所述负载均衡器的标识、所述负载均衡器的虚拟化IP地址VIP,所述负载均衡器的VIP指示所述负载均衡业务;The first computer device obtains configuration information of a load balancer to be created in the second computer device, the configuration information of the load balancer includes an identifier of the load balancer, and a virtualized IP of the load balancer Address VIP, the VIP of the load balancer indicates the load balancing service;
所述第一计算机设备根据所述配置信息,在所述第二计算机设备上创建所述负载均衡器;The first computer device creates the load balancer on the second computer device according to the configuration information;
所述第一计算机设备在所述第二计算机设备上配置所述负载均衡业务的转发模式,所述转发模式使得所述第二计算机设备上的所述发起业务的虚拟机发起的所述负载均衡业务的业务报文定向转发到所述负载均衡器;The first computer device configures a forwarding mode of the load balancing service on the second computer device, the forwarding mode causing the load balancing initiated by the virtual machine initiating the service on the second computer device The service packet of the service is forwarded to the load balancer.
所述第二计算机设备上的所述发起业务的虚拟机根据所述转发模式,发送所述业务报文到所述负载均衡器;The virtual machine that initiates the service on the second computer device sends the service packet to the load balancer according to the forwarding mode;
所述第二计算机设备上的所述负载均衡器接收到所述业务报文后,选择至少一个后端服务器执行所述业务,所述后端服务器用于执行所述负载均衡业务。After receiving the service packet, the load balancer on the second computer device selects at least one backend server to execute the service, and the backend server is configured to execute the load balancing service.
在一种可能的设计中,所述第一计算机设备在所述第二计算机设备上 配置所述负载均衡业务的转发模式包括:In a possible design, the first computer device is on the second computer device The forwarding mode of the load balancing service is as follows:
所述第一计算机设备配置所述第二计算机设备上部署的虚拟交换机,将所述负载均衡器的MAC地址发送给所述发起业务的虚拟机;The first computer device configures a virtual switch deployed on the second computer device, and sends a MAC address of the load balancer to the virtual machine that initiates the service;
所述第二计算机设备上的所述发起业务的虚拟机根据所述转发模式,发送所述业务报文到所述负载均衡器包括:The sending the service packet to the load balancer according to the forwarding mode of the virtual machine that initiates the service on the second computer device includes:
所述发起业务的虚拟机发送所述负载均衡器的MAC地址作为目的地址的所述业务报文,所述虚拟交换机根据所述业务报文的目的地址将所述业务报文发送到所述负载均衡器。The virtual machine that sends the service sends the MAC address of the load balancer as the service packet of the destination address, and the virtual switch sends the service packet to the load according to the destination address of the service packet. Equalizer.
在一种可能的设计中,在所述发起业务的虚拟机发送所述负载均衡器的MAC地址作为目的地址的所述业务报文之前,所述方法还包括:In a possible design, before the virtual machine that initiates the service sends the MAC address of the load balancer as the service message of the destination address, the method further includes:
所述发起业务的虚拟机发送控制报文到所述虚拟交换机,所述控制报文携带所述VIP;The virtual machine that initiates the service sends a control packet to the virtual switch, where the control packet carries the VIP;
所述虚拟交换机向所述发起业务的虚拟机发送所述控制报文的响应消息,所述响应消息中携带所述负载均衡器的MAC地址。The virtual switch sends a response message of the control packet to the virtual machine that initiates the service, where the response message carries the MAC address of the load balancer.
在一种可能的设计中,所述控制报文为地址解析协议ARP报文或互联网控制消息协议ICMP报文。In a possible design, the control message is an address resolution protocol ARP message or an Internet Control Message Protocol (ICMP) message.
在一种可能的设计中,所述第一计算机设备在所述第二计算机设备上配置所述负载均衡业务的转发模式,包括:In a possible design, the first computer device configures a forwarding mode of the load balancing service on the second computer device, including:
所述第一计算机设备指示所述负载均衡器将所述负载均衡器的MAC地址发送给所述发起业务的虚拟机;或者,The first computer device instructs the load balancer to send a MAC address of the load balancer to the virtual machine that initiates the service; or
所述第一计算机设备在所述发起业务的虚拟机上配置所述负载均衡器的MAC地址;The first computer device configures a MAC address of the load balancer on the virtual machine that initiates the service;
相应的,所述第二计算机设备上的所述发起业务的虚拟机根据所述转发模式,发送所述业务报文到所述负载均衡器包括:Correspondingly, the sending, by the virtual machine of the initiating service on the second computer device, the sending the service packet to the load balancer according to the forwarding mode comprises:
所述发起业务的虚拟机发送所述负载均衡器的MAC地址作为目的地址的所述业务报文,所述第二计算机设备上部署的虚拟交换机根据所述业务 报文的目的地址将所述业务报文发送到所述负载均衡器。The virtual machine that initiates the service sends the MAC address of the load balancer as the service packet of the destination address, and the virtual switch deployed on the second computer device is configured according to the service The destination address of the packet sends the service packet to the load balancer.
在一种可能的设计中,所述第一计算机设备根据所述配置信息,在所述第二计算机设备上创建所述负载均衡器包括:In a possible design, the creating, by the first computer device, the load balancer on the second computer device according to the configuration information includes:
所述第一计算机设备在所述第二计算机设备上创建第一台发起所述负载均衡业务的虚拟机后,创建所述负载均衡器。After the first computer device creates the first virtual machine that initiates the load balancing service on the second computer device, the load equalizer is created.
在一种可能的设计中,,所述方法还包括:In a possible design, the method further includes:
所述第一计算机设备在所述第二计算机设备上创建的最后一台发起所述负载均衡业务的虚拟机被删除后,删除所述创建的负载均衡器。And deleting, by the first computer device, the created load balancer after the last one created by the second computer device initiates the load balancing service is deleted.
在一种可能的设计中,所述方法还包括:In one possible design, the method further includes:
所述选择的后端服务器将执行所述业务的结果直接返回给所述发起业务的虚拟机;或者,The selected backend server directly returns the result of executing the service to the virtual machine that initiates the service; or
所述选择的后端服务器将所述业务的执行结果返回给所述负载均衡器,由所述负载均衡器将所述执行结果返回给所述发起业务的虚拟机。The selected backend server returns an execution result of the service to the load balancer, and the load balancer returns the execution result to the virtual machine that initiates the service.
另一方面,本发明实施例提供了一种实现负载均衡的方法,应用于包括至少三台计算机设备的计算机系统,其中,每台计算机设备包括中央处理器和内存,所述至少三台计算机设备中包括第一计算机设备,所述第一计算机设备作为云管理平台,所述至少三台计算机设备中除所述第一计算机设备之外的计算机设备作为业务计算机设备,每台业务计算机设备上运行有发起业务的虚拟机,所述业务为负载均衡业务,包括:In another aspect, an embodiment of the present invention provides a method for implementing load balancing, which is applied to a computer system including at least three computer devices, wherein each computer device includes a central processing unit and a memory, and the at least three computer devices The first computer device includes a first computer device as a cloud management platform, and the computer device other than the first computer device of the at least three computer devices operates as a business computer device on each business computer device There is a virtual machine that initiates a service, and the service is a load balancing service, including:
所述第一计算机设备分别获得待创建在每台业务计算机设备上的负载均衡器的配置信息,所述负载均衡器的配置信息包括所述负载均衡器的标识、所述负载均衡器的虚拟化IP地址VIP,所述负载均衡器的VIP指示所述负载均衡业务;The first computer device respectively obtains configuration information of a load balancer to be created on each service computer device, where configuration information of the load balancer includes an identifier of the load balancer, and virtualization of the load balancer IP address VIP, the VIP of the load balancer indicates the load balancing service;
所述第一计算机设备根据所述待创建在所述每台业务计算机设备的负载均衡器的配置信息,在所述每台业务计算机设备上创建所述每台业务计算机设备的本地负载均衡器; The first computer device creates a local load balancer of each of the service computer devices on each of the service computer devices according to the configuration information of the load balancer to be created in each of the service computer devices;
所述第一计算机设备在所述每台业务计算机设备上配置所述负载均衡业务的转发模式,所述转发模式使得所述每台业务计算机设备上的所述发起业务的虚拟机发起的所述负载均衡业务的业务报文定向转发到本地的负载均衡器,以使得所述每台业务计算机设备上的本地的负载均衡器对本业务计算机设备上的所述发起业务的虚拟机发起的业务报文进行负载均衡的处理。Configuring, by the first computer device, a forwarding mode of the load balancing service on each of the service computer devices, the forwarding mode causing the virtual machine initiated by the originating service on each of the service computer devices to initiate the The service packet of the load balancing service is forwarded to the local load balancer, so that the local load balancer on each service computer device initiates a service packet to the virtual machine that initiates the service on the service computer device. Perform load balancing processing.
在一种可能的设计中,所述第一计算机设备在所述每台业务计算机设备上配置所述负载均衡业务的转发模式包括:In a possible design, the forwarding mode of the first computer device configuring the load balancing service on each of the service computer devices includes:
所述第一计算机设备配置所述每台业务计算机设备上部署的虚拟交换机,将本地的负载均衡器的MAC地址发送给本地的所述发起业务的虚拟机。The first computer device configures the virtual switch deployed on each of the service computer devices to send the MAC address of the local load balancer to the local virtual machine that initiates the service.
在一种可能的设计中,所述第一计算机设备配置所述每台业务计算机设备上部署的虚拟交换机,将所述本地的负载均衡器的MAC地址发送给本地的所述发起业务的虚拟机之后还包括:In a possible design, the first computer device configures a virtual switch deployed on each of the service computer devices, and sends the MAC address of the local load balancer to the local virtual machine of the originating service. It also includes:
所述每台业务计算机设备上发起业务的虚拟机发送控制报文到本地的所述虚拟交换机,所述控制报文携带所述VIP;The virtual machine that initiates the service on each of the service computer devices sends a control packet to the local virtual switch, and the control packet carries the VIP;
所述每台业务计算机设备上本地的虚拟交换机向所述本地的发起业务的虚拟机发送所述控制报文的响应消息,所述响应消息中携带所述本地的负载均衡器的MAC地址。The local virtual switch on each of the service computer devices sends a response message of the control packet to the local virtual machine that initiates the service, where the response message carries the MAC address of the local load balancer.
在一种可能的设计中,所述第一计算机设备根据所述配置信息,在所述每台业务计算机设备上创建所述负载均衡器之前,还包括:In a possible design, the first computer device, before creating the load balancer on each of the service computer devices, according to the configuration information, further includes:
所述第一计算机设备获知第一业务计算机设备上创建了第一台所述发起业务的虚拟机,在所述第一业务计算机设备上创建所述第一业务计算机设备的负载均衡器,直至在每台业务计算机设备上创建所述每台业务计算机设备上的本地负载均衡器。The first computer device learns that the first virtual machine of the first service computer device is created on the first service computer device, and the load balancer of the first service computer device is created on the first service computer device until A local load balancer on each of the business computer devices is created on each business computer device.
在一种可能的设计中,所述负载均衡器包括负载均衡虚拟机、负载均衡容器或负载均衡的namespace。 In one possible design, the load balancer includes a load balancing virtual machine, a load balancing container, or a load balancing namespace.
另一方面,本发明实施例提供了一种实现负载均衡的方法,应用于包括至少两台计算机设备的计算机系统,其中,每台计算机设备包括中央处理器和内存,所述至少两台计算机设备中包括第一计算机设备和第二计算机设备,所述第一计算机设备作为云管理平台,所述第二计算机设备运行有发起业务的虚拟机,所述业务为负载均衡业务,包括:In another aspect, an embodiment of the present invention provides a method for implementing load balancing, which is applied to a computer system including at least two computer devices, wherein each computer device includes a central processing unit and a memory, and the at least two computer devices The first computer device and the second computer device are included, the first computer device is a cloud management platform, and the second computer device is running a virtual machine that initiates a service, where the service is a load balancing service, including:
所述第一计算机设备获得待创建在所述第二计算机设备的负载均衡器的配置信息,所述负载均衡器的配置信息包括所述负载均衡器的标识、所述负载均衡器的虚拟化IP地址VIP,所述负载均衡器的VIP指示所述负载均衡业务;The first computer device obtains configuration information of a load balancer to be created in the second computer device, the configuration information of the load balancer includes an identifier of the load balancer, and a virtualized IP of the load balancer Address VIP, the VIP of the load balancer indicates the load balancing service;
所述第一计算机设备根据所述配置信息,在所述第二计算机设备上创建所述负载均衡器;The first computer device creates the load balancer on the second computer device according to the configuration information;
所述第一计算机设备在所述第二计算机设备上配置所述负载均衡业务的转发模式,所述转发模式使得所述第二计算机设备上的所述发起业务的虚拟机发起的所述负载均衡业务的业务报文定向转发到所述负载均衡器,以使得所述负载均衡器接收到所述业务报文后,选择执行所述业务的后端服务器。The first computer device configures a forwarding mode of the load balancing service on the second computer device, the forwarding mode causing the load balancing initiated by the virtual machine initiating the service on the second computer device The service packet of the service is forwarded to the load balancer, so that the load balancer selects the backend server that executes the service after receiving the service packet.
在一种可能的设计中,所述第一计算机设备在所述第二计算机设备上配置所述负载均衡业务的转发模式,包括:In a possible design, the first computer device configures a forwarding mode of the load balancing service on the second computer device, including:
所述第一计算机设备配置所述第二计算机设备上部署的虚拟交换机将所述负载均衡器的MAC地址发送给所述发起业务的虚拟机,以使得所述发起业务的虚拟机发送所述负载均衡器的MAC地址作为目的地址的所述业务报文。The first computer device configures a virtual switch deployed on the second computer device to send a MAC address of the load balancer to the virtual machine that initiates the service, so that the virtual machine that initiates the service sends the load The MAC address of the equalizer is used as the service packet of the destination address.
在一种可能的设计中,所述第一计算机设备配置所述第二计算机设备上部署的虚拟交换机将所述负载均衡器的MAC地址发送给所述发起业务的虚拟机之后还包括:In a possible design, after the first computer device configures the virtual switch deployed on the second computer device to send the MAC address of the load balancer to the virtual machine that initiates the service, the method further includes:
所述发起业务的虚拟机发送控制报文到所述虚拟交换机,所述控制报 文携带所述VIP;The virtual machine that initiates the service sends a control packet to the virtual switch, and the control packet Carrying the VIP;
所述虚拟交换机向所述发起业务的虚拟机发送所述控制报文的响应消息,所述响应消息中携带所述负载均衡器的MAC地址。The virtual switch sends a response message of the control packet to the virtual machine that initiates the service, where the response message carries the MAC address of the load balancer.
在一种可能的设计中,所述第一计算机设备根据所述配置信息,在所述第二计算机设备上创建所述负载均衡包括:In a possible design, the first computer device creates the load balancing on the second computer device according to the configuration information, including:
所述第一计算机设备在所述第二计算机设备上创建第一台发起所述负载均衡业务的虚拟机后,创建所述负载均衡器。After the first computer device creates the first virtual machine that initiates the load balancing service on the second computer device, the load equalizer is created.
在一种可能的设计中,所述方法还包括:In one possible design, the method further includes:
所述第一计算机设备在所述第二计算机设备上创建的最后一台发起所述负载均衡业务的虚拟机被删除后,删除所述创建的负载均衡器。And deleting, by the first computer device, the created load balancer after the last one created by the second computer device initiates the load balancing service is deleted.
另一方面,本发明实施例提供了一种实现负载均衡的计算机系统,包括至少两台计算机设备,其中,每台计算机设备包括中央处理器和内存,所述至少两台计算机设备中包括第一计算机设备和第二计算机设备,所述第一计算机设备作为云管理平台,所述第二计算机设备运行有发起业务的虚拟机,所述业务为负载均衡业务,其中,In another aspect, an embodiment of the present invention provides a computer system for implementing load balancing, including at least two computer devices, wherein each computer device includes a central processing unit and a memory, and the at least two computer devices include a first one. a computer device and a second computer device, the first computer device as a cloud management platform, the second computer device running a virtual machine that initiates a service, and the service is a load balancing service, wherein
所述第一计算机设备获得待创建在所述第二计算机设备的负载均衡器的配置信息,所述负载均衡器的配置信息包括所述负载均衡器的标识、所述负载均衡器的虚拟化IP地址VIP,所述负载均衡器的VIP指示所述负载均衡业务;The first computer device obtains configuration information of a load balancer to be created in the second computer device, the configuration information of the load balancer includes an identifier of the load balancer, and a virtualized IP of the load balancer Address VIP, the VIP of the load balancer indicates the load balancing service;
所述第一计算机设备根据所述配置信息,在所述第二计算机设备上创建所述负载均衡器;The first computer device creates the load balancer on the second computer device according to the configuration information;
所述第一计算机设备在所述第二计算机设备上配置所述负载均衡业务的转发模式,所述转发模式使得所述第二计算机设备上的所述发起业务的虚拟机发起的所述负载均衡业务的业务报文定向转发到所述负载均衡器;The first computer device configures a forwarding mode of the load balancing service on the second computer device, the forwarding mode causing the load balancing initiated by the virtual machine initiating the service on the second computer device The service packet of the service is forwarded to the load balancer.
所述第二计算机设备上的所述发起业务的虚拟机根据所述转发模式,发送所述业务报文到所述负载均衡器; The virtual machine that initiates the service on the second computer device sends the service packet to the load balancer according to the forwarding mode;
所述第二计算机设备上的所述负载均衡器接收到所述业务报文后,选择至少一个后端服务器执行所述业务,所述后端服务器用于执行所述负载均衡业务。After receiving the service packet, the load balancer on the second computer device selects at least one backend server to execute the service, and the backend server is configured to execute the load balancing service.
在一种可能的设计中,所述第一计算机设备在所述第二计算机设备上配置所述负载均衡业务的转发模式包括:In a possible design, the forwarding mode of the first computer device configuring the load balancing service on the second computer device includes:
所述第一计算机设备配置所述第二计算机设备上部署的虚拟交换机,将所述负载均衡器的MAC地址发送给所述发起业务的虚拟机;The first computer device configures a virtual switch deployed on the second computer device, and sends a MAC address of the load balancer to the virtual machine that initiates the service;
所述第二计算机设备上的所述发起业务的虚拟机根据所述转发模式,发送所述业务报文到所述负载均衡器包括:The sending the service packet to the load balancer according to the forwarding mode of the virtual machine that initiates the service on the second computer device includes:
所述发起业务的虚拟机发送所述负载均衡器的MAC地址作为目的地址的所述业务报文,所述虚拟交换机根据所述业务报文的目的地址将所述业务报文发送到所述负载均衡器。The virtual machine that sends the service sends the MAC address of the load balancer as the service packet of the destination address, and the virtual switch sends the service packet to the load according to the destination address of the service packet. Equalizer.
在一种可能的设计中,在所述发起业务的虚拟机发送所述负载均衡器的MAC地址作为目的地址的所述业务报文之前,还包括:In a possible design, before the virtual machine that sends the service sends the MAC address of the load balancer as the service message of the destination address, the method further includes:
所述发起业务的虚拟机发送控制报文到所述虚拟交换机,所述控制报文携带所述VIP;The virtual machine that initiates the service sends a control packet to the virtual switch, where the control packet carries the VIP;
所述虚拟交换机向所述发起业务的虚拟机发送所述控制报文的响应消息,所述响应消息中携带所述负载均衡器的MAC地址。The virtual switch sends a response message of the control packet to the virtual machine that initiates the service, where the response message carries the MAC address of the load balancer.
在一种可能的设计中,所述控制报文为地址解析协议ARP报文或互联网控制消息协议ICMP报文。In a possible design, the control message is an address resolution protocol ARP message or an Internet Control Message Protocol (ICMP) message.
在一种可能的设计中,所述第一计算机设备在所述第二计算机设备上配置所述负载均衡业务的转发模式,包括:In a possible design, the first computer device configures a forwarding mode of the load balancing service on the second computer device, including:
所述第一计算机设备指示所述负载均衡器将所述负载均衡器的MAC地址发送给所述发起业务的虚拟机;或者,The first computer device instructs the load balancer to send a MAC address of the load balancer to the virtual machine that initiates the service; or
所述第一计算机设备在所述发起业务的虚拟机上配置所述负载均衡器的MAC地址; The first computer device configures a MAC address of the load balancer on the virtual machine that initiates the service;
相应的,所述第二计算机设备上的所述发起业务的虚拟机根据所述转发模式,发送所述业务报文到所述负载均衡器包括:Correspondingly, the sending, by the virtual machine of the initiating service on the second computer device, the sending the service packet to the load balancer according to the forwarding mode comprises:
所述发起业务的虚拟机发送所述负载均衡器的MAC地址作为目的地址的所述业务报文,所述第二计算机设备上部署的虚拟交换机根据所述业务报文的目的地址将所述业务报文发送到所述负载均衡器。The virtual machine that initiates the service sends the MAC address of the load balancer as the service packet of the destination address, and the virtual switch deployed on the second computer device sends the service according to the destination address of the service packet. The message is sent to the load balancer.
在一种可能的设计中,所述第一计算机设备根据所述配置信息,在所述第二计算机设备上创建所述负载均衡器包括:In a possible design, the creating, by the first computer device, the load balancer on the second computer device according to the configuration information includes:
所述第一计算机设备在所述第二计算机设备上创建第一台发起所述负载均衡业务的虚拟机后,创建所述负载均衡器。After the first computer device creates the first virtual machine that initiates the load balancing service on the second computer device, the load equalizer is created.
在一种可能的设计中,所述第一计算机设备在所述第二计算机设备上创建的最后一台发起所述负载均衡业务的虚拟机被删除后,删除所述创建的负载均衡器。In a possible design, the first computer device deletes the created load balancer after the last virtual machine created on the second computer device that initiates the load balancing service is deleted.
在一种可能的设计中,所述选择的后端服务器将执行所述业务的结果直接返回给所述发起业务的虚拟机;或者,In a possible design, the selected backend server directly returns the result of executing the service to the virtual machine that initiated the service; or
所述选择的后端服务器将所述业务的执行结果返回给所述负载均衡器,由所述负载均衡器将所述执行结果返回给所述发起业务的虚拟机。The selected backend server returns an execution result of the service to the load balancer, and the load balancer returns the execution result to the virtual machine that initiates the service.
另一方面,本发明实施例提供了一种实现负载均衡的计算机系统,所述计算机系统包括至少三台计算机设备,其中,每台计算机设备包括中央处理器和内存,所述至少三台计算机设备中包括第一计算机设备,所述第一计算机设备作为云管理平台,所述至少三台计算机设备中除所述第一计算机设备之外的计算机设备作为业务计算机设备,每台业务计算机设备上运行有发起业务的虚拟机,所述业务为负载均衡业务,其中,In another aspect, an embodiment of the present invention provides a computer system for implementing load balancing, the computer system including at least three computer devices, wherein each computer device includes a central processing unit and a memory, and the at least three computer devices The first computer device includes a first computer device as a cloud management platform, and the computer device other than the first computer device of the at least three computer devices operates as a business computer device on each business computer device There is a virtual machine that initiates a service, where the service is a load balancing service, where
所述第一计算机设备分别获得待创建在每台业务计算机设备上的负载均衡器的配置信息,所述负载均衡器的配置信息包括所述负载均衡器的标识、所述负载均衡器的虚拟化IP地址VIP,所述负载均衡器的VIP指示所述负载均衡业务; The first computer device respectively obtains configuration information of a load balancer to be created on each service computer device, where configuration information of the load balancer includes an identifier of the load balancer, and virtualization of the load balancer IP address VIP, the VIP of the load balancer indicates the load balancing service;
所述第一计算机设备根据所述待创建在所述每台业务计算机设备的负载均衡器的配置信息,在所述每台业务计算机设备上创建所述每台业务计算机设备的本地负载均衡器;The first computer device creates a local load balancer of each of the service computer devices on each of the service computer devices according to the configuration information of the load balancer to be created in each of the service computer devices;
所述第一计算机设备在所述每台业务计算机设备上配置所述负载均衡业务的转发模式,所述转发模式使得所述每台业务计算机设备上的所述发起业务的虚拟机发起的所述负载均衡业务的业务报文定向转发到本地的负载均衡器,以使得所述每台业务计算机设备上的本地的负载均衡器对本业务计算机设备上的所述发起业务的虚拟机发起的业务报文进行负载均衡的处理。Configuring, by the first computer device, a forwarding mode of the load balancing service on each of the service computer devices, the forwarding mode causing the virtual machine initiated by the originating service on each of the service computer devices to initiate the The service packet of the load balancing service is forwarded to the local load balancer, so that the local load balancer on each service computer device initiates a service packet to the virtual machine that initiates the service on the service computer device. Perform load balancing processing.
在一种可能的设计中,所述第一计算机设备在所述每台业务计算机设备上配置所述负载均衡业务的转发模式包括:In a possible design, the forwarding mode of the first computer device configuring the load balancing service on each of the service computer devices includes:
所述第一计算机设备配置所述每台业务计算机设备上部署的虚拟交换机,将本地的负载均衡器的MAC地址发送给本地的所述发起业务的虚拟机。The first computer device configures the virtual switch deployed on each of the service computer devices to send the MAC address of the local load balancer to the local virtual machine that initiates the service.
在一种可能的设计中,所述第一计算机设备配置所述每台业务计算机设备上部署的虚拟交换机,将所述本地的负载均衡器的MAC地址发送给本地的所述发起业务的虚拟机之后还包括:In a possible design, the first computer device configures a virtual switch deployed on each of the service computer devices, and sends the MAC address of the local load balancer to the local virtual machine of the originating service. It also includes:
所述每台业务计算机设备上发起业务的虚拟机发送控制报文到本地的所述虚拟交换机,所述控制报文携带所述VIP;The virtual machine that initiates the service on each of the service computer devices sends a control packet to the local virtual switch, and the control packet carries the VIP;
所述每台业务计算机设备上本地的虚拟交换机向所述本地的发起业务的虚拟机发送所述控制报文的响应消息,所述响应消息中携带所述本地的负载均衡器的MAC地址。The local virtual switch on each of the service computer devices sends a response message of the control packet to the local virtual machine that initiates the service, where the response message carries the MAC address of the local load balancer.
在一种可能的设计中,所述第一计算机设备根据所述配置信息,在所述每台业务计算机设备上创建所述负载均衡器之前,还包括:In a possible design, the first computer device, before creating the load balancer on each of the service computer devices, according to the configuration information, further includes:
所述第一计算机设备获知第一业务计算机设备上创建了第一台所述发起业务的虚拟机,在所述第一业务计算机设备上创建所述第一业务计算机设备的负载均衡器,直至在每台业务计算机设备上创建所述每台业务计算 机设备上的本地负载均衡器。The first computer device learns that the first virtual machine of the first service computer device is created on the first service computer device, and the load balancer of the first service computer device is created on the first service computer device until Create each of the business calculations on each business computer device Local load balancer on the machine.
在一种可能的设计中,所述负载均衡器包括负载均衡虚拟机、负载均衡容器或负载均衡的namespace。In one possible design, the load balancer includes a load balancing virtual machine, a load balancing container, or a load balancing namespace.
另一方面,本发明实施例提供了一种实现负载均衡的计算机系统,所述计算机系统包括至少两台计算机设备,其中,每台计算机设备包括中央处理器和内存,所述至少两台计算机设备中包括第一计算机设备和第二计算机设备,所述第一计算机设备作为云管理平台,所述第二计算机设备运行有发起业务的虚拟机,所述业务为负载均衡业务,其中,In another aspect, an embodiment of the present invention provides a computer system for implementing load balancing, where the computer system includes at least two computer devices, wherein each computer device includes a central processing unit and a memory, and the at least two computer devices The first computer device and the second computer device are included, the first computer device is a cloud management platform, and the second computer device is running a virtual machine that initiates a service, where the service is a load balancing service, where
所述第一计算机设备获得待创建在所述第二计算机设备的负载均衡器的配置信息,所述负载均衡器的配置信息包括所述负载均衡器的标识、所述负载均衡器的虚拟化IP地址VIP,所述负载均衡器的VIP指示所述负载均衡业务;The first computer device obtains configuration information of a load balancer to be created in the second computer device, the configuration information of the load balancer includes an identifier of the load balancer, and a virtualized IP of the load balancer Address VIP, the VIP of the load balancer indicates the load balancing service;
所述第一计算机设备根据所述配置信息,在所述第二计算机设备上创建所述负载均衡器;The first computer device creates the load balancer on the second computer device according to the configuration information;
所述第一计算机设备在所述第二计算机设备上配置所述负载均衡业务的转发模式,所述转发模式使得所述第二计算机设备上的所述发起业务的虚拟机发起的所述负载均衡业务的业务报文定向转发到所述负载均衡器,以使得所述负载均衡器接收到所述业务报文后,选择执行所述业务的后端服务器。The first computer device configures a forwarding mode of the load balancing service on the second computer device, the forwarding mode causing the load balancing initiated by the virtual machine initiating the service on the second computer device The service packet of the service is forwarded to the load balancer, so that the load balancer selects the backend server that executes the service after receiving the service packet.
在一种可能的设计中,所述第一计算机设备在所述第二计算机设备上配置所述负载均衡业务的转发模式,包括:In a possible design, the first computer device configures a forwarding mode of the load balancing service on the second computer device, including:
所述第一计算机设备配置所述第二计算机设备上部署的虚拟交换机将所述负载均衡器的MAC地址发送给所述发起业务的虚拟机,以使得所述发起业务的虚拟机发送所述负载均衡器的MAC地址作为目的地址的所述业务报文。The first computer device configures a virtual switch deployed on the second computer device to send a MAC address of the load balancer to the virtual machine that initiates the service, so that the virtual machine that initiates the service sends the load The MAC address of the equalizer is used as the service packet of the destination address.
在一种可能的设计中,所述第一计算机设备配置所述第二计算机设备 上部署的虚拟交换机将所述负载均衡器的MAC地址发送给所述发起业务的虚拟机之后还包括:In a possible design, the first computer device configures the second computer device After the virtual switch deployed on the virtual switch sends the MAC address of the load balancer to the virtual machine that initiates the service, the method further includes:
所述发起业务的虚拟机发送控制报文到所述虚拟交换机,所述控制报文携带所述VIP;The virtual machine that initiates the service sends a control packet to the virtual switch, where the control packet carries the VIP;
所述虚拟交换机向所述发起业务的虚拟机发送所述控制报文的响应消息,所述响应消息中携带所述负载均衡器的MAC地址。The virtual switch sends a response message of the control packet to the virtual machine that initiates the service, where the response message carries the MAC address of the load balancer.
在一种可能的设计中,所述第一计算机设备根据所述配置信息,在所述第二计算机设备上创建所述负载均衡包括:In a possible design, the first computer device creates the load balancing on the second computer device according to the configuration information, including:
所述第一计算机设备在所述第二计算机设备上创建第一台发起所述负载均衡业务的虚拟机后,创建所述负载均衡器。After the first computer device creates the first virtual machine that initiates the load balancing service on the second computer device, the load equalizer is created.
在一种可能的设计中,所述方法还包括:In one possible design, the method further includes:
所述第一计算机设备在所述第二计算机设备上创建的最后一台发起所述负载均衡业务的虚拟机被删除后,删除所述创建的负载均衡器。And deleting, by the first computer device, the created load balancer after the last one created by the second computer device initiates the load balancing service is deleted.
为实现上述目的,本发明实施例的第一方面提供了一种计算机设备,包括中央处理器CPU、内存和存储设备,所述计算机设备中还包括第一虚拟机、负载均衡虚拟机和虚拟交换机,所述第一虚拟机和所述负载均衡虚拟机是在所述计算机设备中创建的虚拟机;To achieve the above objective, a first aspect of the embodiments of the present invention provides a computer device, including a central processing unit CPU, a memory, and a storage device, where the computer device further includes a first virtual machine, a load balancing virtual machine, and a virtual switch. The first virtual machine and the load balancing virtual machine are virtual machines created in the computer device;
所述第一虚拟机,用于发送业务报文;The first virtual machine is configured to send a service packet;
所述虚拟交换机,用于接收所述第一虚拟机发送的所述业务报文,在所述业务报文需要负载均衡处理时,只转发所述业务报文给所述负载均衡虚拟机;The virtual switch is configured to receive the service packet sent by the first virtual machine, and only forward the service packet to the load balancing virtual machine when the service packet needs load balancing processing;
所述负载均衡虚拟机,用于接收所述虚拟交换机转发的所述业务报文,基于负载均衡方式转发所述业务报文。The load balancing virtual machine is configured to receive the service packet forwarded by the virtual switch, and forward the service packet according to a load balancing manner.
所述负载均衡虚拟机基于负载均衡方式转发所述业务报文可以是:所述负载均衡虚拟机在收到业务报文后,首先判断是否已经为所述业务报文分配了一个后端服务器为其服务,如果已经分配了后端服务器,则将该业 务报文发送给已经分配的后端服务器。如果还没有分配后端服务器,则通过负载均衡算法,选择一个后端服务器为其服务。所述负载均衡算法包括但不限于:轮询、加权轮询、随机、最小连接或源地散列,基于位置优先的加权轮询等。所述位置优先的加权轮询方式,可以优先选择在发起业务报文的虚拟机所在的计算机设备中的后端服务器,这样能够节省后端服务器处理业务报文的速度,节省网络带宽。After the load balancing virtual machine forwards the service packet based on the load balancing mode, the load balancing virtual machine first determines whether a backend server has been allocated for the service packet after receiving the service packet. Its service, if the backend server has been assigned, then the industry The service message is sent to the backend server that has been assigned. If a backend server has not been assigned, select a backend server to serve it through a load balancing algorithm. The load balancing algorithms include, but are not limited to, polling, weighted polling, random, minimum or source-to-ground hashing, location-based weighted polling, and the like. The location-prioritized weighted polling mode can preferentially select the back-end server in the computer device where the virtual machine that initiates the service packet is located, which can save the speed of the back-end server processing the service packet and save the network bandwidth.
结合第一方面,本发明实施例第一方面的第一种可能的实现方式中,所述虚拟交换机只转发所述业务报文给所述负载均衡虚拟机包括:With reference to the first aspect, in a first possible implementation manner of the first aspect of the present disclosure, the that the virtual switch only forwards the service packet to the load balancing virtual machine includes:
所述虚拟交换机将所述负载均衡虚拟机的MAC地址发送给所述第一虚拟机,使得所述第一虚拟机基于获取到的所述负载均衡虚拟机的MAC地址发送所述业务报文,所述虚拟交换机将所述业务报文转发给所述负载均衡虚拟机;或,The virtual switch sends the MAC address of the load balancing virtual machine to the first virtual machine, so that the first virtual machine sends the service packet based on the obtained MAC address of the load balancing virtual machine. Transmitting, by the virtual switch, the service packet to the load balancing virtual machine; or
所述负载均衡虚拟机将其MAC地址发送给所述第一虚拟机,使得所述第一虚拟机基于获取到的所述负载均衡虚拟机MAC地址发送所述业务报文,所述虚拟交换机将所述业务报文转发给所述负载均衡虚拟机;或,The load balancing virtual machine sends its MAC address to the first virtual machine, so that the first virtual machine sends the service packet based on the acquired load balancing virtual machine MAC address, and the virtual switch will Transmitting the service packet to the load balancing virtual machine; or
所述第一虚拟机基于预先配置的所述负载均衡虚拟机的MAC地址发送所述业务报文,所述虚拟交换机将所述业务报文转发给所述负载均衡虚拟机。The first virtual machine sends the service packet based on the pre-configured MAC address of the load balancing virtual machine, and the virtual switch forwards the service packet to the load balancing virtual machine.
结合第一方面的第一种可能的实现方式,本发明实施例第一方面的第二种可能的实现方式中,所述虚拟交换机将所述负载均衡虚拟机的MAC地址发送给所述第一虚拟机包括:In conjunction with the first possible implementation of the first aspect, in a second possible implementation manner of the first aspect of the embodiments, the virtual switch sends the MAC address of the load balancing virtual machine to the first Virtual machines include:
所述虚拟交换机接收所述第一虚拟机发送的控制报文,向所述第一虚拟机返回控制响应报文,所述控制响应报文包含所述负载均衡虚拟机的MAC地址。即所述虚拟交换机可以根据配置的转发模式对所述第一虚拟机的业务报文进行定向处理,使得所述第一虚拟交换机将所述业务报文转发给所述第一负载均衡虚拟机。 The virtual switch receives the control packet sent by the first virtual machine, and returns a control response packet to the first virtual machine, where the control response packet includes a MAC address of the load balancing virtual machine. That is, the virtual switch can perform the directional processing on the service packet of the first virtual machine according to the configured forwarding mode, so that the first virtual switch forwards the service packet to the first load balancing virtual machine.
结合第一方面的第二种可能的实现方式,本发明实施例第一方面的第三种可能的实现方式中,所述控制报文为地址解析协议ARP报文或互联网控制消息协议ICMP报文。例如所述控制报文可以是地址解析协议ARP报文,所述转发模式可以是ARP代答模式,所述第一虚拟机可以通过ARP代答模式将所述第一负载均衡虚拟机的MAC地址发送给所述第一虚拟机。可选的,当控制报文是ICMP报文时,所述转发模式也可以是邻居发现协议NDP代答模式。With reference to the second possible implementation manner of the first aspect, in a third possible implementation manner of the first aspect of the embodiment, the control packet is an address resolution protocol ARP packet or an Internet control message protocol ICMP packet. . For example, the control packet may be an address resolution protocol ARP packet, and the forwarding mode may be an ARP pickup mode, and the first virtual machine may use the ARP pickup mode to set the MAC address of the first load balancing virtual machine. Sent to the first virtual machine. Optionally, when the control packet is an ICMP packet, the forwarding mode may also be a neighbor discovery protocol NDP pickup mode.
结合第一方面、第一方面的第一种、第二种或第三种可能的实现方式,本发明实施例第一方面的第四种可能的实现方式中,所述计算机设备还包括虚拟负载均衡代理单元;With reference to the first aspect, the first, the second or the third possible implementation manner of the first aspect, in a fourth possible implementation manner of the first aspect of the embodiments, the computer device further includes a virtual load Equalization agent unit;
所述虚拟负载均衡代理单元,用于接收创建负载均衡虚拟机的配置信息,控制所述负载均衡虚拟机的创建或删除,以及控制所述负载均衡虚拟机与所述虚拟交换机之间连接的建立。The virtual load balancing agent unit is configured to receive configuration information for creating a load balancing virtual machine, control creation or deletion of the load balancing virtual machine, and control establishment of a connection between the load balancing virtual machine and the virtual switch. .
所述虚拟负载均衡代理单元在指示所述虚拟机管理单元根据所述创建负载均衡虚拟机的配置信息创建所述第一负载均衡虚拟机时,向所述虚拟机管理单元发送通知信息,所述通知信息包括创建所述第一负载均衡虚拟机的虚拟机参数信息,所述第一负载均衡虚拟机的虚拟机参数信息包括但不限于:虚拟中央处理器的个数,虚拟内存的大小,以及所述负载均衡虚拟机所在的逻辑网络等信息。And the virtual load balancing agent unit sends the notification information to the virtual machine management unit when the virtual machine management unit is instructed to create the first load balancing virtual machine according to the configuration information of the created load balancing virtual machine, The notification information includes the virtual machine parameter information of the first load balancing virtual machine, where the virtual machine parameter information of the first load balancing virtual machine includes, but is not limited to, the number of virtual central processing units, the size of the virtual memory, and The load balancing information such as a logical network where the virtual machine is located.
上述创建负载均衡虚拟机的配置信息,是用户通过云管理平台(所述第二计算机设备)下发的,所述配置信息包括但不限于:负载均衡虚拟机的标识,负载均衡虚拟机的IP地址,以及与该负载均衡虚拟机相关的后端服务器的信息。所述后端服务器的信息包括但不限于:后端服务器的标识,后端服务器的网络间互连协议(IP,Internet protocol)地址,后端服务器健康检查的方法等。其中,后端服务器的健康检查方法是指负载均衡虚拟机通过检查后端服务器的健康状态的方法。上述后端服务器是提供具体业务的服务器,负载均衡虚拟机根据接收到的业务报文,通过负载均衡算 法等负载均衡方式在后端服务器中选择一个,作为处理所述业务报文的服务器。本发明实施例中,后端服务器可以是一个虚拟机,也可以是一个具体的物理服务器。The configuration information of the load balancing virtual machine is delivered by the user through the cloud management platform (the second computer device), and the configuration information includes but is not limited to: the identifier of the load balancing virtual machine, and the IP of the load balancing virtual machine. The address, and information about the backend server associated with the load balancing virtual machine. The information of the back-end server includes, but is not limited to, an identifier of the back-end server, an IP protocol (Internet protocol) address of the back-end server, and a method for checking the health of the back-end server. The health check method of the backend server refers to a method in which the load balancing virtual machine checks the health status of the backend server. The back-end server is a server that provides a specific service, and the load balancing virtual machine calculates the service packet according to the received load balance. A load balancing method such as a method selects one of the back-end servers as a server that processes the service message. In the embodiment of the present invention, the backend server may be a virtual machine or a specific physical server.
可选的,在所述第一虚拟机是创建所述负载均衡虚拟机配置信息的用户创建的虚拟机时,并且第一虚拟机是所述用户在所述第一计算机设备上创建的第一个虚拟机时,所述第一虚拟负载均衡代理单元启动所述负载均衡虚拟机的创建。同样的,当已经配置了虚拟负载均衡业务的用户配置的最后一个虚拟机被删除时,所述第一虚拟负载均衡代理单元启动所述负载均衡虚拟机的删除。Optionally, when the first virtual machine is a user-created virtual machine that creates the load balancing virtual machine configuration information, and the first virtual machine is the first user created by the user on the first computer device. The virtual load balancing agent unit starts the creation of the load balancing virtual machine. Similarly, when the last virtual machine configured by the user of the virtual load balancing service is deleted, the first virtual load balancing agent unit starts the deletion of the load balancing virtual machine.
结合第一方面、第一方面的第一种、第二种、第三种或第四种可能的实现方式,本发明实施例第一方面的第五种可能的实现方式中,所述计算机设备还包括第二虚拟机,所述第二虚拟机具备处理所述第一虚拟机的所述业务报文的能力;With reference to the first aspect, the first, the second, the third or the fourth possible implementation manner of the first aspect, in a fifth possible implementation manner of the first aspect of the embodiments, a second virtual machine, the second virtual machine having the capability of processing the service message of the first virtual machine;
在所述负载均衡虚拟机通过负载均衡算法确定所述第二虚拟机处理所述第一虚拟机的所述业务报文时,所述第二虚拟机接收所述负载均衡服务器转发的所述业务报文,并将处理所述业务报文的结果发送给所述负载均衡虚拟机;When the load balancing virtual machine determines that the second virtual machine processes the service packet of the first virtual machine by using a load balancing algorithm, the second virtual machine receives the service forwarded by the load balancing server. Sending a message to the load balancing virtual machine by processing the result of processing the service packet;
所述负载均衡虚拟机,还用于将所述第二虚拟机处理所述业务报文的结果通过所述虚拟交换机发送给所述第一虚拟机。The load balancing virtual machine is further configured to send, by the virtual switch, the result of processing the service packet by the second virtual machine to the first virtual machine.
本发明实施例的第二方面提供了一种计算机系统,包括第一计算机设备和第二计算机设备,其中,所述第一计算机设备和所述第二计算机设备分别包括中央处理器CPU、内存和存储设备,所述第一计算机设备中还包括第一虚拟机、第一负载均衡虚拟机和第一虚拟交换机,所述第一虚拟机和所述第一负载均衡虚拟机是在所述第一计算机设备中创建的虚拟机;A second aspect of the embodiments of the present invention provides a computer system including a first computer device and a second computer device, wherein the first computer device and the second computer device respectively include a central processing unit CPU, a memory, and a storage device, the first computer device further includes a first virtual machine, a first load balancing virtual machine, and a first virtual switch, where the first virtual machine and the first load balancing virtual machine are in the first a virtual machine created in a computer device;
所述第一虚拟机,用于发送业务报文;The first virtual machine is configured to send a service packet;
所述第一虚拟交换机,用于接收所述第一虚拟机发送的所述业务报文, 在所述业务报文需要负载均衡处理时,只转发所述业务报文给所述第一负载均衡虚拟机;The first virtual switch is configured to receive the service packet sent by the first virtual machine, When the service packet needs to be load balanced, the service packet is forwarded only to the first load balancing virtual machine;
所述第一负载均衡虚拟机,用于接收所述第一虚拟交换机转发的所述业务报文,基于负载均衡方式转发所述业务报文。The first load balancing virtual machine is configured to receive the service packet forwarded by the first virtual switch, and forward the service packet according to a load balancing manner.
所述第一负载均衡虚拟机基于负载均衡方式转发所述业务报文可以是:所述第一负载均衡虚拟机在收到业务报文后,首先判断是否已经为所述业务报文分配了一个后端服务器为其服务,如果已经分配了后端服务器,则将该业务报文发送给已经分配的后端服务器。如果还没有分配后端服务器,则通过负载均衡算法,选择一个后端服务器为其服务。所述负载均衡算法包括但不限于:轮询、加权轮询、随机、最小连接或源地散列,基于位置优先的加权轮询等。所述位置优先的加权轮询方式,可以优先选择在发起业务报文的虚拟机所在的计算机设备中的后端服务器,这样能够节省后端服务器处理业务报文的速度,节省网络带宽。After the first load balancing virtual machine forwards the service packet based on the load balancing manner, the first load balancing virtual machine first determines whether a service packet has been allocated for the service packet after receiving the service packet. The backend server serves it, and if a backend server has been assigned, the service message is sent to the already assigned backend server. If a backend server has not been assigned, select a backend server to serve it through a load balancing algorithm. The load balancing algorithms include, but are not limited to, polling, weighted polling, random, minimum or source-to-ground hashing, location-based weighted polling, and the like. The location-prioritized weighted polling mode can preferentially select the back-end server in the computer device where the virtual machine that initiates the service packet is located, which can save the speed of the back-end server processing the service packet and save the network bandwidth.
上述第二计算机设备可以是所述计算机系统中的云平台管理设备,实现对所述第一计算机设备的管理和配置,包括对所述第一计算机设备中的虚拟机进行配置和管理。The second computer device may be a cloud platform management device in the computer system, and implement management and configuration of the first computer device, including configuring and managing a virtual machine in the first computer device.
结合第二方面,本发明实施例第二方面的第一种可能的实现方式中,所述第一虚拟交换机只转发所述业务报文给所述第一负载均衡虚拟机包括:With reference to the second aspect, in a first possible implementation manner of the second aspect, the first virtual switch that forwards the service packet to the first load balancing virtual machine includes:
所述第一虚拟交换机将所述第一负载均衡虚拟机的MAC地址发送给所述第一虚拟机,使得所述第一虚拟机基于获取到的所述第一负载均衡虚拟机的MAC地址发送所述业务报文,所述第一虚拟交换机将所述业务报文转发给所述第一负载均衡虚拟机;或,Sending, by the first virtual switch, the MAC address of the first load balancing virtual machine to the first virtual machine, so that the first virtual machine sends the MAC address of the first load balancing virtual machine based on the obtained MAC address The first virtual switch forwards the service packet to the first load balancing virtual machine; or
所述第一负载均衡虚拟机将其MAC地址发送给所述第一虚拟机,使得所述第一虚拟机基于所述第一负载均衡虚拟机的MAC地址发送所述业务报文,所述第一虚拟交换机将所述业务报文转发给所述第一负载均衡虚拟机;或, The first load balancing virtual machine sends its MAC address to the first virtual machine, so that the first virtual machine sends the service packet based on the MAC address of the first load balancing virtual machine. Transmitting the service packet to the first load balancing virtual machine by a virtual switch; or
所述第一虚拟机基于预先配置的所述第一负载均衡虚拟机的MAC地址,发送所述业务报文,所述第一虚拟交换机将所述业务报文转发给所述第一负载均衡虚拟机。The first virtual machine sends the service packet based on the pre-configured MAC address of the first load balancing virtual machine, and the first virtual switch forwards the service packet to the first load balancing virtual machine.
结合第二方面的第一种可能的实现方式,本发明实施例第二方面的第二种可能的实现方式中,With reference to the first possible implementation manner of the second aspect, in a second possible implementation manner of the second aspect of the embodiment of the present invention,
所述第一虚拟交换机将所述第一负载均衡虚拟机的MAC地址发送给所述第一虚拟机包括:所述第一虚拟交换机接收所述第一虚拟机发送的控制报文,向所述第一虚拟机返回控制响应报文,所述控制响应报文包含所述第一负载均衡虚拟机的MAC地址。即可通过虚拟机管理单元配置所述第一虚拟交换机的转发模式,所述第一虚拟交换机根据配置的转发模式对所述第一虚拟机的业务报文进行定向处理,使得所述第一虚拟交换机将所述业务报文转发给所述第一负载均衡虚拟机。The sending, by the first virtual switch, the MAC address of the first load balancing virtual machine to the first virtual machine includes: receiving, by the first virtual switch, a control packet sent by the first virtual machine, to the The first virtual machine returns a control response message, where the control response message includes a MAC address of the first load balancing virtual machine. The forwarding mode of the first virtual switch is configured by the virtual machine management unit, and the first virtual switch performs a directional processing on the service packet of the first virtual machine according to the configured forwarding mode, so that the first virtual The switch forwards the service packet to the first load balancing virtual machine.
结合第二方面的第二种可能的实现方式,本发明实施例第二方面的第三种可能的实现方式中,所述控制报文为地址解析协议ARP报文或互联网控制消息协议ICMP报文。例如所述控制报文可以是地址解析协议ARP报文,所述转发模式可以是ARP代答模式,所述第一虚拟机可以通过ARP代答模式将所述第一负载均衡虚拟机的MAC地址发送给所述第一虚拟机。可选的,当控制报文是ICMP报文时,所述转发模式也可以是邻居发现协议NDP代答模式。With reference to the second possible implementation manner of the second aspect, in a third possible implementation manner of the second aspect of the embodiment, the control packet is an address resolution protocol ARP packet or an Internet control message protocol ICMP packet. . For example, the control packet may be an address resolution protocol ARP packet, and the forwarding mode may be an ARP pickup mode, and the first virtual machine may use the ARP pickup mode to set the MAC address of the first load balancing virtual machine. Sent to the first virtual machine. Optionally, when the control packet is an ICMP packet, the forwarding mode may also be a neighbor discovery protocol NDP pickup mode.
结合第二方面、第二方面的第一种、第二种或第三种可能的实现方式,本发明实施例第二方面的第四种可能的实现方式中,所述第一计算机设备还包括第一虚拟负载均衡代理单元,所述第二计算机设备还包括虚拟负载均衡管理单元和虚拟机管理单元;With reference to the second aspect, the first, the second or the third possible implementation manner of the second aspect, in a fourth possible implementation manner of the second aspect of the embodiments, the first computer device further includes a first virtual load balancing agent unit, the second computer device further comprising a virtual load balancing management unit and a virtual machine management unit;
所述虚拟负载均衡管理单元,用于接收创建所述第一负载均衡虚拟机的配置信息,并将所述创建第一负载均衡虚拟机的配置信息发送给所述第一虚拟负载均衡代理单元;所述第一虚拟负载均衡代理单元,用于接收所述创建第一负载均衡虚拟机的配置信息,指示所述虚拟机管理单元根据所 述创建第一负载均衡虚拟机的配置信息创建所述第一负载均衡虚拟机。The virtual load balancing management unit is configured to receive configuration information for creating the first load balancing virtual machine, and send the configuration information for creating the first load balancing virtual machine to the first virtual load balancing proxy unit; The first virtual load balancing agent unit is configured to receive the configuration information for creating the first load balancing virtual machine, and instruct the virtual machine management unit to Creating configuration information of the first load balancing virtual machine creates the first load balancing virtual machine.
所述第一虚拟负载均衡代理单元在指示所述虚拟机管理单元根据所述创建负载均衡虚拟机的配置信息创建所述第一负载均衡虚拟机时,向所述虚拟机管理单元发送通知信息,所述通知信息包括创建所述第一负载均衡虚拟机的虚拟机参数信息,所述第一负载均衡虚拟机的虚拟机参数信息包括但不限于:虚拟中央处理器的个数,虚拟内存的大小,以及所述负载均衡虚拟机所在的逻辑网络等信息。The first virtual load balancing agent unit sends the notification information to the virtual machine management unit when the virtual machine management unit is instructed to create the first load balancing virtual machine according to the configuration information of the created load balancing virtual machine. The notification information includes the virtual machine parameter information of the first load balancing virtual machine, where the virtual machine parameter information of the first load balancing virtual machine includes but is not limited to: the number of virtual central processing units, and the size of the virtual memory. And information such as the logical network where the load balancing virtual machine is located.
可选的,所述虚拟负载均衡管理单元也可以直接指示所述虚拟机管理单元根据所述创建第一负载均衡虚拟机的配置信息创建所述第一负载均衡虚拟机。Optionally, the virtual load balancing management unit may directly instruct the virtual machine management unit to create the first load balancing virtual machine according to the configuration information for creating the first load balancing virtual machine.
上述创建第一负载均衡虚拟机的配置信息,是用户通过云管理平台(所述第二计算机设备)下发的,所述配置信息包括但不限于:负载均衡虚拟机的标识,负载均衡虚拟机的IP地址,以及与该负载均衡虚拟机相关的后端服务器的信息。所述后端服务器的信息包括但不限于:后端服务器的标识,后端服务器的网络间互连协议(IP,Internet protocol)地址,后端服务器健康检查的方法等。其中,后端服务器的健康检查方法是指负载均衡虚拟机通过检查后端服务器的健康状态的方法。上述后端服务器是提供具体业务的服务器,负载均衡虚拟机根据接收到的业务报文,通过负载均衡算法等负载均衡方式在后端服务器中选择一个,作为处理所述业务报文的服务器。本发明实施例中,后端服务器可以是一个虚拟机,也可以是一个具体的物理服务器。The configuration information of the first load balancing virtual machine is sent by the user through the cloud management platform (the second computer device), and the configuration information includes but is not limited to: the identifier of the load balancing virtual machine, and the load balancing virtual machine IP address and information about the backend server associated with the load balancing virtual machine. The information of the back-end server includes, but is not limited to, an identifier of the back-end server, an IP protocol (Internet protocol) address of the back-end server, and a method for checking the health of the back-end server. The health check method of the backend server refers to a method in which the load balancing virtual machine checks the health status of the backend server. The back-end server is a server that provides a specific service. The load balancing virtual machine selects one of the back-end servers in a load balancing manner, such as a load balancing algorithm, according to the received service packet, as a server that processes the service packet. In the embodiment of the present invention, the backend server may be a virtual machine or a specific physical server.
结合第二方面的第四种可能的实现方式,本发明实施例第二方面的第五种可能的实现方式中,所述第一虚拟负载均衡代理单元,还用于指示所述虚拟机管理单元为所述第一负载均衡虚拟机配置第一虚拟网卡并建立所述第一虚拟网卡与所述第一虚拟交换机之间的连接。其中,所述虚拟机管理单元建立所述第一虚拟网卡与所述第一虚拟交换机之间的连接可以通过 配置虚拟交换机的网络标识来实现,所述网络标识是虚拟交换机的网络接口的标识。并且,所述虚拟机管理单元根据所述第一虚拟负载均衡代理单元的指示建立所述第一虚拟网卡时,还可以根据所述创建负载均衡虚拟机的配置信息,为创建的所述第一虚拟网卡分配IP地址和MAC地址。With reference to the fourth possible implementation manner of the second aspect, in a fifth possible implementation manner of the second aspect, the first virtual load balancing proxy unit is further configured to indicate the virtual machine management unit And configuring a first virtual network card for the first load balancing virtual machine and establishing a connection between the first virtual network card and the first virtual switch. The virtual machine management unit establishes a connection between the first virtual network card and the first virtual switch. The network identifier of the virtual switch is configured to be implemented, where the network identifier is an identifier of a network interface of the virtual switch. And the virtual machine management unit is configured to create the first virtual network card according to the indication of the first virtual load balancing proxy unit, and further configured to create the first virtual network card according to the configuration information of the load balancing virtual machine. The virtual network card assigns an IP address and a MAC address.
结合第二方面的第四种或第五种可能的实现方式,本发明实施例第二方面的第六种可能的实现方式中,所述第一虚拟机是创建所述第一负载均衡虚拟机配置信息的用户创建的虚拟机;所述虚拟负载均衡管理单元,还用于接收创建所述第一虚拟机的配置信息,并在判断所述第一虚拟机是所述用户在所述第一计算机设备上创建的第一个虚拟机时,将创建所述第一虚拟机的信息通知所述第一虚拟负载均衡代理单元;所述第一虚拟负载均衡代理单元,用于在接收到所述虚拟负载均衡管理单元发送的创建所述第一虚拟机的通知时,指示所述虚拟机管理单元创建所述第一负载均衡虚拟机。所述虚拟负载均衡管理单元也可以直接通知所述虚拟机管理单元创建所述第一负载均衡虚拟机。In conjunction with the fourth or fifth possible implementation of the second aspect, in a sixth possible implementation manner of the second aspect of the embodiments, the first virtual machine is configured to create the first load balancing virtual machine a virtual machine created by the user of the configuration information; the virtual load balancing management unit is further configured to receive configuration information for creating the first virtual machine, and determine that the first virtual machine is the user at the first Notifying the first virtual load balancing agent unit of the information of the first virtual machine when the first virtual machine is created on the computer device; the first virtual load balancing agent unit is configured to receive the When the notification of the first virtual machine is sent by the virtual load balancing management unit, the virtual machine management unit is instructed to create the first load balancing virtual machine. The virtual load balancing management unit may also directly notify the virtual machine management unit to create the first load balancing virtual machine.
同样的,当已经配置了虚拟负载均衡业务的用户配置的最后一个虚拟机被删除时,所述虚拟负载均衡管理单元通知所述第一虚拟负载均衡代理单元指示所述虚拟机管理单元删除所述第一负载均衡虚拟机,或直接通知所述虚拟机管理单元删除所述第一负载均衡虚拟机。Similarly, when the last virtual machine configured by the user of the virtual load balancing service is deleted, the virtual load balancing management unit notifies the first virtual load balancing agent unit to instruct the virtual machine management unit to delete the The first load balancing virtual machine, or directly notifying the virtual machine management unit to delete the first load balancing virtual machine.
结合第二方面、第二方面的第一种至第六种任一可能的实现方式,本发明实施例第二方面的第七种可能的实现方式中,所述第一计算机设备还包括第二虚拟机,所述第二虚拟机具备处理所述第一虚拟机的所述业务报文的能力;With reference to the second aspect, the first to the sixth possible implementation manner of the second aspect, in the seventh possible implementation manner of the second aspect of the embodiments, the first computer device further includes a second a virtual machine, the second virtual machine having the capability of processing the service packet of the first virtual machine;
在所述第一负载均衡虚拟机通过负载均衡方式确定所述第二虚拟机处理所述第一虚拟机的所述业务报文时,所述第二虚拟机接收所述第一负载均衡虚拟机转发的所述业务报文,并将处理所述业务报文的结果发送给所述第一负载均衡虚拟机; When the first load balancing virtual machine determines that the second virtual machine processes the service packet of the first virtual machine by using a load balancing manner, the second virtual machine receives the first load balancing virtual machine. Forwarding the service packet, and sending the result of processing the service packet to the first load balancing virtual machine;
所述第一负载均衡虚拟机,还用于将所述第二虚拟机处理所述业务报文的结果通过所述第一虚拟交换机发送给所述第一虚拟机。The first load balancing virtual machine is further configured to send, by the second virtual machine, the result of processing the service packet to the first virtual machine by using the first virtual switch.
结合第二方面、第二方面的第一种至第七种任一可能的实现方式,本发明实施例第二方面的第八种可能的实现方式中,所述计算机系统还包括第三计算机设备,所述第三计算机设备包括第二虚拟负载均衡代理单元、第二虚拟交换机和第三虚拟机;With reference to the second aspect, the first to the seventh possible implementation manners of the second aspect, in an eighth possible implementation manner of the second aspect of the embodiments, the computer system further includes a third computer device The third computer device includes a second virtual load balancing agent unit, a second virtual switch, and a third virtual machine;
所述第二虚拟负载均衡代理单元,用于接收所述虚拟负载均衡管理单元发送的创建第二负载均衡虚拟机的配置信息,基于所述创建第二负载均衡虚拟机的配置信息,指示所述虚拟机管理单元创建所述第二负载均衡虚拟机,以及指示所述虚拟机管理单元为所述第二负载均衡虚拟机配置第二虚拟网卡并建立所述第二虚拟网卡与所述第二虚拟交换机之间的连接;The second virtual load balancing proxy unit is configured to receive configuration information that is sent by the virtual load balancing management unit to create a second load balancing virtual machine, and to indicate the configuration information based on the configuration information of the second load balancing virtual machine. The virtual machine management unit creates the second load balancing virtual machine, and instructs the virtual machine management unit to configure a second virtual network card for the second load balancing virtual machine and establish the second virtual network card and the second virtual The connection between the switches;
所述第二虚拟交换机,用于接收所述第三虚拟机发起的第二业务报文,在所述第二业务报文需要负载均衡处理时,只转发所述第二业务报文给所述第二负载均衡虚拟机;The second virtual switch is configured to receive the second service packet initiated by the third virtual machine, and when the second service packet needs load balancing processing, only forward the second service packet to the a second load balancing virtual machine;
所述第二负载均衡虚拟机,用于接收所述第二虚拟交换机转发的所述第二业务报文,基于负载均衡方式转发所述第二业务报文。The second load balancing virtual machine is configured to receive the second service packet that is forwarded by the second virtual switch, and forward the second service packet according to a load balancing manner.
结合第二方面的第八种可能的实现方式,本发明实施例第二方面的第九种可能的实现方式中,所述虚拟机管理单元为所述第一负载均衡虚拟机配置第一IP地址和第一MAC地址,以及为所述第二负载均衡虚拟机配置第二IP地址和第二MAC地址;其中,所述第一IP地址与所述第二IP地址相同,或所述第一MAC地址与所述第二MAC地址相同。In conjunction with the eighth possible implementation of the second aspect, in a ninth possible implementation manner of the second aspect of the embodiments, the virtual machine management unit configures the first IP address of the first load balancing virtual machine And configuring a second IP address and a second MAC address for the second load balancing virtual machine; wherein the first IP address is the same as the second IP address, or the first MAC address The address is the same as the second MAC address.
可选的,所述第一计算机设备除包括中央处理器CPU、内存和存储设备之外,还可以包括网络硬件等硬件设备;网络硬件可以是交换设备(网卡等)、路由器和/或其他网络设备,用于实现多个设备之间的通信,多个设备之间可以通过无线或有线方式连接连接。Optionally, the first computer device may include hardware devices such as network hardware in addition to the CPU, memory, and storage device; the network hardware may be a switching device (such as a network card), a router, and/or other network. A device is used to implement communication between multiple devices. Multiple devices can be connected by wireless or wired connection.
结合第二方面、第二方面的第一种至第九种任一可能的实现方式,本 发明实施例第二方面的第十种可能的实现方式中,所述第二计算机设备还包括虚拟负载均衡存储设备,用于存储创建负载均衡虚拟机的配置信息。所述虚拟负载均衡存储设备可以是所述第二计算机设备中的存储设备,也可以是独立与所述第二计算机设备的存储设备。With reference to the second aspect, any one of the first to the ninth possible implementation manners of the second aspect, In a tenth possible implementation manner of the second aspect, the second computer device further includes a virtual load balancing storage device, configured to store configuration information for creating a load balancing virtual machine. The virtual load balancing storage device may be a storage device in the second computer device, or may be a storage device independent of the second computer device.
本发明实施例的第三方面提供了一种计算机系统,包括第一计算机设备、第二计算机设备和第三计算机设备,其中,所述第一计算机设备、第二计算机设备和第三计算机设备分别包括中央处理器CPU、内存和存储设备,所述第二计算机设备对所述第一计算机设备和所述第三计算机设备上的虚拟机进行配置和管理,所述第一计算机设备包含第一虚拟交换机,所述第三计算机设备包含第二虚拟交换机,所述第二计算机设备,用于接收在所述第一计算机设备上创建负载均衡虚拟机的配置信息,在所述第一计算机设备中创建第一负载均衡虚拟机,并建立所述第一负载均衡虚拟机与所述第一虚拟交换机的连接;以及接收在所述第三计算机设备上创建负载均衡虚拟机的配置信息,在所述第三计算机设备中创建第二负载均衡虚拟机,并建立所述第二负载均衡虚拟机与所述第二虚拟交换机的连接;A third aspect of the embodiments of the present invention provides a computer system, including a first computer device, a second computer device, and a third computer device, wherein the first computer device, the second computer device, and the third computer device respectively The central computer includes a CPU, a memory, and a storage device, the second computer device configuring and managing a virtual machine on the first computer device and the third computer device, the first computer device including a first virtual a switch, the third computer device includes a second virtual switch, the second computer device configured to receive configuration information for creating a load balancing virtual machine on the first computer device, created in the first computer device First, load balancing the virtual machine, and establishing a connection between the first load balancing virtual machine and the first virtual switch; and receiving configuration information for creating a load balancing virtual machine on the third computer device, where Creating a second load balancing virtual machine in the three computer devices, and establishing the second load balancing virtual machine The virtual switch connected to the second;
所述第一虚拟交换机,用于接收所述第一计算机设备中的第一虚拟机发送的第一业务报文,在所述第一业务报文需要负载均衡处理时,只转发所述第一业务报文给所述第一负载均衡虚拟机;The first virtual switch is configured to receive a first service packet sent by the first virtual machine in the first computer device, and only forward the first service packet when the first service packet needs load balancing processing Transmitting a service packet to the first load balancing virtual machine;
所述第二虚拟交换机,用于接收所述第三计算机设备中的第二虚拟机发送的第二业务报文,在所述第二业务报文需要负载均衡处理时,只转发所述第二业务报文给所述第二负载均衡虚拟机。The second virtual switch is configured to receive a second service packet sent by the second virtual machine in the third computer device, and only forward the second service packet when the second service packet needs load balancing processing The service packet is sent to the second load balancing virtual machine.
结合第三方面,本发明实施例第三方面的第一种可能的实现方式中,所述第一虚拟交换机只转发所述第一业务报文给所述第一负载均衡虚拟机包括:With reference to the third aspect, in a first possible implementation manner of the third aspect, the first virtual switch that forwards the first service packet to the first load balancing virtual machine includes:
所述第一虚拟交换机将所述第一负载均衡虚拟机的MAC地址发送给所述第一虚拟机,使得所述第一虚拟机基于获取到的所述第一负载均衡虚拟 机的MAC地址发送所述业务报文,所述第一虚拟交换机将所述业务报文转发给所述第一负载均衡虚拟机;或,Sending, by the first virtual switch, the MAC address of the first load balancing virtual machine to the first virtual machine, so that the first virtual machine is based on the acquired first load balancing virtual The MAC address of the machine sends the service packet, and the first virtual switch forwards the service packet to the first load balancing virtual machine; or
所述第一负载均衡虚拟机将其MAC地址发送给所述第一虚拟机,使得所述第一虚拟机基于所述第一负载均衡虚拟机的MAC地址发送所述业务报文,所述第一虚拟交换机将所述业务报文转发给所述第一负载均衡虚拟机;或,The first load balancing virtual machine sends its MAC address to the first virtual machine, so that the first virtual machine sends the service packet based on the MAC address of the first load balancing virtual machine. Transmitting the service packet to the first load balancing virtual machine by a virtual switch; or
所述第一虚拟机基于预先配置的所述第一负载均衡虚拟机的MAC地址,发送所述业务报文,所述第一虚拟交换机将所述业务报文转发给所述第一负载均衡虚拟机。The first virtual machine sends the service packet based on the pre-configured MAC address of the first load balancing virtual machine, and the first virtual switch forwards the service packet to the first load balancing virtual machine.
结合第三方面的第一种可能的实现方式,本发明实施例第三方面的第二种可能的实现方式中,所述第一虚拟交换机将所述第一负载均衡虚拟机的MAC地址发送给所述第一虚拟机包括:With reference to the first possible implementation manner of the third aspect, in a second possible implementation manner of the third aspect, the first virtual switch sends the MAC address of the first load balancing virtual machine to The first virtual machine includes:
所述第一虚拟交换机接收所述第一虚拟机发送的控制报文,向所述第一虚拟机返回控制响应报文,所述控制响应报文包含所述第一负载均衡虚拟机的MAC地址。即可通过虚拟机管理单元配置所述第一虚拟交换机的转发模式,所述第一虚拟交换机根据配置的转发模式对所述第一虚拟机的业务报文进行定向处理,使得所述第一虚拟交换机将所述业务报文转发给所述第一负载均衡虚拟机。Receiving, by the first virtual switch, a control packet sent by the first virtual machine, and returning a control response packet to the first virtual machine, where the control response packet includes a MAC address of the first load balancing virtual machine. . The forwarding mode of the first virtual switch is configured by the virtual machine management unit, and the first virtual switch performs a directional processing on the service packet of the first virtual machine according to the configured forwarding mode, so that the first virtual The switch forwards the service packet to the first load balancing virtual machine.
结合第三方面的第二种可能的实现方式,本发明实施例第三方面的第三种可能的实现方式中,所述控制报文为地址解析协议ARP报文或互联网控制消息协议ICMP报文。例如所述控制报文可以是地址解析协议ARP报文,所述转发模式可以是ARP代答模式,所述第一虚拟机可以通过ARP代答模式将所述第一负载均衡虚拟机的MAC地址发送给所述第一虚拟机。可选的,当控制报文是ICMP报文时,所述转发模式也可以是邻居发现协议NDP代答模式。With reference to the second possible implementation manner of the third aspect, in a third possible implementation manner of the third aspect of the embodiments, the control packet is an address resolution protocol ARP packet or an Internet control message protocol ICMP packet. . For example, the control packet may be an address resolution protocol ARP packet, and the forwarding mode may be an ARP pickup mode, and the first virtual machine may use the ARP pickup mode to set the MAC address of the first load balancing virtual machine. Sent to the first virtual machine. Optionally, when the control packet is an ICMP packet, the forwarding mode may also be a neighbor discovery protocol NDP pickup mode.
结合第三方面,第三方面的第一种至第三种任一可能的实现方式,本发明实施例第三方面的第四种可能的实现方式中,所述第一计算机设备还包括第二虚拟机,所述第二虚拟机具备处理所述第一虚拟机的所述业务报 文的能力;With reference to the third aspect, the first to the third possible implementation manners of the third aspect, the fourth possible implementation manner of the third aspect of the embodiment of the present invention, the first computer device further includes a second a virtual machine, the second virtual machine having the service report for processing the first virtual machine Ability of the text;
在所述第一负载均衡虚拟机通过负载均衡方式确定所述第二虚拟机处理所述第一虚拟机的所述业务报文时,所述第二虚拟机接收所述第一负载均衡服务器转发的所述业务报文,并将处理所述业务报文的结果发送给所述第一负载均衡虚拟机;When the first load balancing virtual machine determines that the second virtual machine processes the service packet of the first virtual machine by using a load balancing manner, the second virtual machine receives the first load balancing server for forwarding. The service packet, and the result of processing the service packet is sent to the first load balancing virtual machine;
所述第一负载均衡虚拟机,还用于将所述第二虚拟机处理所述业务报文的结果通过所述第一虚拟交换机发送给所述第一虚拟机。The first load balancing virtual machine is further configured to send, by the second virtual machine, the result of processing the service packet to the first virtual machine by using the first virtual switch.
结合第三方面,第三方面的第一种至第四种任一可能的实现方式,本发明实施例第三方面的第五种可能的实现方式中,With reference to the third aspect, any one of the first to fourth possible implementation manners of the third aspect,
所述第一负载均衡虚拟机的IP地址与所述第二负载均衡虚拟机的IP地址相同;或,The IP address of the first load balancing virtual machine is the same as the IP address of the second load balancing virtual machine; or
所述第一负载均衡虚拟机的MAC地址与所述第二负载均衡虚拟机的MAC地址相同。The MAC address of the first load balancing virtual machine is the same as the MAC address of the second load balancing virtual machine.
第四方面,本发明实施例提供了一种实现负载均衡的方法,包括:In a fourth aspect, an embodiment of the present invention provides a method for implementing load balancing, including:
第二计算机设备接收在第一计算机设备上创建所述负载均衡虚拟机的配置信息,所述第一计算机设备包括中央处理器CPU、内存和存储设备,所述第一计算机设备还包括第一虚拟机和虚拟交换机;The second computer device receives configuration information for creating the load balancing virtual machine on the first computer device, the first computer device including a central processing unit CPU, a memory, and a storage device, the first computer device further including a first virtual Machine and virtual switch;
所述第二计算机设备根据所述配置信息,在所述第一计算机设备上创建负载均衡虚拟机,并建立所述负载均衡虚拟机与所述第一计算机设备中的虚拟交换机的连接;The second computer device creates a load balancing virtual machine on the first computer device according to the configuration information, and establishes a connection between the load balancing virtual machine and a virtual switch in the first computer device;
所述虚拟交换机接收所述第一虚拟机发送的业务报文,在所述业务报文需要负载均衡处理时,只转发所述业务报文给所述负载均衡虚拟机;The virtual switch receives the service packet sent by the first virtual machine, and only forwards the service packet to the load balancing virtual machine when the service packet needs load balancing processing;
所述负载均衡虚拟机接收所述第一虚拟交换机转发的所述业务报文,基于负载均衡方式转发所述业务报文。The load balancing virtual machine receives the service packet forwarded by the first virtual switch, and forwards the service packet according to a load balancing manner.
所述负载均衡虚拟机基于负载均衡方式转发所述业务报文可以是:所述负载均衡虚拟机在收到业务报文后,首先判断是否已经为所述业务报文 分配了一个后端服务器为其服务,如果已经分配了后端服务器,则将该业务报文发送给已经分配的后端服务器。如果还没有分配后端服务器,则通过负载均衡算法,选择一个后端服务器为其服务。所述负载均衡算法包括但不限于:轮询、加权轮询、随机、最小连接或源地散列,基于位置优先的加权轮询等。所述位置优先的加权轮询方式,可以优先选择在发起业务报文的虚拟机所在的计算机设备中的后端服务器,这样能够节省后端服务器处理业务报文的速度,节省网络带宽。The load balancing virtual machine forwards the service packet based on the load balancing mode. The load balancing virtual machine first determines whether the service packet is the service packet after receiving the service packet. A backend server is assigned to serve it, and if a backend server has been assigned, the service message is sent to the already assigned backend server. If a backend server has not been assigned, select a backend server to serve it through a load balancing algorithm. The load balancing algorithms include, but are not limited to, polling, weighted polling, random, minimum or source-to-ground hashing, location-based weighted polling, and the like. The location-prioritized weighted polling mode can preferentially select the back-end server in the computer device where the virtual machine that initiates the service packet is located, which can save the speed of the back-end server processing the service packet and save the network bandwidth.
结合第四方面,本发明实施例第四方面的第一种可能的实现方式中,所述虚拟交换机只转发所述业务报文给所述负载均衡虚拟机包括:With reference to the fourth aspect, in a first possible implementation manner of the fourth aspect of the embodiments of the present disclosure, the that the virtual switch only forwards the service packet to the load balancing virtual machine includes:
所述虚拟交换机将所述负载均衡虚拟机的MAC地址发送给所述第一虚拟机,使得所述第一虚拟机基于获取到的所述负载均衡虚拟机的MAC地址发送所述业务报文,所述虚拟交换机将所述业务报文转发给所述负载均衡虚拟机;或,The virtual switch sends the MAC address of the load balancing virtual machine to the first virtual machine, so that the first virtual machine sends the service packet based on the obtained MAC address of the load balancing virtual machine. Transmitting, by the virtual switch, the service packet to the load balancing virtual machine; or
所述负载均衡虚拟机将其MAC地址发送给所述第一虚拟机,使得所述第一虚拟机基于获取到的所述负载均衡虚拟机的MAC地址发送所述业务报文,所述虚拟交换机将所述业务报文转发给所述负载均衡虚拟机;或,The load balancing virtual machine sends its MAC address to the first virtual machine, so that the first virtual machine sends the service packet based on the obtained MAC address of the load balancing virtual machine, where the virtual switch Forwarding the service packet to the load balancing virtual machine; or
所述第一虚拟机基于预先配置的所述负载均衡虚拟机的MAC地址发送所述业务报文,所述虚拟交换机将所述业务报文转发给所述负载均衡虚拟机。The first virtual machine sends the service packet based on the pre-configured MAC address of the load balancing virtual machine, and the virtual switch forwards the service packet to the load balancing virtual machine.
结合第四方面的第一种可能的实现方式,本发明实施例第四方面的第二种可能的实现方式中,所述虚拟交换机将所述负载均衡虚拟机的MAC地址发送给所述第一虚拟机包括:With reference to the first possible implementation manner of the fourth aspect, in a second possible implementation manner of the fourth aspect, the virtual switch sends the MAC address of the load balancing virtual machine to the first Virtual machines include:
所述虚拟交换机接收所述第一虚拟机发送的控制报文,向所述第一虚拟机返回控制响应报文,所述控制响应报文包含所述负载均衡虚拟机的MAC地址。即可通过配置所述虚拟交换机的转发模式,所述虚拟交换机根据配置的转发模式对所述第一虚拟机的业务报文进行定向处理,使得所述第一 虚拟交换机将所述业务报文转发给所述负载均衡虚拟机。The virtual switch receives the control packet sent by the first virtual machine, and returns a control response packet to the first virtual machine, where the control response packet includes a MAC address of the load balancing virtual machine. The forwarding mode of the virtual switch is configured, and the virtual switch performs directional processing on the service packet of the first virtual machine according to the configured forwarding mode, so that the first The virtual switch forwards the service packet to the load balancing virtual machine.
结合第四方面的第二种可能的实现方式,本发明实施例第四方面的第三种可能的实现方式中,所述控制报文为地址解析协议ARP报文或互联网控制消息协议ICMP报文。例如所述控制报文可以是地址解析协议ARP报文,所述转发模式可以是ARP代答模式,所述第一虚拟机可以通过ARP代答模式将所述第一负载均衡虚拟机的MAC地址发送给所述第一虚拟机。可选的,当控制报文是ICMP报文时,所述转发模式也可以是邻居发现协议NDP代答模式。In conjunction with the second possible implementation manner of the fourth aspect, in a third possible implementation manner of the fourth aspect, the control packet is an address resolution protocol ARP packet or an Internet control message protocol ICMP packet. . For example, the control packet may be an address resolution protocol ARP packet, and the forwarding mode may be an ARP pickup mode, and the first virtual machine may use the ARP pickup mode to set the MAC address of the first load balancing virtual machine. Sent to the first virtual machine. Optionally, when the control packet is an ICMP packet, the forwarding mode may also be a neighbor discovery protocol NDP pickup mode.
结合第四方面,第四方面的第一种至第三种任一可能的实现方式,本发明实施例第四方面的第四种可能的实现方式中,在所述第二计算机设备根据所述配置信息,在所述第一计算机设备上创建负载均衡虚拟机之前,所述方法还包括:With reference to the fourth aspect, any one of the first to the third possible implementation manners of the fourth aspect, the fourth possible implementation manner of the fourth aspect of the embodiments of the present invention, The method further includes: before the creating a load balancing virtual machine on the first computer device, the method further includes:
所述第二计算机设备将所述配置信息发送给所述第一计算机设备;Sending, by the second computer device, the configuration information to the first computer device;
所述第一计算机设备接收创建负载均衡虚拟机的配置信息,指示所述第二计算机设备创建所述负载均衡虚拟机。可选的,所述第二计算机设备可以直接根据所述配置信息,在所述第二计算机设备上创建所述负载均衡虚拟机。The first computer device receives configuration information for creating a load balancing virtual machine, instructing the second computer device to create the load balancing virtual machine. Optionally, the second computer device may directly create the load balancing virtual machine on the second computer device according to the configuration information.
上述创建负载均衡虚拟机的配置信息,是用户通过云管理平台(所述第二计算机设备)下发的,所述配置信息包括但不限于:负载均衡虚拟机的标识,负载均衡虚拟机的IP地址,以及与该负载均衡虚拟机相关的后端服务器的信息。所述后端服务器的信息包括但不限于:后端服务器的标识,后端服务器的网络间互连协议(IP,Internet protocol)地址,后端服务器健康检查的方法等。其中,后端服务器的健康检查方法是指负载均衡虚拟机通过检查后端服务器的健康状态的方法。上述后端服务器是提供具体业务的服务器,负载均衡虚拟机根据接收到的业务报文,通过负载均衡算法等负载均衡方式在后端服务器中选择一个,作为处理所述业务报文的服务器。本发明实施例中,后端服务器可以是一个虚拟机,也可以是一个具 体的物理服务器。The configuration information of the load balancing virtual machine is delivered by the user through the cloud management platform (the second computer device), and the configuration information includes but is not limited to: the identifier of the load balancing virtual machine, and the IP of the load balancing virtual machine. The address, and information about the backend server associated with the load balancing virtual machine. The information of the back-end server includes, but is not limited to, an identifier of the back-end server, an IP protocol (Internet protocol) address of the back-end server, and a method for checking the health of the back-end server. The health check method of the backend server refers to a method in which the load balancing virtual machine checks the health status of the backend server. The back-end server is a server that provides a specific service. The load balancing virtual machine selects one of the back-end servers in a load balancing manner, such as a load balancing algorithm, according to the received service packet, as a server that processes the service packet. In the embodiment of the present invention, the backend server may be a virtual machine or a Physical server.
结合第四方面,第四方面的第一种至第四种任一可能的实现方式,本发明实施例第四方面的第五种可能的实现方式中,所述第二计算机设备还包括第二虚拟机,所述第二虚拟机具备处理所述第一虚拟机的所述业务报文的能力,所述方法还包括:With reference to the fourth aspect, any one of the first to fourth possible implementation manners of the fourth aspect, in the fifth possible implementation manner of the fourth aspect of the embodiments, the second computer device further includes the second a virtual machine, the second virtual machine is capable of processing the service packet of the first virtual machine, and the method further includes:
在所述负载均衡虚拟机通过负载均衡算法确定所述第二虚拟机处理所述第一虚拟机的所述业务报文时,所述第二虚拟机接收所述负载均衡服务器转发的所述业务报文,并将处理所述业务报文的结果发送给所述负载均衡虚拟机;When the load balancing virtual machine determines that the second virtual machine processes the service packet of the first virtual machine by using a load balancing algorithm, the second virtual machine receives the service forwarded by the load balancing server. Sending a message to the load balancing virtual machine by processing the result of processing the service packet;
所述负载均衡虚拟机将所述第二虚拟机处理所述业务报文的结果通过所述虚拟交换机发送给所述第一虚拟机。The load balancing virtual machine sends the result of processing the service packet by the second virtual machine to the first virtual machine by using the virtual switch.
本发明实施例提供的计算机设备、系统和负载均衡的方法,通过每个计算机设备中创建负载均衡虚拟机,在计算机设备中的虚拟机的业务需要进行负载均衡处理时,相关的业务报文只被发送到该计算机设备中的负载均衡虚拟机来进行负载均衡处理。由于负载均衡相关的业务报文在计算机设备中实现,不会出现多个计算机设备上的业务报文集中到一个负载均衡节点,避免了集中式的负载均衡的拥塞带来的处理的延迟。并且,当计算机设备出现故障时,该计算机设备中的虚拟机也会随之下线,不会再产生负载均衡的需求。因此,在单个计算机设备的故障带来的负载均衡虚拟机的故障,不会影响其它计算机设备上的负载均衡虚拟机,也不会存在因负载均衡虚拟机故障导致主备切换带来的业务中断。The computer device, the system, and the load balancing method provided by the embodiments of the present invention, when a load balancing virtual machine is created in each computer device, when the service of the virtual machine in the computer device needs load balancing processing, the related service packet is only A load balancing virtual machine that is sent to the computer device performs load balancing processing. Since the load balancing related service packets are implemented in the computer device, the service packets on the plurality of computer devices are not concentrated to one load balancing node, thereby avoiding the processing delay caused by the centralized load balancing congestion. Moreover, when the computer device fails, the virtual machine in the computer device will also go offline, and there will be no need for load balancing. Therefore, the load balancing virtual machine failure caused by the failure of a single computer device does not affect the load balancing virtual machine on other computer devices, and there is no service interruption caused by the load balancing virtual machine failure. .
附图说明DRAWINGS
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的 附图。In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the embodiments or the description of the prior art will be briefly described below. Obviously, the drawings in the following description are only It is some embodiments of the present invention, and those skilled in the art can obtain other ones according to these drawings without paying creative labor. The figure.
图1为为现有技术中一种实现负载均衡架构示意图;1 is a schematic diagram of implementing a load balancing architecture in the prior art;
图2为本发明实施例实现虚拟负载均衡的一种实现架构示意图;2 is a schematic structural diagram of implementing an implementation of virtual load balancing according to an embodiment of the present invention;
图3为本发明实施例一种计算机设备的结构示意图;3 is a schematic structural diagram of a computer device according to an embodiment of the present invention;
图4为本发明实施例中计算机设备的一种具体实现结构实体图;4 is a structural diagram of a specific implementation structure of a computer device according to an embodiment of the present invention;
图5为本发明实施例第一种计算机系统实现结构示意图;FIG. 5 is a schematic structural diagram of an implementation of a first computer system according to an embodiment of the present invention; FIG.
图6为本发明实施例中第一中计算机系统的一种具体实现结构实体图;6 is a structural diagram of a specific implementation structure of a computer system in a first embodiment of the present invention;
图7为本发明实施例中第一中计算机系统的另一种具体实现结构实体图;FIG. 7 is a structural diagram showing another specific implementation structure of the first computer system according to an embodiment of the present invention; FIG.
图8为本发明实施例一种实现负载均衡方法的流程示意图;FIG. 8 is a schematic flowchart of a method for implementing load balancing according to an embodiment of the present invention;
图9为本发明实施例中另一种实现负载均衡方法的流程示意图。FIG. 9 is a schematic flowchart of another method for implementing load balancing according to an embodiment of the present invention.
具体实施方式detailed description
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明的一部分实施例,而不是全部实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动的前提下所获得的所有其他实施例,都应属于本发明保护的范围。The technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. It is obvious that the described embodiments are a part of the embodiments of the present invention, but not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts shall fall within the scope of the present invention.
参考图1,图1为现有技术中一种实现负载均衡架构示意图。图1中包括计算机设备101、计算机设备102、计算机设备103、主虚拟负载均衡器104和备虚拟负载均衡器105。其中,计算机设备101作为云管理平台,包括中央处理器(CPU,Central processing unit)1011和存储设备1012(例如硬盘、固态硬盘等)等组成部件,运行云管理平台相关程序,实现对计算机设备102和计算机设备103等节点的管理和配置。计算机设备102和计算机设备103通过网络连接,计算机设备101可以根据接收到的关于创建虚拟机的配置信息,在计算机设备102或计算机设备103创建相应的虚拟机。 Referring to FIG. 1, FIG. 1 is a schematic diagram of implementing a load balancing architecture in the prior art. 1 includes a computer device 101, a computer device 102, a computer device 103, a primary virtual load balancer 104, and a standby virtual load balancer 105. The computer device 101 functions as a cloud management platform, including a central processing unit (CPU) 1011 and a storage device 1012 (such as a hard disk, a solid state hard disk, etc.), and runs a cloud management platform related program to implement the pair of computer devices 102. Management and configuration of nodes such as computer device 103. The computer device 102 and the computer device 103 are connected by a network, and the computer device 101 can create a corresponding virtual machine at the computer device 102 or the computer device 103 according to the received configuration information about creating a virtual machine.
图1以每个计算机设备包含两个虚拟机为例进行说明。例如计算机设备102包含虚拟机10211和10212,计算机设备103包含虚拟机10311和10312。主负载均衡器104和备负载均衡器105通过主备的方式,为计算机设备102或计算机设备103中的虚拟机发出的业务报文提供负载均衡服务。主负载均衡器104和备负载均衡器105通过心跳检测的方式连接,当主负载均衡器104故障时,由备负载均衡器105接替主负载均衡器104继续为虚拟机的请求提供负载均衡服务。FIG. 1 illustrates an example in which each computer device includes two virtual machines. For example, computer device 102 includes virtual machines 10211 and 10212, and computer device 103 includes virtual machines 10311 and 10312. The primary load balancer 104 and the backup load balancer 105 provide load balancing services for service messages sent by the virtual machines in the computer device 102 or the computer device 103 in a master-slave manner. The primary load balancer 104 and the backup load balancer 105 are connected by heartbeat detection. When the primary load balancer 104 fails, the backup load balancer 105 takes over the primary load balancer 104 to continue to provide load balancing services for the virtual machine's request.
这种实现负载均衡的方式,当主负载均衡节点104故障需要切换至备负载均衡节点时,在切换器件,没有负载均衡器提供负载均衡服务,造成需要进行负载均衡处理的业务报文无法被处理。同时,只有一个负载均衡器(负载均衡器104或105)处理所有虚拟机的业务报文,容易造成虚拟负载均衡器的过载和拥塞,影响的请求业务的及时处理,降低了用户的体验度。In the load balancing mode, when the primary load balancing node 104 needs to be switched to the standby load balancing node, the load balancing service is not provided by the load balancing device, and the service packet that needs to be load balanced cannot be processed. At the same time, only one load balancer (load balancer 104 or 105) processes the service packets of all the virtual machines, which is easy to cause overload and congestion of the virtual load balancer, and the timely processing of the affected request services reduces the user experience.
为解决上述虚拟负载均衡采用主备方式在切换时造成的中断,以及集中在一个虚拟负载均衡节点时造成的拥塞,本发明实施例提供一种虚拟负载均衡的方法、设备和系统,通过创建分布式负载均衡虚拟机,将负载均衡功能卸载到每个节点设备侧,不需要主备切换的集中负载均衡模式,以避免主备切换时造成的中断和集中式负载均衡所带来的拥塞。The method, device, and system for virtual load balancing are provided by creating a distribution, in order to solve the problem that the virtual load balancing uses the interruption caused by the active/standby mode during the handover, and the congestion caused when the virtual load balancing node is centralized. The load balancing function is used to offload the load balancing function to the device side of each node. The centralized load balancing mode of the active/standby switchover is not required to avoid the interruption caused by the active/standby switchover and the congestion caused by centralized load balancing.
为清楚地描述技术方案,本发明实施例以一个云管理平台,两个计算机设备节点组成的网络为例进行说明。如图2所示,图2为本发明实施例实现虚拟负载均衡的一种实现架构示意图。其中,计算机设备201作为云管理平台,实现对计算机设备202和计算机设备203的虚拟化的管理和配置。需要说明的是,图2以两个计算机设备为例对本发明实施例的方案进行描述,在具体实现时,作为云平台的计算机设备201还可以配置和管理2个以上的计算机设备,本发明实施例不限定具体的计算机设备的个数。In order to clearly describe the technical solution, the embodiment of the present invention uses a cloud management platform and a network composed of two computer device nodes as an example for description. As shown in FIG. 2, FIG. 2 is a schematic diagram of an implementation architecture for implementing virtual load balancing according to an embodiment of the present invention. The computer device 201 functions as a cloud management platform to implement management and configuration of the virtualization of the computer device 202 and the computer device 203. It should be noted that, in FIG. 2, two computer devices are taken as an example to describe the solution of the embodiment of the present invention. In a specific implementation, the computer device 201 as a cloud platform can also configure and manage two or more computer devices. The example does not limit the number of specific computer devices.
以图2中的计算机设备202为例,对本发明实施例中计算机设备的组 成部分进行说明。计算机设备202可以包括计算硬件20231、存储硬件20232、网络硬件20233组成的硬件资源层2023。计算硬件20231可以为专用的处理器或通用的用于提供处理和计算功能的处理器。存储硬件20232用于提供存储能力,该存储能力可以是存储硬件20232本身提供的(例如一台服务器的本地内存或本地硬盘),也可以通过网络提供(例如服务器通过网络连接一个网络存储设备)。网络硬件20233可以是交换设备(网卡等)、路由器和/或其他网络设备,网络硬件20233用于实现多个设备之间的通信,多个设备之间通过无线或有线连接。计算机设备202中的虚拟化层用于抽象硬件资源层的硬件资源,以提供虚拟资源。计算机设备202中的操作系统2022,包括但不限于运行虚拟化管理的虚拟化层Hypervisor20221和虚拟交换机20222。虚拟化层Hypervisor20221对所述计算机设备202中的虚拟机(例如虚拟机20213等)进行管理。虚拟交换机20222为所述Hypervisor20221所管理的虚拟机之间和虚拟机与物理网络之间提供网络连接功能,虚拟负载均衡代理单元20211通过虚拟机化层Hypervisor20221对计算机设备202中的负载均衡虚拟机20212进行配置和管理。Taking the computer device 202 in FIG. 2 as an example, a group of computer devices in the embodiment of the present invention Explain in part. The computer device 202 can include a hardware resource layer 2023 comprised of computing hardware 20231, storage hardware 20232, and network hardware 20233. Computing hardware 20231 can be a dedicated processor or a general purpose processor for providing processing and computing functions. The storage hardware 20232 is configured to provide storage capabilities, which may be provided by the storage hardware 20232 itself (for example, a server's local memory or a local hard disk), or may be provided through a network (for example, the server connects to a network storage device through a network). The network hardware 20233 may be a switching device (network card, etc.), a router, and/or other network device. The network hardware 20233 is used to implement communication between a plurality of devices, and the plurality of devices are connected by wireless or wired. The virtualization layer in computer device 202 is used to abstract the hardware resources of the hardware resource layer to provide virtual resources. The operating system 2022 in the computer device 202 includes, but is not limited to, a virtualization layer Hypervisor 20221 and a virtual switch 20222 running virtualization management. The virtualization layer Hypervisor 20221 manages virtual machines (e.g., virtual machines 20213, etc.) in the computer device 202. The virtual switch 20222 provides a network connection function between the virtual machines managed by the Hypervisor 20221 and between the virtual machine and the physical network. The virtual load balancing agent unit 20211 connects the load balancing virtual machine 20212 in the computer device 202 through the virtualization layer Hypervisor 20221. Configure and manage.
其中,计算机设备201作为云管理平台,运行云管理平台相关程序,实现对计算机设备202和计算机设备203的管理和配置,包括对所述计算机设备202和计算机设备203中的虚拟机进行配置和管理。计算机设备202和计算机设备203,作为云管理平台控制下的设备节点,提供虚拟机等相关的服务或业务。The computer device 201 functions as a cloud management platform, runs a cloud management platform related program, implements management and configuration of the computer device 202 and the computer device 203, and includes configuring and managing virtual machines in the computer device 202 and the computer device 203. . The computer device 202 and the computer device 203 serve as device nodes under the control of the cloud management platform, and provide related services or services such as virtual machines.
需要说明的是,图2中,计算机设备201包括计算硬件20131、存储硬件20132、网络硬件20133组成的硬件资源层2013。计算硬件20131可以为专用的处理器或通用的用于提供处理和计算功能的处理器。存储硬件20132用于提供存储能力,该存储能力可以是存储硬件20132本身提供的(例如一台服务器的本地内存或本地硬盘),也可以通过网络提供(例如服务 器通过网络连接一个网络存储设备)。网络硬件20133可以是交换设备(网卡等)、路由器和/或其他网络设备,网络硬件20133用于实现多个设备之间的通信,多个设备之间通过无线或有线连接。计算机设备201中的虚拟化层用于抽象硬件资源层的硬件资源,以提供虚拟资源。计算机设备201中的操作系统2012,包括但不限于运行虚拟化管理的虚拟化层Hypervisor20121。It should be noted that, in FIG. 2, the computer device 201 includes a hardware resource layer 2013 composed of a computing hardware 20131, a storage hardware 20132, and a network hardware 20133. The computing hardware 20131 can be a dedicated processor or a general purpose processor for providing processing and computing functions. The storage hardware 20132 is used to provide storage capacity, which may be provided by the storage hardware 20132 itself (for example, a server's local memory or a local hard disk), or may be provided through a network (for example, a service) Connect a network storage device through the network). The network hardware 20133 may be a switching device (network card, etc.), a router, and/or other network devices. The network hardware 20133 is used to implement communication between multiple devices, and multiple devices are connected by wireless or wired. The virtualization layer in computer device 201 is used to abstract the hardware resources of the hardware resource layer to provide virtual resources. The operating system 2012 in the computer device 201 includes, but is not limited to, a virtualization layer Hypervisor 20121 running virtualization management.
下面以用户通过云管理平台在计算机设备202申请虚拟机、且需要对申请的虚拟机的业务报文进行负载均衡处理为例,对本发明实施例提供的负载均衡的实现方式进行说明。The following describes the implementation of the load balancing provided by the embodiment of the present invention by using the cloud management platform to apply for a virtual machine on the computer device 202 and load balancing the service packets of the applied virtual machine.
本发明实施例中,可以通过负载均衡器实现对申请的虚拟机的业务报文进行负载均衡处理,即通过创建负载均衡器,实现对申请的虚拟机的业务报文进行负载均衡处理。所述负载均衡器包括但不限于虚拟机、namespace或容器等实现方式。本发明实施例以虚拟机作为负载均衡器为例进行说明。可以理解,对于以namespace或容器作为负载均衡器的实现方式,可以参照以虚拟机作为负载均衡器的实现方式来实现。In the embodiment of the present invention, the load balancer can perform load balancing processing on the service packets of the applied virtual machine, that is, the load balancer is configured to perform load balancing processing on the service packets of the applied virtual machine. The load balancer includes, but is not limited to, a virtual machine, a namespace, or a container. The embodiment of the present invention uses a virtual machine as a load balancer as an example for description. It can be understood that the implementation of using a namespace or a container as a load balancer can be implemented by referring to an implementation in which a virtual machine is used as a load balancer.
本发明实施例中,云管理平台实现对网络、存储、计算等资源的统一调度管理,以及在此之上的业务自动化编排,实现了计费、流程、日志、应用交付的运营功能,最终按使用量付费的模式,向用户和管理员提供可用的、便捷的、按需的网络访问,使用户和管理员可以访问可配置的计算资源共享池(资源包括网络,服务器,存储,应用软件,服务等)。In the embodiment of the present invention, the cloud management platform implements unified scheduling management of resources such as network, storage, and computing, and the business automation orchestration on the above, realizes the operation functions of charging, process, log, and application delivery, and finally presses A pay-as-you-go model that provides users, administrators with available, convenient, on-demand network access, giving users and administrators access to a configurable pool of computing resources (resources including network, server, storage, application software, Service, etc.).
参考图2,作为云管理平台的计算机设备201包括虚拟负载均衡管理单元20111和虚拟机管理单元20112。Referring to FIG. 2, the computer device 201 as a cloud management platform includes a virtual load balancing management unit 20111 and a virtual machine management unit 20112.
所述虚拟负载均衡管理单元20111,用于接收创建负载均衡虚拟机的配置信息,将所述创建负载均衡虚拟机的配置信息存入虚拟负载均衡数据设备20114。所述虚拟负载均衡管理单元20111还可以将所述创建负载均衡虚拟机的配置信息发送给虚拟负载均衡代理单元20211。 The virtual load balancing management unit 20111 is configured to receive configuration information for creating a load balancing virtual machine, and store the configuration information of the created load balancing virtual machine into the virtual load balancing data device 20114. The virtual load balancing management unit 20111 may further send the configuration information of the created load balancing virtual machine to the virtual load balancing proxy unit 20211.
所述虚拟机管理单元20112,用于根据所述创建负载均衡虚拟机的配置信息,创建或删除负载均衡虚拟机20212。The virtual machine management unit 20112 is configured to create or delete the load balancing virtual machine 20212 according to the configuration information of the created load balancing virtual machine.
其中,所述创建负载均衡虚拟机的配置信息是用户通过云管理平台下发的,所述配置信息包括但不限于:负载均衡虚拟机的标识,负载均衡虚拟机的IP地址,例如虚拟化IP(VIP,Virutal IP Address)地址,以及与该负载均衡虚拟机相关的后端服务器的信息。所述负载均衡虚拟机的VIP地址,是所述负载均衡虚拟机的IP地址。所述后端服务器的信息包括但不限于:后端服务器的标识,后端服务器的网络间互连协议(IP,Internet protocol)地址,后端服务器健康检查的方法等。其中,后端服务器的健康检查方法是指负载均衡虚拟机通过检查后端服务器的健康状态的方法。上述后端服务器是提供具体业务的服务器,负载均衡虚拟机根据接收到的业务报文,通过负载均衡算法等负载均衡方式在后端服务器中选择一个,作为处理所述业务报文的服务器。本发明实施例中,后端服务器可以是一个虚拟机,也可以是一个具体的物理服务器。The configuration information of the load balancing virtual machine is delivered by the user through the cloud management platform, and the configuration information includes, but is not limited to, an identifier of the load balancing virtual machine, and an IP address of the load balancing virtual machine, such as a virtualized IP address. (VIP, Virutal IP Address) address, and information about the backend server associated with the load balancing virtual machine. The VIP address of the load balancing virtual machine is an IP address of the load balancing virtual machine. The information of the back-end server includes, but is not limited to, an identifier of the back-end server, an IP protocol (Internet protocol) address of the back-end server, and a method for checking the health of the back-end server. The health check method of the backend server refers to a method in which the load balancing virtual machine checks the health status of the backend server. The back-end server is a server that provides a specific service. The load balancing virtual machine selects one of the back-end servers in a load balancing manner, such as a load balancing algorithm, according to the received service packet, as a server that processes the service packet. In the embodiment of the present invention, the backend server may be a virtual machine or a specific physical server.
图2中,虚拟负载均衡数据设备20114用于存储创建负载均衡虚拟机的配置信息,可以是所述计算机设备201中的存储设备,也可以是独立于所述计算机设备201的存储设备,本发明实施例不限定具体的保存所述创建负载均衡虚拟机的配置信息的方式。In FIG. 2, the virtual load balancing data device 20114 is configured to store configuration information for creating a load balancing virtual machine, which may be a storage device in the computer device 201, or may be a storage device independent of the computer device 201, and the present invention The embodiment does not limit the specific manner of saving the configuration information of the created load balancing virtual machine.
所述虚拟机管理单元20112可以直接根据所述虚拟负载均衡管理单元20111的指示,创建或删除负载均衡虚拟机20212;也可以根据计算机设备202中的虚拟负载均衡代理单元20211的指示,创建或删除负载均衡虚拟机20212。The virtual machine management unit 20112 may directly create or delete the load balancing virtual machine 20212 according to the instruction of the virtual load balancing management unit 20111; or may create or delete according to the instruction of the virtual load balancing agent unit 20211 in the computer device 202. The load balancing virtual machine 20212.
所述虚拟机管理单元20112,还用于根据用户下发的在计算机设备202中创建虚拟机的配置信息,创建相应的虚拟机。例如,当所述计算机设备201接收到用户下发的在计算机设备202中创建虚拟机时,所述虚拟机管理单元20112在所述计算机设备202中创建虚拟机20213。同样的,当所述计 算机设备201接收到用户下发的在计算机设备202中创建作为后端服务器的虚拟机的配置信息时,所述虚拟机管理单元20112创建相应的虚拟机作为后端服务器,例如创建虚拟机20214。The virtual machine management unit 20112 is further configured to create a corresponding virtual machine according to the configuration information that is created by the user and create a virtual machine in the computer device 202. For example, when the computer device 201 receives a virtual machine created by the user in the computer device 202, the virtual machine management unit 20112 creates a virtual machine 20213 in the computer device 202. Similarly, when the meter When the computer device 201 receives the configuration information of the virtual machine created by the user as the backend server in the computer device 202, the virtual machine management unit 20112 creates a corresponding virtual machine as a backend server, for example, creates a virtual machine 20214. .
作为一种可选的实现方式,所述计算机设备202还可以包括虚拟负载均衡代理单元20211,所述虚拟负载均衡代理单元20211用于从所述虚拟负载均衡管理单元20111获取所述创建负载均衡虚拟机的配置信息,指示所述虚拟机管理单元20112根据所述创建负载均衡虚拟机的配置信息,创建负载均衡虚拟机20212。As an optional implementation, the computer device 202 may further include a virtual load balancing proxy unit 20211, where the virtual load balancing proxy unit 20211 is configured to obtain the created load balancing virtuality from the virtual load balancing management unit 20111. The configuration information of the machine instructs the virtual machine management unit 20112 to create a load balancing virtual machine 20212 according to the configuration information of the created load balancing virtual machine.
其中,所述虚拟负载均衡代理单元20211,在指示所述虚拟机管理单元20112根据所述创建负载均衡虚拟机的配置信息创建所述负载均衡虚拟机20212时,向所述虚拟机管理单元20112发送通知信息,所述通知信息还包括创建负载均衡虚拟机20212的虚拟机参数信息。所述负载均衡虚拟机20212的虚拟机参数信息包括但不限于:虚拟中央处理器的个数,虚拟内存的大小,以及所述负载均衡虚拟机20212所在的逻辑网络等信息。The virtual load balancing agent unit 20211, when the virtual machine management unit 20112 is instructed to create the load balancing virtual machine 20212 according to the configuration information of the created load balancing virtual machine, sends the load balancing virtual machine 20212 to the virtual machine management unit 20112. Notification information, the notification information further including virtual machine parameter information for creating a load balancing virtual machine 20212. The virtual machine parameter information of the load balancing virtual machine 20212 includes, but is not limited to, the number of virtual central processing units, the size of the virtual memory, and the logical network in which the load balancing virtual machine 20212 is located.
所述虚拟机管理单元20112创建负载均衡虚拟机20212的过程可以为:虚拟机管理单元20112通过调用创建虚拟机的应用软件编程接口(API,application programming interface),指定带有负载均衡模块的镜像来创建负载均衡虚拟机20212。在调用API创建虚拟机时会使用虚拟机参数信息,以根据虚拟机参数信息创建虚拟机。指定带有负载均衡模块的镜像,使得创建的虚拟机具有负载均衡的模块,然后将所述配置信息配置给虚拟机中的负载均衡模块。The process of creating the load balancing virtual machine 20212 by the virtual machine management unit 20112 may be: the virtual machine management unit 20112 specifies an image with a load balancing module by calling an application programming interface (API) of the created virtual machine. A load balancing virtual machine 20212 is created. Virtual machine parameter information is used when calling the API to create a virtual machine to create a virtual machine based on virtual machine parameter information. The mirror with the load balancing module is specified, so that the created virtual machine has a load balancing module, and then the configuration information is configured to the load balancing module in the virtual machine.
当所述虚拟负载均衡管理单元20111直接通知虚拟机管理单元20112创建负载均衡虚拟机20212时,虚拟负载均衡管理单元20111给所述虚拟机管理单元20112发送通知消息,所述通知消息包括创建所述负载均衡虚拟机20212所需的配置信息和虚拟机参数信息,以通知虚拟机管理单元20112启动创建负载均衡虚拟机20212。在所述计算机设备202中已经创建 了负载均衡虚拟机20212后,所述负载均衡虚拟机20212用于接收所述计算机设备202中的虚拟机,例如虚拟机20213,通过虚拟交换机20222发送的业务报文,基于负载均衡方式对接收到的业务报文进行处理。When the virtual load balancing management unit 20111 directly notifies the virtual machine management unit 20112 to create the load balancing virtual machine 20212, the virtual load balancing management unit 20111 sends a notification message to the virtual machine management unit 20112, where the notification message includes creating the The configuration information and virtual machine parameter information required by the virtual machine 20212 are load balanced to notify the virtual machine management unit 20112 to start creating the load balancing virtual machine 20212. Already created in the computer device 202 After the load balancing virtual machine 20212, the load balancing virtual machine 20212 is configured to receive a virtual machine in the computer device 202, for example, the virtual machine 20213, and the service packet sent by the virtual switch 20222 is received based on the load balancing manner. The business message is processed.
所述负载均衡虚拟机20212基于负载均衡方式对所述计算机设备202中的虚拟机的业务报文进行处理可以是:所述负载均衡虚拟机20212在收到业务报文后,首先判断是否已经为所述业务报文分配了一个后端服务器为其服务,如果已经分配了后端服务器,则将该业务报文发送给已经分配的后端服务器。如果还没有分配后端服务器,则通过负载均衡算法,选择一个后端服务器为其服务。所述负载均衡算法包括但不限于:轮询、加权轮询、随机、最小连接或源地散列,基于位置优先的加权轮询等。所述位置优先的加权轮询方式,可以优先选择在发起业务报文的虚拟机所在的计算机设备中的后端服务器,这样能够节省后端服务器处理业务报文的速度,节省网络带宽。The load balancing virtual machine 20212 processes the service packet of the virtual machine in the computer device 202 based on the load balancing mode. The load balancing virtual machine 20212 first determines whether it is already after receiving the service packet. The service packet is assigned a backend server for its service. If the backend server has been allocated, the service packet is sent to the already assigned backend server. If a backend server has not been assigned, select a backend server to serve it through a load balancing algorithm. The load balancing algorithms include, but are not limited to, polling, weighted polling, random, minimum or source-to-ground hashing, location-based weighted polling, and the like. The location-prioritized weighted polling mode can preferentially select the back-end server in the computer device where the virtual machine that initiates the service packet is located, which can save the speed of the back-end server processing the service packet and save the network bandwidth.
本发明实施例以轮询算法为例,对负载均衡虚拟机20212选取后端服务器的方式予以说明。当负载均衡虚拟机20212的后端服务器包括虚拟机虚拟机20214和虚拟机20314时,负载均衡虚拟机20212把所有的后端服务器(虚拟机20214和虚拟机20314)组成一个列表,在列表中轮流分配需要处理的业务报文。当负载均衡虚拟机20212收到虚拟机20213发送的第一个业务报文,将虚拟机20214作为提供服务的后端服务器,并把所述第一个业务报文发给虚拟机20214;当收到来自虚拟机20213的第二个业务报文时,将虚拟机20314作为提供服务的后端服务器,然后把所述第二个业务报文发给虚拟机20314;当负载均衡虚拟机20212收到虚拟机20213发送的第三个业务报文,将虚拟机20214作为提供服务的后端服务器,并把所述第三个业务报文发给虚拟机20214,以此循环。In the embodiment of the present invention, a polling algorithm is taken as an example, and a manner in which the load balancing virtual machine 20212 selects a backend server is described. When the backend server of the load balancing virtual machine 20212 includes the virtual machine virtual machine 20214 and the virtual machine 20314, the load balancing virtual machine 20212 groups all the backend servers (the virtual machine 20214 and the virtual machine 20314) into a list, taking turns in the list. Allocate business messages that need to be processed. When the load balancing virtual machine 20212 receives the first service packet sent by the virtual machine 20213, the virtual machine 20214 is used as the backend server for providing the service, and sends the first service packet to the virtual machine 20214; When the second service message from the virtual machine 20213 is received, the virtual machine 20314 is used as the back-end server for providing the service, and then the second service message is sent to the virtual machine 20314; when the load balancing virtual machine 20212 receives The third service packet sent by the virtual machine 20213 is used as the backend server for providing the service, and the third service packet is sent to the virtual machine 20214 for circulation.
上述实现负载均衡方式,在用户通过云管理平台在计算机设备202中申请用于发起业务的虚拟机、且需要对申请的虚拟机的业务请求进行负载 均衡处理为例进行的说明。可以理解,当用户通过云管理平台在计算机设备203中申请用于发起业务的虚拟机、且需要对申请的虚拟机的业务请求进行负载均衡处理时,其实现方式类似。由于负载均衡单元分布在每个计算机设备中,不存在集中的负载均衡节点,与负载均衡相关的业务报文在每个计算机设备中实现负载均衡处理,不会出现业务报文的拥塞带来的处理的延迟。并且,计算机设备202和计算机设备203中都部署有负载均衡器,当某一计算机设备出现故障时,该计算系统中的虚拟机也会随之下线,不会再产生负载均衡的需求;因此,在单个计算机设备的故障带来的负载均衡单元的故障,不会影响其它负载均衡业务的处理,也不会存在因负载均衡节点故障导致主备切换带来的业务中断。In the above-mentioned load balancing mode, the user applies for a virtual machine for initiating a service in the computer device 202 through the cloud management platform, and needs to load the service request of the applied virtual machine. The equalization process is described as an example. It can be understood that when a user applies for a virtual machine for initiating a service in the computer device 203 through the cloud management platform, and needs to perform load balancing processing on the service request of the applied virtual machine, the implementation manner is similar. Since the load balancing unit is distributed in each computer device, there is no centralized load balancing node, and the service packets related to load balancing are load-balanced in each computer device, and there is no congestion caused by service packets. Processing delay. Moreover, a load balancer is deployed in both the computer device 202 and the computer device 203. When a certain computer device fails, the virtual machine in the computing system is also offline, and no load balancing requirement is generated; The failure of the load balancing unit caused by the failure of a single computer device does not affect the processing of other load balancing services, and there is no service interruption caused by the active/standby switchover caused by the failure of the load balancing node.
本发明实施例中,所述虚拟负载均衡代理单元20211从所述虚拟负载均衡管理单元20111处获取的所述负载均衡虚拟机20212的配置信息还可以包括所述负载均衡虚拟机20212的网络信息。所述虚拟负载均衡代理单元20211还用于根据创建负载均衡虚拟机的配置信息中的网络信息,指示所述虚拟机管理单元20112为所述负载均衡虚拟机20212建立虚拟网卡,并指示所述虚拟机管理单元20112建立所述虚拟网卡与所述虚拟交换机20222的连接。其中,所述虚拟机管理单元20112根据虚拟负载均衡代理单元20211的指示建立所述虚拟网卡时,还可以根据所述创建负载均衡虚拟机的配置信息,为创建的所述虚拟网卡分配IP地址和MAC地址。可选的,也可以由上述虚拟负载均衡管理单元20111指示所述虚拟机管理单元20112为所述负载均衡虚拟机20212建立虚拟网卡,并建立所述虚拟网卡与所述虚拟交换机20222的连接。In the embodiment of the present invention, the configuration information of the load balancing virtual machine 20212 obtained by the virtual load balancing proxy unit 2011 from the virtual load balancing management unit 20111 may further include network information of the load balancing virtual machine 20212. The virtual load balancing agent unit 20211 is further configured to instruct the virtual machine management unit 20112 to establish a virtual network card for the load balancing virtual machine 20212 according to the network information in the configuration information of the load balancing virtual machine, and indicate the virtual The machine management unit 20112 establishes a connection between the virtual network card and the virtual switch 20222. The virtual machine management unit 20112 may also allocate an IP address to the created virtual network card according to the configuration information of the load balancing virtual machine when the virtual network card is established according to the instruction of the virtual load balancing agent unit 20211. MAC address. Optionally, the virtual machine management unit 20111 may be instructed by the virtual load balancing management unit 20111 to establish a virtual network card for the load balancing virtual machine 20212, and establish a connection between the virtual network card and the virtual switch 20222.
建立所述虚拟网卡与所述虚拟交换机20222的连接可以通过配置虚拟交换机的网络标识来实现。所述虚拟交换机的网络标识是虚拟交换机的网络接口的标识,当虚拟机的网络接口与虚拟交换机的网络接口的标识相同时,虚拟机和虚拟交换机之间才能够建立连接。本发明实施中,所述虚拟 机管理单元20112通过配置虚拟交换机20222的网络标识,建立负载均衡虚拟机20212与虚拟交换机20222之间的连接。例如,虚拟交换机20222有3个网络接口,其网络标识为100,当负载均衡虚拟机20212和虚拟机20213的虚拟网卡具有网络标识为100的接口时,虚拟机20213可以通过网络标识为100的接口与负载均衡虚拟机20212的网络标识为100的接口实现通信。其中,所述虚拟机管理单元20112可以根据所述虚拟负载均衡代理单元20211或虚拟负载均衡管理单元20111指示,为所述虚拟交换机20222配置网络标识。可以理解,上述虚拟交换机20222的3个网络接口只是举例,在具体实现时,所述虚拟交换机20222还可以包括其它的网络接口。例如虚拟交换机20222包括100个网络接口,其中三个网络接口的网络标识为100。Establishing a connection between the virtual network card and the virtual switch 20222 can be implemented by configuring a network identifier of the virtual switch. The network identifier of the virtual switch is an identifier of the network interface of the virtual switch. When the network interface of the virtual machine is the same as the identifier of the network interface of the virtual switch, the virtual machine and the virtual switch can establish a connection. In the implementation of the present invention, the virtual The machine management unit 20112 establishes a connection between the load balancing virtual machine 20212 and the virtual switch 20222 by configuring the network identifier of the virtual switch 20222. For example, the virtual switch 20222 has three network interfaces, and the network identifier is 100. When the virtual network card of the load balancing virtual machine 20212 and the virtual machine 20213 has an interface with the network identifier of 100, the virtual machine 20213 can be identified by the network as an interface of 100. The communication with the interface of the load balancing virtual machine 20212 having the network identifier of 100 is implemented. The virtual machine management unit 20112 may configure a network identifier for the virtual switch 20222 according to the virtual load balancing proxy unit 20211 or the virtual load balancing management unit 20111. It can be understood that the three network interfaces of the virtual switch 20222 are only examples. In a specific implementation, the virtual switch 20222 may further include other network interfaces. For example, the virtual switch 20222 includes 100 network interfaces, and the network identifier of the three network interfaces is 100.
在所述虚拟机管理单元20112根据所述虚拟负载均衡代理单元20211的指示建立所述虚拟网卡与所述虚拟交换机20222的连接后,所述虚拟负载均衡代理单元20211还用于指示虚拟机管理单元20112配置所述虚拟交换机20222的转发模式,所述虚拟交换机20222根据转发模式对所述虚拟机20213的业务报文进行定向转发处理,使得所述虚拟机20213将所述业务报文发送至所述负载均衡虚拟机20212。可选的,也可以由上述虚拟负载均衡管理单元20111指示所述虚拟机管理单元20112配置所述虚拟交换机20222的转发模式。After the virtual machine management unit 20112 establishes the connection between the virtual network card and the virtual switch 20222 according to the instruction of the virtual load balancing agent unit 20211, the virtual load balancing agent unit 20211 is further configured to instruct the virtual machine management unit. The configuration of the virtual switch 20222 is configured to forward the service packet of the virtual machine 20213 according to the forwarding mode, so that the virtual machine 20213 sends the service packet to the The load balancing virtual machine 20212. Optionally, the virtual machine management unit 20112 may be instructed by the virtual load balancing management unit 20111 to configure a forwarding mode of the virtual switch 20222.
上述所述虚拟交换机20222的转发模式可以为地址解析协议(ARP,ARP Address Resolution Protocol)或邻居发现协议(NDP,NDP Neighbor Discovery Protocol)代答模式,即所述虚拟交换机20222对所述业务报文进行定向转发处理的方式为ARP或NDP代答模式。本发明实施例以支持OpenStack的云平台为例,对ARP代答技术的实现方式进行说明。The forwarding mode of the virtual switch 20222 may be an ARP address resolution protocol (ARP) or a NDP Neighbor Discovery Protocol (NDP) mode, that is, the virtual switch 20222 is configured to the service packet. The way to perform directional forwarding processing is ARP or NDP pickup mode. The embodiment of the present invention uses a cloud platform supporting OpenStack as an example to describe the implementation manner of the ARP pickup technology.
ARP代答技术通过流表来实现,流表技术一般由两部分组成,一部分是匹配条件,另一部分是动作,ARP代答的流表的匹配条件是:协议类型为 ARP,ARP的目标协议地址为虚拟化IP地址(VIP,Virutal IP Address),该VIP是负载均衡虚拟机可被访问的IP地址,ARP操作类型为ARP请求。动作包括:1、修改收到的ARP报文的目的媒体访问控制(MAC,Media Access Control)地址为该报文的源MAC地址;2、修改收到的ARP报文的源MAC地址为负载均衡虚拟机20212的MAC地址;3、修改收到的ARP报文的ARP操作类型为ARP应答;4、修改收到的ARP报文的ARP目的协议地址为该ARP报文的ARP源协议地址,其中,协议地址是ARP协议中的术语,即IP地址;5、修改收到的ARP报文的ARP源协议地址为负载均衡虚拟机20212的IP地址;6、修改收到的ARP报文的ARP目的硬件地址为该报文的ARP源硬件地址,其中,硬件地址是ARP协议中的术语,即MAC地址;7、修改收到的ARP报文的ARP源硬件地址为负载均衡虚拟机20212的MAC地址。上述流表中的动作并非每一个动作都必须执行,本领域技术人员可知,动作2为必要。然后,把这个修改后的ARP报文交由虚拟交换机20222发送到虚拟机20213。虚拟交换机20222的ARP代答模式,能够使得虚拟机20213获取与VIP对应的MAC地址,并基于获取到的MAC地址发送业务报文,使得计算机设备202中的虚拟机发送的需要负载均衡处理的业务报文,只发送到计算机设备202上的负载均衡虚拟机20212。The ARP pickup technology is implemented by a flow table. The flow table technology generally consists of two parts, one is the matching condition and the other is the action. The matching condition of the flow table of the ARP pickup is: the protocol type is ARP, the destination protocol address of the ARP is the virtualized IP address (VIP, Virutal IP Address), which is the IP address that the load balancing virtual machine can access, and the ARP operation type is the ARP request. The action includes: 1. Modifying the destination media access control (MAC, Media Access Control) address of the received ARP packet as the source MAC address of the packet; 2. Modifying the source MAC address of the received ARP packet as load balancing. The MAC address of the virtual machine 20212; 3. The ARP operation type of the modified ARP packet is an ARP response; 4. The ARP destination protocol address of the received ARP packet is the ARP source protocol address of the ARP packet, where The protocol address is the term in the ARP protocol, that is, the IP address. 5. The ARP source protocol address of the received ARP packet is the IP address of the load balancing virtual machine 20212. 6. The ARP destination of the received ARP packet is modified. The hardware address is the ARP source hardware address of the packet. The hardware address is the term in the ARP protocol, that is, the MAC address. 7. The ARP source hardware address of the received ARP packet is the MAC address of the load balancing virtual machine 20212. . The actions in the above flow table are not necessarily performed for each action, and those skilled in the art will recognize that action 2 is necessary. Then, the modified ARP packet is sent to the virtual machine 20213 by the virtual switch 20222. The ARP proxy mode of the virtual switch 20222 enables the virtual machine 20213 to obtain the MAC address corresponding to the VIP, and sends a service packet based on the obtained MAC address, so that the virtual machine in the computer device 202 needs to perform load balancing processing. The message is only sent to the load balancing virtual machine 20212 on the computer device 202.
虚拟交换机20222将ARP应答报文发送给虚拟机20213后,虚拟机20213构造业务请求报文,该业务请求报文的IP地址是VIP地址,MAC地址是从虚拟交换机20222的ARP应答中获取的负载均衡虚拟机20212的MAC地址。虚拟机20213将构造的业务请求报文发送给虚拟交换机20222,虚拟交换机20222根据该业务请求报文的IP地址和MAC地址,将业务请求报文发送给负载均衡虚拟机20212。After the virtual switch 20222 sends the ARP reply packet to the virtual machine 20213, the virtual machine 20213 constructs a service request packet. The IP address of the service request packet is a VIP address, and the MAC address is the load obtained from the ARP response of the virtual switch 20222. The MAC address of the virtual machine 20212 is equalized. The virtual machine 20213 sends the configured service request message to the virtual switch 20222. The virtual switch 20222 sends the service request message to the load balancing virtual machine 20212 according to the IP address and the MAC address of the service request message.
对于虚拟机20213发送的不需要负载均衡处理的报文,其IP地址不是VIP地址,虚拟交换机20222可以按照通常的转发模式进行转发。For the packet sent by the virtual machine 20213 that does not require load balancing, the IP address is not a VIP address, and the virtual switch 20222 can forward according to the normal forwarding mode.
上述虚拟交换机20222在接收到虚拟机20213发起的业务报文需要进 行负载均衡处理时,所述虚拟交换机20222通过ARP代答技术将虚拟机20213的业务报文发送到所述负载均衡虚拟机20212,其他计算机设备(如计算机设备203)上的负载均衡虚拟机(如负载均衡虚拟机20312)没有收到ARP请求,就不会收到计算机设备202中的虚拟机2013发出的业务报文,实现了每个计算机设备中的虚拟机的业务报文在需要负载均衡处理时,只在本计算机设备内的负载均衡虚拟机上实现的目的。The virtual switch 20222 needs to enter the service packet initiated by the virtual machine 20213. During the line load balancing process, the virtual switch 20222 sends the service message of the virtual machine 20213 to the load balancing virtual machine 20212 and the load balancing virtual machine on other computer devices (such as the computer device 203) through the ARP pickup technology ( If the load balancing virtual machine 20312 does not receive the ARP request, the service packet sent by the virtual machine 2013 in the computer device 202 is not received, and the service packet of the virtual machine in each computer device needs load balancing. When processed, it is only implemented on a load balancing virtual machine within the computer device.
与在计算机设备202中创建负载均衡虚拟机20212类似,也可以在计算机设备203中创建负载均衡虚拟机20312。由于每个计算机设备中虚拟机发出的需要负载均衡处理的业务报文,只转发给创建在本计算机设备中的负载均衡虚拟机,不会被转发给其它计算机设备中的负载均衡虚拟机来处理,计算机设备202中的负载均衡虚拟机20212的IP地址可以与计算机设备203中负载均衡虚拟机20312的IP地址相同;同样的,计算机设备202中的负载均衡虚拟机20212的MAC地址可以与计算机设备203中负载均衡虚拟机20312的MAC地址相同。这样,可以节省计算机设备所组成的网络中IP地址资源和/或MAC地址资源。Similar to creating a load balancing virtual machine 20212 in the computer device 202, a load balancing virtual machine 20312 can also be created in the computer device 203. Since the service packets sent by the virtual machine in each computer device that require load balancing processing are forwarded only to the load balancing virtual machine created in the computer device, they are not forwarded to the load balancing virtual machine in other computer devices for processing. The IP address of the load balancing virtual machine 20212 in the computer device 202 may be the same as the IP address of the load balancing virtual machine 20312 in the computer device 203. Similarly, the MAC address of the load balancing virtual machine 20212 in the computer device 202 may be associated with the computer device. The MAC address of the load balancing virtual machine 20312 is the same in 203. In this way, IP address resources and/or MAC address resources in the network formed by the computer devices can be saved.
本发明实施例中,所述虚拟负载均衡代理单元20211可以在部署所述负载均衡业务的用户在计算机设备202中创建第一个虚拟机时,指示所述虚拟机管理单元20112创建负载均衡虚拟机20212。这样能够节省计算机设备202的资源,避免在不需要负载均衡业务时,因创建负载均衡虚拟机造成的硬件资源的浪费。判断部署所述负载均衡业务的用户在计算机设备202中创建第一个虚拟机的时机,可以是所述虚拟机管理单元20112在创建虚拟机(例如虚拟机20213)时,所述虚拟负载均衡管理单元20111判断该创建的虚拟机是否是已经配置了虚拟负载均衡业务的用户配置的第一个虚拟机。如果是,则所述虚拟负载均衡管理单元20111通知所述虚拟负载均衡代理单元指示所述虚拟机管理单元20112创建负载均衡虚拟机20212。所述虚拟负载均衡管理单元20111也可以直接通知所述虚拟机管理单元20112 创建负载均衡虚拟机20212。当已经配置了虚拟负载均衡业务的用户配置的最后一个虚拟机被删除时,所述虚拟负载均衡管理单元20111通知所述虚拟负载均衡代理单元指示所述虚拟机管理单元20112删除所述负载均衡虚拟机20212,或直接通知所述虚拟机管理单元20112删除所述负载均衡虚拟机20212。In the embodiment of the present invention, the virtual load balancing proxy unit 20211 may instruct the virtual machine management unit 20112 to create a load balancing virtual machine when the user deploying the load balancing service creates the first virtual machine in the computer device 202. 20212. This can save resources of the computer device 202 and avoid waste of hardware resources caused by creating a load balancing virtual machine when the load balancing service is not required. The timing of creating the first virtual machine in the computer device 202 by the user deploying the load balancing service may be the virtual load balancing management when the virtual machine management unit 20112 creates a virtual machine (for example, the virtual machine 20213). The unit 20111 determines whether the created virtual machine is the first virtual machine configured by the user who has configured the virtual load balancing service. If so, the virtual load balancing management unit 20111 notifies the virtual load balancing agent unit to instruct the virtual machine management unit 20112 to create the load balancing virtual machine 20212. The virtual load balancing management unit 20111 may directly notify the virtual machine management unit 20112. A load balancing virtual machine 20212 is created. When the last virtual machine configured by the user of the virtual load balancing service is deleted, the virtual load balancing management unit 20111 notifies the virtual load balancing agent unit to instruct the virtual machine management unit 20112 to delete the load balancing virtual The machine 20212, or directly notifying the virtual machine management unit 20112, deletes the load balancing virtual machine 20212.
上述在已经配置了虚拟负载均衡业务的用户创建第一个虚拟机时创建负载均衡虚拟机20212,在同一用户配置的最后一个虚拟机被删除时删除所述负载均衡虚拟机20212,能够节省计算机设备202中的虚拟资源,提高计算机设备202中资源的利用率。The load balancing virtual machine 20212 is created when the user who has configured the virtual load balancing service creates the first virtual machine, and the load balancing virtual machine 20212 is deleted when the last virtual machine configured by the same user is deleted, thereby saving computer equipment. The virtual resources in 202 increase the utilization of resources in computer device 202.
上述负载均衡虚拟机20212的创建和配置,是所述计算机设备202中的虚拟负载均衡代理单元20211指示所述计算机设备201中的虚拟机管理单元20112创建的。在具体实现时,所述计算机设备202中也可以不包含所述虚拟负载均衡代理单元20211,当计算机设备201中的虚拟负载均衡管理单元20111接收到创建负载均衡虚拟机20212的配置信息时,可以直接指示所述虚拟机管理单元20112创建负载均衡虚拟机20212。本发明实施例不限定具体的负载均衡虚拟机20212创建方式。The creation and configuration of the load balancing virtual machine 20212 described above is that the virtual load balancing agent unit 20211 in the computer device 202 instructs the virtual machine management unit 20112 in the computer device 201 to create. In a specific implementation, the virtual load balancing agent unit 20211 may not be included in the computer device 202. When the virtual load balancing management unit 20111 in the computer device 201 receives the configuration information for creating the load balancing virtual machine 20212, The virtual machine management unit 20112 is directly instructed to create a load balancing virtual machine 20212. The embodiment of the present invention does not limit the manner in which the specific load balancing virtual machine 20212 is created.
一用户通过云管理平台申请虚拟机20213,通过该虚拟机20213访问视频业务,该视频业务可以由虚拟机20214或虚拟机20314等后端服务器提供为例,说明本发明实施例负载均衡的实现方式。结合图2所示的实施例,云管理平台(计算机设备201)分别在计算机设备202中创建负载均衡虚拟机20212,在计算机设备203中创建负载均衡虚拟机20312;当虚拟机20213发起访问视频业务的业务报文时,该业务报文只被虚拟交换机20222转发给在计算机设备202中的负载均衡虚拟机20212,与计算机设备202通过网络连接的计算机设备203中的负载均衡虚拟机20312不会收到虚拟机20213发送的业务报文,使得计算机设备202中发起的需要负载均衡处理的业务报文只在计算机设备202中实现负载均衡的处理。负载均衡虚拟机20212 接收到虚拟交换机20222转发的虚拟机20213关于视频业务的业务报文后,通过负载均衡算法处理该业务报文,在后端服务器,可以是虚拟机20214或虚拟机20314中选择一个为虚拟机20213提供视频业务。优选的,负载均衡虚拟机20212可以选择虚拟机20214作为后端服务器为虚拟机20213提供视频服务,这样可以节省网络带宽,提高后端服务器响应业务报文的效率。A user applies for the virtual machine 20213 through the cloud management platform, and accesses the video service through the virtual machine 20213. The video service can be provided by the back end server such as the virtual machine 20214 or the virtual machine 20314 as an example to illustrate the implementation of load balancing in the embodiment of the present invention. . In conjunction with the embodiment shown in FIG. 2, the cloud management platform (computer device 201) creates a load balancing virtual machine 20212 in the computer device 202, and creates a load balancing virtual machine 20312 in the computer device 203; when the virtual machine 20213 initiates access to the video service, The service message is forwarded only by the virtual switch 20222 to the load balancing virtual machine 20212 in the computer device 202, and the load balancing virtual machine 20312 in the computer device 203 connected to the computer device 202 through the network does not receive the service message. The service packet sent by the virtual machine 20213 causes the service packet initiated by the computer device 202 to be load balanced to perform load balancing processing only in the computer device 202. Load balancing virtual machine 20212 After receiving the service packet of the virtual machine 20213 forwarded by the virtual switch 20222 for the video service, the service packet is processed by the load balancing algorithm. In the backend server, the virtual machine 20214 or the virtual machine 20314 may be selected as the virtual machine 20213. Provide video services. Preferably, the load balancing virtual machine 20212 can select the virtual machine 20214 as a backend server to provide a video service to the virtual machine 20213. This can save network bandwidth and improve the efficiency of the backend server in responding to service messages.
参考图3,图3为本发明实施例一种计算机设备300的结构示意图。图3中,计算机设备300包括中央处理器CPU3031、内存3032和存储设备3033,还包括在所述计算机设备300硬件基础上虚拟化后生成的第一虚拟机304、负载均衡虚拟机301和虚拟交换机3022,所述第一虚拟机304和所述负载均衡虚拟机是301在所述计算机设备300中创建的虚拟机;Referring to FIG. 3, FIG. 3 is a schematic structural diagram of a computer device 300 according to an embodiment of the present invention. In FIG. 3, the computer device 300 includes a central processing unit CPU 3031, a memory 3032, and a storage device 3033, and further includes a first virtual machine 304, a load balancing virtual machine 301, and a virtual switch that are generated after virtualization on the hardware of the computer device 300. 3022. The first virtual machine 304 and the load balancing virtual machine are 301 virtual machines created in the computer device 300.
所述第一虚拟机304,用于发送业务报文;The first virtual machine 304 is configured to send a service packet.
所述虚拟交换机3022,用于接收所述第一虚拟机304发送的所述业务报文,在所述业务报文需要负载均衡处理时,只转发所述业务报文给所述负载均衡虚拟机301;The virtual switch 3022 is configured to receive the service packet sent by the first virtual machine 304, and only forward the service packet to the load balancing virtual machine when the service packet needs load balancing processing. 301;
所述负载均衡虚拟机301,用于接收所述虚拟交换机3022转发的所述业务报文,基于负载均衡方式转发所述业务报文。The load balancing virtual machine 301 is configured to receive the service packet forwarded by the virtual switch 3022, and forward the service packet according to a load balancing manner.
上述计算机设备300中包含负载均衡虚拟机301,在计算机设备300中的虚拟机发起业务,需要进行负载均衡处理时,相关的业务报文只被发送到计算机设备300中的负载均衡虚拟机301来进行负载均衡处理。由于负载均衡相关的业务报文在计算机设备中实现,不会出现多个计算机设备上的业务报文集中到一个负载均衡节点,避免了集中式的负载均衡的拥塞带来的处理的延迟。并且,当计算机设备300出现故障时,该计算机设备300中的虚拟机也会随之下线,不会再产生负载均衡的需求。因此,在单个计算机设备的故障带来的负载均衡虚拟机的故障,不会影响其它计算机设备上的负载均衡虚拟机,也不会存在因负载均衡虚拟机故障导致主备切换 带来的业务中断。The load balancing virtual machine 301 is included in the computer device 300. When the virtual machine in the computer device 300 initiates a service and needs to perform load balancing processing, the related service message is only sent to the load balancing virtual machine 301 in the computer device 300. Perform load balancing processing. Since the load balancing related service packets are implemented in the computer device, the service packets on the plurality of computer devices are not concentrated to one load balancing node, thereby avoiding the processing delay caused by the centralized load balancing congestion. Moreover, when the computer device 300 fails, the virtual machine in the computer device 300 will also go offline, and there is no need for load balancing. Therefore, the failure of the load balancing virtual machine caused by the failure of a single computer device does not affect the load balancing virtual machine on other computer devices, and there is no active/standby switchover caused by the load balancing virtual machine failure. The business disruption.
本发明实施例中,计算机设备300除包括中央处理器CPU3031、内存3032和存储设备3033之外,还可以包括网络硬件(图中未示出)等硬件设备;网络硬件可以是交换设备(网卡等)、路由器和/或其他网络设备,用于实现多个设备之间的通信,多个设备之间可以通过无线或有线方式连接连接。In the embodiment of the present invention, the computer device 300 may include hardware devices such as network hardware (not shown) in addition to the central processing unit CPU 3031, the memory 3032, and the storage device 3033. The network hardware may be a switching device (such as a network card). ), routers, and/or other network devices are used to implement communication between multiple devices, and multiple devices can be connected by wireless or wired connection.
可选的,所述虚拟交换机3022只转发所述业务报文给所述负载均衡虚拟机301可以包括:Optionally, the forwarding, by the virtual switch 3022, the service packet to the load balancing virtual machine 301 may include:
所述虚拟交换机3022将所述负载均衡虚拟机301的MAC地址发送给所述第一虚拟机304,使得所述第一虚拟机304基于获取到的所述负载均衡虚拟机301的MAC地址发送所述业务报文,所述虚拟交换机3022将所述业务报文转发给所述负载均衡虚拟机301;或,The virtual switch 3022 sends the MAC address of the load balancing virtual machine 301 to the first virtual machine 304, so that the first virtual machine 304 sends the MAC address based on the acquired MAC address of the load balancing virtual machine 301. The service packet, the virtual switch 3022 forwards the service packet to the load balancing virtual machine 301; or
所述负载均衡虚拟机301将其MAC地址发送给所述第一虚拟机304,使得所述第一虚拟机304基于获取到的所述负载均衡虚拟机301的MAC地址发送所述业务报文,所述虚拟交换机3022将所述业务报文转发给所述负载均衡虚拟机301;或,The load balancing virtual machine 301 sends the MAC address to the first virtual machine 304, so that the first virtual machine 304 sends the service packet based on the obtained MAC address of the load balancing virtual machine 301. The virtual switch 3022 forwards the service packet to the load balancing virtual machine 301; or
所述第一虚拟机304基于预先配置的所述负载均衡虚拟机301的MAC地址发送所述业务报文,所述虚拟交换机3022将所述业务报文转发给所述负载均衡虚拟机301。The first virtual machine 304 sends the service packet based on the pre-configured MAC address of the load balancing virtual machine 301, and the virtual switch 3022 forwards the service packet to the load balancing virtual machine 301.
其中,所述虚拟交换机3022将所述负载均衡虚拟机301的MAC地址发送给所述第一虚拟机304可以包括:The sending, by the virtual switch 3022, the MAC address of the load balancing virtual machine 301 to the first virtual machine 304 may include:
所述虚拟交换机3022接收所述第一虚拟机304发送的控制报文,向所述第一虚拟机304返回控制响应报文,所述控制响应报文包含所述负载均衡虚拟机301的MAC地址。The virtual switch 3022 receives the control packet sent by the first virtual machine 304, and returns a control response packet to the first virtual machine 304, where the control response packet includes the MAC address of the load balancing virtual machine 301. .
所述控制报文可以为ARP报文或互联网控制消息协议(ICMP,Internet Control Message Protocol)报文,所述ICMP报文可以是第六版的ICMPv6 报文。以计算机设备300采用IPV4协议为例,当第一虚拟机304需要发送业务报文时,第一虚拟机304先发送ARP报文给虚拟交换机3022,虚拟交换机3022做ARP代答,将负载均衡虚拟机301的MAC地址发送给第一虚拟机304,第一虚拟机304根据获取到负载均衡虚拟机301的MAC地址,结合已经获取到的负载均衡虚拟机301的IP地址等信息,将业务报文通过虚拟交换机3022发送给负载均衡虚拟机301。通过这种方式,使得第一虚拟机304发送的业务报文,在需要进行负载均衡处理时,只发送给计算机设备300中的负载均衡虚拟机301。The control packet may be an ARP packet or an Internet Control Message Protocol (ICMP) packet, and the ICMP packet may be the sixth version of ICMPv6. Message. Taking the IPV4 protocol of the computer device 300 as an example, when the first virtual machine 304 needs to send a service packet, the first virtual machine 304 first sends an ARP packet to the virtual switch 3022, and the virtual switch 3022 performs ARP pickup to load balance the virtual The MAC address of the machine 301 is sent to the first virtual machine 304. The first virtual machine 304 combines the MAC address of the load balancing virtual machine 301 with the information such as the IP address of the load balancing virtual machine 301 that has been acquired. It is sent to the load balancing virtual machine 301 through the virtual switch 3022. In this manner, the service packet sent by the first virtual machine 304 is sent only to the load balancing virtual machine 301 in the computer device 300 when load balancing processing is required.
参考图4,图4为本发明实施例中计算机设备300的一种具体实现结构实体图。图4中,计算机设备300中的操作系统302运行虚拟化管理的虚拟化层Hypervisor3021和虚拟交换机3022,虚拟化层Hypervisor20221对所述计算机设备300中的虚拟机(例如第一虚拟机304等)进行管理,虚拟交换机3022为所述Hypervisor3021所管理的虚拟机之间和虚拟机与物理网络之间提供网络连接功能,虚拟负载均衡代理单元3023通过虚拟机化层Hypervisor3021对计算机设备300中的负载均衡虚拟机301进行配置和管理。Referring to FIG. 4, FIG. 4 is a structural diagram of a specific implementation structure of a computer device 300 according to an embodiment of the present invention. In FIG. 4, the operating system 302 in the computer device 300 runs the virtualization layer hypervisor 3021 and the virtual switch 3022 of the virtualization management, and the virtualization layer Hypervisor 20221 performs the virtual machine (eg, the first virtual machine 304, etc.) in the computer device 300. Management, the virtual switch 3022 provides a network connection function between the virtual machines managed by the Hypervisor 3021 and between the virtual machine and the physical network, and the virtual load balancing agent unit 3023 virtualizes the load in the computer device 300 through the virtualized layer hypervisor 3021. The machine 301 is configured and managed.
所述虚拟负载均衡代理单元3023,用于接收创建负载均衡虚拟机301的配置信息,控制所述负载均衡虚拟机301的创建或删除,以及控制所述负载均衡虚拟机301与所述虚拟交换机3022之间连接的建立。The virtual load balancing agent unit 3023 is configured to receive configuration information for creating a load balancing virtual machine 301, control creation or deletion of the load balancing virtual machine 301, and control the load balancing virtual machine 301 and the virtual switch 3022. The establishment of a connection between.
所述虚拟负载均衡代理单元3023可以在下发创建所述负载均衡虚拟机301的用户在所述计算机设备300中创建第一虚拟机(例如第一虚拟机304)时,启动负载均衡虚拟机301的创建;在创建所述负载均衡虚拟机301的用户在所述计算机设备300中创建的最后一个虚拟机被删除时,所述虚拟负载均衡代理单元3023指示删除所述负载均衡虚拟机301。这样能够节省计算机设备300的资源,避免在不需要负载均衡业务时,因创建负载均衡虚拟机造成的硬件资源的浪费。具体的,所述虚拟负载均衡代理单元3023可以参考 上述图2中虚拟负载均衡代理单元20211的实现方式来实现,不再赘述。The virtual load balancing agent unit 3023 may start the load balancing virtual machine 301 when the user who creates the load balancing virtual machine 301 creates the first virtual machine (for example, the first virtual machine 304) in the computer device 300. Created; when the last virtual machine created by the user who created the load balancing virtual machine 301 in the computer device 300 is deleted, the virtual load balancing agent unit 3023 instructs to delete the load balancing virtual machine 301. This can save resources of the computer device 300 and avoid waste of hardware resources caused by creating a load balancing virtual machine when the load balancing service is not required. Specifically, the virtual load balancing agent unit 3023 can refer to The implementation of the virtual load balancing proxy unit 20211 in FIG. 2 is implemented, and details are not described herein.
可选的,所述计算机设备3022还包括第二虚拟机305,所述第二虚拟机305具备处理所述第一虚拟机304的所述业务报文的能力;Optionally, the computer device 3022 further includes a second virtual machine 305, where the second virtual machine 305 is configured to process the service message of the first virtual machine 304;
在所述负载均衡虚拟机301通过负载均衡算法确定所述第二虚拟机305处理所述第一虚拟机304的所述业务报文时,所述第二虚拟机305接收所述负载均衡服务器301转发的所述业务报文,并将处理所述业务报文的结果发送给所述负载均衡虚拟机301;When the load balancing virtual machine 301 determines that the second virtual machine 305 processes the service packet of the first virtual machine 304 by using a load balancing algorithm, the second virtual machine 305 receives the load balancing server 301. Transmitting the service packet, and sending the result of processing the service packet to the load balancing virtual machine 301;
所述负载均衡虚拟机301,还用于将所述第二虚拟机305处理所述业务报文的结果通过所述虚拟交换机3022发送给所述第一虚拟机304。作为一种可选的实现方式,所述第二虚拟机305也可以直接将处理所述业务报文的结果发送给所述第一虚拟机304,即所述第二虚拟机305不通过所述负载均衡虚拟机301将处理所述业务报文的结果发送给所述第一虚拟机304。The load balancing virtual machine 301 is further configured to send the result of processing the service packet by the second virtual machine 305 to the first virtual machine 304 through the virtual switch 3022. As an optional implementation manner, the second virtual machine 305 may directly send the result of processing the service packet to the first virtual machine 304, that is, the second virtual machine 305 does not pass the The load balancing virtual machine 301 sends the result of processing the service message to the first virtual machine 304.
负载均衡虚拟机301通过负载均衡算法等方式,将第一虚拟机304的业务报文转发给后端服务器(第二虚拟机305)来处理,并将后端服务器处理的结果发送给第一虚拟机304,实现了计算机设备300中利用自身创建的负载均衡虚拟机实现自身设备上负载均衡业务的目的,提高了负载均衡的处理效率。The load balancing virtual machine 301 forwards the service packet of the first virtual machine 304 to the backend server (the second virtual machine 305) by using a load balancing algorithm, and sends the result of the backend server processing to the first virtual The machine 304 realizes the purpose of realizing the load balancing service on the self-device by using the load balancing virtual machine created by the computer device 300, and improves the processing efficiency of the load balancing.
参考图5,图5为本发明实施例第一种计算机系统实现结构示意图,该系统包括第一计算机设备502和第二计算机设备501,其中,所述第二计算机设备501包括中央处理器CPU50131、内存50132和存储设备50133;所述第一计算机设备502包括中央处理器CPU50231、内存50232和存储设备50233,所述第一计算机设备502中还包括在硬件基础上虚拟化后生成的第一虚拟机50213、第一负载均衡虚拟机50212和虚拟交换机50222,所述第一虚拟机50213和所述第一负载均衡虚拟机50212是在所述计算机设备502中创建的虚拟机;Referring to FIG. 5, FIG. 5 is a schematic structural diagram of an implementation of a first computer system according to an embodiment of the present invention. The system includes a first computer device 502 and a second computer device 501, wherein the second computer device 501 includes a central processing unit CPU 50131. The first computer device 502 includes a central processing unit CPU 50231, a memory 50232, and a storage device 50233. The first computer device 502 further includes a first virtual machine generated after being virtualized on a hardware basis. 50213. The first load balancing virtual machine 50212 and the virtual switch 50222. The first virtual machine 50213 and the first load balancing virtual machine 50212 are virtual machines created in the computer device 502.
所述第一虚拟机50213,用于发送业务报文; The first virtual machine 50213 is configured to send a service packet.
所述第一虚拟交换机50222,用于接收所述第一虚拟机50213发送的所述业务报文,在所述业务报文需要负载均衡处理时,只转发所述业务报文给所述第一负载均衡虚拟机50212;The first virtual switch 50222 is configured to receive the service packet sent by the first virtual machine 50213, and only forward the service packet to the first packet when the service packet needs load balancing processing. Load balancing virtual machine 50212;
所述第一负载均衡虚拟机50212,用于接收所述第一虚拟交换机50222转发的所述业务报文,基于负载均衡方式转发所述业务报文。The first load balancing virtual machine 50212 is configured to receive the service packet forwarded by the first virtual switch 50222, and forward the service packet according to a load balancing manner.
上述第一计算机设备502中包含第一负载均衡虚拟机50212,在第一计算机设备502中的虚拟机的业务需要进行负载均衡处理时,相关的业务报文只被发送到第一计算机设备502中的第一负载均衡虚拟机50212来进行负载均衡处理。由于负载均衡相关的业务报文在计算机设备中实现,不会出现多个计算机设备上的业务报文集中到一个负载均衡节点,避免了集中式的负载均衡的拥塞带来的处理的延迟。并且,当第一计算机设备502出现故障时,该第一计算机设备502中的虚拟机也会随之下线,不会再产生负载均衡的需求。因此,在单个计算机设备的故障带来的负载均衡虚拟机的故障,不会影响其它计算机设备上的负载均衡虚拟机,也不会存在因负载均衡虚拟机故障导致主备切换带来的业务中断。The first computer device 502 includes the first load balancing virtual machine 50212. When the service of the virtual machine in the first computer device 502 needs to perform load balancing processing, the related service packet is only sent to the first computer device 502. The first load balancing virtual machine 50212 performs load balancing processing. Since the load balancing related service packets are implemented in the computer device, the service packets on the plurality of computer devices are not concentrated to one load balancing node, thereby avoiding the processing delay caused by the centralized load balancing congestion. Moreover, when the first computer device 502 fails, the virtual machine in the first computer device 502 is also offline, and there is no need for load balancing. Therefore, the load balancing virtual machine failure caused by the failure of a single computer device does not affect the load balancing virtual machine on other computer devices, and there is no service interruption caused by the load balancing virtual machine failure. .
本发明实施例中,所述第二计算机设备501除包括中央处理器CPU50131、内存50132和存储设备50133之外,还可以包括网络硬件(图中未示出)等硬件设备;网络硬件可以是交换设备(网卡等)、路由器和/或其他网络设备,用于实现多个设备之间的通信,多个设备之间可以通过无线或有线方式连接连接。In the embodiment of the present invention, the second computer device 501 may include hardware devices such as network hardware (not shown) in addition to the central processing unit CPU 50131, the memory 50132, and the storage device 50133; the network hardware may be exchanged. Devices (network cards, etc.), routers, and/or other network devices are used to implement communication between multiple devices, and multiple devices can be connected by wireless or wired connection.
可选的,所述第一虚拟交换机50222只转发所述业务报文给所述第一负载均衡虚拟机50212可以包括:Optionally, the first virtual switch 50222 to forward the service packet to the first load balancing virtual machine 50212 may include:
所述第一虚拟交换机50222将所述第一负载均衡虚拟机50212的MAC地址发送给所述第一虚拟机50213,使得所述第一虚拟机50213基于获取到的所述第一负载均衡虚拟机50212MAC地址发送所述业务报文,所述第一虚拟交换机50222将所述业务报文转发给所述第一负载均衡虚拟机50212;或, The first virtual switch 50222 sends the MAC address of the first load balancing virtual machine 50212 to the first virtual machine 50213, so that the first virtual machine 50213 is based on the acquired first load balancing virtual machine. The 50212 MAC address sends the service packet, and the first virtual switch 50222 forwards the service packet to the first load balancing virtual machine 50212; or
所述第一负载均衡虚拟机50212将其MAC地址发送给所述第一虚拟机50213,使得所述第一虚拟机50213基于所述第一负载均衡虚拟机50212MAC地址发送所述业务报文,所述第一虚拟交换机50222将所述业务报文转发给所述第一负载均衡虚拟机50212;或,The first load balancing virtual machine 50212 sends its MAC address to the first virtual machine 50213, so that the first virtual machine 50213 sends the service packet based on the first load balancing virtual machine 50212 MAC address. The first virtual switch 50222 forwards the service packet to the first load balancing virtual machine 50212; or
所述第一虚拟机50213基于预先配置的所述第一负载均衡虚拟机50212的MAC地址,发送所述业务报文,所述第一虚拟交换机50222将所述业务报文转发给所述第一负载均衡虚拟机50212。The first virtual machine 50213 sends the service packet based on the pre-configured MAC address of the first load balancing virtual machine 50212, and the first virtual switch 50222 forwards the service packet to the first Load balancing virtual machine 50212.
其中,所述第一虚拟交换机50222将所述第一负载均衡虚拟机50212的MAC地址发送给所述第一虚拟机50213包括:The sending, by the first virtual switch 50222, the MAC address of the first load balancing virtual machine 50212 to the first virtual machine 50213 includes:
所述第一虚拟交换机50222接收所述第一虚拟机50213发送的控制报文,向所述第一虚拟机50213返回控制响应报文,所述控制响应报文包含所述第一负载均衡虚拟机50212的MAC地址。The first virtual switch 50222 receives the control packet sent by the first virtual machine 50213, and returns a control response message to the first virtual machine 50213, where the control response message includes the first load balancing virtual machine. 50212's MAC address.
所述控制报文可以为ARP报文或ICMPv6报文。以第一计算机设备502采用IPV4协议为例,当第一虚拟机50213需要发送业务报文时,第一虚拟机50213先发送ARP报文给第一虚拟交换机50222,第一虚拟交换机50222做ARP代答,将负载均衡虚拟机301的MAC地址发送给第一虚拟机50213,第一虚拟机50213根据获取到第一负载均衡虚拟机50212的MAC地址,结合已经获取到的第一负载均衡虚拟机50212的IP地址等信息,将业务报文通过第一虚拟交换机50222发送给第一负载均衡虚拟机50212。通过这种方式,使得第一虚拟机50213发送的业务报文,在需要进行负载均衡处理时,只发送给第一计算机设备502中的第一负载均衡虚拟机50212。The control packet can be an ARP packet or an ICMPv6 packet. The first virtual machine 50214 first sends an ARP packet to the first virtual switch 50222, and the first virtual switch 50222 performs the ARP generation. The MAC address of the load balancing virtual machine 301 is sent to the first virtual machine 50213. The first virtual machine 50213 combines the acquired first load balancing virtual machine 50212 according to the MAC address of the first load balancing virtual machine 50212. The information such as the IP address is sent to the first load balancing virtual machine 50212 through the first virtual switch 50222. In this manner, the service packet sent by the first virtual machine 50213 is sent only to the first load balancing virtual machine 50212 in the first computer device 502 when load balancing processing is required.
参考图6,图6为本发明实施例中第一中计算机系统的一种具体实现结构实体图。图6中,第二计算机设备502中的操作系统5022运行虚拟化管理的虚拟化层Hypervisor50221和第一虚拟交换机50222,虚拟化层Hypervisor50221对所述第一计算机设备502中的虚拟机(例如第一虚拟机50213等)进行管理第一虚拟交换机50222为所述Hypervisor50221所管理的 虚拟机之间和虚拟机与物理网络之间提供网络连接功能,虚拟负载均衡代理单元50111通过虚拟机化层Hypervisor50221对第一计算机设备502中的第一负载均衡虚拟机50212进行配置和管理。第二计算机设备501作为计算机系统中的云管理平台,其操作系统5012运行虚拟化管理的虚拟化层Hypervisor50121。所述第二计算机设备501还包括虚拟机管理单元50112和虚拟负载均衡管理单元50111,所述虚拟机管理单元50112实现对第二计算机设备502中虚拟机的配置和管理,虚拟负载均衡管理单元50111用于接收用户下发的创建负载均衡虚拟机的配置信息或创建虚拟机的配置信息,并将相关的配置信息,并将创建负载均衡虚拟机的配置信息保存在虚拟负载均衡数据设备50114中。所述第一计算机设备502还包括第一虚拟负载均衡代理单元50211。Referring to FIG. 6, FIG. 6 is a structural diagram of a specific implementation structure of a computer system in a first embodiment of the present invention. In FIG. 6, the operating system 5022 in the second computer device 502 runs the virtualization layer hypervisor 50221 and the first virtual switch 50222 of the virtualization management, and the virtualization layer Hypervisor 50221 pairs the virtual machine in the first computer device 502 (for example, the first The virtual machine 50213 or the like performs management of the first virtual switch 50222 managed by the Hypervisor 50221. The network connection function is provided between the virtual machines and between the virtual machine and the physical network, and the virtual load balancing agent unit 50111 configures and manages the first load balancing virtual machine 50212 in the first computer device 502 through the virtual machine layer Hypervisor 50221. The second computer device 501 functions as a cloud management platform in the computer system, and its operating system 5012 runs a virtualization layer hypervisor 50121 of virtualization management. The second computer device 501 further includes a virtual machine management unit 50112 and a virtual load balancing management unit 50111. The virtual machine management unit 50112 implements configuration and management of a virtual machine in the second computer device 502. The virtual load balancing management unit 50111 The configuration information for creating a load balancing virtual machine or the configuration information of the virtual machine is created, and the related configuration information is saved, and the configuration information for creating the load balancing virtual machine is saved in the virtual load balancing data device 50114. The first computer device 502 also includes a first virtual load balancing agent unit 50211.
所述虚拟负载均衡管理单元50111,用于接收创建所述第一负载均衡虚拟机50212的配置信息,并将所述创建第一负载均衡虚拟机50212的配置信息发送给所述第一虚拟负载均衡代理单元50211;The virtual load balancing management unit 50111 is configured to receive configuration information for creating the first load balancing virtual machine 50212, and send the configuration information of the first load balancing virtual machine 50212 to the first virtual load balancing. Proxy unit 50211;
所述第一虚拟负载均衡代理单元50211,用于接收所述创建第一负载均衡虚拟机50212的配置信息,指示所述虚拟机管理单元根据所述创建第一负载均衡虚拟机50212的配置信息创建所述第一负载均衡虚拟机50212。The first virtual load balancing agent unit 50211 is configured to receive the configuration information of the first load balancing virtual machine 50212, and instruct the virtual machine management unit to create the configuration information according to the first load balancing virtual machine 50212. The first load balancing virtual machine 50212.
所述第一虚拟负载均衡代理单元50211可以在下发创建所述第一负载均衡虚拟机50212的用户在所述第一计算机设备502中创建第一虚拟机(例如第一虚拟机50213)时,指示所述虚拟机管理单元50112创建所述第一负载均衡虚拟机50212;在创建所述第一负载均衡虚拟机50212的用户在所述第一计算机设备502中创建的最后一个虚拟机被删除时,所述第一虚拟负载均衡代理单元50211指示指示所述虚拟机管理单元50112删除所述第一负载均衡虚拟机50212。这样能够节省第一计算机设备502的资源,避免在不需要负载均衡业务时,因创建负载均衡虚拟机造成的硬件资源的浪费。具体的,所述第一虚拟负载均衡代理单元50211可以参考上述图2中虚拟负载均 衡代理单元20211的实现方式来实现,不再赘述。The first virtual load balancing agent unit 50211 may indicate when the user who created the first load balancing virtual machine 50212 creates the first virtual machine (for example, the first virtual machine 50213) in the first computer device 502. The virtual machine management unit 50112 creates the first load balancing virtual machine 50212; when the last virtual machine created by the user who created the first load balancing virtual machine 50212 in the first computer device 502 is deleted, The first virtual load balancing proxy unit 50211 instructs the virtual machine management unit 50112 to delete the first load balancing virtual machine 50212. This can save resources of the first computer device 502 and avoid waste of hardware resources caused by creating a load balancing virtual machine when the load balancing service is not required. Specifically, the first virtual load balancing proxy unit 50211 can refer to the virtual load in FIG. 2 above. The implementation of the balancing agent unit 20211 is implemented and will not be described again.
在本实施例中,所述第一虚拟负载均衡代理单元50211还用于指示所述虚拟机管理单元50112为所述第一负载均衡虚拟机50212配置第一虚拟网卡并建立所述第一虚拟网卡与所述第一虚拟交换机50222之间的连接。In this embodiment, the first virtual load balancing proxy unit 50211 is further configured to instruct the virtual machine management unit 50112 to configure a first virtual network card for the first load balancing virtual machine 50212 and establish the first virtual network card. A connection with the first virtual switch 50222.
所述虚拟机管理单元50112建立所述虚拟网卡与所述第一虚拟交换机50222的连接可以通过配置第一虚拟交换机50222的网络标识来实现。例如,第一虚拟交换机50222有3个网络接口,其网络标识为100,当第一负载均衡虚拟机50212和第一虚拟机50213的虚拟网卡具有网络标识为100的接口时,所述第一虚拟机50213可以通过网络标识为100的接口与负载均衡虚拟机20212的网络标识为100的接口实现通信。其中,所述虚拟机管理单元50112可以根据所述第一虚拟负载均衡代理单元50211或虚拟负载均衡管理单元50111指示,为所述第一虚拟交换机50222配置网络标识。The virtual machine management unit 50112 establishes that the connection between the virtual network card and the first virtual switch 50222 can be implemented by configuring a network identifier of the first virtual switch 50222. For example, the first virtual switch 50222 has three network interfaces, and the network identifier is 100. When the first load balancing virtual machine 50212 and the virtual network card of the first virtual machine 50213 have an interface with the network identifier of 100, the first virtual The machine 50213 can communicate with the interface of the load balancing virtual machine 20212 with the network identifier of 100 through an interface with a network identifier of 100. The virtual machine management unit 50112 may configure a network identifier for the first virtual switch 50222 according to the first virtual load balancing proxy unit 50211 or the virtual load balancing management unit 50111.
本发明实施例中,所述第一虚拟机50213是创建所述第一负载均衡虚拟机50212配置信息的用户创建的虚拟机;所述虚拟负载均衡管理单元50111接收创建所述第一虚拟机50213的配置信息,并在判断所述第一虚拟机50213是所述用户在所述第一计算机设备502上创建的第一个虚拟机时,将创建所述第一虚拟机50213的信息通知所述第一虚拟负载均衡代理单元50211;所述第一虚拟负载均衡代理单元50211在接收到所述虚拟负载均衡管理单元发送的创建所述第一虚拟机50213的通知时,指示所述虚拟机管理单元50112创建所述第一负载均衡虚拟机50212。这样能够节省计算机设备502的资源,避免在不需要负载均衡业务时,因创建负载均衡虚拟机造成硬件资源的占用和浪费。同样的,在创建所述第一负载均衡虚拟机50212配置信息的用户在所述计算机设备502中的最后一个虚拟机被删除时,所述虚拟负载均衡管理单元50111通知所述第一虚拟负载均衡代理单元50211,所述第一虚拟负载均衡代理单元50211指示所述虚拟机管理单元50112创建所述第一负载均衡虚拟机50212。这样也能够节省计算机设备502的资源,避免 在不需要负载均衡业务时,因负载均衡虚拟机造成硬件资源的占用和浪费。In the embodiment of the present invention, the first virtual machine 50213 is a virtual machine created by a user who creates configuration information of the first load balancing virtual machine 50212; the virtual load balancing management unit 50111 receives the first virtual machine 50213. Configuration information, and when it is determined that the first virtual machine 50213 is the first virtual machine created by the user on the first computer device 502, notifying the information that the first virtual machine 50213 is created a first virtual load balancing agent unit 50211; the first virtual load balancing agent unit 50211 instructing the virtual machine management unit when receiving the notification of creating the first virtual machine 50213 sent by the virtual load balancing management unit The first load balancing virtual machine 50212 is created 50112. In this way, the resources of the computer device 502 can be saved, and the occupation and waste of hardware resources caused by the creation of the load balancing virtual machine are avoided when the load balancing service is not required. Similarly, when the user who creates the configuration information of the first load balancing virtual machine 50212 is deleted when the last virtual machine in the computer device 502 is deleted, the virtual load balancing management unit 50111 notifies the first virtual load balancing. The proxy unit 50211, the first virtual load balancing proxy unit 50211 instructs the virtual machine management unit 50112 to create the first load balancing virtual machine 50212. This also saves resources of the computer device 502 and avoids When load balancing services are not required, hardware resources are occupied and wasted due to load balancing virtual machines.
上述是所述虚拟负载均衡管理单元50111通知所述第一虚拟负载均衡代理单元50211指示所述虚拟机管理单元50112创建或删除所述第一负载均衡虚拟机50212,在具体实现时,也可以是所述虚拟负载均衡管理单元50111通知所述虚拟机管理单元50112创建或删除所述第一负载均衡虚拟机50212,不再赘述。The above is the virtual load balancing management unit 50111 notifying the first virtual load balancing agent unit 50211 to instruct the virtual machine management unit 50112 to create or delete the first load balancing virtual machine 50212. The virtual load balancing management unit 50111 notifies the virtual machine management unit 50112 to create or delete the first load balancing virtual machine 50212, and details are not described herein.
可选的,所述第一计算机设备502还包括第二虚拟机50214,所述第二虚拟机50214具备处理所述第一虚拟机50213的所述业务报文的能力;在所述第一负载均衡虚拟机50212通过负载均衡方式确定所述第二虚拟机50214处理所述第一虚拟机50213的所述业务报文时,所述第二虚拟机50214接收所述第一负载均衡虚拟机50212转发的所述业务报文,并将处理所述业务报文的结果发送给所述第一负载均衡虚拟机50212;所述第一负载均衡虚拟机5021将所述第二虚拟机50214处理所述业务报文的结果通过所述第一虚拟交换机50222发送给所述第一虚拟机50213。Optionally, the first computer device 502 further includes a second virtual machine 50214, where the second virtual machine 50214 is configured to process the service message of the first virtual machine 50213; When the equalization virtual machine 50212 determines that the second virtual machine 50214 processes the service packet of the first virtual machine 50213 by using a load balancing manner, the second virtual machine 50214 receives the first load balancing virtual machine 50212 for forwarding. The service packet, and the result of processing the service packet is sent to the first load balancing virtual machine 50212; the first load balancing virtual machine 5021 processes the service by the second virtual machine 50214 The result of the message is sent to the first virtual machine 50213 through the first virtual switch 50222.
上述第一负载均衡虚拟机50212通过负载均衡算法等方式,将第一虚拟机50213的业务报文转发给后端服务器(第二虚拟机50214)来处理,并将后端服务器处理的结果发送给第一虚拟机50213,实现了计算机设备502中利用自身创建的负载均衡虚拟机实现自身设备上负载均衡业务的目的,提高了负载均衡的处理效率。The first load balancing virtual machine 50212 forwards the service packet of the first virtual machine 50213 to the backend server (the second virtual machine 50214) through a load balancing algorithm, and sends the result of the backend server processing to the first server. The first virtual machine 50213 implements the purpose of realizing the load balancing service on the device by using the load balancing virtual machine created by the computer device 502, and improves the processing efficiency of the load balancing.
本发明实施例的所述第一计算机系统还可以包括第三计算机设备。如图7所示,所述第三计算机设备503与所述计算机设备502类似,包括第二虚拟负载均衡代理单元50311、第二虚拟交换机50322和第三虚拟机50313;The first computer system of the embodiments of the present invention may further include a third computer device. As shown in FIG. 7, the third computer device 503 is similar to the computer device 502, and includes a second virtual load balancing proxy unit 50311, a second virtual switch 50322, and a third virtual machine 50313;
所述第二虚拟负载均衡代理单元50312,用于接收所述虚拟负载均衡管理单元50111发送的创建第二负载均衡虚拟机50312的配置信息,基于所述创建第二负载均衡虚拟机50312的配置信息,指示所述虚拟机管理单元50112创建所述第二负载均衡虚拟机50312,以及指示所述虚拟机管理单元 50112为所述第二负载均衡虚拟机50312配置第二虚拟网卡并建立所述第二虚拟网卡与所述第二虚拟交换机50322之间的连接;The second virtual load balancing proxy unit 50312 is configured to receive the configuration information of the second load balancing virtual machine 50312 sent by the virtual load balancing management unit 50111, and create configuration information of the second load balancing virtual machine 50312 based on the configuration information. Instructing the virtual machine management unit 50112 to create the second load balancing virtual machine 50312, and instructing the virtual machine management unit The second virtual network card is configured for the second load balancing virtual machine 50312 and establishes a connection between the second virtual network card and the second virtual switch 50322.
所述第二虚拟交换机50322,用于接收所述第三虚拟机50313发起的第二业务报文,在所述第二业务报文需要负载均衡处理时,只转发所述第二业务报文给所述第二负载均衡虚拟机50312;The second virtual switch 50322 is configured to receive the second service packet initiated by the third virtual machine 50313. When the second service packet needs to be load balanced, the second service packet is forwarded only to the second service packet. The second load balancing virtual machine 50312;
所述第二负载均衡虚拟机50312,用于接收所述第二虚拟交换机50322转发的所述第二业务报文,基于负载均衡方式转发所述第二业务报文。The second load balancing virtual machine 50312 is configured to receive the second service packet forwarded by the second virtual switch 50322, and forward the second service packet according to a load balancing manner.
相应的,所述虚拟机管理单元50112可以为所述第一负载均衡虚拟机50212配置第一IP地址和第一MAC地址,以及为所述第二负载均衡虚拟机配置第二IP地址和第二MAC地址。其中,所述第一IP地址可以与所述第二IP地址相同,所述第一MAC地址也可以与所述第二MAC地址相同,这样,可以节省计算机设备所组成的网络中IP地址资源或MAC地址资源,提高IP地址资源或MAC地址资源的利用率。Correspondingly, the virtual machine management unit 50112 may configure a first IP address and a first MAC address for the first load balancing virtual machine 50212, and configure a second IP address and a second for the second load balancing virtual machine. MAC address. The first IP address may be the same as the second IP address, and the first MAC address may also be the same as the second MAC address, so that the IP address resource in the network formed by the computer device may be saved or MAC address resource to improve the utilization of IP address resources or MAC address resources.
上述图5、图6和图7所示的实施例,还可以参考图2中具体实现方式来实现,不再赘述。The embodiments shown in FIG. 5, FIG. 6, and FIG. 7 can also be implemented by referring to the specific implementation manner in FIG. 2, and details are not described herein again.
可选的,本发明实施例还提供了第二种计算机系统,包括第一计算机设备(如图2中的计算机设备202或图7中的计算机设备502)、第二计算机设备(如图2中的计算机设备201或图7中的计算机设备501)和第三计算机设备(如图2中的计算机设备203或图7中的计算机设备503),其中,所述第一计算机设备、第二计算机设备和第三计算机设备分别包括中央处理器CPU、内存和存储设备,所述第二计算机设备对所述第一计算机设备和所述第三计算机设备上的虚拟机进行配置和管理,所述第一计算机设备包含第一虚拟交换机,所述第三计算机设备包含第二虚拟交换机;Optionally, the embodiment of the present invention further provides a second computer system, including a first computer device (such as computer device 202 in FIG. 2 or computer device 502 in FIG. 7), and a second computer device (as shown in FIG. 2). Computer device 201 or computer device 501 in FIG. 7 and a third computer device (such as computer device 203 in FIG. 2 or computer device 503 in FIG. 7), wherein the first computer device, the second computer device And the third computer device respectively include a central processing unit CPU, a memory and a storage device, the second computer device configuring and managing the virtual machine on the first computer device and the third computer device, the first The computer device includes a first virtual switch, and the third computer device includes a second virtual switch;
所述第二计算机设备,用于接收在所述第一计算机设备上创建负载均衡虚拟机的配置信息,在所述第一计算机设备中创建第一负载均衡虚拟机,并建立所述第一负载均衡虚拟机与所述第一虚拟交换机的连接;以及接收 在所述第三计算机设备上创建负载均衡虚拟机的配置信息,在所述第三计算机设备中创建第二负载均衡虚拟机,并建立所述第二负载均衡虚拟机与所述第二虚拟交换机的连接;The second computer device is configured to receive configuration information for creating a load balancing virtual machine on the first computer device, create a first load balancing virtual machine in the first computer device, and establish the first load Balancing the connection of the virtual machine to the first virtual switch; and receiving Creating configuration information of the load balancing virtual machine on the third computer device, creating a second load balancing virtual machine in the third computer device, and establishing the second load balancing virtual machine and the second virtual switch Connection;
所述第一虚拟交换机,用于接收所述第一计算机设备中的第一虚拟机发送的第一业务报文,在所述第一业务报文需要负载均衡处理时,只转发所述第一业务报文给所述第一负载均衡虚拟机;The first virtual switch is configured to receive a first service packet sent by the first virtual machine in the first computer device, and only forward the first service packet when the first service packet needs load balancing processing Transmitting a service packet to the first load balancing virtual machine;
所述第二虚拟交换机,用于接收所述第三计算机设备中的第二虚拟机发送的第二业务报文,在所述第二业务报文需要负载均衡处理时,只转发所述第二业务报文给所述第二负载均衡虚拟机。The second virtual switch is configured to receive a second service packet sent by the second virtual machine in the third computer device, and only forward the second service packet when the second service packet needs load balancing processing The service packet is sent to the second load balancing virtual machine.
上述第二计算机系统中包含所述第一计算机设备、第二计算机设备和第三计算机设备,所述第二计算机设备分别在所述第一计算机设备中创建第一负载均衡虚拟机,在所述第三计算机设备中创建第二负载均衡虚拟机,使得每个计算机设备中都有负载均衡虚拟机处理各自计算机设备中的负载均衡业务,每个计算机设备中的虚拟机发出的业务报文,只在本计算机设备中的负载均衡虚拟机来负载均衡的处理。这样,不会出现多个计算机设备上的业务报文集中到一个负载均衡节点,避免了集中式的负载均衡的拥塞带来的处理的延迟。并且,当一个计算机设备出现故障时,该计算机设备中的虚拟机也会随之下线,不会再产生负载均衡的需求。因此,在单个计算机设备的故障带来的负载均衡虚拟机的故障,不会影响其它计算机设备上的负载均衡虚拟机,也不会存在因负载均衡虚拟机故障导致主备切换带来的业务中断。The second computer system includes the first computer device, the second computer device, and the third computer device, and the second computer device respectively creates a first load balancing virtual machine in the first computer device, where The second load balancing virtual machine is created in the third computer device, so that each load balancing virtual machine in each computer device processes the load balancing service in the respective computer device, and the service message sent by the virtual machine in each computer device is only The load balancing virtual machine in the computer device is used for load balancing processing. In this way, service packets on multiple computer devices are not concentrated into one load balancing node, which avoids the processing delay caused by centralized load balancing congestion. Moreover, when a computer device fails, the virtual machine in the computer device will also go offline, and there will be no need for load balancing. Therefore, the load balancing virtual machine failure caused by the failure of a single computer device does not affect the load balancing virtual machine on other computer devices, and there is no service interruption caused by the load balancing virtual machine failure. .
其中,所述第二计算机系统,所述第一虚拟交换机只转发所述第一业务报文给所述第一负载均衡虚拟机包括:The second computer system, the first virtual switch forwarding the first service packet to the first load balancing virtual machine includes:
所述第一虚拟交换机将所述第一负载均衡虚拟机的MAC地址发送给所述第一虚拟机,使得所述第一虚拟机基于获取到的所述第一负载均衡虚拟机MAC地址发送所述业务报文,所述第一虚拟交换机将所述业务报文转发给 所述第一负载均衡虚拟机;或,Sending, by the first virtual switch, the MAC address of the first load balancing virtual machine to the first virtual machine, so that the first virtual machine sends the first load balancing virtual machine MAC address based on the acquired The first virtual switch forwards the service packet to the service packet The first load balancing virtual machine; or
所述第一负载均衡虚拟机将其MAC地址发送给所述第一虚拟机,使得所述第一虚拟机基于所述第一负载均衡虚拟机MAC地址发送所述业务报文,所述第一虚拟交换机将所述业务报文转发给所述第一负载均衡虚拟机;或,The first load balancing virtual machine sends its MAC address to the first virtual machine, so that the first virtual machine sends the service packet based on the first load balancing virtual machine MAC address, the first The virtual switch forwards the service packet to the first load balancing virtual machine; or
所述第一虚拟机基于预先配置的所述第一负载均衡虚拟机的MAC地址,发送所述业务报文,所述第一虚拟交换机将所述业务报文转发给所述第一负载均衡虚拟机。The first virtual machine sends the service packet based on the pre-configured MAC address of the first load balancing virtual machine, and the first virtual switch forwards the service packet to the first load balancing virtual machine.
相应的,所述第一虚拟交换机将所述第一负载均衡虚拟机的MAC地址发送给所述第一虚拟机包括:Correspondingly, the sending, by the first virtual switch, the MAC address of the first load balancing virtual machine to the first virtual machine includes:
所述第一虚拟交换机接收所述第一虚拟机发送的控制报文,向所述第一虚拟机返回控制响应报文,所述控制响应报文包含所述第一负载均衡虚拟机的MAC地址。所述控制报文可以为ARP报文或ICMPv6报文。Receiving, by the first virtual switch, a control packet sent by the first virtual machine, and returning a control response packet to the first virtual machine, where the control response packet includes a MAC address of the first load balancing virtual machine. . The control packet can be an ARP packet or an ICMPv6 packet.
可选的,所述第一计算机设备还包括第二虚拟机,所述第二虚拟机具备处理所述第一虚拟机的所述业务报文的能力;Optionally, the first computer device further includes a second virtual machine, where the second virtual machine is configured to process the service packet of the first virtual machine;
在所述第一负载均衡虚拟机通过负载均衡方式确定所述第二虚拟机处理所述第一虚拟机的所述业务报文时,所述第二虚拟机接收所述第一负载均衡服务器转发的所述业务报文,并将处理所述业务报文的结果发送给所述第一负载均衡虚拟机;When the first load balancing virtual machine determines that the second virtual machine processes the service packet of the first virtual machine by using a load balancing manner, the second virtual machine receives the first load balancing server for forwarding. The service packet, and the result of processing the service packet is sent to the first load balancing virtual machine;
所述第一负载均衡虚拟机,还用于将所述第二虚拟机处理所述业务报文的结果通过所述第一虚拟交换机发送给所述第一虚拟机。The first load balancing virtual machine is further configured to send, by the second virtual machine, the result of processing the service packet to the first virtual machine by using the first virtual switch.
本发明实施例中,所述第一负载均衡虚拟机的IP地址与所述第二负载均衡虚拟机的IP地址相同;或所述第一负载均衡虚拟机的MAC地址与所述第二负载均衡虚拟机的MAC地址相同。这样能够节省所述第二计算机系统中IP地址或MAC地址的地址资源,提高资源的利用率。In the embodiment of the present invention, the IP address of the first load balancing virtual machine is the same as the IP address of the second load balancing virtual machine; or the MAC address of the first load balancing virtual machine and the second load balancing The virtual machine has the same MAC address. In this way, the address resource of the IP address or the MAC address in the second computer system can be saved, and the resource utilization rate can be improved.
参考图8,图8为本发明实施例一种实现负载均衡方法的流程示意图。如图8所示,所述方法包括: Referring to FIG. 8, FIG. 8 is a schematic flowchart of a method for implementing load balancing according to an embodiment of the present invention. As shown in FIG. 8, the method includes:
步骤800:第二计算机设备接收在第一计算机设备上创建所述负载均衡虚拟机的配置信息,所述第一计算机设备包括中央处理器CPU、内存和存储设备,所述第一计算机设备还包括第一虚拟机和虚拟交换机;Step 800: The second computer device receives configuration information for creating the load balancing virtual machine on the first computer device, where the first computer device includes a central processing unit CPU, a memory, and a storage device, and the first computer device further includes The first virtual machine and the virtual switch;
步骤802:所述第二计算机设备根据所述配置信息,在所述第一计算机设备上创建负载均衡虚拟机,并建立所述负载均衡虚拟机与所述第一计算机设备中的虚拟交换机的连接;Step 802: The second computer device creates a load balancing virtual machine on the first computer device according to the configuration information, and establishes a connection between the load balancing virtual machine and a virtual switch in the first computer device. ;
步骤804:所述虚拟交换机接收所述第一虚拟机发送的业务报文,在所述业务报文需要负载均衡处理时,只转发所述业务报文给所述负载均衡虚拟机;Step 804: The virtual switch receives the service packet sent by the first virtual machine, and only forwards the service packet to the load balancing virtual machine when the service packet needs to be load balanced.
步骤806:所述负载均衡虚拟机接收所述第一虚拟交换机转发的所述业务报文,基于负载均衡方式转发所述业务报文。Step 806: The load balancing virtual machine receives the service packet forwarded by the first virtual switch, and forwards the service packet according to a load balancing manner.
上述方法中,第一计算机设备中包含负载均衡虚拟机,在第一计算机设备中的虚拟机发起业务,需要进行负载均衡处理时,相关的业务报文只被发送到第一计算机设备中的负载均衡虚拟机来进行负载均衡处理。由于负载均衡相关的业务报文在计算机设备中实现,不会出现多个计算机设备上的业务报文集中到一个负载均衡节点,避免了集中式的负载均衡的拥塞带来的处理的延迟。并且,当第一计算机设备出现故障时,该第一计算机设备中的虚拟机也会随之下线,不会再产生负载均衡的需求。因此,在单个计算机设备的故障带来的负载均衡虚拟机的故障,不会影响其它计算机设备上的负载均衡虚拟机,也不会存在因负载均衡虚拟机故障导致主备切换带来的业务中断。In the above method, the first computer device includes a load balancing virtual machine, and when the virtual machine in the first computer device initiates a service, and the load balancing process is required, the related service packet is only sent to the load in the first computer device. Balance the virtual machine for load balancing. Since the load balancing related service packets are implemented in the computer device, the service packets on the plurality of computer devices are not concentrated to one load balancing node, thereby avoiding the processing delay caused by the centralized load balancing congestion. Moreover, when the first computer device fails, the virtual machine in the first computer device will also go offline, and there is no need for load balancing. Therefore, the load balancing virtual machine failure caused by the failure of a single computer device does not affect the load balancing virtual machine on other computer devices, and there is no service interruption caused by the load balancing virtual machine failure. .
可选的,上述步骤804中,所述虚拟交换机只转发所述业务报文给所述负载均衡虚拟机包括:Optionally, in the foregoing step 804, the virtual switch only forwards the service packet to the load balancing virtual machine, including:
所述虚拟交换机将所述负载均衡虚拟机的MAC地址发送给所述第一虚拟机,使得所述第一虚拟机基于获取到的所述负载均衡虚拟机MAC地址发送所述业务报文,所述虚拟交换机将所述业务报文转发给所述负载均衡虚拟 机;或,The virtual switch sends the MAC address of the load balancing virtual machine to the first virtual machine, so that the first virtual machine sends the service packet based on the obtained load balancing virtual machine MAC address. The virtual switch forwards the service packet to the load balancing virtual Machine; or,
所述负载均衡虚拟机将其MAC地址发送给所述第一虚拟机,使得所述第一虚拟机基于获取到的所述负载均衡虚拟机MAC地址发送所述业务报文,所述虚拟交换机将所述业务报文转发给所述负载均衡虚拟机;或,The load balancing virtual machine sends its MAC address to the first virtual machine, so that the first virtual machine sends the service packet based on the acquired load balancing virtual machine MAC address, and the virtual switch will Transmitting the service packet to the load balancing virtual machine; or
所述第一虚拟机基于预先配置的所述负载均衡虚拟机的MAC地址发送所述业务报文,所述虚拟交换机将所述业务报文转发给所述负载均衡虚拟机。The first virtual machine sends the service packet based on the pre-configured MAC address of the load balancing virtual machine, and the virtual switch forwards the service packet to the load balancing virtual machine.
其中,所述虚拟交换机将所述负载均衡虚拟机的MAC地址发送给所述第一虚拟机可以包括:The sending, by the virtual switch, the MAC address of the load balancing virtual machine to the first virtual machine may include:
所述虚拟交换机接收所述第一虚拟机发送的控制报文,向所述第一虚拟机返回控制响应报文,所述控制响应报文包含所述负载均衡虚拟机的MAC地址。所述控制报文可以为ARP报文或ICMPv6报文。The virtual switch receives the control packet sent by the first virtual machine, and returns a control response packet to the first virtual machine, where the control response packet includes a MAC address of the load balancing virtual machine. The control packet can be an ARP packet or an ICMPv6 packet.
在所述第二计算机设备根据所述配置信息,在所述第一计算机设备上创建负载均衡虚拟机之前,所述方法还包括:Before the second computer device creates a load balancing virtual machine on the first computer device according to the configuration information, the method further includes:
所述第二计算机设备将所述配置信息发送给所述第一计算机设备;Sending, by the second computer device, the configuration information to the first computer device;
所述第一计算机设备接收创建负载均衡虚拟机的配置信息,指示所述第二计算机设备创建所述负载均衡虚拟机。The first computer device receives configuration information for creating a load balancing virtual machine, instructing the second computer device to create the load balancing virtual machine.
本发明实施例中,所述第二计算机设备还包括第二虚拟机,所述第二虚拟机具备处理所述第一虚拟机的所述业务报文的能力,所述方法还包括:In the embodiment of the present invention, the second computer device further includes a second virtual machine, where the second virtual machine has the capability of processing the service packet of the first virtual machine, and the method further includes:
在所述负载均衡虚拟机通过负载均衡算法确定所述第二虚拟机处理所述第一虚拟机的所述业务报文时,所述第二虚拟机接收所述负载均衡服务器转发的所述业务报文,并将处理所述业务报文的结果发送给所述负载均衡虚拟机;When the load balancing virtual machine determines that the second virtual machine processes the service packet of the first virtual machine by using a load balancing algorithm, the second virtual machine receives the service forwarded by the load balancing server. Sending a message to the load balancing virtual machine by processing the result of processing the service packet;
所述负载均衡虚拟机将所述第二虚拟机处理所述业务报文的结果通过所述虚拟交换机发送给所述第一虚拟机。The load balancing virtual machine sends the result of processing the service packet by the second virtual machine to the first virtual machine by using the virtual switch.
所述第二虚拟机与所述第一虚拟机在一个计算机设备中,能够节省业 务处理跨计算机设备所造成的带宽占用,提高业务处理的效率。The second virtual machine and the first virtual machine are in one computer device, which can save industry It can handle the bandwidth occupation caused by cross-computer equipment and improve the efficiency of business processing.
本发明实施例中方法实施例的实现,还可以参考上述图2所示的实施例的实现方式来实现,不再赘述。The implementation of the method embodiment in the embodiment of the present invention may also be implemented by referring to the implementation manner of the embodiment shown in FIG. 2, and details are not described herein.
下面结合图2所示的应用场景,以用户通过云管理平台在计算机设备202中申请虚拟机20213,通过该虚拟机20213实现具体的业务(例如访问视频业务),该业务可以由计算机设备202中的虚拟机20214或计算机设备203中的虚拟机20314等后端服务器来处理,且需要在虚拟机20214和虚拟机20314之间对虚拟机20213发起的业务做负载均衡为例,对本发明实施例实现负载均衡业务的方法的实现方式进行详细说明。In the following, in conjunction with the application scenario shown in FIG. 2, the user applies for the virtual machine 20213 in the computer device 202 through the cloud management platform, and implements a specific service (for example, accessing a video service) through the virtual machine 20213, and the service may be performed by the computer device 202. The virtual machine 20214 or the virtual machine 20314 in the computer device 203 is processed by the back-end server, and the load balancing of the service initiated by the virtual machine 20213 between the virtual machine 20214 and the virtual machine 20314 is required as an example, which is implemented in the embodiment of the present invention. The implementation method of the load balancing service is described in detail.
图9为实现过程的流程示意图。需要说明的是,图9所示的实现过程仍以具备负载均衡功能的虚拟机作为负载均衡器的实现方式来描述。对于以容器或namespace等实现负载均衡器的实现方式,可以参照下述以虚拟机作为负载均衡器的实现方式来实现。Figure 9 is a schematic flow chart of the implementation process. It should be noted that the implementation process shown in FIG. 9 is still described by using a virtual machine with load balancing function as a load balancer. For implementing the load balancer in a container or a namespace, the implementation of the virtual machine as a load balancer can be implemented as follows.
如图9所示,本发明实施例实现负载均衡业务的一种方法包括:As shown in FIG. 9, a method for implementing load balancing services according to an embodiment of the present invention includes:
步骤900:计算机设备201获取在计算机设备202中创建负载均衡虚拟机的配置信息。Step 900: The computer device 201 acquires configuration information for creating a load balancing virtual machine in the computer device 202.
步骤902:计算机设备201根据获取到的负载均衡虚拟机的配置信息,在计算机设备202中创建负载均衡虚拟机20212;Step 902: The computer device 201 creates a load balancing virtual machine 20212 in the computer device 202 according to the acquired configuration information of the load balancing virtual machine.
步骤904:配置计算机设备202中负载均衡业务的转发模式,使得虚拟机20213发起的业务,只被转发到在计算机设备202中创建的负载均衡虚拟机20212进行负载均衡处理;Step 904: Configure a forwarding mode of the load balancing service in the computer device 202, so that the service initiated by the virtual machine 20213 is only forwarded to the load balancing virtual machine 20212 created in the computer device 202 for load balancing processing;
其中,所述虚拟机20213发起的业务为负载均衡业务,所述负载均衡业务为需要进行负载均衡处理的业务。The service initiated by the virtual machine 20213 is a load balancing service, and the load balancing service is a service that needs to perform load balancing processing.
步骤906:负载均衡虚拟机20212接收虚拟机20213发送的业务,选择一个后端服务器处理所述虚拟机20213发起的业务;Step 906: The load balancing virtual machine 20212 receives the service sent by the virtual machine 20213, and selects a backend server to process the service initiated by the virtual machine 20213.
步骤908:后端服务器将处理后的所述虚拟机20213发起的业务返回 给虚拟机20213。Step 908: The backend server returns the processed service initiated by the virtual machine 20213. Give virtual machine 20213.
上述步骤900中,计算机设备201作为云管理平台,能获取到需要创建的负载均衡虚拟机的配置信息,例如用户通过计算机设备201上运行的云管理平台相关的软件下发的负载均衡虚拟机的配置信息,或者计算机设备201中预先存储的关于负载均衡虚拟机的配置信息。并且,计算机设备201作为云管理平台,也可以获取其它的业务虚拟机,例如计算机设备202中虚拟机20213的配置信息。计算机设备201获取业务虚拟机的配置信息的方式,也包括接收用户通过云管理平台相关软件下发的配置信息或计算机设备201中预先存储的配置信息。In the above step 900, the computer device 201, as the cloud management platform, can obtain the configuration information of the load balancing virtual machine that needs to be created, for example, the load balancing virtual machine delivered by the user through the software related to the cloud management platform running on the computer device 201. Configuration information, or configuration information about the load balancing virtual machine pre-stored in the computer device 201. Moreover, the computer device 201, as a cloud management platform, may also acquire configuration information of other service virtual machines, such as the virtual machine 20213 in the computer device 202. The manner in which the computer device 201 obtains the configuration information of the service virtual machine includes receiving configuration information delivered by the user through the cloud management platform related software or configuration information pre-stored in the computer device 201.
由于本发明实施例是用户通过云管理平台在计算机设备202中申请虚拟机20213,该虚拟机20213发起的业务请求需要进行负载均衡处理。为避免现有技术中集中式的负载均衡节点所造成的拥塞等弊端,本发明实施例在计算机设备202中创建负载均衡虚拟机20212,由该负载均衡虚拟机20212处理虚拟机20213发起的需要进行负载均衡处理的业务请求。因此,在步骤900中,计算机设备201需要获取在计算机设备202中创建的负载均衡虚拟机的配置信息,即负载均衡虚拟机20212的配置信息,并根据获取到的负载均衡虚拟机的配置信息在计算机设备202中配置负载均衡虚拟机。The embodiment of the present invention is that the user requests the virtual machine 20213 in the computer device 202 through the cloud management platform, and the service request initiated by the virtual machine 20213 needs to perform load balancing processing. In order to avoid the congestion and the like caused by the centralized load balancing node in the prior art, the embodiment of the present invention creates a load balancing virtual machine 20212 in the computer device 202, and the load balancing virtual machine 20212 processes the need initiated by the virtual machine 20213. Service request for load balancing processing. Therefore, in step 900, the computer device 201 needs to acquire the configuration information of the load balancing virtual machine created in the computer device 202, that is, the configuration information of the load balancing virtual machine 20212, and according to the acquired configuration information of the load balancing virtual machine. A load balancing virtual machine is configured in the computer device 202.
本发明实施例中,所述负载均衡虚拟机的配置信息包括但不限于:负载均衡虚拟机20212的标识,负载均衡虚拟机20212的VIP地址。其中,所述负载均衡虚拟机20212的VIP指示负载均衡业务。例如,当负载均衡虚拟机20212的IP地址被配置为VIP时,该负载均衡虚拟机20212能够被作为处理负载均衡业务的节点被寻址到。可选的,本发明实施例中,所述负载均衡虚拟机的配置信息还包括与该负载均衡虚拟机20212相关的后端服务器的信息等。In the embodiment of the present invention, the configuration information of the load balancing virtual machine includes, but is not limited to, an identifier of the load balancing virtual machine 20212, and a VIP address of the load balancing virtual machine 20212. The VIP of the load balancing virtual machine 20212 indicates a load balancing service. For example, when the IP address of the load balancing virtual machine 20212 is configured as a VIP, the load balancing virtual machine 20212 can be addressed as a node that handles load balancing services. Optionally, in the embodiment of the present invention, the configuration information of the load balancing virtual machine further includes information about a backend server related to the load balancing virtual machine 20212.
可选的,所述配置信息还可以包括虚拟机参数信息,虚拟机参数信息包括但不限于:虚拟中央处理器的个数,虚拟内存的大小,以及所述负载 均衡虚拟机20212所在的逻辑网络等信息。该虚拟机的参数信息可以是预先配置好的参数列表,按照不同的需求可以选择不同的参数列表。该参数列表可以是用户下发配置信息时指定的,也可以是计算机设备201根据预先的策略在存储的配置信息列表中获取的,本发明实施例不限定获取负载均衡虚拟机20212的虚拟机参数信息的方式。Optionally, the configuration information may further include virtual machine parameter information, where the virtual machine parameter information includes, but is not limited to, the number of virtual central processing units, the size of the virtual memory, and the load. The information such as the logical network where the virtual machine 20212 is located is equalized. The parameter information of the virtual machine may be a pre-configured parameter list, and different parameter lists may be selected according to different requirements. The parameter list may be specified when the user sends the configuration information, or may be obtained by the computer device 201 in the stored configuration information list according to the previous policy. The embodiment of the present invention does not limit the virtual machine parameter of the load balancing virtual machine 20212. The way information is.
在步骤902中,计算机设备201根据获取到的负载均衡虚拟机的配置信息,创建负载均衡虚拟机20212。In step 902, the computer device 201 creates a load balancing virtual machine 20212 according to the acquired configuration information of the load balancing virtual machine.
计算机设备201作为云管理平台,能够在计算机设备202中创建普通虚拟机,也能够创建负载均衡虚拟机。计算机设备201能够根据获取到的负载均衡虚拟机20212的配置信息,在计算机设备202中创建负载均衡虚拟机20212。As a cloud management platform, the computer device 201 can create a normal virtual machine in the computer device 202, and can also create a load balancing virtual machine. The computer device 201 can create a load balancing virtual machine 20212 in the computer device 202 based on the acquired configuration information of the load balancing virtual machine 20212.
可选的,上述方法还可以包括步骤901:计算机设备201在计算机设备202中创建虚拟机20213。该虚拟机20213是用户创建的业务虚拟机,虚拟机20213是发起业务的虚拟机。虚拟机20213发起的业务包括负载均衡业务,即虚拟机20213发起的负载均衡业务,是需要进行负载均衡处理的业务。Optionally, the foregoing method may further include the step 901: the computer device 201 creates the virtual machine 20213 in the computer device 202. The virtual machine 20213 is a service virtual machine created by a user, and the virtual machine 20213 is a virtual machine that initiates a service. The service initiated by the virtual machine 20213 includes a load balancing service, that is, a load balancing service initiated by the virtual machine 20213, which is a service that needs to perform load balancing processing.
当下发创建负载均衡虚拟机配置信息的用户在计算机设备202上创建第一个虚拟机时,例如创建第一个发起负载均衡业务的虚拟机20213时,计算机设备201创建负载均衡虚拟机20212。在该用户创建的最后一个虚拟机被删除时,例如删除最后一个发起负载均衡业务的虚拟机20213时,计算机设备201删除负载均衡虚拟机20212。这样,只在用户创建发起负载均衡业务的虚拟机时才创建负载均衡虚拟机20212,能够避免该用户没有创建虚拟机时因创建负载均衡虚拟机带来的计算机设备202的资源被占用的问题,提高了计算机设备202的资源利用率。When the user who created the load balancing virtual machine configuration information creates the first virtual machine on the computer device 202, for example, when the first virtual machine 20213 that initiates the load balancing service is created, the computer device 201 creates the load balancing virtual machine 20212. When the last virtual machine created by the user is deleted, for example, the last virtual machine 20213 that initiated the load balancing service is deleted, the computer device 201 deletes the load balancing virtual machine 20212. In this way, the load balancing virtual machine 20212 is created only when the user creates the virtual machine that initiates the load balancing service, which can avoid the problem that the resources of the computer device 202 caused by the creation of the load balancing virtual machine are occupied when the user does not create the virtual machine. The resource utilization of computer device 202 is increased.
上述计算机设备201判断该创建的虚拟机是否是已经配置了虚拟负载均衡业务的用户创建的第一个业务虚拟机,可以根据用户的信息,例如用 户的标识信息等,判断是否是已经配置了虚拟负载均衡业务的用户创建的第一个业务虚拟机。The computer device 201 determines whether the created virtual machine is the first service virtual machine created by the user who has configured the virtual load balancing service, and may use the information according to the user, for example, The identification information of the user, etc., determines whether it is the first service virtual machine created by the user who has configured the virtual load balancing service.
同样的,判断已经配置了虚拟负载均衡业务的用户创建的最后一个业务虚拟机被删除时,也可以按照上述用户的信息来判断,不再赘述。Similarly, when it is determined that the last service virtual machine created by the user who has configured the virtual load balancing service is deleted, the user information may be determined according to the information of the user, and details are not described herein.
在步骤902中,计算机设备201根据获取到的负载均衡虚拟机的配置信息,创建负载均衡虚拟机20212还包括计算机设备201根据负载均衡虚拟机的配置信息中的网络信息,为所述负载均衡虚拟机20212配置虚拟网卡。In step 902, the computer device 201 creates a load balancing virtual machine 20212 according to the acquired configuration information of the load balancing virtual machine, and further includes the computer device 201 as the load balancing virtual network according to the network information in the configuration information of the load balancing virtual machine. The machine 20212 configures a virtual network card.
上述步骤904中,可以是由计算机设备201在计算机设备202中配置负载均衡业务的转发模式。其中,所述转发模式使得计算机设备202上的所述发起业务的虚拟机,例如虚拟机20213,发起的所述负载均衡业务的业务报文定向转发到所述负载均衡器。In the above step 904, a forwarding mode in which the load balancing service is configured in the computer device 202 by the computer device 201 may be used. The forwarding mode forwards the service packet of the load balancing service initiated by the virtual machine that initiates the service on the computer device 202, such as the virtual machine 20213, to the load balancer.
计算机设备201配置计算机设备202中负载均衡业务的转发模式,可以通过配置算机设备202中虚拟交换机的转发模式来实现。计算机设备202中虚拟交换机为虚拟交换机20222,所述虚拟交换机20222被配置的转发模式,是对所述虚拟机20213发送的需要负载均衡处理的业务报文进行定向转发处理,将所述虚拟机20213发送的需要负载均衡处理的业务报文,只发送至所述计算机设备202中的负载均衡虚拟机20212。可选的,所述虚拟交换机20222的转发模式可以为ARP或NDP代答模式,即所述虚拟交换机20222对所述业务报文进行定向转发通过ARP或NDP代答模式来实现。The computer device 201 configures the forwarding mode of the load balancing service in the computer device 202, which can be implemented by configuring the forwarding mode of the virtual switch in the computer device 202. The virtual switch in the computer device 202 is a virtual switch 20222. The forwarding mode of the virtual switch 20222 is configured to perform a directional forwarding process on the service packet that needs to be load-balanced and sent by the virtual machine 20213. The service message sent for load balancing processing is sent only to the load balancing virtual machine 20212 in the computer device 202. Optionally, the forwarding mode of the virtual switch 20222 may be an ARP or NDP pickup mode, that is, the virtual switch 20222 performs directional forwarding of the service packet by using an ARP or NDP pickup mode.
当所述虚拟机20213发起负载均衡业务的业务报文时,所述虚拟机20213根据所述负载均衡业务的转发模式,发送所述负载均衡业务的业务报文到所述负载均衡虚拟机20212。具体的,可以是所述虚拟机20213发起需要进行负载均衡处理的负载均衡业务时,先发送一个以VIP为目的IP的控制报文,该控制报文可以是负载均衡业务的广播报文。在通常情况下,所述虚拟机20213发起以VIP为目的IP的控制报文,会被转发到所有IP地址 为VIP的负载均衡节点(例如负载均衡器等)。但本发明实施例中,由于计算机设备201在计算机设备202中配置了负载均衡业务的转发模式,计算机设备202中的虚拟交换机20222在接收到虚拟机20213发送的控制报文后,只将负载均衡虚拟机20212的MAC地址发送给虚拟机20213。虚拟机20213根据获取到的负载均衡虚拟机20212的MAC地址,将负载均衡业务的业务报文发送给负载均衡虚拟机20212。使得虚拟机20213发起的业务,只被转发到在计算机设备202中创建的负载均衡虚拟机20212进行负载均衡处理。When the virtual machine 20213 initiates a service packet of the load balancing service, the virtual machine 20213 sends the service packet of the load balancing service to the load balancing virtual machine 20212 according to the forwarding mode of the load balancing service. Specifically, when the virtual machine 20213 initiates a load balancing service that needs to perform load balancing processing, the control device may first send a control packet with the VIP as the destination IP, and the control packet may be a broadcast packet of the load balancing service. In the normal case, the virtual machine 20213 initiates a control packet with the VIP as the destination IP, and is forwarded to all IP addresses. A load balancing node (such as a load balancer, etc.) that is a VIP. However, in the embodiment of the present invention, since the computer device 201 configures the forwarding mode of the load balancing service in the computer device 202, the virtual switch 20222 in the computer device 202 only balances the load after receiving the control packet sent by the virtual machine 20213. The MAC address of the virtual machine 20212 is sent to the virtual machine 20213. The virtual machine 20213 sends the service packet of the load balancing service to the load balancing virtual machine 20212 according to the obtained MAC address of the load balancing virtual machine 20212. The services initiated by the virtual machine 20213 are only forwarded to the load balancing virtual machine 20212 created in the computer device 202 for load balancing processing.
可选的,在所述虚拟机20213发送业务报文之前,发送到虚拟交换机20222的控制报文可以是ARP报文或ICMP报文。Optionally, before the virtual machine 20213 sends the service packet, the control packet sent to the virtual switch 20222 may be an ARP packet or an ICMP packet.
本发明实施例以支持OpenStack的云平台为例,对ARP代答技术的实现方式进行说明。在虚拟机20213第一次发起负载均衡处理的业务时,先发送控制报文给虚拟交换机20222,例如先发送一个ARP请求报文给虚拟交换机20222,虚拟交换机20222做ARP代答。由于虚拟机20213第一次发起负载均衡处理的业务时,虚拟机20213不知道处理负载均衡业务的负载均衡虚拟机的MAC地址,只知道负载均衡业务的VIP地址。因此,虚拟机20213第一次发起负载均衡处理的业务时,先发送一个ARP请求,以获取处理负载均衡业务的负载均衡虚拟机的MAC地址。The embodiment of the present invention uses a cloud platform supporting OpenStack as an example to describe the implementation manner of the ARP pickup technology. When the virtual machine 20213 first initiates the service of the load balancing process, the control packet is sent to the virtual switch 20222, for example, an ARP request packet is sent to the virtual switch 20222, and the virtual switch 20222 performs ARP pickup. When the virtual machine 20213 initiates the load balancing processing service for the first time, the virtual machine 20213 does not know the MAC address of the load balancing virtual machine that processes the load balancing service, and only knows the VIP address of the load balancing service. Therefore, when the virtual machine 20213 initiates the load balancing processing service for the first time, it first sends an ARP request to obtain the MAC address of the load balancing virtual machine that processes the load balancing service.
所述ARP请求报文的目的IP为VIP,该VIP为负载均衡虚拟机可被访问的IP地址。所述ARP请求报文的目的MAC地址可以是通用的负载均衡虚拟机的MAC地址,该MAC不是一个具体的负载均衡虚拟机的MAC地址,目的MAC地址也可以为空。ARP代答技术通过流表来实现,流表技术一般由两部分组成,一部分是匹配条件,另一部分是动作,ARP代答的流表的匹配条件是:协议类型为ARP,ARP的目标协议地址为VIP,该VIP是负载均衡虚拟机可被访问的IP地址,ARP操作类型为ARP请求。当虚拟交换机20222对虚拟机20213发送的ARP请求做ARP代答时,将负载均衡虚拟机20212 的MAC地址返回给虚拟机20213。The destination IP address of the ARP request packet is a VIP, and the VIP is an IP address that the load balancing virtual machine can access. The destination MAC address of the ARP request packet may be a MAC address of a general load balancing virtual machine. The MAC address is not a MAC address of a specific load balancing virtual machine, and the destination MAC address may also be empty. The ARP pickup technology is implemented by a flow table. The flow table technology generally consists of two parts, one is the matching condition and the other is the action. The matching condition of the flow table of the ARP pickup is: the protocol type is ARP, the target protocol address of the ARP For the VIP, the VIP is the IP address that the load balancing virtual machine can be accessed, and the ARP operation type is the ARP request. When the virtual switch 20222 performs ARP pickup on the ARP request sent by the virtual machine 20213, the load balancing virtual machine 20212 The MAC address is returned to the virtual machine 20213.
虚拟交换机20222将ARP应答报文发送给虚拟机20213后,虚拟机20213发送需要负载均衡处理的业务报文,所述业务报文的IP地址是VIP地址,MAC地址是从虚拟交换机20222的ARP应答中获取的负载均衡虚拟机20212的MAC。虚拟机20213将所述业务报文发送给虚拟交换机20222。虚拟交换机20202收到虚拟机20213发送的业务报文后,根据业务报文中携带的MAC地址,将该业务报文发送给负载均衡虚拟机20212。After the virtual switch 20222 sends the ARP reply packet to the virtual machine 20213, the virtual machine 20213 sends a service packet that needs load balancing processing. The IP address of the service packet is a VIP address, and the MAC address is an ARP response from the virtual switch 20222. The MAC of the load balancing virtual machine 20212 obtained in . The virtual machine 20213 sends the service packet to the virtual switch 20222. After receiving the service packet sent by the virtual machine 20213, the virtual switch 20202 sends the service packet to the load balancing virtual machine 20212 according to the MAC address carried in the service packet.
上述虚拟交换机20222接收虚拟机20213发送的业务报文,根据所述业务报文的IP地址和MAC地址,将所述业务报文发送到负载均衡虚拟机20212。其他计算机设备(如计算机设备203)上的负载均衡虚拟机(如负载均衡虚拟机20312)没有收到虚拟机20213的业务报文,不会处理虚拟机20213发送的需要负载均衡处理的业务报文。实现了每个计算机设备中的虚拟机的业务报文在需要负载均衡处理时,只在本计算机设备内的负载均衡虚拟机上实现的目的。The virtual switch 20222 receives the service packet sent by the virtual machine 20213, and sends the service packet to the load balancing virtual machine 20212 according to the IP address and the MAC address of the service packet. The load balancing virtual machine (such as the load balancing virtual machine 20312) on the other computer device (such as the computer device 203) does not receive the service packet of the virtual machine 20213, and does not process the service packet that needs to be load balanced and sent by the virtual machine 20213. . The purpose of realizing the service message of the virtual machine in each computer device is only implemented on the load balancing virtual machine in the computer device when load balancing processing is required.
作为一种可选的实现方式,所述计算机设备201在所述计算机设备202上配置所述负载均衡业务的转发模式还可以通过下述方式实现:As an optional implementation manner, the forwarding mode of the load balancing service configured by the computer device 201 on the computer device 202 can also be implemented by:
所述计算机设备201指示所述负载均衡虚拟机20212将所述负载均衡虚拟机20212的MAC地址发送给所述发起业务的虚拟机(例如虚拟机20213);或者,The computer device 201 instructs the load balancing virtual machine 20212 to send the MAC address of the load balancing virtual machine 20212 to the virtual machine (eg, the virtual machine 20213) that initiates the service; or
所述计算机设备201在所述发起业务的虚拟机(例如虚拟机20213)上配置所述负载均衡虚拟机20212的MAC地址。The computer device 201 configures the MAC address of the load balancing virtual machine 20212 on the virtual machine (eg, virtual machine 20213) that initiates the service.
其中,当所述计算机设备201指示所述负载均衡虚拟机20212将所述负载均衡虚拟机20212的MAC地址发送给所述发起业务的虚拟机(例如虚拟机20213)时,发起业务的虚拟机(例如虚拟机20213),以接收到的所述负载均衡虚拟机20212的MAC地址,作为发起负载均衡业务时的目的MAC地址。当所述计算机设备201在所述发起业务的虚拟机(例如虚拟机20213) 上配置所述负载均衡虚拟机20212的MAC地址时,配置的所述负载均衡虚拟机20212的MAC地址,是发起业务的虚拟机(例如虚拟机20213)发送负载均衡业务时的目的MAC地址。When the computer device 201 instructs the load balancing virtual machine 20212 to send the MAC address of the load balancing virtual machine 20212 to the virtual machine (eg, the virtual machine 20213) that initiates the service, the virtual machine that initiates the service ( For example, the virtual machine 20213) receives the MAC address of the load balancing virtual machine 20212 as the destination MAC address when initiating the load balancing service. When the computer device 201 is in the virtual machine that initiates the service (for example, the virtual machine 20213) When the MAC address of the load balancing virtual machine 20212 is configured, the MAC address of the load balancing virtual machine 20212 is the destination MAC address when the virtual machine (for example, the virtual machine 20213) that initiates the service sends the load balancing service.
上述步骤906中,负载均衡虚拟机20212接收虚拟机20213发送的业务,选择一个后端服务器处理所述虚拟机20213发起的业务,可以包括如下实现步骤:所述负载均衡虚拟机20212在收到业务报文后,首先判断是否已经为所述业务报文分配了一个后端服务器为其服务,如果已经分配了后端服务器,则将该业务报文发送给已经分配的后端服务器。如果还没有分配后端服务器,则通过负载均衡算法,选择一个后端服务器为其服务。所述负载均衡算法包括但不限于:轮询、加权轮询、随机、最小连接或源地散列,基于位置优先的加权轮询等。所述位置优先的加权轮询方式,可以优先选择在发起业务报文的虚拟机所在的计算机设备中的后端服务器,即计算机设备202中的虚拟机20214作为处理虚拟机20213业务的后端服务器,这样能够节省后端服务器处理业务报文的速度,节省网络带宽。当然,步骤906中,负载均衡虚拟机20212也可以将虚拟机20213的业务请求经过负载均衡算法处理后,发送给计算机设备203中的虚拟机20314,由该虚拟机20314作为处理虚拟机20213业务的后端服务器,处理虚拟机20213发起的业务。In the foregoing step 906, the load balancing virtual machine 20212 receives the service sent by the virtual machine 20213, and selects a backend server to process the service initiated by the virtual machine 20213. The method may include the following steps: the load balancing virtual machine 20212 receives the service. After the packet is received, it is first determined whether a service is sent to the service server by the backend server. If the backend server has been allocated, the service packet is sent to the already assigned backend server. If a backend server has not been assigned, select a backend server to serve it through a load balancing algorithm. The load balancing algorithms include, but are not limited to, polling, weighted polling, random, minimum or source-to-ground hashing, location-based weighted polling, and the like. The location-prioritized weighted polling mode may preferentially select the back-end server in the computer device where the virtual machine that originated the service message is located, that is, the virtual machine 20214 in the computer device 202 as the back-end server that processes the virtual machine 20213 service. This can save the speed of the back-end server processing service packets and save network bandwidth. Of course, in step 906, the load balancing virtual machine 20212 may also process the service request of the virtual machine 20213 through the load balancing algorithm, and then send it to the virtual machine 20314 in the computer device 203, and the virtual machine 20314 serves as the processing virtual machine 20213. The backend server processes the services initiated by the virtual machine 20213.
需要说明的是,图9中步骤906的虚线表示可选,即负载均衡虚拟机20212可以将所述虚拟机20213发起的业务转发给计算机设备202中的后端服务器即虚拟机20214,也可以转发给计算机设备203中的后端服务器及虚拟机20314。It should be noted that the dotted line of step 906 in FIG. 9 indicates that the load balancing virtual machine 20212 can forward the service initiated by the virtual machine 20213 to the backend server in the computer device 202, that is, the virtual machine 20214, and can also forward the service. The backend server and virtual machine 20314 in the computer device 203 are provided.
上述步骤908中,后端服务器将处理后的业务请求返回给虚拟机20213的方式可以包括两种:In the foregoing step 908, the manner in which the backend server returns the processed service request to the virtual machine 20213 may include two types:
方式一:处理虚拟机20213业务请求的后端服务器,通过负载均衡虚拟机20212将处理后的结果返回给虚拟机20213; Method 1: The backend server processing the virtual machine 20213 service request, and returning the processed result to the virtual machine 20213 through the load balancing virtual machine 20212;
方式二:处理处理虚拟机20213业务请求的后端服务器,不通过负载均衡虚拟机20212,直接将处理后的结果返回给虚拟机20213。Manner 2: The back-end server that processes the service request of the virtual machine 20213 does not pass the load balancing virtual machine 20212, and directly returns the processed result to the virtual machine 20213.
上述方式一中,负载均衡虚拟机20212在向处理虚拟机20213业务请求的后端服务器转发虚拟机20213的业务请求时,将业务请求的源地址(包括IP地址和MC地址等)写为负载均衡虚拟机20212的地址,将目的地址写为处理虚拟机20213业务请求的后端服务器的地址。这样,处理虚拟机20213业务请求的后端服务器根据接收业务请求时携带的源地址,将处理业务请求的结果返回给负载均衡虚拟机20212,负载均衡虚拟机20212再将接收到处理的业务请求返回发送给虚拟机20213。In the foregoing manner 1, the load balancing virtual machine 20212 writes the source address (including the IP address and the MC address, etc.) of the service request as load balancing when forwarding the service request of the virtual machine 20213 to the backend server that processes the virtual machine 20213 service request. The address of the virtual machine 20212 writes the destination address as the address of the backend server that processes the virtual machine 20213 service request. In this way, the backend server processing the service request of the virtual machine 20213 returns the result of processing the service request to the load balancing virtual machine 20212 according to the source address carried in the service request, and the load balancing virtual machine 20212 returns the service request received. Sent to virtual machine 20213.
上述方式二中,负载均衡虚拟机20212在向处理虚拟机20213业务请求的后端服务器转发虚拟机20213的业务请求时,将源地址(包括IP地址和MC地址等)写为虚拟机20213的地址,将目的地址写为处理虚拟机20213业务请求的后端服务器的地址。这样,处理虚拟机20213业务请求的后端服务器根据接收业务请求时携带的源地址,将处理业务请求的结果返回给虚拟机20213。In the foregoing manner 2, the load balancing virtual machine 20212 writes the source address (including the IP address, the MC address, and the like) as the address of the virtual machine 20213 when forwarding the service request of the virtual machine 20213 to the backend server that processes the virtual machine 20213 service request. The destination address is written as the address of the backend server that processes the virtual machine 20213 service request. In this way, the backend server that processes the virtual machine 20213 service request returns the result of processing the service request to the virtual machine 20213 according to the source address carried when receiving the service request.
需要说明的是,图9中步骤908的虚线表示可选,即当步骤906中负载均衡虚拟机20212将所述虚拟机20213发起的业务转发给计算机设备202中的后端服务器即虚拟机20214时,由虚拟机20214将处理后的业务请求返回给虚拟机20213。当步骤906中负载均衡虚拟机20212将所述虚拟机20213发起的业务转发给计算机设备203中的后端服务器即虚拟机20314时,由虚拟机20314将处理后的业务请求返回给虚拟机20213。It should be noted that the dotted line of step 908 in FIG. 9 indicates that the load balancing virtual machine 20212 forwards the service initiated by the virtual machine 20213 to the backend server in the computer device 202, that is, the virtual machine 20214. The processed service request is returned by the virtual machine 20214 to the virtual machine 20213. When the load balancing virtual machine 20212 forwards the service initiated by the virtual machine 20213 to the backend server in the computer device 203, that is, the virtual machine 20314, the virtual machine 20314 returns the processed service request to the virtual machine 20213.
本发明实施例中,上述计算机设备202和计算机设备203也叫作业务计算机设备。计算机设备202和/或计算机设备203上运行的虚拟机,例如虚拟机20213,也叫作发起业务的虚拟机,其发起的业务包括负载均衡业务。In the embodiment of the present invention, the computer device 202 and the computer device 203 are also referred to as service computer devices. A virtual machine running on computer device 202 and/or computer device 203, such as virtual machine 20213, is also referred to as a virtual machine that initiates a service, and the services initiated by the computer device 202 include load balancing services.
上述步骤900-步骤908的实现过程,是以作为云管理平台的计算机设备201在计算机设备202中创建负载均衡虚拟机20212为例进行说明的。 可以理解,对于计算机设备201在计算机设备203中创建负载均衡虚拟机20312的过程,与上述过程类似,不再赘述。The implementation process of the above steps 900- 908 is described by taking the computer device 201 as the cloud management platform to create the load balancing virtual machine 20212 in the computer device 202 as an example. It can be understood that the process for the computer device 201 to create the load balancing virtual machine 20312 in the computer device 203 is similar to the above process and will not be described again.
这样,计算机设备201可以分别在计算机设备202和计算机设备203中创建负载均衡虚拟机。每个业务计算机设备(例如计算机设备202和计算机设备203)上的业务虚拟机(例如虚拟机20213或虚拟机20313)发起的负载均衡业务的业务报文,定向转发到本地的负载均衡虚拟机。即业务计算机设备202中的业务虚拟机20213发起的负载均衡业务,只被转发到计算机设备202本地的负载均衡虚拟机(即负载均衡虚拟机20212)来实现负载均衡业务。业务计算机设备203中的业务虚拟机20313发起的负载均衡业务,只被转发到计算机设备203本地的负载均衡虚拟机(即负载均衡虚拟机20312)来实现负载均衡业务。Thus, computer device 201 can create a load balancing virtual machine in computer device 202 and computer device 203, respectively. The service packets of the load balancing service initiated by the service virtual machine (for example, the virtual machine 20213 or the virtual machine 20313) on each of the business computer devices (for example, the computer device 202 and the computer device 203) are forwarded to the local load balancing virtual machine. That is, the load balancing service initiated by the service virtual machine 20213 in the business computer device 202 is only forwarded to the load balancing virtual machine (ie, the load balancing virtual machine 20212) local to the computer device 202 to implement the load balancing service. The load balancing service initiated by the service virtual machine 20313 in the service computer device 203 is only forwarded to the load balancing virtual machine (ie, the load balancing virtual machine 20312) local to the computer device 203 to implement the load balancing service.
由于业务计算机设备202中的业务虚拟机20213发起的负载均衡业务,只被转发到计算机设备202本地的负载均衡虚拟机(即负载均衡虚拟机20212)来实现负载均衡业务;业务计算机设备203中的业务虚拟机20313发起的负载均衡业务,只被转发到计算机设备203本地的负载均衡虚拟机(即负载均衡虚拟机20312)来实现负载均衡业务。所以,业务计算机设备202中的负载均衡虚拟机20212的IP地址可以与业务计算机设备203中负载均衡虚拟机20312的IP地址相同;同样的,业务计算机设备202中的负载均衡虚拟机20212的MAC地址可以与业务计算机设备203中负载均衡虚拟机20312的MAC地址相同。这样,可以节省计算机设备所组成的网络中IP地址资源和/或MAC地址资源。The load balancing service initiated by the service virtual machine 20213 in the service computer device 202 is only forwarded to the load balancing virtual machine (ie, the load balancing virtual machine 20212) local to the computer device 202 to implement the load balancing service; in the service computer device 203 The load balancing service initiated by the service virtual machine 20313 is only forwarded to the load balancing virtual machine (ie, the load balancing virtual machine 20312) local to the computer device 203 to implement the load balancing service. Therefore, the IP address of the load balancing virtual machine 20212 in the business computer device 202 can be the same as the IP address of the load balancing virtual machine 20312 in the business computer device 203; likewise, the MAC address of the load balancing virtual machine 20212 in the business computer device 202. The MAC address of the load balancing virtual machine 20312 in the business computer device 203 can be the same. In this way, IP address resources and/or MAC address resources in the network formed by the computer devices can be saved.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员 可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the various examples described in connection with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both, for clarity of hardware and software. Interchangeability, the composition and steps of the various examples have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the solution. Professional skill worker Different methods may be used to implement the described functionality for each particular application, but such implementation should not be considered to be beyond the scope of the present invention.
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。A person skilled in the art can clearly understand that, for the convenience and brevity of the description, the specific working process of the system, the device and the unit described above can refer to the corresponding process in the foregoing method embodiment, and details are not described herein again.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另外,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口、装置或单元的间接耦合或通信连接,也可以是电的,机械的或其它的形式连接。In the several embodiments provided by the present application, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. For example, the device embodiments described above are merely illustrative. For example, the division of the unit is only a logical function division. In actual implementation, there may be another division manner, for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, or an electrical, mechanical or other form of connection.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本发明实施例方案的目的。The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the embodiments of the present invention.
另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以是两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may 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.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分,或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的 全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。The integrated unit, if implemented in the form of a software functional unit and sold or used as a standalone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention contributes in essence or to the prior art, or all or part of the technical solution may be embodied in the form of a software product stored in a storage medium. Including a number of instructions for causing a computer device (which may be a personal computer, server, or network device, etc.) to perform the methods of the various embodiments of the present invention All or part of the steps. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like. .
以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到各种等效的修改或替换,这些修改或替换都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以权利要求的保护范围为准。 The above is only the specific embodiment of the present invention, but the scope of the present invention is not limited thereto, and any equivalent person can be easily conceived within the technical scope of the present invention by any person skilled in the art. Modifications or substitutions are intended to be included within the scope of the invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims (36)

  1. 一种实现负载均衡的方法,应用于包括至少两台计算机设备的计算机系统,其中,每台计算机设备包括中央处理器和内存,所述至少两台计算机设备中包括第一计算机设备和第二计算机设备,所述第一计算机设备作为云管理平台,所述第二计算机设备运行有发起业务的虚拟机,所述业务为负载均衡业务,其特征在于,A method for implementing load balancing is applied to a computer system including at least two computer devices, wherein each computer device includes a central processing unit and a memory, and the at least two computer devices include a first computer device and a second computer The device, the first computer device is a cloud management platform, the second computer device is running a virtual machine that initiates a service, and the service is a load balancing service, wherein
    所述第一计算机设备获得待创建在所述第二计算机设备的负载均衡器的配置信息,所述负载均衡器的配置信息包括所述负载均衡器的标识、所述负载均衡器的虚拟化IP地址VIP,所述负载均衡器的VIP指示所述负载均衡业务;The first computer device obtains configuration information of a load balancer to be created in the second computer device, the configuration information of the load balancer includes an identifier of the load balancer, and a virtualized IP of the load balancer Address VIP, the VIP of the load balancer indicates the load balancing service;
    所述第一计算机设备根据所述配置信息,在所述第二计算机设备上创建所述负载均衡器;The first computer device creates the load balancer on the second computer device according to the configuration information;
    所述第一计算机设备在所述第二计算机设备上配置所述负载均衡业务的转发模式,所述转发模式使得所述第二计算机设备上的所述发起业务的虚拟机发起的所述负载均衡业务的业务报文定向转发到所述负载均衡器;The first computer device configures a forwarding mode of the load balancing service on the second computer device, the forwarding mode causing the load balancing initiated by the virtual machine initiating the service on the second computer device The service packet of the service is forwarded to the load balancer.
    所述第二计算机设备上的所述发起业务的虚拟机根据所述转发模式,发送所述业务报文到所述负载均衡器;The virtual machine that initiates the service on the second computer device sends the service packet to the load balancer according to the forwarding mode;
    所述第二计算机设备上的所述负载均衡器接收到所述业务报文后,选择至少一个后端服务器执行所述业务,所述后端服务器用于执行所述负载均衡业务。After receiving the service packet, the load balancer on the second computer device selects at least one backend server to execute the service, and the backend server is configured to execute the load balancing service.
  2. 根据权利要求1所述的方法,其特征在于,所述第一计算机设备在所述第二计算机设备上配置所述负载均衡业务的转发模式包括:The method of claim 1, wherein the configuring, by the first computer device, the forwarding mode of the load balancing service on the second computer device comprises:
    所述第一计算机设备配置所述第二计算机设备上部署的虚拟交换机,将所述负载均衡器的MAC地址发送给所述发起业务的虚拟机;The first computer device configures a virtual switch deployed on the second computer device, and sends a MAC address of the load balancer to the virtual machine that initiates the service;
    所述第二计算机设备上的所述发起业务的虚拟机根据所述转发模式,发送所述业务报文到所述负载均衡器包括: The sending the service packet to the load balancer according to the forwarding mode of the virtual machine that initiates the service on the second computer device includes:
    所述发起业务的虚拟机发送所述负载均衡器的MAC地址作为目的地址的所述业务报文,所述虚拟交换机根据所述业务报文的目的地址将所述业务报文发送到所述负载均衡器。The virtual machine that sends the service sends the MAC address of the load balancer as the service packet of the destination address, and the virtual switch sends the service packet to the load according to the destination address of the service packet. Equalizer.
  3. 根据权利要求2所述的方法,其特征在于,在所述发起业务的虚拟机发送所述负载均衡器的MAC地址作为目的地址的所述业务报文之前,所述方法还包括:The method according to claim 2, wherein before the virtual machine that initiates the service sends the MAC address of the load balancer as the service message of the destination address, the method further includes:
    所述发起业务的虚拟机发送控制报文到所述虚拟交换机,所述控制报文携带所述VIP;The virtual machine that initiates the service sends a control packet to the virtual switch, where the control packet carries the VIP;
    所述虚拟交换机向所述发起业务的虚拟机发送所述控制报文的响应消息,所述响应消息中携带所述负载均衡器的MAC地址。The virtual switch sends a response message of the control packet to the virtual machine that initiates the service, where the response message carries the MAC address of the load balancer.
  4. 根据权利要求3所述的方法,其特征在于,所述控制报文为地址解析协议ARP报文或互联网控制消息协议ICMP报文。The method according to claim 3, wherein the control message is an address resolution protocol ARP message or an internet control message protocol ICMP message.
  5. 根据权利要求1所述的方法,其特征在于,所述第一计算机设备在所述第二计算机设备上配置所述负载均衡业务的转发模式,包括:The method according to claim 1, wherein the first computer device configures a forwarding mode of the load balancing service on the second computer device, including:
    所述第一计算机设备指示所述负载均衡器将所述负载均衡器的MAC地址发送给所述发起业务的虚拟机;或者,The first computer device instructs the load balancer to send a MAC address of the load balancer to the virtual machine that initiates the service; or
    所述第一计算机设备在所述发起业务的虚拟机上配置所述负载均衡器的MAC地址;The first computer device configures a MAC address of the load balancer on the virtual machine that initiates the service;
    相应的,所述第二计算机设备上的所述发起业务的虚拟机根据所述转发模式,发送所述业务报文到所述负载均衡器包括:Correspondingly, the sending, by the virtual machine of the initiating service on the second computer device, the sending the service packet to the load balancer according to the forwarding mode comprises:
    所述发起业务的虚拟机发送所述负载均衡器的MAC地址作为目的地址的所述业务报文,所述第二计算机设备上部署的虚拟交换机根据所述业务报文的目的地址将所述业务报文发送到所述负载均衡器。The virtual machine that initiates the service sends the MAC address of the load balancer as the service packet of the destination address, and the virtual switch deployed on the second computer device sends the service according to the destination address of the service packet. The message is sent to the load balancer.
  6. 根据权利要求1-5任一项所述的方法,其特征在于,所述第一计算机设备根据所述配置信息,在所述第二计算机设备上创建所述负载均衡器包括: The method according to any one of claims 1-5, wherein the creating, by the first computer device, the load balancer on the second computer device according to the configuration information comprises:
    所述第一计算机设备在所述第二计算机设备上创建第一台发起所述负载均衡业务的虚拟机后,创建所述负载均衡器。After the first computer device creates the first virtual machine that initiates the load balancing service on the second computer device, the load equalizer is created.
  7. 根据权利要求1-6任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1 to 6, wherein the method further comprises:
    所述第一计算机设备在所述第二计算机设备上创建的最后一台发起所述负载均衡业务的虚拟机被删除后,删除所述创建的负载均衡器。And deleting, by the first computer device, the created load balancer after the last one created by the second computer device initiates the load balancing service is deleted.
  8. 根据权利要求1-7任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1 to 7, wherein the method further comprises:
    所述选择的后端服务器将执行所述业务的结果直接返回给所述发起业务的虚拟机;或者,The selected backend server directly returns the result of executing the service to the virtual machine that initiates the service; or
    所述选择的后端服务器将所述业务的执行结果返回给所述负载均衡器,由所述负载均衡器将所述执行结果返回给所述发起业务的虚拟机。The selected backend server returns an execution result of the service to the load balancer, and the load balancer returns the execution result to the virtual machine that initiates the service.
  9. 一种实现负载均衡的方法,应用于包括至少三台计算机设备的计算机系统,其中,每台计算机设备包括中央处理器和内存,所述至少三台计算机设备中包括第一计算机设备,所述第一计算机设备作为云管理平台,所述至少三台计算机设备中除所述第一计算机设备之外的计算机设备作为业务计算机设备,每台业务计算机设备上运行有发起业务的虚拟机,所述业务为负载均衡业务,其特征在于,A method for implementing load balancing is applied to a computer system including at least three computer devices, wherein each computer device includes a central processing unit and a memory, and the at least three computer devices include a first computer device, the a computer device as a cloud management platform, wherein at least three computer devices other than the first computer device are used as business computer devices, and each business computer device runs a virtual machine that initiates a service, and the service For load balancing services, it is characterized by
    所述第一计算机设备分别获得待创建在每台业务计算机设备上的负载均衡器的配置信息,所述负载均衡器的配置信息包括所述负载均衡器的标识、所述负载均衡器的虚拟化IP地址VIP,所述负载均衡器的VIP指示所述负载均衡业务;The first computer device respectively obtains configuration information of a load balancer to be created on each service computer device, where configuration information of the load balancer includes an identifier of the load balancer, and virtualization of the load balancer IP address VIP, the VIP of the load balancer indicates the load balancing service;
    所述第一计算机设备根据所述待创建在所述每台业务计算机设备的负载均衡器的配置信息,在所述每台业务计算机设备上创建所述每台业务计算机设备的本地负载均衡器;The first computer device creates a local load balancer of each of the service computer devices on each of the service computer devices according to the configuration information of the load balancer to be created in each of the service computer devices;
    所述第一计算机设备在所述每台业务计算机设备上配置所述负载均衡 业务的转发模式,所述转发模式使得所述每台业务计算机设备上的所述发起业务的虚拟机发起的所述负载均衡业务的业务报文定向转发到本地的负载均衡器,以使得所述每台业务计算机设备上的本地的负载均衡器对本业务计算机设备上的所述发起业务的虚拟机发起的业务报文进行负载均衡的处理。The first computer device configures the load balancing on each of the service computer devices a forwarding mode of the service, the forwarding mode of the load balancing service initiated by the virtual machine that initiates the service on each of the service computer devices is forwarded to a local load balancer, so that the The local load balancer on each of the service computer devices performs load balancing processing on the service packets initiated by the virtual machine that initiates the service on the service computer device.
  10. 根据权利要求9所述的方法,其特征在于,所述第一计算机设备在所述每台业务计算机设备上配置所述负载均衡业务的转发模式包括:The method according to claim 9, wherein the forwarding mode of the load balancing service configured by the first computer device on each of the service computer devices comprises:
    所述第一计算机设备配置所述每台业务计算机设备上部署的虚拟交换机,将本地的负载均衡器的MAC地址发送给本地的所述发起业务的虚拟机。The first computer device configures the virtual switch deployed on each of the service computer devices to send the MAC address of the local load balancer to the local virtual machine that initiates the service.
  11. 根据权利要求10所述的方法,其特征在于,所述第一计算机设备配置所述每台业务计算机设备上部署的虚拟交换机,将所述本地的负载均衡器的MAC地址发送给本地的所述发起业务的虚拟机之后还包括:The method of claim 10, wherein the first computer device configures a virtual switch deployed on each of the service computer devices to transmit the MAC address of the local load balancer to the local After the virtual machine that initiated the business, it also includes:
    所述每台业务计算机设备上发起业务的虚拟机发送控制报文到本地的所述虚拟交换机,所述控制报文携带所述VIP;The virtual machine that initiates the service on each of the service computer devices sends a control packet to the local virtual switch, and the control packet carries the VIP;
    所述每台业务计算机设备上本地的虚拟交换机向所述本地的发起业务的虚拟机发送所述控制报文的响应消息,所述响应消息中携带所述本地的负载均衡器的MAC地址。The local virtual switch on each of the service computer devices sends a response message of the control packet to the local virtual machine that initiates the service, where the response message carries the MAC address of the local load balancer.
  12. 根据权利要求9-11任一项所述的方法,其特征在于,所述第一计算机设备根据所述配置信息,在所述每台业务计算机设备上创建所述负载均衡器之前,还包括:The method according to any one of claims 9 to 11, wherein the first computer device further comprises: before creating the load balancer on each of the service computer devices according to the configuration information, further comprising:
    所述第一计算机设备获知第一业务计算机设备上创建了第一台所述发起业务的虚拟机,在所述第一业务计算机设备上创建所述第一业务计算机设备的负载均衡器,直至在每台业务计算机设备上创建所述每台业务计算机设备上的本地负载均衡器。The first computer device learns that the first virtual machine of the first service computer device is created on the first service computer device, and the load balancer of the first service computer device is created on the first service computer device until A local load balancer on each of the business computer devices is created on each business computer device.
  13. 根据权利要求9-12任一项所述的方法,其特征在于,所述负载均衡器包括负载均衡虚拟机、负载均衡容器或负载均衡的namespace。 The method according to any one of claims 9 to 12, wherein the load balancer comprises a load balancing virtual machine, a load balancing container or a load balancing namespace.
  14. 一种实现负载均衡的方法,应用于包括至少两台计算机设备的计算机系统,其中,每台计算机设备包括中央处理器和内存,所述至少两台计算机设备中包括第一计算机设备和第二计算机设备,所述第一计算机设备作为云管理平台,所述第二计算机设备运行有发起业务的虚拟机,所述业务为负载均衡业务,其特征在于,A method for implementing load balancing is applied to a computer system including at least two computer devices, wherein each computer device includes a central processing unit and a memory, and the at least two computer devices include a first computer device and a second computer The device, the first computer device is a cloud management platform, the second computer device is running a virtual machine that initiates a service, and the service is a load balancing service, wherein
    所述第一计算机设备获得待创建在所述第二计算机设备的负载均衡器的配置信息,所述负载均衡器的配置信息包括所述负载均衡器的标识、所述负载均衡器的虚拟化IP地址VIP,所述负载均衡器的VIP指示所述负载均衡业务;The first computer device obtains configuration information of a load balancer to be created in the second computer device, the configuration information of the load balancer includes an identifier of the load balancer, and a virtualized IP of the load balancer Address VIP, the VIP of the load balancer indicates the load balancing service;
    所述第一计算机设备根据所述配置信息,在所述第二计算机设备上创建所述负载均衡器;The first computer device creates the load balancer on the second computer device according to the configuration information;
    所述第一计算机设备在所述第二计算机设备上配置所述负载均衡业务的转发模式,所述转发模式使得所述第二计算机设备上的所述发起业务的虚拟机发起的所述负载均衡业务的业务报文定向转发到所述负载均衡器,以使得所述负载均衡器接收到所述业务报文后,选择执行所述业务的后端服务器。The first computer device configures a forwarding mode of the load balancing service on the second computer device, the forwarding mode causing the load balancing initiated by the virtual machine initiating the service on the second computer device The service packet of the service is forwarded to the load balancer, so that the load balancer selects the backend server that executes the service after receiving the service packet.
  15. 根据权利要求14所述的方法,其特征在于,所述第一计算机设备在所述第二计算机设备上配置所述负载均衡业务的转发模式,包括:The method according to claim 14, wherein the first computer device configures a forwarding mode of the load balancing service on the second computer device, including:
    所述第一计算机设备配置所述第二计算机设备上部署的虚拟交换机将所述负载均衡器的MAC地址发送给所述发起业务的虚拟机,以使得所述发起业务的虚拟机发送所述负载均衡器的MAC地址作为目的地址的所述业务报文。The first computer device configures a virtual switch deployed on the second computer device to send a MAC address of the load balancer to the virtual machine that initiates the service, so that the virtual machine that initiates the service sends the load The MAC address of the equalizer is used as the service packet of the destination address.
  16. 根据权利要求15所述的方法,其特征在于,所述第一计算机设备配置所述第二计算机设备上部署的虚拟交换机将所述负载均衡器的MAC地址发送给所述发起业务的虚拟机之后还包括:The method according to claim 15, wherein the first computer device configures a virtual switch deployed on the second computer device to send the MAC address of the load balancer to the virtual machine that initiates the service. Also includes:
    所述发起业务的虚拟机发送控制报文到所述虚拟交换机,所述控制报 文携带所述VIP;The virtual machine that initiates the service sends a control packet to the virtual switch, and the control packet Carrying the VIP;
    所述虚拟交换机向所述发起业务的虚拟机发送所述控制报文的响应消息,所述响应消息中携带所述负载均衡器的MAC地址。The virtual switch sends a response message of the control packet to the virtual machine that initiates the service, where the response message carries the MAC address of the load balancer.
  17. 根据权利要求14-16任一项所述的方法,其特征在于,所述第一计算机设备根据所述配置信息,在所述第二计算机设备上创建所述负载均衡包括:The method according to any one of claims 14 to 16, wherein the creating, by the first computer device, the load balancing on the second computer device according to the configuration information comprises:
    所述第一计算机设备在所述第二计算机设备上创建第一台发起所述负载均衡业务的虚拟机后,创建所述负载均衡器。After the first computer device creates the first virtual machine that initiates the load balancing service on the second computer device, the load equalizer is created.
  18. 根据权利要求14-17任一项所述的方法,其特征在于,所述方法还包括:The method of any of claims 14-17, wherein the method further comprises:
    所述第一计算机设备在所述第二计算机设备上创建的最后一台发起所述负载均衡业务的虚拟机被删除后,删除所述创建的负载均衡器。And deleting, by the first computer device, the created load balancer after the last one created by the second computer device initiates the load balancing service is deleted.
  19. 一种实现负载均衡的计算机系统,包括至少两台计算机设备,其中,每台计算机设备包括中央处理器和内存,所述至少两台计算机设备中包括第一计算机设备和第二计算机设备,所述第一计算机设备作为云管理平台,所述第二计算机设备运行有发起业务的虚拟机,所述业务为负载均衡业务,其特征在于,A computer system for implementing load balancing, comprising at least two computer devices, wherein each computer device includes a central processing unit and a memory, and the at least two computer devices include a first computer device and a second computer device, The first computer device is a cloud management platform, and the second computer device is running a virtual machine that initiates a service, where the service is a load balancing service, and the
    所述第一计算机设备获得待创建在所述第二计算机设备的负载均衡器的配置信息,所述负载均衡器的配置信息包括所述负载均衡器的标识、所述负载均衡器的虚拟化IP地址VIP,所述负载均衡器的VIP指示所述负载均衡业务;The first computer device obtains configuration information of a load balancer to be created in the second computer device, the configuration information of the load balancer includes an identifier of the load balancer, and a virtualized IP of the load balancer Address VIP, the VIP of the load balancer indicates the load balancing service;
    所述第一计算机设备根据所述配置信息,在所述第二计算机设备上创建所述负载均衡器;The first computer device creates the load balancer on the second computer device according to the configuration information;
    所述第一计算机设备在所述第二计算机设备上配置所述负载均衡业务的转发模式,所述转发模式使得所述第二计算机设备上的所述发起业务的虚拟机发起的所述负载均衡业务的业务报文定向转发到所述负载均衡器; The first computer device configures a forwarding mode of the load balancing service on the second computer device, the forwarding mode causing the load balancing initiated by the virtual machine initiating the service on the second computer device The service packet of the service is forwarded to the load balancer.
    所述第二计算机设备上的所述发起业务的虚拟机根据所述转发模式,发送所述业务报文到所述负载均衡器;The virtual machine that initiates the service on the second computer device sends the service packet to the load balancer according to the forwarding mode;
    所述第二计算机设备上的所述负载均衡器接收到所述业务报文后,选择至少一个后端服务器执行所述业务,所述后端服务器用于执行所述负载均衡业务。After receiving the service packet, the load balancer on the second computer device selects at least one backend server to execute the service, and the backend server is configured to execute the load balancing service.
  20. 根据权利要求19所述的计算机系统,其特征在于,所述第一计算机设备在所述第二计算机设备上配置所述负载均衡业务的转发模式包括:The computer system according to claim 19, wherein the configuring, by the first computer device, the forwarding mode of the load balancing service on the second computer device comprises:
    所述第一计算机设备配置所述第二计算机设备上部署的虚拟交换机,将所述负载均衡器的MAC地址发送给所述发起业务的虚拟机;The first computer device configures a virtual switch deployed on the second computer device, and sends a MAC address of the load balancer to the virtual machine that initiates the service;
    所述第二计算机设备上的所述发起业务的虚拟机根据所述转发模式,发送所述业务报文到所述负载均衡器包括:The sending the service packet to the load balancer according to the forwarding mode of the virtual machine that initiates the service on the second computer device includes:
    所述发起业务的虚拟机发送所述负载均衡器的MAC地址作为目的地址的所述业务报文,所述虚拟交换机根据所述业务报文的目的地址将所述业务报文发送到所述负载均衡器。The virtual machine that sends the service sends the MAC address of the load balancer as the service packet of the destination address, and the virtual switch sends the service packet to the load according to the destination address of the service packet. Equalizer.
  21. 根据权利要求20所述的计算机系统,其特征在于,在所述发起业务的虚拟机发送所述负载均衡器的MAC地址作为目的地址的所述业务报文之前,还包括:The computer system according to claim 20, wherein before the virtual machine that initiates the service sends the MAC address of the load balancer as the service message of the destination address, the method further includes:
    所述发起业务的虚拟机发送控制报文到所述虚拟交换机,所述控制报文携带所述VIP;The virtual machine that initiates the service sends a control packet to the virtual switch, where the control packet carries the VIP;
    所述虚拟交换机向所述发起业务的虚拟机发送所述控制报文的响应消息,所述响应消息中携带所述负载均衡器的MAC地址。The virtual switch sends a response message of the control packet to the virtual machine that initiates the service, where the response message carries the MAC address of the load balancer.
  22. 根据权利要求21所述的计算机系统,其特征在于,所述控制报文为地址解析协议ARP报文或互联网控制消息协议ICMP报文。The computer system according to claim 21, wherein the control message is an address resolution protocol ARP message or an internet control message protocol ICMP message.
  23. 根据权利要求19所述的计算机系统,其特征在于,所述第一计算机设备在所述第二计算机设备上配置所述负载均衡业务的转发模式,包括:The computer system according to claim 19, wherein the first computer device configures a forwarding mode of the load balancing service on the second computer device, including:
    所述第一计算机设备指示所述负载均衡器将所述负载均衡器的MAC地 址发送给所述发起业务的虚拟机;或者,The first computer device instructs the load balancer to MAC ground the load balancer Sending the address to the virtual machine that initiated the service; or,
    所述第一计算机设备在所述发起业务的虚拟机上配置所述负载均衡器的MAC地址;The first computer device configures a MAC address of the load balancer on the virtual machine that initiates the service;
    相应的,所述第二计算机设备上的所述发起业务的虚拟机根据所述转发模式,发送所述业务报文到所述负载均衡器包括:Correspondingly, the sending, by the virtual machine of the initiating service on the second computer device, the sending the service packet to the load balancer according to the forwarding mode comprises:
    所述发起业务的虚拟机发送所述负载均衡器的MAC地址作为目的地址的所述业务报文,所述第二计算机设备上部署的虚拟交换机根据所述业务报文的目的地址将所述业务报文发送到所述负载均衡器。The virtual machine that initiates the service sends the MAC address of the load balancer as the service packet of the destination address, and the virtual switch deployed on the second computer device sends the service according to the destination address of the service packet. The message is sent to the load balancer.
  24. 根据权利要求19-23任一项所述的计算机系统,其特征在于,所述第一计算机设备根据所述配置信息,在所述第二计算机设备上创建所述负载均衡器包括:The computer system according to any one of claims 19 to 23, wherein the creating, by the first computer device, the load balancer on the second computer device according to the configuration information comprises:
    所述第一计算机设备在所述第二计算机设备上创建第一台发起所述负载均衡业务的虚拟机后,创建所述负载均衡器。After the first computer device creates the first virtual machine that initiates the load balancing service on the second computer device, the load equalizer is created.
  25. 根据权利要求19-24任一项所述的计算机系统,其特征在于:A computer system according to any of claims 19-24, wherein:
    所述第一计算机设备在所述第二计算机设备上创建的最后一台发起所述负载均衡业务的虚拟机被删除后,删除所述创建的负载均衡器。And deleting, by the first computer device, the created load balancer after the last one created by the second computer device initiates the load balancing service is deleted.
  26. 根据权利要求19-25任一项所述的计算机系统,其特征在于:A computer system according to any of claims 19-25, wherein:
    所述选择的后端服务器将执行所述业务的结果直接返回给所述发起业务的虚拟机;或者,The selected backend server directly returns the result of executing the service to the virtual machine that initiates the service; or
    所述选择的后端服务器将所述业务的执行结果返回给所述负载均衡器,由所述负载均衡器将所述执行结果返回给所述发起业务的虚拟机。The selected backend server returns an execution result of the service to the load balancer, and the load balancer returns the execution result to the virtual machine that initiates the service.
  27. 一种实现负载均衡的计算机系统,所述计算机系统包括至少三台计算机设备,其中,每台计算机设备包括中央处理器和内存,所述至少三台计算机设备中包括第一计算机设备,所述第一计算机设备作为云管理平台,所述至少三台计算机设备中除所述第一计算机设备之外的计算机设备作为业务计算机设备,每台业务计算机设备上运行有发起业务的虚拟机, 所述业务为负载均衡业务,其特征在于,A computer system for implementing load balancing, the computer system comprising at least three computer devices, wherein each computer device includes a central processing unit and a memory, and the at least three computer devices include a first computer device, the a computer device as a cloud management platform, wherein at least three computer devices other than the first computer device are used as business computer devices, and each business computer device runs a virtual machine that initiates a service, The service is a load balancing service, and is characterized in that
    所述第一计算机设备分别获得待创建在每台业务计算机设备上的负载均衡器的配置信息,所述负载均衡器的配置信息包括所述负载均衡器的标识、所述负载均衡器的虚拟化IP地址VIP,所述负载均衡器的VIP指示所述负载均衡业务;The first computer device respectively obtains configuration information of a load balancer to be created on each service computer device, where configuration information of the load balancer includes an identifier of the load balancer, and virtualization of the load balancer IP address VIP, the VIP of the load balancer indicates the load balancing service;
    所述第一计算机设备根据所述待创建在所述每台业务计算机设备的负载均衡器的配置信息,在所述每台业务计算机设备上创建所述每台业务计算机设备的本地负载均衡器;The first computer device creates a local load balancer of each of the service computer devices on each of the service computer devices according to the configuration information of the load balancer to be created in each of the service computer devices;
    所述第一计算机设备在所述每台业务计算机设备上配置所述负载均衡业务的转发模式,所述转发模式使得所述每台业务计算机设备上的所述发起业务的虚拟机发起的所述负载均衡业务的业务报文定向转发到本地的负载均衡器,以使得所述每台业务计算机设备上的本地的负载均衡器对本业务计算机设备上的所述发起业务的虚拟机发起的业务报文进行负载均衡的处理。Configuring, by the first computer device, a forwarding mode of the load balancing service on each of the service computer devices, the forwarding mode causing the virtual machine initiated by the originating service on each of the service computer devices to initiate the The service packet of the load balancing service is forwarded to the local load balancer, so that the local load balancer on each service computer device initiates a service packet to the virtual machine that initiates the service on the service computer device. Perform load balancing processing.
  28. 根据权利要求27所述的计算机系统,其特征在于,所述第一计算机设备在所述每台业务计算机设备上配置所述负载均衡业务的转发模式包括:The computer system according to claim 27, wherein the forwarding mode of the load balancing service configured by the first computer device on each of the service computer devices comprises:
    所述第一计算机设备配置所述每台业务计算机设备上部署的虚拟交换机,将本地的负载均衡器的MAC地址发送给本地的所述发起业务的虚拟机。The first computer device configures the virtual switch deployed on each of the service computer devices to send the MAC address of the local load balancer to the local virtual machine that initiates the service.
  29. 根据权利要求28所述的计算机系统,其特征在于,所述第一计算机设备配置所述每台业务计算机设备上部署的虚拟交换机,将所述本地的负载均衡器的MAC地址发送给本地的所述发起业务的虚拟机之后还包括:The computer system according to claim 28, wherein said first computer device configures a virtual switch deployed on said each business computer device, and transmits a MAC address of said local load balancer to a local office After the virtual machine that initiates the service, it also includes:
    所述每台业务计算机设备上发起业务的虚拟机发送控制报文到本地的所述虚拟交换机,所述控制报文携带所述VIP;The virtual machine that initiates the service on each of the service computer devices sends a control packet to the local virtual switch, and the control packet carries the VIP;
    所述每台业务计算机设备上本地的虚拟交换机向所述本地的发起业务的虚拟机发送所述控制报文的响应消息,所述响应消息中携带所述本地的 负载均衡器的MAC地址。The local virtual switch on each of the service computer devices sends a response message of the control packet to the local virtual machine that initiates the service, where the response message carries the local The MAC address of the load balancer.
  30. 根据权利要求27-29任一项所述的计算机系统,其特征在于,所述第一计算机设备根据所述配置信息,在所述每台业务计算机设备上创建所述负载均衡器之前,还包括:The computer system according to any one of claims 27 to 29, wherein the first computer device further includes, before creating the load balancer on each of the service computer devices according to the configuration information, :
    所述第一计算机设备获知第一业务计算机设备上创建了第一台所述发起业务的虚拟机,在所述第一业务计算机设备上创建所述第一业务计算机设备的负载均衡器,直至在每台业务计算机设备上创建所述每台业务计算机设备上的本地负载均衡器。The first computer device learns that the first virtual machine of the first service computer device is created on the first service computer device, and the load balancer of the first service computer device is created on the first service computer device until A local load balancer on each of the business computer devices is created on each business computer device.
  31. 根据权利要求27-30任一项所述的计算机系统,其特征在于,所述负载均衡器包括负载均衡虚拟机、负载均衡容器或负载均衡的namespace。A computer system according to any one of claims 27-30, wherein the load balancer comprises a load balancing virtual machine, a load balancing container or a load balancing namespace.
  32. 一种实现负载均衡的计算机系统,所述计算机系统包括至少两台计算机设备,其中,每台计算机设备包括中央处理器和内存,所述至少两台计算机设备中包括第一计算机设备和第二计算机设备,所述第一计算机设备作为云管理平台,所述第二计算机设备运行有发起业务的虚拟机,所述业务为负载均衡业务,其特征在于,A computer system for implementing load balancing, the computer system comprising at least two computer devices, wherein each computer device comprises a central processing unit and a memory, and the at least two computer devices comprise a first computer device and a second computer The device, the first computer device is a cloud management platform, the second computer device is running a virtual machine that initiates a service, and the service is a load balancing service, wherein
    所述第一计算机设备获得待创建在所述第二计算机设备的负载均衡器的配置信息,所述负载均衡器的配置信息包括所述负载均衡器的标识、所述负载均衡器的虚拟化IP地址VIP,所述负载均衡器的VIP指示所述负载均衡业务;The first computer device obtains configuration information of a load balancer to be created in the second computer device, the configuration information of the load balancer includes an identifier of the load balancer, and a virtualized IP of the load balancer Address VIP, the VIP of the load balancer indicates the load balancing service;
    所述第一计算机设备根据所述配置信息,在所述第二计算机设备上创建所述负载均衡器;The first computer device creates the load balancer on the second computer device according to the configuration information;
    所述第一计算机设备在所述第二计算机设备上配置所述负载均衡业务的转发模式,所述转发模式使得所述第二计算机设备上的所述发起业务的虚拟机发起的所述负载均衡业务的业务报文定向转发到所述负载均衡器,以使得所述负载均衡器接收到所述业务报文后,选择执行所述业务的后端服务器。 The first computer device configures a forwarding mode of the load balancing service on the second computer device, the forwarding mode causing the load balancing initiated by the virtual machine initiating the service on the second computer device The service packet of the service is forwarded to the load balancer, so that the load balancer selects the backend server that executes the service after receiving the service packet.
  33. 根据权利要求32所述的计算机系统,其特征在于,所述第一计算机设备在所述第二计算机设备上配置所述负载均衡业务的转发模式,包括:The computer system according to claim 32, wherein the first computer device configures a forwarding mode of the load balancing service on the second computer device, including:
    所述第一计算机设备配置所述第二计算机设备上部署的虚拟交换机将所述负载均衡器的MAC地址发送给所述发起业务的虚拟机,以使得所述发起业务的虚拟机发送所述负载均衡器的MAC地址作为目的地址的所述业务报文。The first computer device configures a virtual switch deployed on the second computer device to send a MAC address of the load balancer to the virtual machine that initiates the service, so that the virtual machine that initiates the service sends the load The MAC address of the equalizer is used as the service packet of the destination address.
  34. 根据权利要求32所述的计算机系统,其特征在于,所述第一计算机设备配置所述第二计算机设备上部署的虚拟交换机将所述负载均衡器的MAC地址发送给所述发起业务的虚拟机之后还包括:The computer system according to claim 32, wherein said first computer device configures a virtual switch deployed on said second computer device to transmit a MAC address of said load balancer to said virtual machine that initiates service It also includes:
    所述发起业务的虚拟机发送控制报文到所述虚拟交换机,所述控制报文携带所述VIP;The virtual machine that initiates the service sends a control packet to the virtual switch, where the control packet carries the VIP;
    所述虚拟交换机向所述发起业务的虚拟机发送所述控制报文的响应消息,所述响应消息中携带所述负载均衡器的MAC地址。The virtual switch sends a response message of the control packet to the virtual machine that initiates the service, where the response message carries the MAC address of the load balancer.
  35. 根据权利要求32-34任一项所述的计算机系统,其特征在于,所述第一计算机设备根据所述配置信息,在所述第二计算机设备上创建所述负载均衡包括:The computer system according to any one of claims 32-34, wherein the creating, by the first computer device, the load balancing on the second computer device according to the configuration information comprises:
    所述第一计算机设备在所述第二计算机设备上创建第一台发起所述负载均衡业务的虚拟机后,创建所述负载均衡器。After the first computer device creates the first virtual machine that initiates the load balancing service on the second computer device, the load equalizer is created.
  36. 根据权利要求32-35任一项所述的计算机系统,其特征在于,所述方法还包括:The computer system according to any one of claims 32 to 35, wherein the method further comprises:
    所述第一计算机设备在所述第二计算机设备上创建的最后一台发起所述负载均衡业务的虚拟机被删除后,删除所述创建的负载均衡器。 And deleting, by the first computer device, the created load balancer after the last one created by the second computer device initiates the load balancing service is deleted.
PCT/CN2016/105945 2015-12-30 2016-11-15 Computer device, system and method for implementing load balancing WO2017114017A1 (en)

Priority Applications (5)

Application Number Priority Date Filing Date Title
CN201910303925.6A CN110113441B (en) 2015-12-30 2016-11-15 Computer equipment, system and method for realizing load balance
CN201680003074.8A CN107078969B (en) 2015-12-30 2016-11-15 Realize computer equipment, the system and method for load balancing
EP16880807.9A EP3316532B1 (en) 2015-12-30 2016-11-15 Computer device, system and method for implementing load balancing
JP2017567446A JP6544872B2 (en) 2015-12-30 2016-11-15 Load balancing computer device, system and method
US16/020,960 US10171567B2 (en) 2015-12-30 2018-06-27 Load balancing computer device, system, and method

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CNPCT/CN2015/099961 2015-12-30
CN2015099961 2015-12-30

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US16/020,960 Continuation US10171567B2 (en) 2015-12-30 2018-06-27 Load balancing computer device, system, and method

Publications (1)

Publication Number Publication Date
WO2017114017A1 true WO2017114017A1 (en) 2017-07-06

Family

ID=59224495

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/105945 WO2017114017A1 (en) 2015-12-30 2016-11-15 Computer device, system and method for implementing load balancing

Country Status (5)

Country Link
US (1) US10171567B2 (en)
EP (1) EP3316532B1 (en)
JP (1) JP6544872B2 (en)
CN (2) CN110113441B (en)
WO (1) WO2017114017A1 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111935206A (en) * 2020-06-23 2020-11-13 新浪网技术(中国)有限公司 Message processing method and device and network equipment
CN112306643A (en) * 2020-11-30 2021-02-02 深信服科技股份有限公司 Virtual machine configuration method, device and equipment, and cloud platform
CN116360987A (en) * 2023-03-17 2023-06-30 中国科学院软件研究所 Self-adaptive load balancing method and system

Families Citing this family (42)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015172107A1 (en) 2014-05-09 2015-11-12 Nutanix, Inc. Mechanism for providing external access to a secured networked virtualization environment
US11550558B2 (en) 2016-02-12 2023-01-10 Nutanix, Inc. Virtualized file server deployment
US11218418B2 (en) 2016-05-20 2022-01-04 Nutanix, Inc. Scalable leadership election in a multi-processing computing environment
US10728090B2 (en) * 2016-12-02 2020-07-28 Nutanix, Inc. Configuring network segmentation for a virtualization environment
US10824455B2 (en) 2016-12-02 2020-11-03 Nutanix, Inc. Virtualized server systems and methods including load balancing for virtualized file servers
US11562034B2 (en) 2016-12-02 2023-01-24 Nutanix, Inc. Transparent referrals for distributed file servers
US11568073B2 (en) 2016-12-02 2023-01-31 Nutanix, Inc. Handling permissions for virtualized file servers
US11294777B2 (en) 2016-12-05 2022-04-05 Nutanix, Inc. Disaster recovery for distributed file servers, including metadata fixers
US11288239B2 (en) 2016-12-06 2022-03-29 Nutanix, Inc. Cloning virtualized file servers
US11281484B2 (en) 2016-12-06 2022-03-22 Nutanix, Inc. Virtualized server systems and methods including scaling of file system virtual machines
CN107707661B (en) * 2017-10-16 2020-10-16 中国银联股份有限公司 Load balancing resource management method and device
US11086826B2 (en) 2018-04-30 2021-08-10 Nutanix, Inc. Virtualized server systems and methods including domain joining techniques
CN108449282B (en) * 2018-05-29 2021-12-21 华为技术有限公司 Load balancing method and device
US10942788B2 (en) 2018-06-15 2021-03-09 Vmware, Inc. Policy constraint framework for an sddc
US10812337B2 (en) 2018-06-15 2020-10-20 Vmware, Inc. Hierarchical API for a SDDC
US20190045000A1 (en) * 2018-06-29 2019-02-07 Intel Corporation Technologies for load-aware traffic steering
US11194680B2 (en) 2018-07-20 2021-12-07 Nutanix, Inc. Two node clusters recovery on a failure
CN109040309B (en) * 2018-09-14 2021-03-05 厦门天锐科技股份有限公司 Load balancing method based on XMPP communication processing server
US11770447B2 (en) 2018-10-31 2023-09-26 Nutanix, Inc. Managing high-availability file servers
CN109597671B (en) * 2018-12-11 2022-06-10 国云科技股份有限公司 Desktop cloud implementation method compatible with centralized and distributed operation
US10841226B2 (en) * 2019-03-29 2020-11-17 Juniper Networks, Inc. Configuring service load balancers with specified backend virtual networks
CN110177028B (en) * 2019-05-30 2021-06-22 北京字节跳动网络技术有限公司 Distributed health examination method and device
CN110740164B (en) * 2019-09-04 2021-01-08 华云数据控股集团有限公司 Server determination method, regulation and control method, device, equipment and storage medium
CN111010342B (en) * 2019-11-21 2023-04-07 天津卓朗科技发展有限公司 Distributed load balancing implementation method and device
US11153261B2 (en) * 2020-01-22 2021-10-19 Cisco Technology, Inc. Routing traffic for virtualized/containerized network functions
EP4078901A4 (en) 2020-04-01 2023-10-11 VMWare, Inc. Auto deploying network elements for heterogeneous compute elements
US11768809B2 (en) 2020-05-08 2023-09-26 Nutanix, Inc. Managing incremental snapshots for fast leader node bring-up
CN113687940B (en) * 2020-05-19 2024-02-27 阿里巴巴集团控股有限公司 Load balancing method and device and physical machine
US11803408B2 (en) 2020-07-29 2023-10-31 Vmware, Inc. Distributed network plugin agents for container networking
US11863352B2 (en) 2020-07-30 2024-01-02 Vmware, Inc. Hierarchical networking for nested container clusters
CN112532542B (en) * 2020-11-20 2022-08-16 锐捷网络股份有限公司 Load balancing mode selection method and device
US12131192B2 (en) 2021-03-18 2024-10-29 Nutanix, Inc. Scope-based distributed lock infrastructure for virtualized file server
KR102644436B1 (en) * 2021-06-04 2024-03-07 주식회사 카카오엔터프라이즈 Load balancer manage system, method, program in a cloud native environment and the load balancer created by this method
US12117972B2 (en) 2021-08-19 2024-10-15 Nutanix, Inc. File server managers and systems for managing virtualized file servers
US20230066137A1 (en) 2021-08-19 2023-03-02 Nutanix, Inc. User interfaces for disaster recovery of distributed file servers
CN114205360B (en) * 2021-12-08 2024-04-16 京东科技信息技术有限公司 Data transmission method, device and system
CN114385351A (en) * 2021-12-10 2022-04-22 苏州浪潮智能科技有限公司 Cloud management platform load balancing performance optimization method, device, equipment and medium
US11902245B2 (en) 2022-01-14 2024-02-13 VMware LLC Per-namespace IP address management method for container networks
US11848910B1 (en) 2022-11-11 2023-12-19 Vmware, Inc. Assigning stateful pods fixed IP addresses depending on unique pod identity
US11831511B1 (en) 2023-01-17 2023-11-28 Vmware, Inc. Enforcing network policies in heterogeneous systems
CN116401066B (en) * 2023-05-25 2023-08-29 北京志凌海纳科技有限公司 Dynamic scheduling method and system for multiple virtual services for improving resource utilization
US12101244B1 (en) 2023-06-12 2024-09-24 VMware LLC Layer 7 network security for container workloads

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103220354A (en) * 2013-04-18 2013-07-24 广东宜通世纪科技股份有限公司 Method for achieving load balancing of server cluster
US9038091B2 (en) * 2011-08-25 2015-05-19 Verizon Patent And Licensing Inc. Methods and systems for dynamically establishing one or more connections between a software application and a cluster of message broker
CN104780115A (en) * 2014-01-14 2015-07-15 上海盛大网络发展有限公司 Load balancing method and load balancing system in cloud computing environment
CN104917805A (en) * 2015-01-14 2015-09-16 杭州华三通信技术有限公司 Load sharing method and equipment
CN104935672A (en) * 2015-06-29 2015-09-23 杭州华三通信技术有限公司 High available realizing method and equipment of load balancing service

Family Cites Families (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101539922A (en) 2008-03-18 2009-09-23 北京书生国际信息技术有限公司 Method for realizing authority of document library system
US8427956B1 (en) * 2006-03-06 2013-04-23 Cisco Technology, Inc. Facilitating packet flow in a communication network implementing load balancing and security operations
JP2010061283A (en) * 2008-09-02 2010-03-18 Fujitsu Ltd Load balancer setting program, load balancer setting method and load balancer setting apparatus
CN101719081B (en) 2009-12-01 2012-10-10 北京大学 Method for scheduling virtual machines
JP5392137B2 (en) * 2010-02-17 2014-01-22 富士通株式会社 Program, computer and method for communication processing
US8335841B2 (en) * 2010-09-30 2012-12-18 Microsoft Corporation Logical networks
US8676980B2 (en) * 2011-03-22 2014-03-18 Cisco Technology, Inc. Distributed load balancer in a virtual machine environment
CN104168323B (en) 2013-08-26 2018-10-30 天津书生云科技有限公司 A kind of cloud service system and method
US20130159487A1 (en) * 2011-12-14 2013-06-20 Microsoft Corporation Migration of Virtual IP Addresses in a Failover Cluster
CN103384255B (en) * 2011-12-31 2016-08-10 华为数字技术(成都)有限公司 The load-balancing method of cluster virtual machine, server and system
US9043784B2 (en) * 2012-01-12 2015-05-26 Red Hat, Inc. Management of inter-dependent configurations of virtual machines in a cloud
EP2875440A4 (en) * 2012-07-20 2016-05-25 Hewlett Packard Development Co Policy-based scaling of network resources
CN104580124B (en) * 2013-10-29 2019-04-05 华为技术有限公司 Protocol stack selection method, device and equipment
US9699251B2 (en) * 2014-05-13 2017-07-04 Nutanix, Inc. Mechanism for providing load balancing to an external node utilizing a clustered environment for storage management
GB2533434A (en) * 2014-12-16 2016-06-22 Cisco Tech Inc Networking based redirect for CDN scale-down
WO2016096004A1 (en) * 2014-12-18 2016-06-23 Nokia Solutions And Networks Oy Network load balancer
US9462427B2 (en) * 2015-01-14 2016-10-04 Kodiak Networks, Inc. System and method for elastic scaling using a container-based platform
US9813509B1 (en) * 2015-06-09 2017-11-07 Amazon Technologies, Inc. Template generator for frequently occurring application programming interface call sequences
CN104994145B (en) * 2015-06-23 2018-08-10 山东大学 A kind of load-balancing method based on KVM virtualization cluster

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9038091B2 (en) * 2011-08-25 2015-05-19 Verizon Patent And Licensing Inc. Methods and systems for dynamically establishing one or more connections between a software application and a cluster of message broker
CN103220354A (en) * 2013-04-18 2013-07-24 广东宜通世纪科技股份有限公司 Method for achieving load balancing of server cluster
CN104780115A (en) * 2014-01-14 2015-07-15 上海盛大网络发展有限公司 Load balancing method and load balancing system in cloud computing environment
CN104917805A (en) * 2015-01-14 2015-09-16 杭州华三通信技术有限公司 Load sharing method and equipment
CN104935672A (en) * 2015-06-29 2015-09-23 杭州华三通信技术有限公司 High available realizing method and equipment of load balancing service

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP3316532A4 *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111935206A (en) * 2020-06-23 2020-11-13 新浪网技术(中国)有限公司 Message processing method and device and network equipment
CN111935206B (en) * 2020-06-23 2023-05-23 新浪财经移动网络科技(北京)有限公司 Message processing method, device and network equipment
CN112306643A (en) * 2020-11-30 2021-02-02 深信服科技股份有限公司 Virtual machine configuration method, device and equipment, and cloud platform
CN112306643B (en) * 2020-11-30 2023-12-29 深信服科技股份有限公司 Virtual machine configuration method, device and equipment, and cloud platform
CN116360987A (en) * 2023-03-17 2023-06-30 中国科学院软件研究所 Self-adaptive load balancing method and system
CN116360987B (en) * 2023-03-17 2023-09-12 中国科学院软件研究所 Self-adaptive load balancing method and system

Also Published As

Publication number Publication date
CN107078969B (en) 2019-04-19
US10171567B2 (en) 2019-01-01
CN110113441B (en) 2022-09-23
CN110113441A (en) 2019-08-09
JP6544872B2 (en) 2019-07-17
EP3316532A4 (en) 2018-09-19
CN107078969A (en) 2017-08-18
EP3316532A1 (en) 2018-05-02
JP2018523932A (en) 2018-08-23
US20180332105A1 (en) 2018-11-15
EP3316532B1 (en) 2019-07-31

Similar Documents

Publication Publication Date Title
WO2017114017A1 (en) Computer device, system and method for implementing load balancing
US11381507B2 (en) Virtual network device and related method
US10313178B2 (en) Virtual network inter-container communication
EP3586494B1 (en) Load balancing in distributed computing systems
CN110088732B (en) Data packet processing method, host and system
US20190028538A1 (en) Method, apparatus, and system for controlling service traffic between data centers
US8213336B2 (en) Distributed data center access switch
US10594586B2 (en) Dialing test method, dialing test system, and computing node
CN102447624B (en) Load balancing method in server cluster, as well as node server and cluster
WO2015117401A1 (en) Information processing method and device
CN105577723B (en) Virtualize the method and apparatus that load balancing is realized in network
US9350666B2 (en) Managing link aggregation traffic in a virtual environment
US9686178B2 (en) Configuring link aggregation groups to perform load balancing in a virtual environment
WO2017114363A1 (en) Packet processing method, bng and bng cluster system
CN113709220B (en) High-availability implementation method and system of virtual load equalizer and electronic equipment
WO2023207189A1 (en) Load balancing method and system, computer storage medium, and electronic device
WO2023016415A1 (en) Node for running container group, and management system and method of container group
WO2018129957A1 (en) Vbng system multi-virtual machine load sharing method and vbng system device
US11996993B2 (en) Packet transmission method, apparatus, and system, and storage medium
EP3843342A1 (en) Communication method and related device
CN118870548A (en) Distribution method and distribution unit thereof

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16880807

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2017567446

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE