CN116455730A - A method, system and controller for active/standby switching - Google Patents
A method, system and controller for active/standby switching Download PDFInfo
- Publication number
- CN116455730A CN116455730A CN202310227657.0A CN202310227657A CN116455730A CN 116455730 A CN116455730 A CN 116455730A CN 202310227657 A CN202310227657 A CN 202310227657A CN 116455730 A CN116455730 A CN 116455730A
- Authority
- CN
- China
- Prior art keywords
- bare metal
- metal server
- proxy
- server node
- proxy gateway
- Prior art date
- Legal status (The legal status 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 status listed.)
- Pending
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
- H04L41/06—Management of faults, events, alarms or notifications
- H04L41/0654—Management of faults, events, alarms or notifications using network fault recovery
- H04L41/0663—Performing the actions predefined by failover planning, e.g. switching to standby network elements
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
Description
技术领域technical field
本发明涉及数据通信领域,尤其涉及一种主备切换方法、系统及控制器。The invention relates to the field of data communication, in particular to a master-standby switching method, system and controller.
背景技术Background technique
随着数据中心带宽的不断增加以及云计算的兴起,对服务器网络处理能力的要求越来越高,同时随着VXLAN(Virtual Extensible Local Area Network,虚拟可扩展局域网)等复杂技术以及SDN(Software Defined Network,软件定义网络)的推广,需要花费更多的服务器CPU(Central Processing Unit,中央处理器)进行处理。在这种背景下,智能网卡应运而生,在服务器侧引入智能网卡后,可以将服务器的某些业务能力卸载到智能网卡上执行,极大的提升了服务器整体的数据处理能力,释放了CPU的算力。With the continuous increase of data center bandwidth and the rise of cloud computing, the requirements for server network processing capabilities are getting higher and higher. At the same time, with complex technologies such as VXLAN (Virtual Extensible Local Area Network, virtual scalable local Network, software-defined network) promotion, need to spend more server CPU (Central Processing Unit, central processing unit) for processing. In this context, the smart network card came into being. After the smart network card is introduced on the server side, some business capabilities of the server can be offloaded to the smart network card for execution, which greatly improves the overall data processing capability of the server and frees up the CPU. computing power.
在智能网卡的应用过程中,对于使用不支持网络卸载的智能网卡或者使用标准网卡的场景中,尤其在数据中心的BMS(Bare Metal Server,裸金属服务器)节点上使用标准网卡或者使用不支持网络卸载的智能网卡时,OVS(Open Virtual Switch,开放虚拟交换机)组件需要运行在服务器之外的一个代理节点上进行专门的网络业务处理。但是这些代理节点的可靠性以及代理节点出现故障后如何恢复业务,是实际应用中亟待解决的技术问题。In the application process of smart network cards, for scenarios where smart network cards that do not support network offloading or standard network When the intelligent network card is uninstalled, the OVS (Open Virtual Switch, open virtual switch) component needs to run on an agent node other than the server for specialized network service processing. However, the reliability of these proxy nodes and how to restore the business after the proxy node fails are technical problems that need to be solved urgently in practical applications.
发明内容Contents of the invention
为解决上述技术问题,本发明实施例提供了一种主备切换方法、系统及控制器,用以解决代理节点可靠性不足,代理节点异常后如何快速恢复业务的技术问题。In order to solve the above-mentioned technical problems, the embodiment of the present invention provides a master/standby switchover method, system and controller, which are used to solve the technical problems of insufficient reliability of the proxy node and how to quickly restore the service after the proxy node is abnormal.
第一方面,本发明实施例提供了一种主备切换方法,应用于一种主备切换系统,所述系统包括控制器、至少两个代理网关以及至少一个裸金属服务器节点,所述控制器与所述至少两个代理网关通信连接,所述至少两个代理网关与所述至少一个裸金属服务器节点通信连接,所述控制器中存储有所述至少一个裸金属服务器节点对应的主代理网关和备代理网关的对应关系表,所述方法包括:In the first aspect, the embodiment of the present invention provides an active/standby switchover method, which is applied to an active/standby switchover system, and the system includes a controller, at least two agent gateways, and at least one bare metal server node, and the controller Communicatively connected to the at least two proxy gateways, the at least two proxy gateways are communicatively connected to the at least one bare metal server node, and the master proxy gateway corresponding to the at least one bare metal server node is stored in the controller and the corresponding relationship table of the standby proxy gateway, the method includes:
所述控制器检测到任一代理网关异常,依据所述对应关系表,获取以所述任一代理网关为主代理网关的第一裸金属服务器节点;The controller detects that any proxy gateway is abnormal, and obtains the first bare metal server node with any proxy gateway as the primary proxy gateway according to the correspondence table;
所述控制器按照预设规则从所述第一裸金属服务器节点对应的备代理网关中,为所述第一裸金属服务器节点选举出新的主代理网关,以使所述新的主代理网关处理所述第一裸金属服务器节点发送的报文。The controller elects a new master proxy gateway for the first bare metal server node from the backup proxy gateways corresponding to the first bare metal server node according to preset rules, so that the new master proxy gateway Processing the message sent by the first bare metal server node.
本发明实施例提供的一种主备切换方法,裸金属服务器节点不感知代理网关的存在,当主代理网关出现异常后,可以让裸金属服务器节点无感知的将业务流量转发到新的主代理网关,从而快速恢复客户业务。In the active/standby switching method provided by the embodiment of the present invention, the bare metal server node is not aware of the existence of the proxy gateway, and when the primary proxy gateway is abnormal, the bare metal server node can forward the business traffic to the new primary proxy gateway without awareness , so as to quickly restore customer business.
在一种可能的实施方式中,所述控制器按照预设规则从所述第一裸金属服务器节点对应的备代理网关中,为所述第一裸金属服务器节点选举出新主代理网关,包括:In a possible implementation manner, the controller elects a new master proxy gateway for the first bare metal server node from the standby proxy gateways corresponding to the first bare metal server node according to preset rules, including :
所述控制器获取所述第一裸金属服务器节点对应的每个备代理网关处理的裸金属服务器节点的IP地址数,选择处理的裸金属服务器节点的IP地址数最少的备代理网关为新的主代理网关;The controller obtains the number of IP addresses of the bare metal server nodes processed by each standby proxy gateway corresponding to the first bare metal server node, and selects the standby proxy gateway with the least number of IP addresses of the processed bare metal server nodes as the new main proxy gateway;
和/或,所述控制器获取所述第一裸金属服务器节点对应的每个备代理网关处理的流表条目数,选择处理的流表条目数最少的备代理网关为新的主代理网关。And/or, the controller acquires the number of flow table entries processed by each standby proxy gateway corresponding to the first bare metal server node, and selects the standby proxy gateway with the least number of processed flow table entries as the new primary proxy gateway.
在一种可能的实施方式中,在所述控制器检测到所述任一代理网关异常之前,所述方法还包括:In a possible implementation manner, before the controller detects that any of the proxy gateways is abnormal, the method further includes:
所述控制器为每个裸金属服务器节点配置主代理网关和备代理网关,并将每个裸金属服务器节点与主代理网关和备代理网关的对应关系存储在本地的所述对应关系表中;所述控制器为所有的主代理网关配置相同的虚拟IP地址和不同的虚拟MAC地址;The controller configures a master proxy gateway and a backup proxy gateway for each bare metal server node, and stores the correspondence between each bare metal server node and the master proxy gateway and backup proxy gateway in the local correspondence table; The controller configures the same virtual IP address and different virtual MAC addresses for all master proxy gateways;
所述控制器获取所述对应关系表中的每个裸金属服务器节点的关键信息,并依据每个裸金属服务器节点的关键信息创建第一代理流表,并下发给该裸金属服务器节点对应的主代理网关,其中,所述第一代理流表中包括该主代理网关的虚拟IP地址和虚拟MAC地址、对应的裸金属服务器节点的关键信息;The controller obtains the key information of each bare metal server node in the correspondence table, creates a first proxy flow table according to the key information of each bare metal server node, and sends it to the corresponding BMS node. The primary proxy gateway, wherein the first proxy flow table includes the virtual IP address and virtual MAC address of the primary proxy gateway, and the key information of the corresponding bare metal server node;
每个主代理网关接收到所述第一代理流表后,获取所述第一代理流表中对应的裸金属服务器节点的关键信息,并基于所述对应的裸金属服务器节点的关键信息以及所述虚拟IP地址和虚拟MAC地址构造第一ARP报文,并将所述第一ARP报文发送给所述对应的裸金属服务器节点;After receiving the first proxy flow table, each main proxy gateway obtains the key information of the corresponding bare metal server node in the first proxy flow table, and based on the key information of the corresponding bare metal server node and the The virtual IP address and the virtual MAC address construct a first ARP message, and send the first ARP message to the corresponding bare metal server node;
所述对应的裸金属服务器节点接收到所述第一ARP报文后,生成本地ARP表项,以使所述对应的裸金属服务器节点依据所述ARP表项与目的端进行通信。After receiving the first ARP message, the corresponding bare metal server node generates a local ARP entry, so that the corresponding bare metal server node communicates with the destination end according to the ARP entry.
在本发明实施例提供的一种主备切换方法,不需要裸金属服务器节点和代理网关之间进行保活等协议的交互,所有的代理网关都使用同一个虚拟的IP地址,使得裸金属服务器节点不感知代理网关的存在。同时,代理网关节点的数量可以根据用户需求进行灵活配置。In the active/standby switchover method provided by the embodiment of the present invention, there is no need for protocol interaction between the bare metal server node and the proxy gateway, and all proxy gateways use the same virtual IP address, so that the bare metal server Nodes are not aware of the existence of proxy gateways. At the same time, the number of proxy gateway nodes can be flexibly configured according to user needs.
在一种可能的实施方式中,在所述控制器按照预设规则从所述第一裸金属服务器节点对应的备代理网关中,为所述第一裸金属服务器节点选举出新的主代理网关之后,所述方法还包括:In a possible implementation manner, the controller elects a new primary proxy gateway for the first bare metal server node from the standby proxy gateways corresponding to the first bare metal server node according to preset rules Afterwards, the method also includes:
所述控制器依据所述对应关系表,获取以所述新的主代理网关为主代理网关的第二裸金属服务器节点,并依据所述第二裸金属服务器节点的关键信息创建第二代理流表,并下发给所述新的主代理网关,所述第二代理流表中包括所述新的主代理网关的虚拟IP地址和虚拟MAC地址、所述第二裸金属服务器节点的关键信息;The controller acquires a second bare metal server node using the new primary proxy gateway as the primary proxy gateway according to the correspondence table, and creates a second proxy flow according to key information of the second bare metal server node table, and send it to the new main proxy gateway, the second proxy flow table includes the virtual IP address and virtual MAC address of the new main proxy gateway, and the key information of the second bare metal server node ;
所述新的主代理网关接收到所述第二代理流表后,获取所述第二代理流表中所述第二裸金属服务器节点的关键信息,并基于所述第二裸金属服务器节点的关键信息以及所述新的主代理网关的虚拟IP地址和虚拟MAC地址构造第二ARP报文,并将所述第二ARP报文发送给所述第二裸金属服务器节点;After the new main proxy gateway receives the second proxy flow table, obtains the key information of the second bare metal server node in the second proxy flow table, and based on the second bare metal server node The key information and the virtual IP address and virtual MAC address of the new main agent gateway construct a second ARP message, and send the second ARP message to the second bare metal server node;
所述第二裸金属服务器节点接收到所述第二ARP报文后,更新本地ARP表项,以使所述第二裸金属服务器节点依据更新后的ARP表项与目的端进行通信。After receiving the second ARP message, the second bare metal server node updates a local ARP entry, so that the second bare metal server node communicates with the destination end according to the updated ARP entry.
第二方面,本发明实施例提供了一种主备切换方法,应用于一种主备切换系统中的控制器,所述控制器与至少两个代理网关通信连接,所述至少两个代理网关与至少一个裸金属服务器节点通信连接,所述控制器中存储有所述至少一个裸金属服务器节点对应的主代理网关和备代理网关的对应关系表,所述方法包括:In the second aspect, the embodiment of the present invention provides an active-standby switchover method, which is applied to a controller in an active-standby switchover system, the controller communicates with at least two proxy gateways, and the at least two proxy gateways Communicatively connected to at least one bare metal server node, the controller stores a corresponding relationship table between the primary agent gateway and the standby agent gateway corresponding to the at least one bare metal server node, and the method includes:
检测到任一代理网关异常,依据所述对应关系表,获取以所述任一代理网关为主代理网关的第一裸金属服务器节点;An abnormality of any proxy gateway is detected, and according to the corresponding relationship table, the first bare metal server node using the proxy gateway as the primary proxy gateway is obtained;
按照预设规则从所述第一裸金属服务器节点对应的备代理网关中,为所述第一裸金属服务器节点选举出新的主代理网关,以使所述新的主代理网关处理所述第一裸金属服务器节点发送的报文。Elect a new master proxy gateway for the first bare metal server node from the standby proxy gateways corresponding to the first bare metal server node according to preset rules, so that the new master proxy gateway processes the first bare metal server node. A message sent by a BMS node.
在一种可能的实施方式中,所述按照预设规则从所述第一裸金属服务器节点对应的备代理网关中,为所述第一裸金属服务器节点选举出新主代理网关,包括:In a possible implementation manner, the electing a new master proxy gateway for the first bare metal server node from the backup proxy gateways corresponding to the first bare metal server node according to preset rules includes:
获取所述第一裸金属服务器节点对应的每个备代理网关处理的裸金属服务器节点的IP地址数,选择处理的裸金属服务器节点的IP地址数最少的备代理网关为新的主代理网关;Obtain the number of IP addresses of the bare metal server nodes processed by each standby proxy gateway corresponding to the first bare metal server node, and select the standby proxy gateway with the least number of IP addresses of the processed bare metal server nodes as the new primary proxy gateway;
和/或,获取所述第一裸金属服务器节点对应的每个备代理网关处理的流表条目数,选择处理的流表条目数最少的备代理网关为新的主代理网关。And/or, acquire the number of flow table entries processed by each standby proxy gateway corresponding to the first bare metal server node, and select the standby proxy gateway with the least number of processed flow table entries as the new primary proxy gateway.
在一种可能的实施方式中,在所述检测到所述任一代理网关异常之前,所述方法还包括:In a possible implementation manner, before the detection of the abnormality of any of the proxy gateways, the method further includes:
为每个裸金属服务器节点配置主代理网关和备代理网关,并将每个裸金属服务器节点与主代理网关和备代理网关的对应关系存储在本地的所述对应关系表中;为所有的主代理网关配置相同的虚拟IP地址和不同的虚拟MAC地址;Configure a master proxy gateway and a backup proxy gateway for each bare metal server node, and store the corresponding relationship between each bare metal server node and the master proxy gateway and backup proxy gateway in the local correspondence table; The proxy gateway is configured with the same virtual IP address and different virtual MAC addresses;
获取所述对应关系表中的每个裸金属服务器节点的关键信息,并依据每个裸金属服务器节点的关键信息创建第一代理流表,并下发给该裸金属服务器节点对应的主代理网关,以使该主代理网关接收到所述第一代理流表后,获取所述第一代理流表中对应的裸金属服务器节点的关键信息,并基于所述对应的裸金属服务器节点的关键信息以及所述虚拟IP地址和虚拟MAC地址构造第一ARP报文,并将所述第一ARP报文发送给所述对应的裸金属服务器节点,触发所述对应的裸金属服务器节点依据所述第一ARP报文生成本地ARP表项,以使所述对应的裸金属服务器节点依据所述ARP表项与目的端进行通信;Obtain the key information of each bare metal server node in the correspondence table, create a first proxy flow table according to the key information of each bare metal server node, and send it to the main proxy gateway corresponding to the bare metal server node so that after receiving the first proxy flow table, the main proxy gateway obtains the key information of the corresponding bare metal server node in the first proxy flow table, and based on the key information of the corresponding bare metal server node And the virtual IP address and the virtual MAC address construct a first ARP message, and send the first ARP message to the corresponding BMS node, triggering the corresponding BMS node according to the first ARP message An ARP message generates a local ARP entry, so that the corresponding bare metal server node communicates with the destination end according to the ARP entry;
其中,所述第一代理流表中包括该主代理网关的虚拟IP地址和虚拟MAC地址、对应的裸金属服务器节点的关键信息。Wherein, the first proxy flow table includes the virtual IP address and virtual MAC address of the main proxy gateway, and key information of the corresponding bare metal server node.
在一种可能的实施方式中,在所述按照预设规则从所述第一裸金属服务器节点对应的备代理网关中,为所述第一裸金属服务器节点选举出新的主代理网关之后,所述方法还包括:In a possible implementation manner, after selecting a new master proxy gateway for the first bare metal server node from the backup proxy gateways corresponding to the first bare metal server node according to preset rules, The method also includes:
依据所述对应关系表,获取以所述新的主代理网关为主代理网关的第二裸金属服务器节点,并依据所述第二裸金属服务器节点的关键信息创建第二代理流表,并下发给所述新的主代理网关,以使所述新的主代理网关接收到所述第二代理流表后,获取所述第二代理流表中所述第二裸金属服务器节点的关键信息,并基于所述第二裸金属服务器节点的关键信息以及所述新的主代理网关的虚拟IP地址和虚拟MAC地址构造第二ARP报文,并将所述第二ARP报文发送给所述第二裸金属服务器节点,触发所述第二裸金属服务器节点依据所述第二ARP报文更新本地ARP表项,以使所述第二裸金属服务器节点依据更新后的ARP表项与目的端进行通信;According to the correspondence table, obtain the second bare metal server node with the new primary proxy gateway as the primary proxy gateway, and create a second proxy flow table according to the key information of the second bare metal server node, and download sending to the new primary proxy gateway, so that the new primary proxy gateway obtains the key information of the second bare metal server node in the second proxy flow table after receiving the second proxy flow table , and construct a second ARP message based on the key information of the second bare metal server node and the virtual IP address and virtual MAC address of the new master proxy gateway, and send the second ARP message to the The second bare metal server node triggers the second bare metal server node to update the local ARP entry according to the second ARP message, so that the second bare metal server node can communicate with the destination end according to the updated ARP entry communicate;
其中,所述第二代理流表中包括所述新的主代理网关的虚拟IP地址和虚拟MAC地址、所述第二裸金属服务器节点的关键信息。Wherein, the second proxy flow table includes the virtual IP address and virtual MAC address of the new master proxy gateway, and key information of the second bare metal server node.
第三方面,本发明实施例提供了一种主备切换系统,所述系统包括控制器、至少两个代理网关以及至少一个裸金属服务器节点,所述控制器与所述至少两个代理网关通信连接,所述至少两个代理网关与所述至少一个裸金属服务器节点通信连接,所述控制器用于执行如上述第二方面所述的主备切换方法。In a third aspect, an embodiment of the present invention provides an active/standby switchover system, the system includes a controller, at least two agent gateways, and at least one bare metal server node, and the controller communicates with the at least two agent gateways The at least two proxy gateways are connected in communication with the at least one bare metal server node, and the controller is configured to execute the active/standby switching method as described in the second aspect above.
第四方面,本发明实施例提供了一种控制器,包括处理器,所述处理器和存储器耦合,所述存储器存储有程序,当所述存储器存储的程序指令被所述处理器执行时实现如上述第二方面所述的主备切换方法。In a fourth aspect, an embodiment of the present invention provides a controller, including a processor, the processor is coupled to a memory, the memory stores a program, and when the program instructions stored in the memory are executed by the processor, the The active/standby switching method as described in the second aspect above.
本发明实施例提供的一种主备切换方法、系统及控制器,裸金属服务器节点不感知代理网关的存在,当主代理网关出现异常后,可以让裸金属服务器节点无感知的将业务流量转发到新的主代理网关,从而快速恢复客户业务。本发明不需要裸金属服务器节点和代理网关之间进行保活等协议的交互,所有的代理网关都使用同一个虚拟的IP地址,使得裸金属服务器节点不感知代理网关的存在。同时,代理网关节点的数量可以根据用户需求进行灵活配置。In the active-standby switching method, system and controller provided by the embodiments of the present invention, the bare metal server node does not perceive the existence of the proxy gateway, and when the primary proxy gateway is abnormal, the bare metal server node can forward the business traffic to A new master proxy gateway to quickly restore customer business. The present invention does not require the protocol interaction between the bare metal server node and the proxy gateway, and all the proxy gateways use the same virtual IP address, so that the bare metal server node does not perceive the existence of the proxy gateway. At the same time, the number of proxy gateway nodes can be flexibly configured according to user needs.
附图说明Description of drawings
为了更清楚地说明本发明实施例的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following will briefly introduce the accompanying drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only some of the present invention. Embodiments, for those of ordinary skill in the art, other drawings can also be obtained based on these drawings without any creative effort.
图1为本发明实施例一种示例的系统架构示意图;FIG. 1 is a schematic diagram of a system architecture of an example of an embodiment of the present invention;
图2为本发明实施例另一种示例的系统架构示意图;FIG. 2 is a schematic diagram of the system architecture of another example of the embodiment of the present invention;
图3为本发明实施例的一种主备切换方法的流程示意图。Fig. 3 is a schematic flow chart of an active/standby switching method according to an embodiment of the present invention.
具体实施方式Detailed ways
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.
本发明实施例描述的系统架构以及业务场景是为了更加清楚的说明本发明实施例的技术方案,并不构成对于本发明实施例提供的技术方案的限定,本领域普通技术人员可知,随着系统架构的演变和新业务场景的出现,本发明实施例提供的技术方案对于类似的技术问题,同样适用。The system architecture and business scenarios described in the embodiments of the present invention are to illustrate the technical solutions of the embodiments of the present invention more clearly, and do not constitute limitations on the technical solutions provided by the embodiments of the present invention. The evolution of the architecture and the emergence of new business scenarios, the technical solutions provided by the embodiments of the present invention are also applicable to similar technical problems.
下面结合具体实施例对上述方法进行详细描述。The above method will be described in detail below in conjunction with specific embodiments.
随着智能网卡的应用,尤其是在数据中心的BMS节点上使用标准网卡或者使用不支持网络卸载的智能网卡时,OVS组件需要运行在服务器之外的一个代理节点上进行专门的网络业务处理。但是这些代理节点的可靠性以及代理节点出现异常后如何恢复业务,是实际应用中亟待解决的技术问题。With the application of smart network cards, especially when standard network cards or smart network cards that do not support network offloading are used on the BMS node of the data center, the OVS component needs to run on an agent node other than the server for specialized network business processing. However, the reliability of these proxy nodes and how to restore the business after the proxy node is abnormal are technical problems that need to be solved urgently in practical applications.
为了解决上述技术问题,本发明实施例提供了一种主备切换系统,该系统包括控制器、至少两个代理网关以及至少一个裸金属服务器节点。其中,控制器与至少两个代理网关通信连接,主要用于管理控制,比如流表下发、状态检测以及控制ARP(AddressResolution Protocol,地址解析协议)发包等。至少两个代理网关与至少一个裸金属服务器节点通信连接,代理网关上运行有OVS组件,用于对裸金属服务器节点的业务进行处理,代理网关可以是通过软件实现后运行在某台服务器上,也可以是通过智能网卡等硬件产品实现。In order to solve the above technical problems, an embodiment of the present invention provides an active/standby switchover system, which includes a controller, at least two agent gateways, and at least one bare metal server node. Wherein, the controller communicates with at least two proxy gateways, and is mainly used for management control, such as flow table distribution, status detection, and control of ARP (Address Resolution Protocol, address resolution protocol) packet distribution. At least two proxy gateways communicate with at least one bare metal server node. The OVS component runs on the proxy gateway to process the business of the bare metal server node. The proxy gateway can be implemented by software and run on a certain server. It may also be implemented through hardware products such as smart network cards.
实施例1Example 1
如图1所示,为本发明实施例的系统架构示意图,其中,控制器与n(n≥2,n为自然数)个代理网关通信连接,n个代理网关与m(m≥1,m为自然数)个BMS节点通信链接,在该系统架构下,控制器为每个裸金属服务器节点配置主代理网关和备代理网关,其中,可以基于用户需求为每个裸金属服务器节点配置一个或多个主代理网关,并配置至少一个备代理网关。如可以为BMS1设置1个主代理网关、2个备代理网关。为BMS2设置1个主代理网关、3个备代理网关等。As shown in Figure 1, it is a schematic diagram of the system architecture of the embodiment of the present invention, wherein, the controller communicates with n (n ≥ 2, n is a natural number) proxy gateways, and n proxy gateways communicate with m (m ≥ 1, m is natural number) BMS node communication links, under this system architecture, the controller configures a primary agent gateway and a backup agent gateway for each bare metal server node, wherein, one or more agent gateways can be configured for each bare metal server node based on user requirements The main proxy gateway, and configure at least one backup proxy gateway. For example, one main agent gateway and two standby agent gateways can be set for BMS1. Set up 1 primary proxy gateway, 3 backup proxy gateways, etc. for BMS2.
控制器将裸金属服务器节点与主备代理网关的对应关系存储在本地的对应关系表中。控制器依据该对应关系表可以获取到任一代理网关所代理的裸金属服务器节点信息,从而向该任一代理网关下发相应的代理流表,以实现该任一代理网关依据代理流表处理对应的裸金属服务器节点发送的报文。The controller stores the correspondence between the bare metal server nodes and the active and standby proxy gateways in a local correspondence table. According to the corresponding relationship table, the controller can obtain the information of the bare metal server node proxied by any proxy gateway, so as to send the corresponding proxy flow table to any proxy gateway, so as to realize the processing by any proxy gateway according to the proxy flow table The packet sent by the corresponding bare metal server node.
在本发明实施例中,当控制器检测到任一代理网关异常时,依据对应关系表,获取以该任一代理网关为主代理网关的第一裸金属服务器节点信息,这里获取到的第一裸金属服务器节点可能只有一个,也可能有多个,如果以该任一代理网关为主代理网关的第一裸金属服务器节点只有一个,则按照预设规则从这个第一裸金属服务器节点对应的备代理网关中选举出一个新的主代理网关,以使该新的主代理网关处理该第一裸金属服务器节点发送的报文。如果以该任一代理网关为主代理网关的第一裸金属服务器节点有多个,则分别为每个第一裸金属服务器节点从各自对应的备代理网关中选择出各自的新的主代理网关。其中,每个第一裸金属服务器节点的主备代理网关可能相同,也可能不同,需要基于用户需求在控制器上进行相应的配置。In the embodiment of the present invention, when the controller detects that any proxy gateway is abnormal, it obtains the first bare metal server node information with any proxy gateway as the primary proxy gateway according to the corresponding relationship table. The obtained first There may be only one bare metal server node, or there may be multiple ones. If there is only one first bare metal server node with any proxy gateway as the primary proxy gateway, the corresponding A new master proxy gateway is elected from the standby proxy gateways, so that the new master proxy gateway processes the message sent by the first bare metal server node. If there are multiple first BMS nodes with any proxy gateway as the primary proxy gateway, select a new primary proxy gateway for each first BMS node from the corresponding backup proxy gateways . Wherein, the active and standby proxy gateways of each first bare metal server node may be the same or different, and corresponding configurations need to be performed on the controller based on user requirements.
本发明实施例提供的一种主备切换系统,通过控制器为裸金属服务器节点配置主备代理网关,且在主代理网关异常后,为裸金属服务器节点选择新的主代理网关,实现了裸金属服务器节点不需要感知代理网关的存在,当主代理网关出现异常后,可以让裸金属服务器无感知的将业务流量转发到新的主代理网关,从而快速恢复客户业务。本发明不需要裸金属服务器节点和代理网关之间进行保活等协议的交互,代理网关节点的数量可以根据用户需求进行灵活配置。The embodiment of the present invention provides an active-standby switchover system. The controller configures the active-standby agent gateway for the bare metal server node, and selects a new active agent gateway for the bare metal server node after the main agent gateway is abnormal, so as to realize the bare metal server node. The metal server node does not need to be aware of the existence of the proxy gateway. When the primary proxy gateway is abnormal, the bare metal server can forward the business traffic to the new primary proxy gateway without awareness, so as to quickly restore customer services. The present invention does not require the interaction of protocols such as keep-alive between the bare metal server node and the proxy gateway, and the number of proxy gateway nodes can be flexibly configured according to user requirements.
实施例2Example 2
如图2所示,为本发明实施例提供的另一种示例的主备切换系统的系统架构示意图,其中,控制器与代理网关1、代理网关2、……代理网关n通信连接,代理网关1、代理网关2、……代理网关n通过业务交换机与BMS1-BMSm通信链接,业务交换机将与BMS1-BMSm连接的端口配置为access模式,将连接BMS1的端口VLAN配置为VLAN1,连接BMS2的端口VLAN配置为VLAN 2,依此类推,连接BMSm的端口VLAN配置为VLAN m。业务交换机将与代理网关1、代理网关2、……代理网关n的NIC1链接的端口配置为trunk模式,允许VLAN 1-VLANm通过。用户设置BMS1-BMSm的网关IP地址为IP-GW。设置BMS1的IP地址为IP-1,设置BMS2的IP地址为IP-2,依此类推,设置BMSm的IP地址为IP-m。设置BMS1的MAC地址为MAC1,BMS2的MAC地址为MAC2,依此类推,BMSm的MAC地址为MACm。设置代理网关1的管理IP地址为IP_MG1,代理网关2的管理IP地址为IP_MG2,依此类推,代理网关n的管理IP地址为IP_MGn。控制器将代理网关1到代理网关n的虚拟IP地址配置成用户设置的各裸金属服务器节点的网关IP地址,即控制器将代理网关1到代理网关n的虚拟IP地址都设置为IP-GW。As shown in Figure 2, it is a schematic diagram of the system architecture of another exemplary active-standby switching system provided by the embodiment of the present invention, wherein the controller communicates with agent gateway 1, agent gateway 2, ... agent gateway n, and the agent gateway 1. Proxy gateway 2, ... proxy gateway n communicates with BMS1-BMSm through a service switch. The service switch configures the port connected to BMS1-BMSm as access mode, configures the VLAN of the port connected to BMS1 as VLAN1, and configures the port connected to BMS2 The VLAN is configured as VLAN 2, and so on, and the VLAN of the port connected to BMSm is configured as VLAN m. The service switch configures the ports linked with the NIC1 of the proxy gateway 1, proxy gateway 2, ... proxy gateway n as trunk mode, allowing VLAN 1-VLANm to pass through. The user sets the gateway IP address of BMS1-BMSm to IP-GW. Set the IP address of BMS1 to IP-1, set the IP address of BMS2 to IP-2, and so on, set the IP address of BMSm to IP-m. Set the MAC address of BMS1 to MAC1, the MAC address of BMS2 to MAC2, and so on, and the MAC address of BMSm to MACm. Set the management IP address of proxy gateway 1 to IP_MG1, the management IP address of proxy gateway 2 to IP_MG2, and so on, and the management IP address of proxy gateway n to IP_MGn. The controller configures the virtual IP addresses of proxy gateway 1 to proxy gateway n as the gateway IP addresses of the bare metal server nodes set by the user, that is, the controller sets the virtual IP addresses of proxy gateway 1 to proxy gateway n as IP-GW .
在本发明实施例中,控制器为每个裸金属服务器节点配置主代理网关和备代理网关,并将每个裸金属服务器节点与主代理网关和至少一个备代理网关的对应关系存储在本地的对应关系表中。In this embodiment of the present invention, the controller configures a master proxy gateway and a backup proxy gateway for each bare metal server node, and stores the corresponding relationship between each bare metal server node and the master proxy gateway and at least one backup proxy gateway in the local Correspondence table.
在本发明实施例中,裸金属服务器节点的关键信息包括VLAN ID、IP地址和MAC地址,这些关键信息与一个裸金属服务器节点形成一一对应关系,可以确保裸金属服务器节点的接入安全性和准确性。控制器基于主备代理网关的管理IP地址信息对主备代理网关进行监控和管理。因此,作为本发明实施例的一种实现方式,对应关系表中至少存储所有裸金属服务器节点的VLAN ID、IP地址和MAC地址信息,以及主备代理网关的管理IP地址、虚拟IP地址和虚拟MAC地址信息。主代理网关和备代理网关上均运行有OVS组件。In the embodiment of the present invention, the key information of the bare metal server node includes VLAN ID, IP address and MAC address, and these key information form a one-to-one correspondence with a bare metal server node, which can ensure the access security of the bare metal server node and accuracy. The controller monitors and manages the active and standby proxy gateways based on the management IP address information of the active and standby proxy gateways. Therefore, as an implementation of the embodiment of the present invention, at least the VLAN ID, IP address, and MAC address information of all bare metal server nodes are stored in the correspondence table, as well as the management IP address, virtual IP address, and virtual IP address of the active and standby agent gateways. MAC address information. OVS components are running on both the active agent gateway and the standby agent gateway.
如图2所示的系统架构中,控制器为BMS1-BMSm都分别配置了主代理网关和备代理网关,并将BMS1-BMSm与主代理网关和备代理网关的对应关系存储在本地的对应关系表中。示例的,假设m=2,即有2个裸金属服务器节点:BMS1和BMS2,控制器为BMS1和BMS2分别配置了1个主代理网关和2个备代理网关,如设置BMS1的主代理网关为代理网关1,备代理网关为代理网关2和代理网关3;设置BMS2的主代理网关为代理网关2,备代理网关为代理网关3和代理网关4。In the system architecture shown in Figure 2, the controller configures the main agent gateway and the standby agent gateway for BMS1-BMSm respectively, and stores the corresponding relationship between BMS1-BMSm and the main agent gateway and the standby agent gateway in the local corresponding relationship table. For example, assuming m=2, that is, there are 2 BMS nodes: BMS1 and BMS2, and the controller configures 1 primary proxy gateway and 2 backup proxy gateways for BMS1 and BMS2 respectively. For example, the primary proxy gateway of BMS1 is set as Proxy gateway 1, standby proxy gateways are proxy gateway 2 and proxy gateway 3; set the main proxy gateway of BMS2 as proxy gateway 2, and the backup proxy gateways are proxy gateway 3 and proxy gateway 4.
控制器配置的BMS1和BMS2与主备代理网关的对应关系表,如下表1所示,The corresponding relationship between BMS1 and BMS2 configured by the controller and the active and standby proxy gateways is shown in Table 1 below.
表1Table 1
在本发明实施例中,控制器中建立代理网关与裸金属服务器节点的对应关系后,需要向代理网关下发代理流表,从而实现代理网关依据代理流表处理来自裸金属服务器节点的报文,以建立裸金属服务器节点与其他网络通信设备等的通信。示例的,控制器建立上述表1所示对应关系表后,依据对应关系表获取以代理网关1为主代理网关的裸金属服务器节点BMS1,向代理网关1下发处理BMS1的报文的代理流表。代理网关1依据代理流表处理BMS1发送的报文,可以实现BMS1与目的端之间的通信。In the embodiment of the present invention, after the corresponding relationship between the proxy gateway and the bare metal server node is established in the controller, the proxy flow table needs to be delivered to the proxy gateway, so that the proxy gateway can process the message from the bare metal server node according to the proxy flow table , to establish communication between bare metal server nodes and other network communication devices. For example, after the controller establishes the corresponding relationship table shown in Table 1 above, according to the corresponding relationship table, it obtains the bare metal server node BMS1 with the proxy gateway 1 as the main proxy gateway, and sends the proxy flow for processing the message of BMS1 to the proxy gateway 1. surface. The proxy gateway 1 processes the message sent by the BMS1 according to the proxy flow table, so as to realize the communication between the BMS1 and the destination end.
可以理解的,上述表1中记载的裸金属服务器节点与主备代理网关之间的对应关系仅仅是示例的,当存在更多的裸金属服务器节点与主备代理网关的对应关系时,可以参照上述示例在对应关系表中建立更多的裸金属服务器节点与主备代理网关的对应关系。It can be understood that the correspondence between bare metal server nodes and active/standby proxy gateways recorded in Table 1 is just an example. When there are more correspondences between bare metal server nodes and active/standby proxy gateways, you can refer to The above example establishes more correspondences between bare metal server nodes and active/standby proxy gateways in the correspondence table.
作为本发明实施例的一种实现方式,控制器为所有的主代理网关配置相同的虚拟IP地址和不同的虚拟MAC地址,使得裸金属服务器节点感知不到多个代理网关的存在,但是又能区分出不同的代理网关,且代理网关的虚拟IP地址只携带在交互的报文(如代理流表,ARP广播报文等)中使用,并不是真实配置在接口上,所以也不会存在IP地址冲突。As an implementation of the embodiment of the present invention, the controller configures the same virtual IP address and different virtual MAC addresses for all the main proxy gateways, so that the bare metal server node cannot perceive the existence of multiple proxy gateways, but can Distinguish different proxy gateways, and the virtual IP address of the proxy gateway is only used in the interactive packets (such as proxy flow table, ARP broadcast packets, etc.), and is not actually configured on the interface, so there will be no IP Address conflict.
作为本发明实施例的一种实现方式,控制器依据对应关系表,获取各主代理网关需要处理的裸金属服务器节点的信息,向各主代理网关下发各自需要处理的裸金属服务器节点的代理流表,该代理流表中包括裸金属服务器节点的VLAN ID、MAC地址和IP地址信息,以及主代理网关的虚拟IP地址和虚拟MAC地址信息。As an implementation method of the embodiment of the present invention, the controller obtains the information of the bare metal server nodes that need to be processed by each main proxy gateway according to the corresponding relationship table, and sends the proxy information of the bare metal server nodes that need to be processed to each main proxy gateway. Flow table, the proxy flow table includes the VLAN ID, MAC address and IP address information of the bare metal server node, and the virtual IP address and virtual MAC address information of the main proxy gateway.
在各主代理网关均正常的情况下,各主代理网关只负责处理各自对应的裸金属服务器节点的报文。When the main agent gateways are normal, each main agent gateway is only responsible for processing the packets of their corresponding bare metal server nodes.
具体的,裸金属服务器节点初始通信时,发出针对网关地址的ARP Request广播报文,该ARP Request广播报文经过业务交换机后发送给所有的代理网关,但是只有裸金属服务器节点对应的主代理网关才会处理该报文。主代理网关针对该ARP Request广播报文进行ARP代答后,裸金属服务器节点收到主代理网关的ARP应答报文后,在本地生成对应的ARP表项,以建立起裸金属服务器节点与其对应的主代理网关的对应关系,实现从该裸金属服务器节点发出的报文就只会发送给其对应的主代理网关。Specifically, when the bare metal server node initially communicates, it sends an ARP Request broadcast message for the gateway address, and the ARP Request broadcast message is sent to all proxy gateways after passing through the service switch, but only the primary proxy gateway corresponding to the bare metal server node The message will be processed. After the main proxy gateway performs ARP proxy response to the ARP Request broadcast message, the bare metal server node generates the corresponding ARP entry locally after receiving the ARP reply message from the main proxy gateway, so as to establish the correspondence between the bare metal server node and its The corresponding relationship of the main proxy gateway of the BMS node, so that the packets sent from the bare metal server node will only be sent to the corresponding main proxy gateway.
当裸金属服务器节点需要与目的端进行通信时,裸金属服务器节点向目的端发送业务报文,该业务报文的源IP地址为裸金属服务器节点的IP地址,源MAC地址为裸金属服务器节点的MAC地址,目标MAC地址为该裸金属服务器节点对应的主代理网关的虚拟MAC地址,目的IP地址为目标虚拟化节点的IP地址,从而该业务报文经过主代理网关后,发送到目标虚拟化节点,实现裸金属服务器节点与目标虚拟化节点间的通信。When the BMS node needs to communicate with the destination end, the BMS node sends a service packet to the destination end. The source IP address of the service packet is the IP address of the BMS node, and the source MAC address is the BMS node The target MAC address is the virtual MAC address of the main agent gateway corresponding to the bare metal server node, and the destination IP address is the IP address of the target virtualization node, so that the service packet is sent to the target virtualization virtualization nodes to implement communication between bare metal server nodes and target virtualization nodes.
在本发明实施例中,控制器在检测到任一代理网关异常时,依据上述建立的对应关系表,获取以该任一代理网关为主代理网关的对应的裸金属服务器节点,并按照预设规则从裸金属服务器节点各自对应的备代理网关中选举出新的主代理网关,从而实现代理网关的主备切换。In the embodiment of the present invention, when the controller detects that any proxy gateway is abnormal, according to the above established correspondence table, obtains the corresponding bare metal server node with any proxy gateway as the primary proxy gateway, and according to the preset The rule elects a new master proxy gateway from the standby proxy gateways corresponding to the bare metal server nodes, so as to realize the active/standby switchover of the proxy gateways.
在本发明实施例中,控制器选举出新的主代理网关后,需要向该新的主代理网关下发处理其新代理的所有第二裸金属服务器节点的报文的代理流表;该代理流表中包括第二裸金属服务器节点的VLAN ID、MAC地址和IP地址以及该新的主代理网关的虚拟IP地址和虚拟MAC地址。新的主代理网关接收到该代理流表后,获取该代理流表中第二裸金属服务器节点的关键信息,并基于这些关键信息构造对应的ARP报文,将该ARP报文发送给对应的第二裸金属服务器节点。这里构造的ARP报文中至少包括第二裸金属服务器节点的VLAN ID、MAC地址和IP地址以及主代理网关的虚拟IP地址和虚拟MAC地址等信息,针对不同的第二裸金属服务器节点,ARP报文的内容不同。因此,新的主代理网关所新代理的第二裸金属服务器节点的数量为多个时,需要针对不同第二裸金属服务器节点的关键信息构造多份不同的ARP报文。第二裸金属服务器节点接收到对应的ARP报文后,解析并获取新的主代理网关的虚拟MAC地址等信息,更新本地ARP表项。In the embodiment of the present invention, after the controller elects a new master proxy gateway, it needs to deliver to the new master proxy gateway a proxy flow table for processing messages of all second bare metal server nodes of its new proxy; the proxy The flow table includes the VLAN ID, MAC address, and IP address of the second bare metal server node, and the virtual IP address and virtual MAC address of the new master proxy gateway. After receiving the proxy flow table, the new main proxy gateway obtains the key information of the second bare metal server node in the proxy flow table, constructs the corresponding ARP message based on the key information, and sends the ARP message to the corresponding The second bare metal server node. The ARP message constructed here includes at least the VLAN ID, MAC address, and IP address of the second BMS node, and the virtual IP address and virtual MAC address of the main proxy gateway. For different second BMS nodes, the ARP The content of the message is different. Therefore, when the number of second bare metal server nodes newly proxied by the new master proxy gateway is multiple, it is necessary to construct multiple different ARP packets for key information of different second bare metal server nodes. After receiving the corresponding ARP message, the second bare metal server node parses and obtains information such as the virtual MAC address of the new main agent gateway, and updates the local ARP entry.
作为本发明实施例的一种优选实施方式,控制器可以为所有的主代理网关均配置相同的虚拟IP地址和不同的虚拟MAC地址;并将该虚拟IP地址和虚拟MAC地址携带在下发给主代理网关的代理流表中,当主代理网关节点出现异常后,可以让裸金属服务器节点无感知的将业务流量转发到新的主代理节点,从而快速恢复客户业务。As a preferred implementation of the embodiment of the present invention, the controller can configure the same virtual IP address and different virtual MAC addresses for all the master proxy gateways; and carry the virtual IP addresses and virtual MAC addresses in the In the proxy flow table of the proxy gateway, when the primary proxy gateway node is abnormal, the bare metal server node can forward the business traffic to the new primary proxy node without awareness, so as to quickly restore customer services.
在本发明实施例中,裸金属服务器节点不需要感知代理网关的存在,当代理网关节点出现异常后,可以让裸金属服务器无感知的将业务流量转发到新的代理节点,从而快速恢复客户业务。In the embodiment of the present invention, the bare metal server node does not need to be aware of the existence of the proxy gateway. When the proxy gateway node is abnormal, the bare metal server can forward the business traffic to the new proxy node without awareness, so as to quickly restore customer services .
实施例3Example 3
基于本发明实施例提供的主备切换系统,本发明实施例提供了一种主备切换方法,如图3所示,该方法包括:Based on the active-standby switchover system provided by the embodiment of the present invention, the embodiment of the present invention provides an active-standby switchover method, as shown in FIG. 3 , the method includes:
S301.控制器检测到任一代理网关异常,依据对应关系表,获取以该任一代理网关为主代理网关的第一裸金属服务器节点。S301. The controller detects that any proxy gateway is abnormal, and obtains the first bare metal server node using the proxy gateway as the primary proxy gateway according to the correspondence table.
在本步骤中,控制器检测代理网关是否异常可以是通过控制器与代理网关建立的连接进行判断,示例的,当控制器与代理网关的OVS连接断开时,则认为该代理网关发生异常。或者,也可以是在控制器无法与代理网关建立连接时,则认为代理网关异常。或者,还可以是控制器无法与代理网关通信时,则认为代理网关异常。In this step, whether the controller detects whether the proxy gateway is abnormal can be judged through the connection established between the controller and the proxy gateway. For example, when the OVS connection between the controller and the proxy gateway is disconnected, it is considered that the proxy gateway is abnormal. Alternatively, when the controller fails to establish a connection with the proxy gateway, it is considered that the proxy gateway is abnormal. Alternatively, when the controller cannot communicate with the proxy gateway, it is considered that the proxy gateway is abnormal.
在本发明实施例中,在控制器检测到该任一代理网关异常之前,控制器为每个裸金属服务器节点配置主代理网关和备代理网关,并将每个裸金属服务器节点与主代理网关和备代理网关的对应关系存储在本地的对应关系表中。其中,该对应关系表中至少存储有裸金属服务器节点的VLAN ID、IP地址和MAC地址等关键信息,以及主备代理网关的管理IP地址、虚拟IP地址和虚拟MAC地址等信息。In this embodiment of the present invention, before the controller detects that any proxy gateway is abnormal, the controller configures a primary proxy gateway and a backup proxy gateway for each bare metal server node, and connects each bare metal server node with the primary proxy gateway The corresponding relationship with the standby proxy gateway is stored in the local corresponding relationship table. Wherein, the correspondence table at least stores key information such as the VLAN ID, IP address, and MAC address of the bare metal server node, and information such as the management IP address, virtual IP address, and virtual MAC address of the active and standby proxy gateways.
控制器建立裸金属服务器节点与主备代理网关的对应关系表后,会基于该对应关系表,向各主代理网关下发代理流表,以使得主代理网关依据代理流表处理对应裸金属服务器节点发送的报文。After the controller establishes the correspondence table between the bare metal server node and the active and standby agent gateways, it will send the agent flow table to each main agent gateway based on the correspondence table, so that the main agent gateway can process the corresponding bare metal server according to the agent flow table. message sent by the node.
具体的,控制器获取对应关系表中的每个裸金属服务器节点的关键信息,并依据每个裸金属服务器节点的关键信息创建第一代理流表,并下发给该裸金属服务器节点对应的主代理网关,其中,第一代理流表中包括该主代理网关的虚拟IP地址和虚拟MAC地址、对应的裸金属服务器节点的关键信息。裸金属服务器节点的关键信息至少包括:VLAN ID、MAC地址和IP地址等。Specifically, the controller obtains the key information of each bare metal server node in the correspondence table, and creates a first proxy flow table based on the key information of each bare metal server node, and sends it to the corresponding The main proxy gateway, wherein the first proxy flow table includes the virtual IP address and virtual MAC address of the main proxy gateway, and key information of the corresponding bare metal server node. The key information of the bare metal server node includes at least: VLAN ID, MAC address, and IP address.
示例的,针对“BMS1的主代理网关为代理网关1,BMS 2的主代理网关为代理网关2”,则控制器向代理网关1下发代理流表1,该代理流表1用于对BMS1发送的报文进行处理,BMS1发送的报文中携带“VLAN ID=1、src_ip=IP-1、src_mac=MAC1”等信息。控制器向代理网关2下发代理流表2,该代理流表2用于对BMS2发送的报文进行处理,BMS2发送的报文中携带“VLAN ID=2、src_ip=IP-2、src_mac=MAC2”等信息。代理流表类型可以为ARP代答和/或相应业务处理等,如相应业务处理可以为封装隧道等。需要特别注意的是,所有主代理网关上在ARP代答流表中使用的源IP地址都是虚拟IP地址。由于该虚拟IP地址只有在表项中存在,在报文封装时才会使用,并不是直接配置在某个接口上的,所以就不存在IP地址冲突的问题。For example, for "the main proxy gateway of BMS1 is proxy gateway 1, and the primary proxy gateway of BMS 2 is proxy gateway 2", the controller sends proxy flow table 1 to proxy gateway 1, and the proxy flow table 1 is used to control BMS1 The sent message is processed, and the message sent by BMS1 carries information such as "VLAN ID=1, src_ip=IP-1, src_mac=MAC1". The controller sends the proxy flow table 2 to the proxy gateway 2. The proxy flow table 2 is used to process the message sent by the BMS2. The message sent by the BMS2 carries "VLAN ID=2, src_ip=IP-2, src_mac= MAC2" and other information. The proxy flow table type may be ARP proxy and/or corresponding service processing, for example, the corresponding service processing may be an encapsulation tunnel or the like. It is important to note that the source IP addresses used in the ARP proxy flow table on all primary proxy gateways are virtual IP addresses. Since the virtual IP address only exists in the entry and is used when the packet is encapsulated, and is not directly configured on an interface, there is no problem of IP address conflict.
在本发明实施例中,每个主代理网关接收到第一代理流表后,获取第一代理流表中对应的裸金属服务器节点的关键信息,并基于对应的裸金属服务器节点的关键信息以及虚拟IP地址和虚拟MAC地址构造第一ARP报文,并将第一ARP报文发送给对应的裸金属服务器节点。对应的裸金属服务器节点接收到该第一ARP报文后,生成本地ARP表项,以使对应的裸金属服务器节点依据该ARP表项与目的端进行通信。In the embodiment of the present invention, after receiving the first proxy flow table, each main proxy gateway obtains the key information of the corresponding bare metal server node in the first proxy flow table, and based on the key information of the corresponding bare metal server node and The virtual IP address and the virtual MAC address construct the first ARP packet, and send the first ARP packet to the corresponding bare metal server node. After receiving the first ARP message, the corresponding bare metal server node generates a local ARP entry, so that the corresponding bare metal server node communicates with the destination end according to the ARP entry.
需要特别说明的是,在各主代理网关均正常的情况下,各主代理网关只负责处理各自对应的裸金属服务器节点的报文。It should be noted that, when all the main proxy gateways are normal, each main proxy gateway is only responsible for processing the packets of their corresponding bare metal server nodes.
具体的,当裸金属服务器节点初始通信时,发出针对网关地址的ARP Request广播报文(该ARP Request广播报文中携带VLAN ID、网关IP地址)后,该ARP Request广播报文经过业务交换机后发送给所有的代理网关,但是只有该裸金属服务器节点对应的主代理网关会处理该报文。主代理网关针对该ARP Request广播报文进行ARP代答后,裸金属服务器节点收到主代理网关的ARP应答后,在本地生成对应的ARP表项。从该裸金属服务器节点发出的报文就只会发送给其对应的主代理网关。Specifically, when the bare metal server node initially communicates, after sending an ARP Request broadcast message for the gateway address (the ARP Request broadcast message carries the VLAN ID and the gateway IP address), after the ARP Request broadcast message passes through the service switch It is sent to all proxy gateways, but only the main proxy gateway corresponding to the bare metal server node will process the message. After the main agent gateway performs ARP proxy for the ARP Request broadcast message, the bare metal server node generates the corresponding ARP entry locally after receiving the ARP response from the main agent gateway. Packets sent from the bare metal server node will only be sent to its corresponding master proxy gateway.
当裸金属服务器节点需要与目标虚拟化节点进行通信时,裸金属服务器节点向目标虚拟化节点发送业务报文,该业务报文的源IP地址为裸金属服务器节点的IP地址,源MAC地址为裸金属服务器节点的MAC地址,目标MAC地址为该裸金属服务器节点对应的主代理网关的虚拟MAC地址,目的IP地址为目标虚拟化节点的IP地址,从而该业务报文经过主代理网关后,发送到目标虚拟化节点,实现裸金属服务器节点与目标虚拟化节点间的通信。When the BMS node needs to communicate with the target virtualization node, the BMS node sends a service packet to the target virtualization node. The source IP address of the service packet is the IP address of the BMS node, and the source MAC address is The MAC address of the bare metal server node, the target MAC address is the virtual MAC address of the main proxy gateway corresponding to the bare metal server node, and the destination IP address is the IP address of the target virtualization node, so that after the service packet passes through the main proxy gateway, Send it to the target virtualization node to realize the communication between the bare metal server node and the target virtualization node.
在本发明实施例中,各主代理网关进行ARP代答时所使用的IP地址均为虚拟IP地址IP-GW,使用的MAC地址分别为各主代理网关的虚拟MAC地址,如代理网关1的虚拟MAC地址为MAC-AG1、代理网关2的虚拟MAC地址为MAC-AG2,……,代理网关n的虚拟MAC地址为MAC-AGn。In the embodiment of the present invention, the IP addresses used by each main agent gateway for ARP proxy are the virtual IP address IP-GW, and the MAC addresses used are respectively the virtual MAC addresses of each main agent gateway, such as the The virtual MAC address is MAC-AG1, the virtual MAC address of agent gateway 2 is MAC-AG2, ..., the virtual MAC address of agent gateway n is MAC-AGn.
示例的,以图2中裸金属服务器节点1(BMS1)与虚拟化节点1之间进行通信为例,详细阐述本发明的节点间通信的实现过程,具体如下:As an example, taking the communication between the bare metal server node 1 (BMS1) and the virtualization node 1 in FIG. 2 as an example, the implementation process of the inter-node communication of the present invention is described in detail, as follows:
BMS1发送针对网关地址IP-GW的ARP Request广播报文,该ARP Request广播报文的目的MAC地址为ffff.ffff.ffff、源MAC地址为MAC1,目的IP地址为IP-GW,源IP地址为IP-1,与BMS1互联的业务交换机从端口P1收到该ARP Request广播报文后,在属于VLAN 1的所有端口中洪泛(如从端口P1_1、P1_2、P1_n中添加VLAN ID=1后洪泛出去),然后所有的代理网关都会收到携带VLAN ID=1的该ARP request广播报文。由于只有BMS1对应的主代理网关1上存在匹配“VLAN ID=1、src_ip=IP-1、sec_mac=MAC1”的代理流表,所以只有主代理网关1会处理该ARP request广播报文,其他代理网关都会将收到的该报文丢弃。BMS1 sends an ARP Request broadcast message targeting the gateway address IP-GW. The destination MAC address of the ARP Request broadcast message is ffff.ffff.ffff, the source MAC address is MAC1, the destination IP address is IP-GW, and the source IP address is IP-1, after the service switch interconnected with BMS1 receives the ARP Request broadcast message from port P1, it floods all ports belonging to VLAN 1 (such as adding VLAN ID=1 from ports P1_1, P1_2, and P1_n after flooding flood out), and then all proxy gateways will receive the ARP request broadcast message carrying VLAN ID=1. Since only the main agent gateway 1 corresponding to BMS1 has a proxy flow table matching "VLAN ID=1, src_ip=IP-1, sec_mac=MAC1", only the main agent gateway 1 will process the ARP request broadcast message, and other agents The gateway will discard the received message.
主代理网关1对该ARP Request广播报文进行应答,从NIC1接口发送ARP Replay报文,该ARP Replay报文的目的MAC地址为MAC1、源MAC地址为MAC-AG1,VLAN ID为1、目的IP地址为IP-1,源IP地址为IP-GW。The main proxy gateway 1 responds to the ARP Request broadcast message, and sends an ARP Replay message from the NIC1 interface. The destination MAC address of the ARP Replay message is MAC1, the source MAC address is MAC-AG1, the VLAN ID is 1, and the destination IP The address is IP-1, and the source IP address is IP-GW.
业务交换机从与主代理网关1互联的P1_1端口收到该ARPReplay报文后,查询FDB表项后,将该报文的VLAN TAG剥离后,从与BMS1互联的P1端口发送出去;After the service switch receives the ARPReplay message from the P1_1 port connected to the main agent gateway 1, after querying the FDB entry, the VLAN TAG of the message is stripped off, and then sent out from the P1 port connected to BMS1;
BMS1收到该ARP Replay报文后,在本地生成对应的ARP表项。After receiving the ARP Replay message, BMS1 locally generates the corresponding ARP entry.
BMS1向虚拟化节点1发送第一业务报文,该第一业务报文的目的MAC地址为MAC-AG1、源MAC地址为MAC1、目的IP地址为虚拟化节点1的IP地址、源IP地址为IP-1;BMS1 sends the first service message to virtualized node 1. The destination MAC address of the first service message is MAC-AG1, the source MAC address is MAC1, the destination IP address is the IP address of virtualized node 1, and the source IP address is IP-1;
业务交换机从与BMS1互联的端口P1收到该第一业务报文后,查询FDB表项后,将该第一业务报文添加VLAN ID=1后从与主代理网关1互联的端口P1_1发出,这样只有主代理网关1可以收到该第一业务报文;After the service switch receives the first service message from the port P1 interconnected with BMS1, after querying the FDB entry, the first service message is added with VLAN ID=1 and sent out from the port P1_1 interconnected with the main agent gateway 1, In this way, only the main proxy gateway 1 can receive the first service message;
主代理网关1接收到该第一业务报文后,根据对应的流表要求(比如添加VXLAN隧道信息等)处理该第一业务报文后从接口NIC2发出去;After the main proxy gateway 1 receives the first service message, it processes the first service message according to the corresponding flow table requirements (such as adding VXLAN tunnel information, etc.) and sends it out from the interface NIC2;
业务交换机从与主代理网关1的NIC2互联的端口(如P2_1)接收到该处理后的第一业务报文,经过FDB表项或者路由表项查询后,从对应端口发出(如端口Pup)后,最终到达目的虚拟化节点1。从而实现BMS1与虚拟化节点1之间进行通信。The service switch receives the processed first service message from the port (such as P2_1) interconnected with the NIC2 of the main proxy gateway 1, and sends it out from the corresponding port (such as port Pup) after being queried by the FDB entry or the routing table entry. , and finally reach the destination virtualization node 1. In this way, the communication between the BMS1 and the virtualization node 1 is realized.
作为本发明实施例的一种优选实现方式,控制器可以为裸金属服务器节点设置一个以上的备代理网关,当主代理网关异常后,从这些备代理网关中选举出一个主代理网关接替工作。具体备代理网关的数量可以根据用户需求进行设置。As a preferred implementation of the embodiment of the present invention, the controller can set more than one backup proxy gateway for the bare metal server node, and when the primary proxy gateway is abnormal, a primary proxy gateway is elected from these backup proxy gateways to take over. The number of specific standby proxy gateways can be set according to user requirements.
作为本发明实施例的一种实现方式,控制器为所有的主代理网关配置相同的虚拟IP地址和不同的虚拟MAC地址,使得裸金属服务器节点感知不到多个代理网关的存在,但是又能区分出不同的代理网关,且代理网关的虚拟IP地址只携带在交互的报文中使用,并不是真实配置在接口上,所以也不会存在IP地址冲突。As an implementation of the embodiment of the present invention, the controller configures the same virtual IP address and different virtual MAC addresses for all the main proxy gateways, so that the bare metal server node cannot perceive the existence of multiple proxy gateways, but can Different proxy gateways are distinguished, and the virtual IP address of the proxy gateway is only used in the exchanged packets and is not actually configured on the interface, so there will be no IP address conflict.
S302.控制器按照预设规则从第一裸金属服务器节点对应的备代理网关中,为第一裸金属服务器节点选举出新的主代理网关,以使新的主代理网关处理第一裸金属服务器节点发送的报文。S302. The controller elects a new master proxy gateway for the first bare metal server node from the backup proxy gateways corresponding to the first bare metal server node according to preset rules, so that the new master proxy gateway handles the first bare metal server message sent by the node.
在本步骤中,控制器从备代理网关中选举出新的主代理网关,可以是根据备代理网关处理的裸金属服务器节点IP地址的数量以及流表条目数进行判断,从而在对应的备代理网关中选举出新的主代理网关。In this step, the controller elects a new primary proxy gateway from the standby proxy gateway, which may be judged based on the number of IP addresses of bare metal server nodes processed by the standby proxy gateway and the number of flow table entries, so that the corresponding standby proxy gateway A new master proxy gateway is elected from the gateways.
具体的,控制器按照预设规则从第一裸金属服务器节点对应的备代理网关中,为第一裸金属服务器节点选举出新主代理网关,包括:Specifically, the controller elects a new master proxy gateway for the first bare metal server node from the backup proxy gateways corresponding to the first bare metal server node according to preset rules, including:
一种实现方式,控制器获取第一裸金属服务器节点对应的每个备代理网关处理的裸金属服务器节点的IP地址数,选择处理的裸金属服务器节点的IP地址数最少的备代理网关为新的主代理网关;In an implementation manner, the controller acquires the number of IP addresses of the BMS nodes processed by each backup proxy gateway corresponding to the first BMS node, and selects the backup proxy gateway with the least number of IP addresses of the BMS nodes processed as the new BMS node. The main agent gateway of ;
另一种实现方式,控制器获取第一裸金属服务器节点对应的每个备代理网关处理的流表条目数,选择处理的流表条目数最少的备代理网关为新的主代理网关。In another implementation manner, the controller acquires the number of flow table entries processed by each standby proxy gateway corresponding to the first bare metal server node, and selects the standby proxy gateway with the least number of processed flow table entries as the new primary proxy gateway.
可选的,还可以依据裸金属服务器节点对应的每个备代理网关处理的裸金属服务器节点IP地址数和流表条目数选举出新的主代理网关,如从对应的每个备代理网关中选择一个处理的裸金属服务器节点IP地址数最少的备代理网关作为新的主代理网关。当对应的每个备代理网关中处理的裸金属服务器节点IP地址数都相同时,则从对应的每个备代理网关中选择处理的流表条目数最少的备代理网关作为新的主代理网关。或者,当对应的每个备代理网关中处理的流表条目数都相同时,则从对应的每个备代理网关中选择处理的裸金属服务器节点IP地址数最少的备代理网关作为新的主代理网关。Optionally, a new master proxy gateway can also be elected based on the number of IP addresses of bare metal server nodes and the number of flow table entries processed by each standby proxy gateway corresponding to the bare metal server node, for example, from each corresponding standby proxy gateway Select a standby proxy gateway that handles the least number of BMS node IP addresses as the new primary proxy gateway. When the number of bare metal server node IP addresses processed in each corresponding standby proxy gateway is the same, select the standby proxy gateway with the least number of processed flow table entries from each corresponding standby proxy gateway as the new primary proxy gateway . Or, when the number of flow table entries processed in each corresponding standby proxy gateway is the same, select the standby proxy gateway with the least number of BMS node IP addresses processed from each corresponding standby proxy gateway as the new primary proxy gateway. proxy gateway.
示例的,如控制器检测到代理网关1发生故障,则依据对应关系表获取到以代理网关1为主代理网关的裸金属服务器节点为BMS1,BMS1对应的备代理网关为代理网关2和代理网关3,则比较代理网关2和代理网关3处理的裸金属服务器节点IP地址数,选择处理的裸金属服务器节点IP地址数少(如代理网关3)的为新的主代理网关;若代理网关2和代理网关3处理的裸金属服务器节点IP地址数相同,则判断代理网关2和代理网关3的流表条目数量,选择处理的流表条目数少(如代理网关2)的为新的主代理网关。For example, if the controller detects that proxy gateway 1 fails, it can obtain the BMS node with proxy gateway 1 as the primary proxy gateway based on the corresponding relationship table as BMS1, and the backup proxy gateways corresponding to BMS1 are proxy gateway 2 and proxy gateway 3. Compare the number of BMS node IP addresses processed by Proxy Gateway 2 and Proxy Gateway 3, and select the one with fewer IP addresses of BMS nodes processed (such as Proxy Gateway 3) as the new primary Proxy Gateway; if Proxy Gateway 2 If the number of IP addresses of bare metal server nodes processed by proxy gateway 3 is the same, determine the number of flow table entries of proxy gateway 2 and proxy gateway 3, and select the one with fewer flow table entries (such as proxy gateway 2) as the new master proxy gateway.
在本发明实施例中,当主代理网关异常时,控制器选出新的主代理网关后,控制器会向新的主代理网关下发处理对应裸金属服务器节点的报文的代理流表。新的主代理网关产生后,新的主代理网关会构建具备特定特征的ARP报文,发给对应裸金属服务器节点。使得受影响的裸金属服务器节点都能够及时更新ARP表项,完成代理网关切换,从而让受影响的裸金属服务器节点的后续报文能够发送到新的代理网关,快速恢复业务。In the embodiment of the present invention, when the main proxy gateway is abnormal, after the controller selects a new main proxy gateway, the controller sends the new main proxy gateway a proxy flow table for processing messages corresponding to the bare metal server node. After a new primary proxy gateway is generated, the new primary proxy gateway will construct an ARP packet with specific characteristics and send it to the corresponding bare metal server node. All affected bare metal server nodes can update ARP entries in time to complete proxy gateway switching, so that subsequent packets of affected bare metal server nodes can be sent to the new proxy gateway, and services can be quickly restored.
具体的,在控制器按照预设规则从第一裸金属服务器节点对应的备代理网关中,为第一裸金属服务器节点选举出新的主代理网关之后,控制器依据对应关系表,获取以新的主代理网关为主代理网关的第二裸金属服务器节点,并依据第二裸金属服务器节点的关键信息创建第二代理流表,并下发给新的主代理网关,其中,第二代理流表中包括新的主代理网关的虚拟IP地址和虚拟MAC地址、第二裸金属服务器节点的关键信息。第二裸金属服务器节点的关键信息可以是VLAN ID、MAC地址和IP地址等信息。示例的,如BMS1和BMS3的主代理网关1发生故障后,控制器选择代理网关3作为BMS1和BMS3的新的主代理网关,那么控制器向代理网关3下发代理流表3和代理流表4,代理流表3用于对与“VLAN ID=1、src_ip=IP-1、src_mac=MAC1”匹配的报文进行处理,代理流表4用于对与“VLAN ID=3、src_ip=IP-3、src_mac=MAC3”匹配的报文进行处理。即,控制器向代理网关3下发处理BMS1发送的报文的代理流表3和处理BMS3发送的报文的代理流表4。其中,src_ip表示源IP地址,src_mac表示源MAC地址。Specifically, after the controller elects a new primary proxy gateway for the first bare metal server node from the standby proxy gateways corresponding to the first bare metal server node according to preset rules, the controller obtains the new primary proxy gateway according to the corresponding relationship table. The primary proxy gateway of the primary proxy gateway is the second bare metal server node of the primary proxy gateway, and creates a second proxy flow table based on the key information of the second bare metal server node, and sends it to the new primary proxy gateway, wherein the second proxy flow table The table includes the virtual IP address and virtual MAC address of the new main agent gateway, and key information of the second bare metal server node. The key information of the second bare metal server node may be information such as a VLAN ID, a MAC address, and an IP address. For example, if the main proxy gateway 1 of BMS1 and BMS3 fails, the controller selects proxy gateway 3 as the new primary proxy gateway of BMS1 and BMS3, then the controller sends proxy flow table 3 and proxy flow table to proxy gateway 3 4. Proxy flow table 3 is used to process packets matched with "VLAN ID=1, src_ip=IP-1, src_mac=MAC1", and proxy flow table 4 is used to process packets matching "VLAN ID=3, src_ip=IP -3, src_mac=MAC3" matches the message to be processed. That is, the controller issues the proxy flow table 3 for processing the message sent by BMS1 and the proxy flow table 4 for processing the message sent by BMS3 to the proxy gateway 3 . Among them, src_ip represents the source IP address, and src_mac represents the source MAC address.
新的主代理网关接收到第二代理流表后,获取第二代理流表中第二裸金属服务器节点的关键信息,并基于第二裸金属服务器节点的关键信息以及新的主代理网关的虚拟IP地址和虚拟MAC地址构造第二ARP报文,并将第二ARP报文发送给第二裸金属服务器节点。其中,ARP报文中至少包括裸金属服务器节点的VLAN ID、IP地址和MAC地址以及新的主代理网关的虚拟IP地址和虚拟MAC地址,针对不同的裸金属服务器节点,ARP报文的内容不同。After receiving the second proxy flow table, the new main proxy gateway obtains the key information of the second bare metal server node in the second proxy flow table, and based on the key information of the second bare metal server node and the virtual The IP address and the virtual MAC address construct a second ARP packet, and send the second ARP packet to the second bare metal server node. Among them, the ARP message includes at least the VLAN ID, IP address, and MAC address of the bare metal server node and the virtual IP address and virtual MAC address of the new primary agent gateway. For different bare metal server nodes, the content of the ARP message is different. .
一种可选的实现方式,控制器调用新的主代理网关上的ARP产生器,按照一定频率构造产生一定数量的ARP报文,如每秒发送一次,一共发送3次。产生的该ARP报文经ARP转换模块构建包括裸金属服务器节点关键信息的ARPReplay报文后从新的主代理网关的NIC1接口发送出去。In an optional implementation mode, the controller invokes the ARP generator on the new main proxy gateway to construct and generate a certain number of ARP packets according to a certain frequency, such as sending once per second, and sending a total of 3 times. The generated ARP message is sent out from the NIC1 interface of the new main agent gateway after the ARP conversion module constructs an ARPReplay message including the key information of the bare metal server node.
示例的,假设针对BMS1和BMS3的主代理网关1发生故障,选择出的新的主代理网关为代理网关3,那么经ARP转换模块转换后的ARP报文需要生成两份,分别具备如下特征:For example, assuming that the main proxy gateway 1 for BMS1 and BMS3 fails, and the new main proxy gateway selected is proxy gateway 3, then the ARP message converted by the ARP conversion module needs to generate two copies, each with the following characteristics:
ARP报文1:VLAN ID=1,arp_op=2,src_mac=MAC-AG3,dst_mac=MAC1,src_ip=IP-GW,dst_ip=IP-1。ARP message 1: VLAN ID=1, arp_op=2, src_mac=MAC-AG3, dst_mac=MAC1, src_ip=IP-GW, dst_ip=IP-1.
ARP报文2:VLAN ID=3,arp_op=2,src_mac=MAC-AG3,dst_mac=MAC3,src_ip=IP-GW,dst_ip=IP-3。其中,arp_op表示ARP报文类型,src_mac表示源MAC地址,dst_mac表示目的MAC地址,src_ip表示源IP地址,dst_ip表示目的IP地址。ARP packet 2: VLAN ID=3, arp_op=2, src_mac=MAC-AG3, dst_mac=MAC3, src_ip=IP-GW, dst_ip=IP-3. Among them, arp_op indicates the type of ARP packet, src_mac indicates the source MAC address, dst_mac indicates the destination MAC address, src_ip indicates the source IP address, and dst_ip indicates the destination IP address.
然后将这两份ARP报文从指定的NIC1接口发出。由于生成的ARP报文具备新的主代理网关的虚拟特征(即虚拟IP地址和虚拟MAC地址等)并且携带新的主代理网关所有新代理的裸金属服务器节点的VLAN TAG,所以生成的ARP报文最终会到达该新的主代理网关所新代理的所有裸金属服务器节点。Then send the two ARP packets through the specified NIC1 interface. Since the generated ARP packet has the virtual characteristics of the new primary proxy gateway (that is, virtual IP address and virtual MAC address, etc.) and carries the VLAN TAG of all new proxy BMS nodes of the new primary proxy gateway, The text will eventually reach all BMS nodes proxied by the new master proxy gateway.
第二裸金属服务器节点接收到所述第二ARP报文后,更新本地ARP表项,以使第二裸金属服务器节点依据更新后的ARP表项与目的端进行通信。After receiving the second ARP message, the second bare metal server node updates a local ARP entry, so that the second bare metal server node communicates with the destination end according to the updated ARP entry.
具体的,裸金属服务器节点收到目的MAC地址为本机MAC地址的ARP报文后,解析并获取该ARP报文中的相关信息后,更新本地ARP表项,从而将后续发出的报文的目的MAC地址更新为新的主代理网关的虚拟MAC地址,裸金属服务器节点上的报文将只会发送到该新的主代理网关,从而完成代理网关切换。Specifically, after receiving an ARP packet whose destination MAC address is the local MAC address, the BMS node parses and obtains relevant information in the ARP packet, and then updates the local ARP entry, so that the The destination MAC address is updated to the virtual MAC address of the new primary proxy gateway, and the packets on the BMS node will only be sent to the new primary proxy gateway, thus completing proxy gateway switching.
本发明实施例提供的一种主备切换方法,裸金属服务器节点不需要感知代理网关的存在,当主代理网关出现异常后,可以让裸金属服务器无感知的将业务流量转发到新的代理网关,从而快速恢复客户业务。本发明不需要裸金属服务器节点和代理网关之间进行保活等协议的交互,所有的代理网关都使用同一个虚拟的IP地址和不同的虚拟MAC地址,使得裸金属服务器节点不感知代理网关的存在。同时,代理网关节点的数量可以根据用户需求进行灵活配置。In the active-standby switching method provided by the embodiment of the present invention, the bare metal server node does not need to be aware of the existence of the proxy gateway. When the primary proxy gateway is abnormal, the bare metal server can forward the business traffic to the new proxy gateway without awareness. So as to quickly restore customer business. The present invention does not require the protocol interaction between the bare metal server node and the proxy gateway, and all the proxy gateways use the same virtual IP address and different virtual MAC addresses, so that the bare metal server node does not perceive the proxy gateway exist. At the same time, the number of proxy gateway nodes can be flexibly configured according to user needs.
本发明实施例提供了一种主备切换方法,该方法应用于一种主备切换系统中的控制器,控制器与至少两个代理网关通信连接,该至少两个代理网关与至少一个裸金属服务器节点通信连接,控制器中存储有至少一个裸金属服务器节点对应的主代理网关和备代理网关的对应关系表,该方法包括:The embodiment of the present invention provides a master-standby switchover method, which is applied to a controller in a master-standby switchover system, where the controller communicates with at least two agent gateways, and the at least two agent gateways communicate with at least one bare metal The server node is connected in communication, and the controller stores a corresponding relationship table between the primary agent gateway and the standby agent gateway corresponding to at least one bare metal server node, and the method includes:
检测到任一代理网关异常,依据对应关系表,获取以该任一代理网关为主代理网关的第一裸金属服务器节点。An abnormality of any proxy gateway is detected, and the first bare metal server node using the proxy gateway as the primary proxy gateway is obtained according to the corresponding relationship table.
在检测到任一代理网关异常之前,该方法还包括:为每个裸金属服务器节点配置主代理网关和备代理网关,并将每个裸金属服务器节点与主代理网关和备代理网关的对应关系存储在本地的对应关系表中;为所有的主代理网关配置相同的虚拟IP地址和不同的虚拟MAC地址。获取对应关系表中的每个裸金属服务器节点的关键信息,并依据每个裸金属服务器节点的关键信息创建第一代理流表,并下发给该裸金属服务器节点对应的主代理网关,以使该主代理网关接收到第一代理流表后,获取第一代理流表中对应的裸金属服务器节点的关键信息,并基于对应的裸金属服务器节点的关键信息以及虚拟IP地址和虚拟MAC地址构造第一ARP报文,并将第一ARP报文发送给对应的裸金属服务器节点,触发对应的裸金属服务器节点依据第一ARP报文生成本地ARP表项,以使对应的裸金属服务器节点依据ARP表项与目的端进行通信。Before any proxy gateway abnormality is detected, the method further includes: configuring a primary proxy gateway and a standby proxy gateway for each bare metal server node, and mapping each bare metal server node to the primary proxy gateway and the standby proxy gateway Stored in the local correspondence table; configure the same virtual IP address and different virtual MAC addresses for all master agent gateways. Obtain the key information of each bare metal server node in the corresponding relationship table, create a first proxy flow table based on the key information of each bare metal server node, and send it to the main proxy gateway corresponding to the bare metal server node, so as to After receiving the first proxy flow table, the main proxy gateway obtains the key information of the corresponding bare metal server node in the first proxy flow table, and based on the key information of the corresponding bare metal server node and the virtual IP address and virtual MAC address Construct the first ARP message, and send the first ARP message to the corresponding bare metal server node, trigger the corresponding bare metal server node to generate a local ARP entry according to the first ARP message, so that the corresponding bare metal server node Communicate with the destination end based on the ARP entry.
其中,第一代理流表中包括该主代理网关的虚拟IP地址和虚拟MAC地址、对应的裸金属服务器节点的关键信息。Wherein, the first proxy flow table includes the virtual IP address and virtual MAC address of the main proxy gateway, and key information of the corresponding bare metal server node.
具体的,按照预设规则从第一裸金属服务器节点对应的备代理网关中,为第一裸金属服务器节点选举出新的主代理网关,以使新的主代理网关处理第一裸金属服务器节点发送的报文。Specifically, a new master proxy gateway is selected for the first bare metal server node from the standby proxy gateways corresponding to the first bare metal server node according to preset rules, so that the new master proxy gateway can process the first bare metal server node sent message.
其中,按照预设规则从第一裸金属服务器节点对应的备代理网关中,为第一裸金属服务器节点选举出新主代理网关,包括:Wherein, according to preset rules, a new master proxy gateway is elected for the first bare metal server node from the backup proxy gateways corresponding to the first bare metal server node, including:
一种可能的实现方式是,获取第一裸金属服务器节点对应的每个备代理网关处理的裸金属服务器节点的IP地址数,选择处理的裸金属服务器节点的IP地址数最少的备代理网关为新的主代理网关;A possible implementation method is to obtain the number of IP addresses of BMS nodes processed by each backup proxy gateway corresponding to the first BMS node, and select the backup proxy gateway with the least number of IP addresses of BMS nodes processed as new main proxy gateway;
另一种可能的实现方式是,获取第一裸金属服务器节点对应的每个备代理网关处理的流表条目数,选择处理的流表条目数最少的备代理网关为新的主代理网关。Another possible implementation is to obtain the number of flow table entries processed by each standby proxy gateway corresponding to the first bare metal server node, and select the standby proxy gateway with the least number of processed flow table entries as the new primary proxy gateway.
在按照预设规则从第一裸金属服务器节点对应的备代理网关中,为第一裸金属服务器节点选举出新的主代理网关之后,该方法还包括:After electing a new primary proxy gateway for the first bare metal server node from the standby proxy gateways corresponding to the first bare metal server node according to preset rules, the method further includes:
依据对应关系表,获取以新的主代理网关为主代理网关的第二裸金属服务器节点,并依据第二裸金属服务器节点的关键信息创建第二代理流表,并下发给新的主代理网关,以使新的主代理网关接收到第二代理流表后,获取第二代理流表中第二裸金属服务器节点的关键信息,并基于第二裸金属服务器节点的关键信息以及新的主代理网关的虚拟IP地址和虚拟MAC地址构造第二ARP报文,并将第二ARP报文发送给第二裸金属服务器节点,触发第二裸金属服务器节点依据第二ARP报文更新本地ARP表项,以使第二裸金属服务器节点依据更新后的ARP表项与目的端进行通信。其中,第二代理流表中包括新的主代理网关的虚拟IP地址和虚拟MAC地址、第二裸金属服务器节点的关键信息。According to the corresponding relationship table, obtain the second bare metal server node with the new main agent gateway as the main agent gateway, and create a second agent flow table based on the key information of the second bare metal server node, and send it to the new main agent gateway, so that after the new master proxy gateway receives the second proxy flow table, it obtains the key information of the second bare metal server node in the second proxy flow table, and based on the key information of the second bare metal server node and the new master The proxy gateway's virtual IP address and virtual MAC address construct a second ARP message, and send the second ARP message to the second BMS node, triggering the second BMS node to update the local ARP table according to the second ARP message entry, so that the second bare metal server node communicates with the destination end according to the updated ARP entry. Wherein, the second proxy flow table includes the virtual IP address and virtual MAC address of the new primary proxy gateway, and key information of the second bare metal server node.
本发明实施例提供的一种主备切换方法,裸金属服务器节点不需要感知代理网关的存在,当主代理网关出现异常后,可以让裸金属服务器无感知的将业务流量转发到新的代理网关,从而快速恢复客户业务。本发明不需要裸金属服务器节点和代理网关之间进行保活等协议的交互,所有的代理网关都使用同一个虚拟的IP地址和不同的虚拟MAC地址,使得裸金属服务器节点不感知代理网关的存在。同时,代理网关节点的数量可以根据用户需求进行灵活配置。In the active-standby switching method provided by the embodiment of the present invention, the bare metal server node does not need to be aware of the existence of the proxy gateway. When the primary proxy gateway is abnormal, the bare metal server can forward the business traffic to the new proxy gateway without awareness. So as to quickly restore customer business. The present invention does not require the protocol interaction between the bare metal server node and the proxy gateway, and all the proxy gateways use the same virtual IP address and different virtual MAC addresses, so that the bare metal server node does not perceive the proxy gateway exist. At the same time, the number of proxy gateway nodes can be flexibly configured according to user needs.
本发明实施例还提供了一种控制器,具体的,该控制器包括处理器,所述处理器和存储器耦合,所述存储器存储有程序,当所述存储器存储的程序指令被所述处理器执行时实现上述实施例所述的主备切换方法的步骤。The embodiment of the present invention also provides a controller. Specifically, the controller includes a processor, the processor is coupled to a memory, and the memory stores a program. When the program instructions stored in the memory are executed by the processor During execution, the steps of the master-standby switchover method described in the foregoing embodiments are realized.
可以理解的,本发明实施例还能提供一种电子设备,具体的,该电子设备包括:处理器、存储器及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述计算机程序被所述处理器执行时实现上述实施例提供的一种主备切换方法的步骤。It can be understood that the embodiment of the present invention can also provide an electronic device, specifically, the electronic device includes: a processor, a memory, and a computer program stored in the memory and operable on the processor, the When the computer program is executed by the processor, the steps of the master/standby switchover method provided in the foregoing embodiments are implemented.
其中,上述处理器是电子设备的控制中心,通过运行或执行存储在存储器内的软件程序和/或模块以及调用存储在存储器内的数据,执行电子设备的各种功能和处理数据,从而对电子设备进行整体监控。处理器可包括一个或多个处理单元。Wherein, the above-mentioned processor is the control center of the electronic equipment. By running or executing software programs and/or modules stored in the memory and calling data stored in the memory, it executes various functions of the electronic equipment and processes data, thereby controlling the electronic equipment. The device is monitored as a whole. A processor may include one or more processing units.
存储器可用于存储软件程序以及各种数据。存储器可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序等;存储数据区可存储用户使用数据等。此外,存储器可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。The memory can be used to store software programs as well as various data. The memory may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function, etc.; the data storage area may store user usage data, etc. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage devices.
本发明实施例还提供了一种计算机可读存储介质,计算机可读存储介质上存储有计算机程序,该计算机程序被处理器执行时实现上述实施例提供的一种主备切换方法的多个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。其中,计算机可读存储介质,如随机存取存储器(Random-Access Memory,RAM)、只读存储器(Read-Only Memory,ROM)、快闪存储器(Flash Memory),硬盘(Hard Disk Drive,HDD)、固态硬盘(Solid-StateDrive,SSD)、光盘等。An embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, multiple processes of the master-standby switching method provided in the above-mentioned embodiments are implemented. , and can achieve the same technical effect, in order to avoid repetition, it will not be repeated here. Among them, the computer-readable storage medium, such as random access memory (Random-Access Memory, RAM), read-only memory (Read-Only Memory, ROM), flash memory (Flash Memory), hard disk (Hard Disk Drive, HDD) , Solid State Drive (Solid-State Drive, SSD), optical disc, etc.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的控制器各模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and brevity of the description, the specific working process of each module of the controller described above can refer to the corresponding process in the foregoing method embodiment, and will not be repeated here.
在本发明所提供的几个实施例中,应该理解到,所揭露的系统和和方法,可以通过其它的方式实现。例如,以上所描述的系统实施例仅仅是示意性的,也可以是其他省略部分装置的类似系统,或者是相关领域的相似系统架构中,实现本发明实施例提供的方法过程,此处不再赘述。In the several embodiments provided by the present invention, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the above-described system embodiments are only illustrative, and may also be other similar systems omitting some devices, or similar system architectures in related fields, to implement the method process provided by the embodiments of the present invention, which will not be repeated here repeat.
最后应说明的是:以上实施例仅用于说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明保护范围。Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: it can still be Modifications are made to the technical solutions described in the foregoing embodiments, or equivalent replacements are made to some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions depart from the protection scope of the present invention.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202310227657.0A CN116455730A (en) | 2023-03-10 | 2023-03-10 | A method, system and controller for active/standby switching |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202310227657.0A CN116455730A (en) | 2023-03-10 | 2023-03-10 | A method, system and controller for active/standby switching |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN116455730A true CN116455730A (en) | 2023-07-18 |
Family
ID=87134593
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202310227657.0A Pending CN116455730A (en) | 2023-03-10 | 2023-03-10 | A method, system and controller for active/standby switching |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN116455730A (en) |
-
2023
- 2023-03-10 CN CN202310227657.0A patent/CN116455730A/en active Pending
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN103997414B (en) | Method and network control unit for generating configuration information | |
| EP2843906B1 (en) | Method, apparatus, and system for data transmission | |
| CN112470436A (en) | Multi-cloud connectivity using SRV6 and BGP | |
| CN113938405B (en) | A method and device for data processing | |
| CN107306215B (en) | A data processing method, system and node | |
| CN110896371A (en) | Virtual network equipment and related method | |
| WO2019080592A1 (en) | Method and device for sending messages | |
| US9407547B2 (en) | Fibre channel over ethernet (FCoE) over virtual port channel (vPC) | |
| CN118590346B (en) | Network intercommunication method, device, computer equipment and storage medium | |
| CN105704042A (en) | Message processing method, BNG and BNG cluster system | |
| CN108494675A (en) | Realize the method, apparatus and routing device of Virtual Router Redundacy Protocol backup group | |
| CN113839862A (en) | Method, system, terminal and storage medium for synchronizing ARP information between MCLAG neighbors | |
| WO2020173424A1 (en) | Message processing method, and gateway device | |
| WO2018068588A1 (en) | Method and software-defined networking (sdn) controller for providing multicast service | |
| US20080205376A1 (en) | Redundant router having load sharing functionality | |
| CN115695374A (en) | IPv6 subnet prefix advertisement implementation method, device, equipment and storage medium | |
| CN102447703B (en) | A kind of heat backup method and system, CGN equipment | |
| CN109120556B (en) | Method and system for cloud host to access object storage server | |
| CN112217680B (en) | Controller capability benchmark test method and device based on software-defined wide area network | |
| CN114125910A (en) | Tunnel keep-alive method, network equipment, system and storage medium | |
| CN116455730A (en) | A method, system and controller for active/standby switching | |
| CN116599840A (en) | Network equipment dual uplink management configuration method, device and storage medium | |
| CN116074268A (en) | A control method of network interface and multi-node server | |
| WO2023284366A1 (en) | Dbng-cp backup method and apparatus | |
| CN117009135A (en) | User data backup, user data recovery methods and database server equipment |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination |