WO2023184925A1 - Load balancer and implementation method therefor, load balancing method, and gateway system - Google Patents
Load balancer and implementation method therefor, load balancing method, and gateway system Download PDFInfo
- Publication number
- WO2023184925A1 WO2023184925A1 PCT/CN2022/124069 CN2022124069W WO2023184925A1 WO 2023184925 A1 WO2023184925 A1 WO 2023184925A1 CN 2022124069 W CN2022124069 W CN 2022124069W WO 2023184925 A1 WO2023184925 A1 WO 2023184925A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- container
- proxy
- configuration
- service
- envoy
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 52
- 230000007246 mechanism Effects 0.000 claims description 13
- 238000012544 monitoring process Methods 0.000 claims description 7
- 230000004044 response Effects 0.000 claims description 3
- 238000005516 engineering process Methods 0.000 description 3
- 230000008569 process Effects 0.000 description 3
- 238000010586 diagram Methods 0.000 description 2
- 238000013461 design Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L47/00—Traffic control in data switching networks
- H04L47/10—Flow control; Congestion control
- H04L47/12—Avoiding congestion; Recovering from congestion
- H04L47/125—Avoiding congestion; Recovering from congestion by balancing the load, e.g. traffic engineering
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L65/00—Network arrangements, protocols or services for supporting real-time applications in data packet communication
- H04L65/10—Architectures or entities
- H04L65/102—Gateways
Definitions
- the load balancing gateway proxy service before the load balancing gateway proxy service uses the network of the container engine Docker to start the proxy container envoy container, it also includes:
- Acquisition unit used to obtain requests sent by the application
- the load balancing unit 502 is configured to load balance the request based on the latest target service configuration pulled from the configuration service XDS server of the gateway system.
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Multimedia (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
- Computer And Data Communications (AREA)
- Stored Programmes (AREA)
Abstract
The present application discloses a load balancer and an implementation method therefor, a load balancing method, and a gateway system. The implementation method for a load balancer comprises: a proxy agent controller sends, to a load balancing gateway proxy on a target host, a creation request comprising creation configuration information, wherein the target host refers to any one of a plurality of hosts; the load balancing gateway proxy creates a proxy envoy container according to the creation configuration information, generates and mounts a configuration file of the proxy envoy container, and starts the proxy envoy container by using the network of a Docker container engine; the proxy envoy container pulls up the latest target service configuration on the basis of an address of a configuration service XDS server in the configuration file for carrying out load balancing on a request of an application.
Description
本申请要求于2022年03月29日提交中国专利局、申请号为202210317360.9、发明名称为“负载均衡器及其实现方法、负载均衡的方法、网关系统”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application requires the priority of the Chinese patent application submitted to the China Patent Office on March 29, 2022, with the application number 202210317360.9, and the invention name is "Load balancer and its implementation method, load balancing method, gateway system", all of which The contents are incorporated into this application by reference.
本申请涉及负载均衡技术领域,特别涉及一种负载均衡器及其实现方法、负载均衡的方法、网关系统。This application relates to the field of load balancing technology, and in particular to a load balancer and its implementation method, a load balancing method, and a gateway system.
为了能提供网络数据处理能力、增加吞吐量、提高网络的可用性和灵活性等,当前的系统通常都会对访问请求进行负载均衡。In order to provide network data processing capabilities, increase throughput, improve network availability and flexibility, current systems usually load balance access requests.
当前,对于从使用镜像仓库拉取镜像,通常在前端使用LVS+keepalived实现虚拟IP的自动切换,后端使用Nginx或者HAProxy实现7层负载均衡,从而可以对后端的节点进行流量和访问的负载均衡。Currently, for pulling images from the mirror warehouse, LVS+keepalived is usually used on the front end to achieve automatic switching of virtual IPs, and Nginx or HAProxy is used on the back end to achieve layer 7 load balancing, so that traffic and access load balancing can be performed on the back-end nodes. .
但是利用Nginx或者HAProxy实现的负载均衡,都是基于文件进行配置的,所以当后端增加节点或者存在其他方便的更新时,必须重新修改或者生成配置文件,然后再将配置文件进行重新加载生效,对于后端也需要进行重新启动,所以非常的不方便。However, load balancing implemented using Nginx or HAProxy is configured based on files. Therefore, when nodes are added to the backend or there are other convenient updates, the configuration file must be modified or generated, and then the configuration file must be reloaded to take effect. The backend also needs to be restarted, so it is very inconvenient.
发明内容Contents of the invention
基于上述现有技术的不足,本申请提供了一种负载均衡器及其实现方法、负载均衡的方法、网关系统,以解决现有在进行变更时过于繁琐的问题。Based on the shortcomings of the above-mentioned existing technologies, this application provides a load balancer and its implementation method, a load balancing method, and a gateway system to solve the existing problem of being too cumbersome when making changes.
为了实现上述目的,本申请提供了以下技术方案:In order to achieve the above objectives, this application provides the following technical solutions:
本申请第一方面提供了一种负载均衡器的实现方法,应用于网关系统,所述网关系统至少包括网关控制服务以及多台主机,所述网关控制服务包括代理控制器Agent Controller以及配置服务XDS server,每台所述主机部署有容器引擎Docker以及负载均衡网关代理,所述负载均衡器的实现方法,包括:The first aspect of this application provides a method for implementing a load balancer, which is applied to a gateway system. The gateway system at least includes a gateway control service and multiple hosts. The gateway control service includes an agent controller Agent Controller and a configuration service XDS. server, each host is deployed with a container engine Docker and a load balancing gateway agent. The implementation method of the load balancer includes:
所述代理控制器Agent Controller向目标主机上的所述负载均衡网关代理发送创建请求;其中,所述创建请求包括创建配置信息;所述目标主机指代所述多个主机中的任意一台;The agent controller Agent Controller sends a creation request to the load balancing gateway agent on the target host; wherein the creation request includes creation configuration information; the target host refers to any one of the multiple hosts;
所述目标主机上的所述负载均衡网关代理根据所述创建配置信息创建代理容器envoy container,以及生成并挂载所述代理容器envoy container的配置文件;The load balancing gateway proxy on the target host creates a proxy container envoy container based on the creation configuration information, and generates and mounts the configuration file of the proxy container envoy container;
所述负载均衡网关代理服务利用所述容器引擎Docker的网络启动所述代理容器envoy container;The load balancing gateway proxy service uses the network of the container engine Docker to start the proxy container envoy container;
所述代理容器envoy container基于所述配置文件中的所述配置服务XDS server的地址,从所述配置服务XDS server中拉取最新的目标服务配置,用于对应用程序的请求进行负载均衡。The proxy container envoy container pulls the latest target service configuration from the configuration service XDS server based on the address of the configuration service XDS server in the configuration file for load balancing application requests.
可选地,在上述的负载均衡器的实现方法中,所述网关系统还包括高可用服务keepalived,所述代理控制器Agent Controller向目标主机上的所述负载均衡网关代理发送创建请求之后,还包括:Optionally, in the above load balancer implementation method, the gateway system also includes a high availability service keepalived. After the agent controller Agent Controller sends a creation request to the load balancing gateway agent on the target host, it also include:
所述目标主机上的所述负载均衡网关代理调用所述高可用服务keepalived为所述目标主机以及其他备用的所述主机生成对应的IP。The load balancing gateway agent on the target host calls the high-availability service keepalived to generate corresponding IPs for the target host and other backup hosts.
可选地,在上述的负载均衡器的实现方法中,所述负载均衡网关代理服务利用容器引擎Docker的网络启动所述代理容器envoy container之前,还包括:Optionally, in the above load balancer implementation method, before the load balancing gateway proxy service uses the network of the container engine Docker to start the proxy container envoy container, it also includes:
所述容器引擎Docker响应网络创建操作,为所述代理容器envoy container创建所述容器引擎Docker的MACVLAN网络;The container engine Docker responds to the network creation operation and creates the MACVLAN network of the container engine Docker for the proxy container envoy container;
其中,所述负载均衡网关代理服务利用容器引擎Docker的网络启动所述代理容器envoy container,包括:Among them, the load balancing gateway proxy service uses the network of the container engine Docker to start the proxy container envoy container, including:
所述负载均衡网关代理服务调用所述容器引擎Docker的MACVLAN网络为所述代理容器envoy container分配网络地址,并基于所述网络地址启动所述代理容器envoy container。The load balancing gateway proxy service calls the MACVLAN network of the container engine Docker to allocate a network address to the proxy container envoy container, and starts the proxy container envoy container based on the network address.
可选地,在上述的负载均衡器的实现方法中,所述代理容器envoy container基于所述配置文件中的所述配置服务XDS server的地址,从所述配置服务XDS server中拉取最新的目标服务配置,用于对应用程序的请求 进行负载均衡,包括:Optionally, in the above implementation method of the load balancer, the proxy container envoy container pulls the latest target from the configuration service XDS server based on the address of the configuration service XDS server in the configuration file. Service configuration, used to load balance the application's requests, including:
所述代理容器envoy container通过对应的发现机制监听所述配置文件中的所述配置服务XDS server的地址;其中,所述发现机制包括监听动态发现、集群动态发现、服务端点动态发现、路由规则动态发现;The proxy container envoy container monitors the address of the configuration service XDS server in the configuration file through the corresponding discovery mechanism; wherein the discovery mechanism includes monitoring dynamic discovery, cluster dynamic discovery, service endpoint dynamic discovery, and routing rule dynamics. Discover;
当监听到所述配置文件中的所述配置服务XDS server的任意地址中的所述目标服务配置更新时,所述代理容器envoy container拉取最新的所述目标服务配置用于对应用程序的请求进行负载均衡。When monitoring the target service configuration update at any address of the configuration service XDS server in the configuration file, the proxy container envoy container pulls the latest target service configuration for requests to the application. Perform load balancing.
本申请第二方面提供了一种负载均衡的方法,应用于负载均衡器,所述负载均衡器为在网关系统中创建的代理容器envoy container,所述负载均衡的方法,包括:The second aspect of this application provides a load balancing method, which is applied to a load balancer. The load balancer is a proxy container envoy container created in the gateway system. The load balancing method includes:
获取应用程序发送的请求;Get the request sent by the application;
基于从所述网关系统的所述配置服务XDS server中拉取到的最新的目标服务配置对所述请求进行负载均衡;其中,所述目标服务配置由所述代理容器envoy container在启动后基于其配置文件中的配置服务XDS server的地址,从所述配置服务XDS server中拉取到;所述代理容器envoy container的配置文件由目标主机上的负载均衡网关代理根据创建请求中的创建配置信息创建代理容器envoy container时,根据所述创建配置信息生成并挂载;所述目标主机指代所述多个主机中的任意一台;所述创建请求时由所述网关系统中的所述代理控制器Agent Controller发送;所述代理容器envoy container由所述负载均衡网关代理服务利用所述网关系统中的容器引擎Docker的网络启动。The request is load balanced based on the latest target service configuration pulled from the configuration service XDS server of the gateway system; wherein the target service configuration is based on the proxy container envoy container after it is started. The address of the configuration service XDS server in the configuration file is pulled from the configuration service XDS server; the configuration file of the proxy container envoy container is created by the load balancing gateway proxy on the target host based on the creation configuration information in the creation request. When the proxy container envoy container is generated and mounted according to the creation configuration information; the target host refers to any one of the multiple hosts; the creation request is controlled by the proxy in the gateway system Sent by Agent Controller; the proxy container envoy container is started by the load balancing gateway proxy service using the network of the container engine Docker in the gateway system.
本申请第三方面提供了一种网关系统,包括:The third aspect of this application provides a gateway system, including:
网关控制服务以及多台主机;Gateway control services and multiple hosts;
所述网关控制服务包括代理控制器Agent Controller以及配置服务XDS server;The gateway control service includes the agent controller Agent Controller and the configuration service XDS server;
每台所述主机部署有容器引擎Docker以及负载均衡网关代理;Each host is deployed with the container engine Docker and the load balancing gateway agent;
所述代理控制器Agent Controller用于向目标主机上的所述负载均衡网关代理发送创建请求;其中,所述创建请求包括创建配置信息;所述目标主机指代所述多个主机中的任意一台;The agent controller Agent Controller is used to send a creation request to the load balancing gateway agent on the target host; wherein the creation request includes creation configuration information; the target host refers to any one of the multiple hosts tower;
所述负载均衡网关代理用于根据所述创建配置信息创建代理容器envoy container,以及生成并挂载所述代理容器envoy container的配置文件,并利用所述容器引擎Docker的网络启动所述代理容器envoy container;其中,所述代理容器envoy container在启动后基于所述配置文件中的所述配置服务XDS server的地址,从所述配置服务XDS server中拉取最新的目标服务配置,用于对应用程序的请求进行负载均衡。The load balancing gateway proxy is used to create a proxy container envoy container based on the creation configuration information, generate and mount the configuration file of the proxy container envoy container, and use the network of the container engine Docker to start the proxy container envoy container; wherein, after startup, the proxy container envoy container pulls the latest target service configuration from the configuration service XDS server based on the address of the configuration service XDS server in the configuration file, which is used to configure the application The requests are load balanced.
可选地,在上述提供的网关系统中,还包括:Optionally, the gateway system provided above also includes:
高可用服务keepalived,用于为所述目标主机以及其他备用的所述主机生成对应的IP。The high availability service keepalived is used to generate corresponding IPs for the target host and other backup hosts.
可选地,在上述提供的网关系统中,所述容器引擎Docker还用于:Optionally, in the gateway system provided above, the container engine Docker is also used for:
响应网络创建操作,为所述代理容器envoy container创建所述容器引擎Docker的MACVLAN网络;In response to the network creation operation, create the MACVLAN network of the container engine Docker for the proxy container envoy container;
其中,所述负载均衡网关代理服务利用容器引擎Docker的网络启动所述代理容器envoy container时,用于:Wherein, when the load balancing gateway proxy service uses the network of the container engine Docker to start the proxy container envoy container, it is used for:
调用所述容器引擎Docker的MACVLAN网络为所述代理容器envoy container分配网络地址,并基于所述网络地址启动所述代理容器envoy container。Call the MACVLAN network of the container engine Docker to allocate a network address to the proxy container envoy container, and start the proxy container envoy container based on the network address.
可选地,在上述提供的网关系统中,所述代理容器envoy container基于所述配置文件中的所述配置服务XDS server的地址,从所述配置服务XDS server中拉取最新的目标服务配置,用于对应用程序的请求进行负载均衡时,用于:Optionally, in the gateway system provided above, the proxy container envoy container pulls the latest target service configuration from the configuration service XDS server based on the address of the configuration service XDS server in the configuration file, When used to load balance an application's requests, it is used to:
通过对应的发现机制监听所述配置文件中的所述配置服务XDS server的地址;其中,所述发现机制包括监听动态发现、集群动态发现、服务端点动态发现、路由规则动态发现;Monitor the address of the configuration service XDS server in the configuration file through the corresponding discovery mechanism; wherein the discovery mechanism includes monitoring dynamic discovery, cluster dynamic discovery, service endpoint dynamic discovery, and routing rule dynamic discovery;
当监听到所述配置文件中的所述配置服务XDS server的任意地址中的所述目标服务配置更新时,拉取最新的所述目标服务配置用于对应用程序的请求进行负载均衡。When the target service configuration update in any address of the configuration service XDS server in the configuration file is monitored, the latest target service configuration is pulled for load balancing of application requests.
本申请第四方面提供了一种负载均衡器,所述负载均衡器为在网关系统中创建的代理容器envoy container,所述负载均衡器,包括:The fourth aspect of this application provides a load balancer. The load balancer is a proxy container envoy container created in the gateway system. The load balancer includes:
获取单元,用于获取应用程序发送的请求;Acquisition unit, used to obtain requests sent by the application;
负载均衡单元,用于基于从所述网关系统的所述配置服务XDS server中拉取到的最新的目标服务配置对所述请求进行负载均衡;其中,所述目标服务配置由所述代理容器envoy container在启动后基于其配置文件中的配置服务XDS server的地址,从所述配置服务XDS server中拉取到;所述代理容器envoy container的配置文件由目标主机上的负载均衡网关代理根据创建请求中的创建配置信息创建代理容器envoy container时,根据所述创建配置信息生成并挂载;所述目标主机指代所述多个主机中的任意一台;所述创建请求时由所述网关系统中的所述代理控制器Agent Controller发送;所述代理容器envoy container由所述负载均衡网关代理服务利用所述网关系统中的容器引擎Docker的网络启动。A load balancing unit, configured to load balance the request based on the latest target service configuration pulled from the configuration service XDS server of the gateway system; wherein the target service configuration is configured by the proxy container envoy After the container is started, it is pulled from the configuration service XDS server based on the address of the configuration service XDS server in its configuration file; the configuration file of the proxy container envoy container is created by the load balancing gateway proxy on the target host according to the creation request When creating the proxy container envoy container, it is generated and mounted according to the creation configuration information; the target host refers to any one of the multiple hosts; when the creation request is made, the gateway system The agent controller in Agent Controller sends; the agent container envoy container is started by the network of the load balancing gateway agent service using the container engine Docker in the gateway system.
本申请提供的一种负载均衡器的实现方法,应用于网关系统,该网关系统至少包括网关控制服务以及多台主机,网关控制服务包括代理控制器Agent Controller以及配置服务XDS server,每台主机部署有容器引擎Docker以及负载均衡网关代理。在需要创建负载均衡器时,代理控制器Agent Controller向目标主机上的负载均衡网关代理发送创建请求。其中,创建请求包括创建配置信息,目标主机指代所述多个主机中的任意一台。目标主机上的负载均衡网关代理根据所述创建配置信息创建代理容器envoy container,以及生成并挂载代理容器envoy container的配置文件,然后利用容器引擎Docker的网络启动代理容器envoy container。启动后的代理容器envoy container基于配置文件中的配置服务XDS server的地址,从配置服务XDS server中拉取最新的目标服务配置,用于对应用程序的请求进行负载均衡。从而在新增节点或者存在其他变更时,只需要通过配置服务XDS server进行动态配置,即可以将配置拉取,用于负载均衡,不需要重新启动。This application provides a load balancer implementation method, which is applied to a gateway system. The gateway system at least includes a gateway control service and multiple hosts. The gateway control service includes an agent controller Agent Controller and a configuration service XDS server. Each host is deployed There is the container engine Docker and the load balancing gateway agent. When a load balancer needs to be created, the Agent Controller sends a creation request to the load balancing gateway agent on the target host. The creation request includes creation configuration information, and the target host refers to any one of the multiple hosts. The load balancing gateway proxy on the target host creates the proxy container envoy container based on the creation configuration information, generates and mounts the configuration file of the proxy container envoy container, and then uses the network of the container engine Docker to start the proxy container envoy container. The started proxy container envoy container pulls the latest target service configuration from the configuration service XDS server based on the address of the configuration service XDS server in the configuration file, which is used to load balance application requests. Therefore, when adding new nodes or making other changes, you only need to perform dynamic configuration through the configuration service XDS server, and the configuration can be pulled for load balancing without restarting.
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的实施例,对于本领域普通技术人员来讲, 在不付出创造性劳动的前提下,还可以根据提供的附图获得其他的附图。In order to explain the embodiments of the present application or the technical solutions in the prior art more clearly, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings in the following description are only These are embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on the provided drawings without exerting creative efforts.
图1为本申请实施例提供的一种网关系统的架构示意图;Figure 1 is a schematic architectural diagram of a gateway system provided by an embodiment of the present application;
图2为本申请实施例提供的一种负载均衡器的实现方法的流程图;Figure 2 is a flow chart of a load balancer implementation method provided by an embodiment of the present application;
图3为本申请另一实施例提供的另一种负载均衡器的实现方法的流程图;Figure 3 is a flow chart of another load balancer implementation method provided by another embodiment of the present application;
图4为本申请另一实施例提供的一种负载均衡的方法的流程图;Figure 4 is a flow chart of a load balancing method provided by another embodiment of the present application;
图5为本申请另一实施例提供的一种负载均衡器的结构示意图。Figure 5 is a schematic structural diagram of a load balancer provided by another embodiment of the present application.
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of this application.
在本申请中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。In this application, relational terms such as first, second, etc. are only used to distinguish one entity or operation from another entity or operation and do not necessarily require or imply the existence of any such entity or operation. an actual relationship or sequence. Furthermore, the terms "comprises," "comprises," or any other variation thereof are intended to cover a non-exclusive inclusion, such that a process, method, article or apparatus including a list of elements includes not only those elements, but also those not expressly listed Other elements, or elements inherent to the process, method, article or equipment. Without further limitation, an element defined by the statement "comprises a..." does not exclude the presence of additional identical elements in a process, method, article, or apparatus that includes the stated element.
本申请提供了一种负载均衡器的实现方法,应用于网关系统,即需要通过网关系统实现负载均衡器,以解决现有在进行变更时过于繁琐的问题。This application provides a method for implementing a load balancer, which is applied to a gateway system. That is, the load balancer needs to be implemented through the gateway system to solve the existing problem of being too cumbersome when making changes.
可选地,为了实现本申请实施例提供的负载均衡器的实现方法,本申请另一实施例提供了一种网关系统,如图1所示,包括:Optionally, in order to implement the load balancer implementation method provided in the embodiment of this application, another embodiment of this application provides a gateway system, as shown in Figure 1, including:
网关控制服务以及多台主机。Gateway controls services as well as multiple hosts.
网关控制服务包括代理控制器Agent Controller以及配置服务XDS server。Gateway control services include agent controller Agent Controller and configuration service XDS server.
每台主机部署有容器引擎Docker以及负载均衡网关代理。Each host is deployed with the container engine Docker and the load balancing gateway agent.
代理控制器Agent Controller用于向目标主机上的负载均衡网关代理发送创建请求。其中,创建请求包括创建配置信息。目标主机指代多个主机中的任意一台。Agent Controller Agent Controller is used to send a create request to the load balancing gateway agent on the target host. Among them, the creation request includes creation configuration information. The target host refers to any one of multiple hosts.
负载均衡网关代理用于根据创建配置信息创建代理容器envoy container,以及生成并挂载代理容器envoy container的配置文件,并利用容器引擎Docker的网络启动代理容器envoy container。The load balancing gateway proxy is used to create a proxy container envoy container based on the creation configuration information, generate and mount the configuration file of the proxy container envoy container, and use the network of the container engine Docker to start the proxy container envoy container.
其中,代理容器envoy container在启动后基于配置文件中的配置服务XDS server的地址,从配置服务XDS server中拉取最新的目标服务配置,用于对应用程序的请求进行负载均衡。Among them, the proxy container envoy container pulls the latest target service configuration from the configuration service XDS server based on the address of the configuration service XDS server in the configuration file after startup, which is used to load balance application requests.
可选地,在本申请另一实施例提供的网关系统中,还包括:Optionally, the gateway system provided by another embodiment of the present application also includes:
高可用服务keepalived,用于为目标主机以及其他备用的主机生成对应的IP。The high-availability service keepalived is used to generate corresponding IPs for the target host and other backup hosts.
可选地,在本申请另一实施例提供的网关系统中,容器引擎Docker还用于:Optionally, in the gateway system provided by another embodiment of this application, the container engine Docker is also used for:
响应网络创建操作,为代理容器envoy container创建容器引擎Docker的MACVLAN网络。In response to the network creation operation, create the MACVLAN network of the container engine Docker for the proxy container envoy container.
其中,本申请实施例中的负载均衡网关代理服务利用容器引擎Docker的网络启动代理容器envoy container时,用于:Among them, when the load balancing gateway proxy service in the embodiment of this application uses the network of the container engine Docker to start the proxy container envoy container, it is used for:
调用容器引擎Docker的MACVLAN网络为代理容器envoy container分配网络地址,并基于网络地址启动代理容器envoy container。Call the MACVLAN network of the container engine Docker to assign a network address to the proxy container envoy container, and start the proxy container envoy container based on the network address.
可选地,在本申请另一实施例提供的网关系统中,代理容器envoy container基于配置文件中的配置服务XDS server的地址,从配置服务XDS server中拉取最新的目标服务配置,用于对应用程序的请求进行负载均衡时,用于:Optionally, in the gateway system provided by another embodiment of the present application, the proxy container envoy container pulls the latest target service configuration from the configuration service XDS server based on the address of the configuration service XDS server in the configuration file for use in When application requests are load balanced, they are used to:
通过对应的发现机制监听配置文件中的配置服务XDS server的地址。其中,发现机制包括监听动态发现、集群动态发现、服务端点动态发现、路由规则动态发现。Monitor the address of the configuration service XDS server in the configuration file through the corresponding discovery mechanism. Among them, the discovery mechanism includes dynamic discovery of listeners, dynamic discovery of clusters, dynamic discovery of service endpoints, and dynamic discovery of routing rules.
当监听到配置文件中的配置服务XDS server的任意地址中的目标服务配置更新时,拉取最新的目标服务配置用于对应用程序的请求进行负载均衡。When the target service configuration update in any address of the configuration service XDS server in the configuration file is monitored, the latest target service configuration is pulled for load balancing of application requests.
基于上述提供的网关系统,本申请实施例提供了一种负载均衡器的实 现方法,具体应用于上述的网关系统,根据上述可知,网关系统至少包括网关控制服务以及多台主机,网关控制服务包括代理控制器Agent Controller以及配置服务XDS server,每台主机部署有容器引擎Docker以及负载均衡网关代理。Based on the gateway system provided above, embodiments of the present application provide a load balancer implementation method, which is specifically applied to the above gateway system. According to the above, it can be seen that the gateway system at least includes a gateway control service and multiple hosts. The gateway control service includes Agent Controller and configuration service XDS server. Each host is deployed with container engine Docker and load balancing gateway agent.
如图2所示,本申请实施例提供的负载均衡器的实现方法,包括以下步骤:As shown in Figure 2, the implementation method of the load balancer provided by the embodiment of this application includes the following steps:
S201、代理控制器Agent Controller向目标主机上的负载均衡网关代理发送创建请求。S201. The agent controller Agent Controller sends a creation request to the load balancing gateway agent on the target host.
其中,创建请求包括创建配置信息。目标主机指代多个主机中的任意一台。Among them, the creation request includes creation configuration information. The target host refers to any one of multiple hosts.
具体在需要创建负载均衡器时,开发人员可以根据创建的需求配置创建配置信息,具体包括了关于负载均衡器的相应的配置信息,然后通过代理控制器Agent Controller向一台主机上的负载均衡网关代理发送包括该配置信息的创建请求,以请求负载均衡网关代理创建负载均衡器。从而实现容器的动态创建。Specifically, when a load balancer needs to be created, developers can create configuration information based on the created demand configuration, including the corresponding configuration information about the load balancer, and then send it to the load balancing gateway on a host through the Agent Controller. The agent sends a create request that includes this configuration information to request the load balancing gateway agent to create the load balancer. This enables dynamic creation of containers.
需要说明的是,在本申请实施例中,使用代理容器envoy container来实现一个负载均衡器(软件网关),所以本申请实施例中的负载均衡器即为代理容器envoy container。Envoy代理本身支持动态路由规则,并且动态启动监听端口无需重新启动,还支持流量镜像,而且通过XDS协议可以动态的更新路由规则,后端地址等。It should be noted that in the embodiment of this application, the proxy container envoy container is used to implement a load balancer (software gateway), so the load balancer in the embodiment of this application is the proxy container envoy container. The Envoy proxy itself supports dynamic routing rules, and can dynamically start listening ports without restarting. It also supports traffic mirroring, and can dynamically update routing rules, backend addresses, etc. through the XDS protocol.
S202、目标主机上的负载均衡网关代理根据创建配置信息创建代理容器envoy container,以及生成并挂载代理容器envoy container的配置文件。S202. The load balancing gateway proxy on the target host creates the proxy container envoy container based on the creation configuration information, and generates and mounts the configuration file of the proxy container envoy container.
可选地,目标主机上的负载均衡网关代理在接收到创建请求后,可以在包括目标主机在内的多台主机上根据创建配置信息创建多个代理容器envoy container。然后根据创建配置信息生成代理容器envoy container的配置文件,配置文件中包括了代理容器envoy container所要监听的配置服务XDS server的地址,以便于代理容器envoy container监听动态发现、集群动态发现、服务端动态发现以及路由规则动态发现等,即能监听到目标服务配置的更新,以拉取最新的目标服务配置,用于负载均衡。Optionally, after receiving the creation request, the load balancing gateway proxy on the target host can create multiple proxy container envoy containers based on the creation configuration information on multiple hosts including the target host. Then generate the configuration file of the proxy container envoy container based on the created configuration information. The configuration file includes the address of the configuration service XDS server to be monitored by the proxy container envoy container, so that the proxy container envoy container can monitor dynamic discovery, cluster dynamic discovery, and server-side dynamics. Discovery and dynamic discovery of routing rules, etc., that is, it can monitor updates of the target service configuration to pull the latest target service configuration for load balancing.
可选地,为了更好地实现高可用性,所以网关系统还可以进一步包括高可用服务keepalived。相应地,在本申请实施例中,在执行步骤S201之后, 在执行步骤S202的同时,还可以进一步包括:Optionally, in order to better achieve high availability, the gateway system can further include a high-availability service keepalived. Correspondingly, in the embodiment of the present application, after executing step S201, while executing step S202, it may further include:
目标主机上的所述负载均衡网关代理调用高可用服务keepalived为目标主机以及其他备用的主机生成对应的IP。The load balancing gateway agent on the target host calls the high-availability service keepalived to generate corresponding IPs for the target host and other backup hosts.
其中,备用的主机指的是也同样创建了与目标主机相同的代理容器envoy container的主机。需要说明的是,高可用服务keepalived实现高可用性的方式属于现有的技术,因此此处不再赘述。Among them, the backup host refers to the host that has also created the same proxy container envoy container as the target host. It should be noted that the way the high-availability service keepalived implements high availability is an existing technology, so it will not be described again here.
S203、负载均衡网关代理服务利用容器引擎Docker的网络启动代理容器envoy container。S203. The load balancing gateway proxy service uses the network of the container engine Docker to start the proxy container envoy container.
具体的,通过容器引擎Docker动态创建Docker的网络,具体可以三层网络Docker MACVLAN,也可以是两层网络Docker IPVLAN,然后让代理容器envoy container与创建的网络进行关联,从而启动代理容器envoy container。Specifically, the Docker network is dynamically created through the container engine Docker. Specifically, it can be a three-layer network Docker MACVLAN or a two-layer network Docker IPVLAN, and then the proxy container envoy container is associated with the created network, thereby starting the proxy container envoy container.
S204、代理容器envoy container基于配置文件中的配置服务XDS server的地址,从配置服务XDS server中拉取最新的目标服务配置,用于对应用程序的请求进行负载均衡。S204. The proxy container envoy container pulls the latest target service configuration from the configuration service XDS server based on the address of the configuration service XDS server in the configuration file, which is used to load balance application requests.
可选地,代理容器envoy container在首次启动后,可以基于配置文件中的配置服务XDS server的地址,从配置服务XDS server中拉取的目标服务配置。其中,目标服务配置可以包括监听动态发现、集群动态发现、服务端点动态发现、路由规则动态发现等发现的相关的服务配置。Optionally, after the proxy container envoy container is started for the first time, the target service configuration can be pulled from the configuration service XDS server based on the address of the configuration service XDS server in the configuration file. Among them, the target service configuration may include discovery-related service configurations such as monitoring dynamic discovery, cluster dynamic discovery, service endpoint dynamic discovery, routing rule dynamic discovery, etc.
可选地,在后续代理容器envoy container可以是定期基于配置文件中的配置服务XDS server的地址,从配置服务XDS server中拉取的目标服务配置。也可以是实时监听配置文件中的配置服务XDS server的地址,当发现监听的地址下存在配置更新时,拉取更新后的目标服务配置。Optionally, the subsequent proxy container envoy container can periodically pull the target service configuration from the configuration service XDS server based on the address of the configuration service XDS server in the configuration file. It can also be the address of the configuration service XDS server in the configuration file that is monitored in real time. When it is found that there is a configuration update under the monitored address, the updated target service configuration is pulled.
具体的,代理容器envoy container在拉取目标服务配置后,由于目标服务配置包括了路由规则、负载均衡规则等,所以当接收到应用程序发送的请求时,就可以基于路由规则、负载均衡规则等目标服务配置对该请求进行负载均衡。Specifically, after the proxy container envoy container pulls the target service configuration, since the target service configuration includes routing rules, load balancing rules, etc., when it receives a request sent by the application, it can based on the routing rules, load balancing rules, etc. The target service configuration load balances the request.
本申请实施例提供的一种负载均衡器的实现方法,应用于网关系统,该网关系统至少包括网关控制服务以及多台主机,网关控制服务包括代理控制器Agent Controller以及配置服务XDS server,每台主机部署有容器引擎Docker以及负载均衡网关代理。在需要创建负载均衡器时,代理控制器 Agent Controller向目标主机上的负载均衡网关代理发送创建请求。其中,创建请求包括创建配置信息,目标主机指代所述多个主机中的任意一台。目标主机上的负载均衡网关代理根据所述创建配置信息创建代理容器envoy container,以及生成并挂载代理容器envoy container的配置文件,然后利用容器引擎Docker的网络启动代理容器envoy container。启动后的代理容器envoy container基于配置文件中的配置服务XDS server的地址,从配置服务XDS server中拉取最新的目标服务配置,用于对应用程序的请求进行负载均衡。从而在新增节点或者存在其他变更时,只需要通过配置服务XDS server进行动态配置,即可以将配置拉取,用于负载均衡,不需要重新启动。The implementation method of a load balancer provided by the embodiment of this application is applied to a gateway system. The gateway system at least includes a gateway control service and multiple hosts. The gateway control service includes an agent controller Agent Controller and a configuration service XDS server. Each server The host is deployed with the container engine Docker and the load balancing gateway agent. When a load balancer needs to be created, the Agent Controller sends a creation request to the load balancing gateway agent on the target host. The creation request includes creation configuration information, and the target host refers to any one of the multiple hosts. The load balancing gateway proxy on the target host creates the proxy container envoy container based on the creation configuration information, generates and mounts the configuration file of the proxy container envoy container, and then uses the network of the container engine Docker to start the proxy container envoy container. The started proxy container envoy container pulls the latest target service configuration from the configuration service XDS server based on the address of the configuration service XDS server in the configuration file, which is used to load balance application requests. Therefore, when adding new nodes or making other changes, you only need to perform dynamic configuration through the configuration service XDS server, and the configuration can be pulled for load balancing without restarting.
本申请另一实施例中提供了另一种负载均衡器的实现方法,同样应用于上述的网关系统。如图3所示,本申请实施例提供的负载均衡器的实现方法,包括以下步骤:Another embodiment of the present application provides another load balancer implementation method, which is also applied to the above-mentioned gateway system. As shown in Figure 3, the implementation method of the load balancer provided by the embodiment of this application includes the following steps:
S301、代理控制器Agent Controller向目标主机上的负载均衡网关代理发送创建请求。S301. The agent controller Agent Controller sends a creation request to the load balancing gateway agent on the target host.
其中,创建请求包括创建配置信息。目标主机指代多个主机中的任意一台。Among them, the creation request includes creation configuration information. The target host refers to any one of multiple hosts.
需要说明的是,在本申请实施例中,步骤S301的具体实施方式可相应地参考上述方法实施例中的相应的步骤,此处不再赘述。It should be noted that in the embodiment of the present application, the specific implementation of step S301 may refer to the corresponding steps in the above method embodiment, and will not be described again here.
S302、目标主机上的负载均衡网关代理根据创建配置信息创建代理容器envoy container,以及生成并挂载代理容器envoy container的配置文件。S302. The load balancing gateway proxy on the target host creates the proxy container envoy container based on the creation configuration information, and generates and mounts the configuration file of the proxy container envoy container.
需要说明的是,在本申请实施例中,步骤S301的具体实施方式可相应地参考上述方法实施例中的相应的步骤,此处不再赘述。It should be noted that in the embodiment of the present application, the specific implementation of step S301 may refer to the corresponding steps in the above method embodiment, and will not be described again here.
S303、容器引擎Docker响应网络创建操作,为代理容器envoy container创建容器引擎Docker的MACVLAN网络。S303. The container engine Docker responds to the network creation operation and creates the MACVLAN network of the container engine Docker for the proxy container envoy container.
在本申请实施例中,通过动态创建的Docker的MACVLAN网络来进行代理容器envoy container的启动。当然,也可以采用其他的网络。In the embodiment of this application, the proxy container envoy container is started through the dynamically created MACVLAN network of Docker. Of course, other networks can also be used.
S304、负载均衡网关代理服务调用容器引擎Docker的MACVLAN网络为代理容器envoy container分配网络地址,并基于网络地址启动代理容器envoy container。S304. The load balancing gateway proxy service calls the MACVLAN network of the container engine Docker to allocate a network address to the proxy container envoy container, and starts the proxy container envoy container based on the network address.
S305、代理容器envoy container通过对应的发现机制监听配置文件中的配置服务XDS server的地址。S305. The proxy container envoy container monitors the address of the configuration service XDS server in the configuration file through the corresponding discovery mechanism.
其中,发现机制包括监听动态发现、集群动态发现、服务端点动态发现、路由规则动态发现。Among them, the discovery mechanism includes dynamic discovery of listeners, dynamic discovery of clusters, dynamic discovery of service endpoints, and dynamic discovery of routing rules.
在本申请实施例中,通过发现机制监听配置文件中的配置服务XDS server的地址,以能在配置的地址下出现文件更新时,可以及时拉取最新的目标服务配置,用于负载均衡。In the embodiment of this application, the address of the configuration service XDS server in the configuration file is monitored through the discovery mechanism, so that when a file update occurs under the configured address, the latest target service configuration can be pulled in time for load balancing.
S306、当监听到配置文件中的配置服务XDS server的任意地址中的目标服务配置更新时,代理容器envoy container拉取最新的目标服务配置用于对应用程序的请求进行负载均衡。S306. When listening to the target service configuration update at any address of the configuration service XDS server in the configuration file, the proxy container envoy container pulls the latest target service configuration for load balancing of application requests.
本申请另一实施例提供了一种负载均衡的方法,应用于上述任意一个实施例提供负载均衡器的实现方法所实现的负载均衡器。根据上述可知,在本申请实施例中,负载均衡器即为在网关系统中创建的代理容器envoy container。如图4所示,本申请实施例提供的负载均衡的方法,包括:Another embodiment of the present application provides a load balancing method, which can be applied to the load balancer implemented by the load balancer implementation method provided in any of the above embodiments. According to the above, in the embodiment of this application, the load balancer is the proxy container envoy container created in the gateway system. As shown in Figure 4, the load balancing method provided by the embodiment of the present application includes:
S401、获取应用程序发送的请求。S401. Obtain the request sent by the application.
具体的,用户可以通过应用程序向后端发起请求,此时作为负载均衡器的代理容器envoy container将获取应用程序发送的请求,然后执行步骤S402。Specifically, the user can initiate a request to the backend through the application. At this time, the proxy container envoy container acting as the load balancer will obtain the request sent by the application, and then perform step S402.
S402、基于从网关系统的配置服务XDS server中拉取到的最新的目标服务配置对请求进行负载均衡。S402. Load balance the request based on the latest target service configuration pulled from the configuration service XDS server of the gateway system.
其中,目标服务配置具体包括路由规则以及负载均衡规则等。所以代理容器envoy container基于拉取到的目标服务配置进行路由转发,即进行负载均衡。Among them, the target service configuration specifically includes routing rules and load balancing rules. Therefore, the proxy container envoy container performs routing and forwarding based on the pulled target service configuration, that is, load balancing.
其中,目标服务配置由代理容器envoy container在启动后基于其配置文件中的配置服务XDS server的地址,从配置服务XDS server中拉取到。代理容器envoy container的配置文件由目标主机上的负载均衡网关代理根据创建请求中的创建配置信息创建代理容器envoy container时,根据创建配置信息生成并挂载。目标主机指代多个主机中的任意一台。创建请求时由网关系统中的代理控制器Agent Controller发送。代理容器envoy container由负载均衡网关代理服务利用网关系统中的容器引擎Docker的网络启动。Among them, the target service configuration is pulled from the configuration service XDS server by the proxy container envoy container based on the address of the configuration service XDS server in its configuration file after startup. The configuration file of the proxy container envoy container is generated and mounted based on the creation configuration information when the proxy container envoy container is created by the load balancing gateway proxy on the target host based on the creation configuration information in the creation request. The target host refers to any one of multiple hosts. The creation request is sent by the Agent Controller in the gateway system. The proxy container envoy container is started by the load balancing gateway proxy service using the Docker container engine in the gateway system.
需要说明的是,代理容器envoy container根据具体的实现方式,可相应地参考上述任意一个方法实施例提供负载均衡器的实现方法,此处不再赘述。It should be noted that according to the specific implementation method of the proxy container envoy container, the implementation method of the load balancer can be provided by referring to any of the above method embodiments, which will not be described again here.
本申请实施例提供了一种负载均衡器,所述负载均衡器为在网关系统中创建的代理容器envoy container。如图5所示,本申请实施例提供的负载均衡器,包括:The embodiment of this application provides a load balancer, which is a proxy container envoy container created in the gateway system. As shown in Figure 5, the load balancer provided by this embodiment of the application includes:
获取单元501,用于获取应用程序发送的请求。The obtaining unit 501 is used to obtain the request sent by the application program.
负载均衡单元502,用于基于从所述网关系统的所述配置服务XDS server中拉取到的最新的目标服务配置对所述请求进行负载均衡。The load balancing unit 502 is configured to load balance the request based on the latest target service configuration pulled from the configuration service XDS server of the gateway system.
其中,目标服务配置由代理容器envoy container在启动后基于其配置文件中的配置服务XDS server的地址,从配置服务XDS server中拉取到。代理容器envoy container的配置文件由目标主机上的负载均衡网关代理根据创建请求中的创建配置信息创建代理容器envoy container时,根据创建配置信息生成并挂载。目标主机指代多个主机中的任意一台。创建请求时由网关系统中的代理控制器Agent Controller发送。代理容器envoy container由负载均衡网关代理服务利用网关系统中的容器引擎Docker的网络启动。Among them, the target service configuration is pulled from the configuration service XDS server by the proxy container envoy container based on the address of the configuration service XDS server in its configuration file after startup. The configuration file of the proxy container envoy container is generated and mounted based on the creation configuration information when the proxy container envoy container is created by the load balancing gateway proxy on the target host based on the creation configuration information in the creation request. The target host refers to any one of multiple hosts. The creation request is sent by the Agent Controller in the gateway system. The proxy container envoy container is started by the load balancing gateway proxy service using the Docker container engine in the gateway system.
专业人员还可以进一步意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those skilled in the art may further realize that the units and algorithm steps of each example described in connection with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of both. In order to clearly illustrate the possible functions of hardware and software, Interchangeability, in the above description, the composition and steps of each example have been generally described according to functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Skilled artisans may implement the described functionality using different methods for each specific application, but such implementations should not be considered beyond the scope of this application.
对所公开的实施例的上述说明,使本领域专业技术人员能够实现或使用本申请。对这些实施例的多种修改对本领域的专业技术人员来说将是显而易见的,本文中所定义的一般原理可以在不脱离本申请的精神或范围的情况下,在其它实施例中实现。因此,本申请将不会被限制于本文所示的这些实施例,而是要符合与本文所公开的原理和新颖特点相一致的最宽的范围。The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be practiced in other embodiments without departing from the spirit or scope of the application. Therefore, the present application is not to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims (10)
- 一种负载均衡器的实现方法,其特征在于,应用于网关系统,所述网关系统至少包括网关控制服务以及多台主机,所述网关控制服务包括代理控制器Agent Controller以及配置服务XDS server,每台所述主机部署有容器引擎Docker以及负载均衡网关代理,所述负载均衡器的实现方法,包括:A load balancer implementation method, characterized in that it is applied to a gateway system. The gateway system at least includes a gateway control service and multiple hosts. The gateway control service includes an agent controller Agent Controller and a configuration service XDS server. Each The host is deployed with a container engine Docker and a load balancing gateway agent. The implementation method of the load balancer includes:所述代理控制器Agent Controller向目标主机上的所述负载均衡网关代理发送创建请求;其中,所述创建请求包括创建配置信息;所述目标主机指代所述多个主机中的任意一台;The agent controller Agent Controller sends a creation request to the load balancing gateway agent on the target host; wherein the creation request includes creation configuration information; the target host refers to any one of the multiple hosts;所述目标主机上的所述负载均衡网关代理根据所述创建配置信息创建代理容器envoy container,以及生成并挂载所述代理容器envoy container的配置文件;The load balancing gateway proxy on the target host creates a proxy container envoy container based on the creation configuration information, and generates and mounts the configuration file of the proxy container envoy container;所述负载均衡网关代理服务利用所述容器引擎Docker的网络启动所述代理容器envoy container;The load balancing gateway proxy service uses the network of the container engine Docker to start the proxy container envoy container;所述代理容器envoy container基于所述配置文件中的所述配置服务XDS server的地址,从所述配置服务XDS server中拉取最新的目标服务配置,用于对应用程序的请求进行负载均衡。The proxy container envoy container pulls the latest target service configuration from the configuration service XDS server based on the address of the configuration service XDS server in the configuration file for load balancing application requests.
- 根据权利要求1所述的方法,其特征在于,所述网关系统还包括高可用服务keepalived,所述代理控制器Agent Controller向目标主机上的所述负载均衡网关代理发送创建请求之后,还包括:The method according to claim 1, characterized in that the gateway system also includes a high-availability service keepalived. After the agent controller Agent Controller sends a creation request to the load balancing gateway agent on the target host, it also includes:所述目标主机上的所述负载均衡网关代理调用所述高可用服务keepalived为所述目标主机以及其他备用的所述主机生成对应的IP。The load balancing gateway agent on the target host calls the high-availability service keepalived to generate corresponding IPs for the target host and other backup hosts.
- 根据权利要求1所述的方法,其特征在于,所述负载均衡网关代理服务利用容器引擎Docker的网络启动所述代理容器envoy container之前,还包括:The method according to claim 1, characterized in that before the load balancing gateway proxy service uses the network of the container engine Docker to start the proxy container envoy container, it also includes:所述容器引擎Docker响应网络创建操作,为所述代理容器envoy container创建所述容器引擎Docker的MACVLAN网络;The container engine Docker responds to the network creation operation and creates the MACVLAN network of the container engine Docker for the proxy container envoy container;其中,所述负载均衡网关代理服务利用容器引擎Docker的网络启动所述代理容器envoy container,包括:Among them, the load balancing gateway proxy service uses the network of the container engine Docker to start the proxy container envoy container, including:所述负载均衡网关代理服务调用所述容器引擎Docker的MACVLAN 网络为所述代理容器envoy container分配网络地址,并基于所述网络地址启动所述代理容器envoy container。The load balancing gateway proxy service calls the MACVLAN network of the container engine Docker to allocate a network address to the proxy container envoy container, and starts the proxy container envoy container based on the network address.
- 根据权利要求1所述的方法,其特征在于,所述代理容器envoy container基于所述配置文件中的所述配置服务XDS server的地址,从所述配置服务XDS server中拉取最新的目标服务配置,用于对应用程序的请求进行负载均衡,包括:The method according to claim 1, characterized in that the proxy container envoy container pulls the latest target service configuration from the configuration service XDS server based on the address of the configuration service XDS server in the configuration file. , used to load balance application requests, including:所述代理容器envoy container通过对应的发现机制监听所述配置文件中的所述配置服务XDS server的地址;其中,所述发现机制包括监听动态发现、集群动态发现、服务端点动态发现、路由规则动态发现;The proxy container envoy container monitors the address of the configuration service XDS server in the configuration file through the corresponding discovery mechanism; wherein the discovery mechanism includes monitoring dynamic discovery, cluster dynamic discovery, service endpoint dynamic discovery, and routing rule dynamics. Discover;当监听到所述配置文件中的所述配置服务XDS server的任意地址中的所述目标服务配置更新时,所述代理容器envoy container拉取最新的所述目标服务配置用于对应用程序的请求进行负载均衡。When monitoring the target service configuration update at any address of the configuration service XDS server in the configuration file, the proxy container envoy container pulls the latest target service configuration for requests to the application. Perform load balancing.
- 一种负载均衡的方法,其特征在于,应用于负载均衡器,所述负载均衡器为在网关系统中创建的代理容器envoy container,所述负载均衡的方法,包括:A load balancing method, characterized in that it is applied to a load balancer, and the load balancer is a proxy container envoy container created in the gateway system. The load balancing method includes:获取应用程序发送的请求;Get the request sent by the application;基于从所述网关系统的所述配置服务XDS server中拉取到的最新的目标服务配置对所述请求进行负载均衡;其中,所述目标服务配置由所述代理容器envoy container在启动后基于其配置文件中的配置服务XDS server的地址,从所述配置服务XDS server中拉取到;所述代理容器envoy container的配置文件由目标主机上的负载均衡网关代理根据创建请求中的创建配置信息创建代理容器envoy container时,根据所述创建配置信息生成并挂载;所述目标主机指代所述多个主机中的任意一台;所述创建请求时由所述网关系统中的所述代理控制器Agent Controller发送;所述代理容器envoy container由所述负载均衡网关代理服务利用所述网关系统中的容器引擎Docker的网络启动。The request is load balanced based on the latest target service configuration pulled from the configuration service XDS server of the gateway system; wherein the target service configuration is based on the proxy container envoy container after it is started. The address of the configuration service XDS server in the configuration file is pulled from the configuration service XDS server; the configuration file of the proxy container envoy container is created by the load balancing gateway proxy on the target host based on the creation configuration information in the creation request. When the proxy container envoy container is generated and mounted according to the creation configuration information; the target host refers to any one of the multiple hosts; the creation request is controlled by the proxy in the gateway system Sent by Agent Controller; the proxy container envoy container is started by the load balancing gateway proxy service using the network of the container engine Docker in the gateway system.
- 一种网关系统,其特征在于,包括:A gateway system, characterized by including:网关控制服务以及多台主机;Gateway control services and multiple hosts;所述网关控制服务包括代理控制器Agent Controller以及配置服务 XDS server;The gateway control service includes agent controller Agent Controller and configuration service XDS server;每台所述主机部署有容器引擎Docker以及负载均衡网关代理;Each host is deployed with the container engine Docker and the load balancing gateway agent;所述代理控制器Agent Controller用于向目标主机上的所述负载均衡网关代理发送创建请求;其中,所述创建请求包括创建配置信息;所述目标主机指代所述多个主机中的任意一台;The agent controller Agent Controller is used to send a creation request to the load balancing gateway agent on the target host; wherein the creation request includes creation configuration information; the target host refers to any one of the multiple hosts tower;所述负载均衡网关代理用于根据所述创建配置信息创建代理容器envoy container,以及生成并挂载所述代理容器envoy container的配置文件,并利用所述容器引擎Docker的网络启动所述代理容器envoy container;其中,所述代理容器envoy container在启动后基于所述配置文件中的所述配置服务XDS server的地址,从所述配置服务XDS server中拉取最新的目标服务配置,用于对应用程序的请求进行负载均衡。The load balancing gateway proxy is used to create a proxy container envoy container based on the creation configuration information, generate and mount the configuration file of the proxy container envoy container, and use the network of the container engine Docker to start the proxy container envoy container; wherein, after startup, the proxy container envoy container pulls the latest target service configuration from the configuration service XDS server based on the address of the configuration service XDS server in the configuration file, which is used to configure the application The requests are load balanced.
- 根据权利要求6所述的网关系统,其特征在于,还包括:The gateway system according to claim 6, further comprising:高可用服务keepalived,用于为所述目标主机以及其他备用的所述主机生成对应的IP。The high availability service keepalived is used to generate corresponding IPs for the target host and other backup hosts.
- 根据权利要求6所述的网关系统,其特征在于,所述容器引擎Docker还用于:The gateway system according to claim 6, characterized in that the container engine Docker is also used for:响应网络创建操作,为所述代理容器envoy container创建所述容器引擎Docker的MACVLAN网络;In response to the network creation operation, create the MACVLAN network of the container engine Docker for the proxy container envoy container;其中,所述负载均衡网关代理服务利用容器引擎Docker的网络启动所述代理容器envoy container时,用于:Wherein, when the load balancing gateway proxy service uses the network of the container engine Docker to start the proxy container envoy container, it is used for:调用所述容器引擎Docker的MACVLAN网络为所述代理容器envoy container分配网络地址,并基于所述网络地址启动所述代理容器envoy container。Call the MACVLAN network of the container engine Docker to allocate a network address to the proxy container envoy container, and start the proxy container envoy container based on the network address.
- 根据权利要求6所述的网关系统,其特征在于,所述代理容器envoy container基于所述配置文件中的所述配置服务XDS server的地址,从所述配置服务XDS server中拉取最新的目标服务配置,用于对应用程序的请求进行负载均衡时,用于:The gateway system according to claim 6, wherein the proxy container envoy container pulls the latest target service from the configuration service XDS server based on the address of the configuration service XDS server in the configuration file. Configuration, used when load balancing requests to an application, is used to:通过对应的发现机制监听所述配置文件中的所述配置服务XDS server的地址;其中,所述发现机制包括监听动态发现、集群动态发现、服务端 点动态发现、路由规则动态发现;Monitor the address of the configuration service XDS server in the configuration file through the corresponding discovery mechanism; wherein the discovery mechanism includes monitoring dynamic discovery, cluster dynamic discovery, service endpoint dynamic discovery, and routing rule dynamic discovery;当监听到所述配置文件中的所述配置服务XDS server的任意地址中的所述目标服务配置更新时,拉取最新的所述目标服务配置用于对应用程序的请求进行负载均衡。When the target service configuration update in any address of the configuration service XDS server in the configuration file is monitored, the latest target service configuration is pulled for load balancing of application requests.
- 一种负载均衡器,其特征在于,所述负载均衡器为在网关系统中创建的代理容器envoy container,所述负载均衡器,包括:A load balancer, characterized in that the load balancer is a proxy container envoy container created in the gateway system, and the load balancer includes:获取单元,用于获取应用程序发送的请求;Acquisition unit, used to obtain requests sent by the application;负载均衡单元,用于基于从所述网关系统的所述配置服务XDS server中拉取到的最新的目标服务配置对所述请求进行负载均衡;其中,所述目标服务配置由所述代理容器envoy container在启动后基于其配置文件中的配置服务XDS server的地址,从所述配置服务XDS server中拉取到;所述代理容器envoy container的配置文件由目标主机上的负载均衡网关代理根据创建请求中的创建配置信息创建代理容器envoy container时,根据所述创建配置信息生成并挂载;所述目标主机指代所述多个主机中的任意一台;所述创建请求时由所述网关系统中的所述代理控制器Agent Controller发送;所述代理容器envoy container由所述负载均衡网关代理服务利用所述网关系统中的容器引擎Docker的网络启动。A load balancing unit, configured to load balance the request based on the latest target service configuration pulled from the configuration service XDS server of the gateway system; wherein the target service configuration is configured by the proxy container envoy After the container is started, it is pulled from the configuration service XDS server based on the address of the configuration service XDS server in its configuration file; the configuration file of the proxy container envoy container is created by the load balancing gateway proxy on the target host according to the creation request When creating the proxy container envoy container, it is generated and mounted according to the creation configuration information; the target host refers to any one of the multiple hosts; when the creation request is made, the gateway system The agent controller in Agent Controller sends; the agent container envoy container is started by the network of the load balancing gateway agent service using the container engine Docker in the gateway system.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210317360.9A CN114640633B (en) | 2022-03-29 | 2022-03-29 | Load balancer, realization method thereof, load balancing method and gateway system |
CN202210317360.9 | 2022-03-29 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2023184925A1 true WO2023184925A1 (en) | 2023-10-05 |
Family
ID=81952216
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2022/124069 WO2023184925A1 (en) | 2022-03-29 | 2022-10-09 | Load balancer and implementation method therefor, load balancing method, and gateway system |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN114640633B (en) |
WO (1) | WO2023184925A1 (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117978611A (en) * | 2024-01-19 | 2024-05-03 | 广东慧云科技股份有限公司 | Operation and maintenance management system |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114640633B (en) * | 2022-03-29 | 2024-04-05 | 京东科技信息技术有限公司 | Load balancer, realization method thereof, load balancing method and gateway system |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP2692095A1 (en) * | 2011-03-28 | 2014-02-05 | Telefonaktiebolaget LM Ericsson (PUBL) | Method, apparatus and computer program product for updating load balancer configuration data |
CN106790595A (en) * | 2016-12-29 | 2017-05-31 | 上海理想信息产业(集团)有限公司 | A kind of Docker containers active load balancer and method |
CN107426034A (en) * | 2017-08-18 | 2017-12-01 | 国网山东省电力公司信息通信公司 | A kind of extensive container scheduling system and method based on cloud platform |
CN113067739A (en) * | 2021-04-29 | 2021-07-02 | 中国工商银行股份有限公司 | High-density container network deployment method and system |
CN113949707A (en) * | 2021-09-30 | 2022-01-18 | 上海浦东发展银行股份有限公司 | OpenResty and K8S-based container cloud service discovery and load balancing method |
CN114640633A (en) * | 2022-03-29 | 2022-06-17 | 京东科技信息技术有限公司 | Load balancer, implementation method thereof, load balancing method and gateway system |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106302771A (en) * | 2016-08-23 | 2017-01-04 | 浪潮电子信息产业股份有限公司 | Domain name configuration method of application created based on Docker container |
US10841226B2 (en) * | 2019-03-29 | 2020-11-17 | Juniper Networks, Inc. | Configuring service load balancers with specified backend virtual networks |
KR20210127564A (en) * | 2020-04-14 | 2021-10-22 | 삼성전자주식회사 | Method and apparatus for dynamic and efficient load balancing in mobile communication network |
CN113835825B (en) * | 2021-03-03 | 2024-08-20 | 京东科技控股股份有限公司 | Dynamic adjustment method and device of virtual service host, server and storage medium |
CN113556267A (en) * | 2021-07-20 | 2021-10-26 | 全球能源互联网研究院有限公司 | Terminal equipment state monitoring method and system and edge Internet of things proxy gateway |
-
2022
- 2022-03-29 CN CN202210317360.9A patent/CN114640633B/en active Active
- 2022-10-09 WO PCT/CN2022/124069 patent/WO2023184925A1/en unknown
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP2692095A1 (en) * | 2011-03-28 | 2014-02-05 | Telefonaktiebolaget LM Ericsson (PUBL) | Method, apparatus and computer program product for updating load balancer configuration data |
CN106790595A (en) * | 2016-12-29 | 2017-05-31 | 上海理想信息产业(集团)有限公司 | A kind of Docker containers active load balancer and method |
CN107426034A (en) * | 2017-08-18 | 2017-12-01 | 国网山东省电力公司信息通信公司 | A kind of extensive container scheduling system and method based on cloud platform |
CN113067739A (en) * | 2021-04-29 | 2021-07-02 | 中国工商银行股份有限公司 | High-density container network deployment method and system |
CN113949707A (en) * | 2021-09-30 | 2022-01-18 | 上海浦东发展银行股份有限公司 | OpenResty and K8S-based container cloud service discovery and load balancing method |
CN114640633A (en) * | 2022-03-29 | 2022-06-17 | 京东科技信息技术有限公司 | Load balancer, implementation method thereof, load balancing method and gateway system |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117978611A (en) * | 2024-01-19 | 2024-05-03 | 广东慧云科技股份有限公司 | Operation and maintenance management system |
Also Published As
Publication number | Publication date |
---|---|
CN114640633B (en) | 2024-04-05 |
CN114640633A (en) | 2022-06-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11611592B1 (en) | Multiple-master DNS system | |
WO2023184925A1 (en) | Load balancer and implementation method therefor, load balancing method, and gateway system | |
US10171567B2 (en) | Load balancing computer device, system, and method | |
EP3490224B1 (en) | Data synchronization method and system | |
CN111615066B (en) | Distributed micro-service registration and calling method based on broadcast | |
US6996617B1 (en) | Methods, systems and computer program products for non-disruptively transferring a virtual internet protocol address between communication protocol stacks | |
JP2017507575A (en) | Proxy server failover and load clustering | |
US11153269B2 (en) | On-node DHCP implementation for virtual machines | |
JP2011507426A (en) | Method, system, and program for failover in a host that simultaneously supports multiple virtual IP addresses across multiple adapters | |
US11178218B2 (en) | Bidirectional communication clusters | |
EP3058700B1 (en) | Communication system architecture | |
US11997015B2 (en) | Route updating method and user cluster | |
WO2013097484A1 (en) | Method, server and system for balancing loads of virtual machine cluster | |
JP2005295124A (en) | Path table synchronizing method, network device, and path table synchronizing program | |
WO2023207189A1 (en) | Load balancing method and system, computer storage medium, and electronic device | |
US20160226963A1 (en) | Load balancing using predictable state partitioning | |
CN111756780B (en) | Method for synchronizing connection information and load balancing system | |
WO2023221990A1 (en) | Udp message distribution method, device and readable storage medium | |
TWI834078B (en) | One-stop setting system and method applied to virtual and hardware firewall | |
WO2022161501A1 (en) | Method for processing multiple data flows, and related system | |
JP6643123B2 (en) | Management server system, system, system method and program | |
CN109731345B (en) | Voice processing method and device, electronic equipment and storage medium | |
JP2013003982A (en) | Load distribution system, load distribution device and server device | |
CN116743845B (en) | Edge service discovery method, device, node equipment and readable storage medium | |
CN116781701A (en) | Message processing method, device, electronic equipment and storage medium |
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: 22934743 Country of ref document: EP Kind code of ref document: A1 |