Cross-az device handover system, method, storage medium, and program product
By using a cross-AZ device handover system and managing the HAVIP address of virtual routers through location service devices, the problem of cross-AZ device handover is solved, and high availability services are achieved between different AZs.
Patent Information
- Application Number
- CN202310156572.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-20
- Publication Date
- 2025-12-05
- Estimated Expiration
- 2043-02-20
AI Technical Summary
Existing technology cannot enable device switching across Availability Zones (AZs), resulting in virtual switch HAVIP addresses being unable to switch devices across AZs and thus failing to provide high availability services between AZs.
This invention provides a cross-AZ device handover system that manages the HAVIP address of a virtual router through a location service device, generates and manages routing table entries, and enables cross-AZ device handover. The system includes a location service device, a virtual switch, and an ECS (Elastic Compute Service). The HAVIP address of the virtual router is a global IP address that can be used across different AZs.
It enables device switching between different Availability Zones (AZs), ensures high availability of the virtual router's HAVIP address, and can automatically select the primary ECS within an ECS group to provide high availability services.
Smart Images

Figure CN116346713B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of cloud technology, and in particular relates to a cross-AZ device switching system and method, a storage medium and a program product. BACKGROUND
[0002] With the continuous development of cloud technology, people have higher and higher requirements for VPC (Virtual Private Cloud). For example, flexibility, security, reliability, privacy, interconnection and high availability. To achieve high availability, multiple ECSs (Elastic Compute Service) are deployed on the VPC. When one ECS fails to provide services externally, the virtual switch HAVIP (High Availability Virtual Internet Protocol) address is switched from one ECS to another ECS, so that the other ECS can continue to provide services through the virtual switch HAVIP address.
[0003] Since the virtual switch HAVIP address belongs to the network segment corresponding to the virtual switch, and the network segment corresponding to the virtual switch can only serve one AZ (Availability Zone), it is impossible to perform device switching across AZs. Therefore, there is an urgent need to provide a cross-AZ device switching method. SUMMARY
[0004] The embodiments of the present application provide a cross-AZ device switching system, method, storage medium and program product, which can perform device switching across AZs. The technical solution is as follows:
[0005] In a first aspect, a cross-AZ device switching system is provided, and the system comprises a location service device, at least two virtual switches and at least one ECS connected to each virtual switch, wherein the location service device is connected to at least two virtual switches;
[0006] The location service device and at least two virtual switches are located in the same data center, at least two virtual switches are located in the same VPC in the data center, the VPC comprises at least two AZs, each virtual switch and the connected ECS are deployed in one AZ, at least two ECSs connected to the virtual switches all have the use authority of the virtual router high HAVIP address, the virtual router HAVIP address is allocated by the VPC, and the virtual router HAVIP address is a global IP address that can cross different AZs;
[0007] Each of the virtual switches is configured to forward a message between the location service device and a connected ECS.
[0008] Each of the ECSs connected to the virtual switches is configured to provide a service through the virtual router HAVIP address when becoming a master ECS, the master ECS being an ECS available to the virtual router HAVIP address.
[0009] The location service device is configured to generate and manage a routing table item of the master ECS, the routing table item being configured to indicate that a message accessing the virtual router HAVIP address is forwarded to the master ECS.
[0010] In a second aspect, a method for cross-AZ device switching is provided, the method being applied to the cross-AZ device switching system of the first aspect, and the method comprising:
[0011] When it is detected that the virtual router HAVIP address is available on a first ECS, the location service device generates a first routing table item pointing to the first ECS, the first ECS being any ECS in a first AZ of the VPC, and the first routing table item being configured to indicate an address of the first ECS so as to forward a message accessing the virtual router HAVIP address to the first ECS.
[0012] When it is detected that the virtual router HAVIP address is not available on the first ECS but available on a second ECS, the location service device generates a second routing table item pointing to the second ECS, the second ECS being any ECS in a second AZ of the VPC, and the second routing table item being configured to indicate an address of the second ECS so as to forward a message accessing the virtual router HAVIP address to the second ECS.
[0013] The location service device switches the first routing table item to the second routing table item, so that the second ECS provides a service through the virtual router HAVIP address.
[0014] In a third aspect, a computer readable storage medium is provided, the computer readable storage medium storing at least one computer program, the at least one computer program being executable by a processor to implement the cross-AZ device switching method of the second aspect.
[0015] In a fourth aspect, a computer program product is provided, the computer program product comprising a computer program, the computer program being executable by a processor to implement the cross-AZ device switching method of the second aspect.
[0016] The technical scheme provided by the embodiments of the present application has the following beneficial effects:
[0017] The virtual router HAVIP address is a global IP address assigned by the VPC, and the ECSs in different AZs of the VPC can be bound to the virtual router HAVIP address at the same time, so as to have the use right of the virtual router HAVIP address. In the ECS group composed of multiple ECSs in different AZs and bound to the virtual router HAVIP address, when the location service device detects that the virtual router HAVIP address is available on a first ECS, a first routing table item pointing to the first ECS is generated, and the first ECS provides services for the access device of the virtual router HAVIP address. When it is detected that the virtual router HAVIP address is not available on the first ECS but available on a second ECS, a second routing table item pointing to the second ECS is generated, and the second routing table item is switched to the second routing table item, so that the second ECS can provide services for the access device of the virtual router HAVIP address. Since the positions of the ECSs in the ECS group are the same, when the first ECS as the master ECS fails, the master ECS selected by the ECS group can be an ECS in the same AZ as the first ECS or an ECS in a different AZ from the first ECS. Regardless of which ECS, the location service device can generate a routing table item pointing to the ECS, so as to provide high-availability services for the device accessing the virtual router HAVIP address. BRIEF DESCRIPTION OF DRAWINGS
[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0019] Figure 1 is a structure schematic diagram of a cross-AZ device switching system provided by an embodiment of the present application;
[0020] Figure 2 is a structure schematic diagram of a cross-AZ device switching system provided by an embodiment of the present application;
[0021] Figure 3 is a schematic diagram of an object mounted by a virtual router HAVIP address provided by an embodiment of the present application;
[0022] Figure 4 is a structure schematic diagram of another cross-AZ device switching system provided by an embodiment of the present application;
[0023] Figure 5is a structural schematic diagram of another cross-AZ device switching system provided by an embodiment of the present application.
[0024] Figure 6 is a structural schematic diagram of another cross-AZ device switching system provided by an embodiment of the present application.
[0025] Figure 7 is a structural block diagram of an electronic device provided by an embodiment of the present application.
[0026] Figure 8 is a flowchart of a cross-AZ device switching method provided by an embodiment of the present application. DETAILED DESCRIPTION
[0027] In order to make the purpose, technical solutions and advantages of the present application clearer, the embodiments of the present application will be further described in detail below with reference to the drawings.
[0028] It can be understood that the terms "each", "multiple" and "any" used in the embodiments of the present application include two or more, each refers to each of the corresponding multiple, and any refers to any one of the corresponding multiple. For example, multiple words include 10 words, and each word refers to each of the 10 words, and any word refers to any one of the 10 words.
[0029] The information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data for analysis, stored data, displayed data, etc.) and signals involved in the present application are authorized by the user or fully authorized by all parties, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards of relevant countries and regions.
[0030] First, before performing the embodiments of the present application, the terms involved in the embodiments of the present application are explained.
[0031] The VPC is a dynamic configuration pool of public cloud computing resources, which needs to use encryption protocols, tunneling protocols and other security programs to transmit data between private enterprises and cloud service providers. The VPC includes three important components of virtual switches, gateways and controllers. The virtual switch and the gateway form the key path of the data path, and the controller uses a self-developed protocol to issue forwarding tables to the gateway and the virtual switch, which completes the configuration of the key path of the path. The configuration path and the data path are separated from each other. The virtual switch in the VPC is a distributed node, the gateway and the controller are cluster deployed and multi-machine room backup, all links have redundancy disaster recovery, which improves the overall availability of the VPC.
[0032] ARP (Address Resolution Protocol) is a TCP / IP (Transmission Control Protocol / Internet Protocol) protocol that obtains the physical address according to the IP address. When a host sends information, it broadcasts an ARP request containing the target IP address to all hosts on the local area network, and receives a return message to determine the physical address of the target; after receiving the return message, the IP address and physical address are stored in the local ARP cache for a certain period of time, and the next request is directly queried from the ARP cache to save resources.
[0033] The HAVIP address is a private IP resource that can be created and released independently. The HAVIP address can be used in cooperation with high-availability software (such as the Keepalived keep-alive checking mechanism) to build high-availability master-slave services and improve availability.
[0034] CIDR (Classless Inter-Domain Routing) is a method for classifying IP addresses for allocating IP addresses to users and effectively routing IP data packets on the Internet. CIDR is called classless inter-domain routing because CIDR does not distinguish between A-class, B-class, and C-class addresses, but uses the value of the CIDR prefix to specify the number of bits in the address as a network ID. The essence of CIDR is to continuously allocate the encoding of the host part to the network prefix, thereby generating new sub-networks.
[0035] Keepalived is a software similar to layer 3, 4, and 5 switching mechanisms, i.e., layer 3, layer 4, and layer 5 switching. The function of Keepalived is to detect the state of the server. If one server is down or has a fault, Keepalived will remove the detected faulty server from the system and use other servers to replace the server. When the server is working normally, Keepalived automatically adds the server to the server group.
[0036] Region refers to a physical data center. That is, a region is an independent physical data center.
[0037] Availability zone refers to a physically isolated region in the same region in terms of power and network. The availability zones are interconnected within the network, and physically isolated between different availability zones.
[0038] High availability refers to the ability of a system to perform its functions without interruption, representing the degree of availability of the system.
[0039] Redundancy switchover is an operation in which the main system switches to the slave system when a non-urgent failure occurs during system operation.
[0040] A virtual router (vRouter) is the hub of a private network. As an important functional component in a private network, it can connect various virtual switches in the private network and is also a gateway device connecting the private network and other networks. After the successful creation of each private network, the system automatically creates a router. Each router is associated with a routing table.
[0041] Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and network to realize the calculation, storage, processing, and sharing of data in a wide area network or local area network. Based on the cloud computing business model, cloud technology can be composed of a resource pool, applied to network technology, information technology, integration technology, management platform technology, and application technology, and used on demand, flexibly and conveniently. With the high development and application of the Internet industry, the background service of the technical network system requires a large amount of computing and storage resources. For example, video websites, image websites, and more portals can only be realized through cloud computing.
[0042] Cloud computing, as an important support for cloud technology, is the product of the development and integration of traditional computer and network technologies such as grid computing, distributed computing, parallel computing, utility computing, network storage, virtualization, load balancing, and can obtain the required resources in a network in a demand-based and easily expandable manner. Virtualization is one of the main technologies for realizing cloud computing, is a resource mapping and management logic software technology, and is a technical solution for simplifying the management of computing resources and optimizing the utilization of resources. In simple terms, it is to virtualize hardware resources to achieve isolation, scalability, full utilization of resources, and security.
[0043] In virtualization scenarios, users can create their own virtual networks within the cloud environment without considering the underlying physical network environment. These virtual networks include public cloud networks, private cloud networks, and hybrid cloud networks. Within a virtual network, each device, regardless of how it connects to the network, must have a unique IP address. This IP address is an abstraction of the host hardware address. Simply put, the MAC (Media Access Control Address) address is the physical address, while the IP address is the logical address. A virtual IP is an IP address not assigned to a physical device. In other words, a device providing services externally has both a physical IP and a virtual IP, and either of these two IP addresses can be used to connect to the device.
[0044] Virtual IP addresses are typically used to achieve high availability. To achieve high availability, existing VPC networks usually deploy multiple Availability Zones (AZs), with one virtual switch in each AZ. Each virtual switch corresponds to a virtual switch HAVIP address, and each virtual switch HAVIP address is simultaneously bound to at least two ECS instances within the AZ. Existing technology uses DNS (Domain Name System) for domain name resolution to enable cross-AZ device failover. Specifically, a mapping between domain names and two virtual switch HAVIP addresses is pre-defined, and each virtual switch HAVIP address is bound to an ECS instance within its corresponding AZ. When the primary ECS instance in an AZ fails, DNS failover occurs to the other virtual switch HAVIP address corresponding to the domain name, which is also the virtual switch HAVIP address of the backup ECS instance in the other AZ, allowing the backup ECS instance to continue providing service. However, DNS systems typically set a cache TTL (Time To Live). Within the set TTL, the DNS system will not perform domain name resolution, but will directly obtain the HAVIP address of the virtual switch corresponding to the domain name from the cache. In this case, if the primary ECS fails, it will be impossible to switch to the backup ECS, and thus it is impossible to truly achieve high availability of VPC in cross-AZ scenarios.
[0045] To achieve high availability for VPCs across Availability Zones (AZs), this application innovatively proposes a new CIDR, namely a Virtual Router CIDR. This virtual router CIDR is allocated by the VPC and is part of the VPC's CIDR configuration. Similar to the VPC, the virtual router CIDR is configured at the region level. This virtual router CIDR is a global CIDR and can be used across different AZs within the VPC. This virtual router CIDR does not overlap with the CIDRs configured on specified virtual switches, thus avoiding the inability to provide service due to the same IP address having different attributes.
[0046] Optionally, to meet the needs of tenants within a VPC, multiple virtual router CIDRs can be configured for a tenant.
[0047] In addition, the virtual router HAVIP address in the present application is bound with an EIP (Elastic IP, elastic IP address), that is, the ability to access the public network can be obtained. The EIP is a NAT IP located on a public network gateway and can be mapped to the bound cloud resource through a NAT mode. The EIP supports binding to an ECS instance of a private network type, a CLB (Classic Load Balancer, traditional load balancing) instance of a private network type, an ALB (Application Load Balancer) of a private network type, a secondary elastic network card of a private network type, a NAT gateway, and a HAVIP.
[0048] It should be noted that, in order to distinguish between CIDRs of different attributes, the present application will refer to the CIDR created by the virtual switch as the virtual switch CIDR, and the CIDR created by the VPC as the virtual router CIDR. The virtual switch HAVIP address used by the prior art when switching devices belongs to the virtual switch CIDR, while the virtual router HAVIP address used by the present application when switching devices belongs to the virtual router CIDR. Since the virtual router CIDR is a global network segment that can span different AZs within a VPC, and the virtual router HAVIP address belongs to the virtual router CIDR, the virtual router HAVIP address also has the ability to span different AZs within a VPC. Based on the ability to span different AZs within a VPC, the virtual router HAVIP address can be bound to ECSs in different AZs within a VPC. In the process of providing services based on the virtual router HAVIP address, when the primary ECS fails to provide services, device switching across AZs can be performed.
[0049] For the virtual router HAVIP address allocated for any VPC, the present application provides a cross-AZ device switching system, which is shown in Figure 1 The system includes a location service device, at least two virtual switches (VSW1 and VSW2) Figure 1 Only two virtual switches are shown by way of example, but this does not mean that only two virtual switches are included in the system) and at least one ECS (ECS1 and ECS2) connected to each virtual switch Figure 1 Only the connection relationship between the virtual switch and the ECS is shown by way of example, and in fact, each virtual switch can be connected to two or more ECSs), and the location service device is connected to the at least two virtual switches.
[0050] Referring to Figure 1The location service device and the at least two virtual switches are located in a same data center, the data center comprises at least one VPC, the at least two virtual switches are located in a same VPC of the data center, the VPC comprises at least two AZs, each virtual switch and the ECS connected thereto are located in one AZ, the ECS connected to the at least two virtual switches each has a use right of a virtual router HAVIP address, the virtual router HAVIP address is allocated by the VPC, and the virtual router HAVIP address is a global IP address that can cross different AZs.
[0051] The virtual switch is a basic network device of the VPC and is used to connect different cloud resources. After the VPC is created, one or more subnets can be divided for the VPC by creating a virtual switch. The intranets of different virtual switches in a same VPC are interconnected, and the application can be deployed in the virtual switches in different AZs to improve the availability of the application. Each virtual switch is connected to the location service device and is used to forward a message between the location service device and the connected ECS.
[0052] The ECS is a service providing device in the VPC and is used to provide accurate and fast computing services, store a large amount of data, and realize data sharing. The ECS connected to each virtual switch is used to provide a service through the virtual router HAVIP address when the ECS becomes a master ECS, and the master ECS is an ECS available for the virtual router HAVIP address.
[0053] The location service device is a new device deployed by the embodiment of the application for managing the virtual router HAVIP address allocated to each VPC in the data center, and the device is not deployed in the existing device switching system. The location service device has multiple functions, including performing a live detection on the ECS bound to the virtual router HAVIP address, generating a routing table item for the master ECS, and managing the routing table item of the master ECS. The routing table item is used to indicate the address of the master ECS to forward a message accessing the virtual router HAVIP address to the master ECS. The location service device can be a single physical server, a cluster or a distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud service, cloud database, cloud computing, cloud function, cloud storage, network service, cloud communication, middleware service, domain name service, security service, CDN (Content Delivery Network), and the like.
[0054] Referring to Figure 1The system also includes a private network gateway. The private network gateway resides within each VPC in the data center and connects to the location service device and each virtual switch within each VPC. The private network gateway provides private network address translation services for ECS instances within the VPC, enabling multiple ECS instances to access the local data center or other VPC private network gateways via relayed private network addresses (i.e., NAT IP addresses). Based on the private network gateway, packets from client devices in other VPCs within the data center accessing the virtual router's HAVIP address can be forwarded to the primary ECS.
[0055] See Figure 1 The system also includes a public network gateway. Located within the data center, this gateway connects to location service devices. The public network gateway is an enterprise-grade security gateway product designed for public network access, providing NAT proxy functions (SNAT and DNAT), 100Gbps forwarding capabilities, and cross-availability zone disaster recovery capabilities. It features high performance, automatic elasticity, flexible billing, and granular operation and maintenance, helping users better manage public network access traffic. Based on the public network gateway, packets from client devices outside the data center accessing the virtual router's HAVIP address can be forwarded to the primary ECS instance.
[0056] for Figure 1 The cross-AZ device switching system shown below will be explained in more intuitive terms to illustrate its structure and function. Figure 2 Let me introduce it. Figure 2 The device switching system shown includes: a location service device 101, a first ECS 102, a first virtual switch 103, a second ECS 104, and a second virtual switch 105 (the private network gateway of VPC1 is not shown in the figure). The location service device 101, the first virtual switch 103, and the second virtual switch 105 are located within the same data center, while the first virtual switch 103 and the second virtual switch 105 are located within VPC1. The first virtual switch 103 is a virtual switch on the physical machine where the first ECS 104 resides. This first virtual switch 103 is connected to the first ECS 104 and is used to forward packets sent and received by the first ECS 102. The second virtual switch 105 is a virtual switch on the physical machine where the second ECS 104 resides. This second virtual switch 105 is connected to the second ECS 106 and is used to forward packets sent and received by the second ECS 104. The VPC1 includes multiple AZs, such as the first AZ (represented as AZ1 in the figure) and the second AZ (represented as AZ2 in the figure), etc., wherein the first virtual switch 103 and the first ECS 104 are deployed in AZ1, and the second virtual switch 105 and the second ECS 106 are deployed in AZ2.
[0057] It should be noted that, although Figure 2The private network gateway included in the VPC1 is not shown in the figure, but the private network gateway is required to forward the packet accessing the virtual router HAVIP address to the primary ECS in the VPC1, whether the packet is sent by the ECS in the same data center or by the client device outside the data center.
[0058] In the embodiment of the present application, when the VPC1 network is created, each ECS in the VPC1 can bind to the virtual router HAVIP address allocated by the VPC1 network, and announce the use right of the virtual router HAVIP address through an ARP packet. When the first ECS 102 in the first AZ becomes the primary ECS in the ECS group, the first ECS 102 sends a primary announcement packet of the virtual router HAVIP address to the location service device 101, and the primary announcement packet is in the form of ARP, that is, the primary announcement packet is an ARP packet. The first virtual switch 103 receives the primary announcement packet, adds the location information of the first ECS 102 in the ARP primary announcement packet, and sends the ARP primary announcement packet to the location service device 101. When receiving the primary announcement packet, the location service device 101 determines that the virtual router HAVIP address is available on the first ECS 102, and generates a first routing table item pointing to the first ECS 102, which is used to indicate the address of the first ECS 102 to send the packet accessing the virtual router HAVIP address to the first ECS 102.
[0059] In order to provide high-availability service to the device accessing the virtual router HAVIP address, the ECSs bound to the virtual router HAVIP address form an ECS group, and the ECSs in the ECS group probe each other. When it is detected that the first ECS 102 is unavailable, the second ECS 104 in the ECS group is selected as the primary ECS. When becoming the primary ECS in the ECS group, the second ECS 104 sends a primary announcement packet of the virtual router HAVIP address to the location service device 101. The second virtual switch 105 receives the primary announcement packet, adds the location information of the second ECS 104 in the primary announcement packet, and sends the primary announcement packet to the location service device 101. When receiving the primary announcement packet, the location service device 101 determines that the virtual router HAVIP address is unavailable on the first ECS 102 and available on the second ECS 104, and generates a second routing table item pointing to the second ECS 104, which is used to indicate the address of the second ECS 104 to send the packet accessing the virtual router HAVIP address to the second ECS 104.
[0060] In the foregoing example in which the active ECS actively sends the active announcement message to the location service device 101, in an actual scenario, the location service device 101 can also send a probe message carrying the virtual router HAVIP address to each ECS in the ECS group. The probe message is used to trigger the active ECS in the ECS group to respond, so as to send a reply message back to the location service device 101 in response to the probe message. When the reply message is received, the location service device determines that the virtual router HAVIP address is available on the ECS.
[0061] In an embodiment of the present application, the location service device maintains a routing table, which includes a plurality of routing table entries. Each routing table entry is used to indicate the address of the active ECS in a corresponding time. Therefore, when it is determined that the virtual router HAVIP address is available on the second ECS 104, the location service device also switches the first routing table entry to the second routing table entry, so that the second ECS 104 can provide services through the virtual router HAVIP address.
[0062] In an embodiment of the present application, the mounting object of the virtual router HAVIP address can be an ECS, an aggregation port (for example, ENI bonding, etc.), or a virtual switch HAVIP address, etc. When the mounting object of the virtual router HAVIP address is an aggregation port, a plurality of ECSs connected by the aggregation port are virtually formed into an ECS to jointly provide services. When the aggregation port is selected as the active ECS in the ECS group, the plurality of ECSs connected by the aggregation port all need to send the active announcement message to the location service device 101. After the announcement is successful, the plurality of ECSs connected by the aggregation port jointly provide services for devices accessing the virtual router HAVIP address. Further, after the announcement is successful, the aggregation port also aggregates the location information of the plurality of ECSs connected thereby, and then sends the aggregated location information to the location service device 101. When the mounting object of the virtual router HAVIP address is a virtual switch HAVIP address, the virtual router HAVIP address and the virtual switch HAVIP address are processed in a nested manner. Specifically, the virtual router HAVIP address is mapped to the virtual switch HAVIP address, and the virtual switch HAVIP address is mapped to an ECS. In this case, when the location information is queried, nested querying is needed, that is, the virtual switch HAVIP address mounted by the virtual router HAVIP address is queried, and then the location information of the ECS configured with the virtual switch HAVIP address is queried according to the virtual switch HAVIP address.
[0063] In an embodiment of the present application, the first ECS 102 and the second ECS 104 are different when the mounting objects of the virtual switch HAVIP address are different.
[0064] Specifically, when the mounting object of the virtual switch HAVIP address is an ECS, the first ECS 102 can be any ECS connected with the first virtual switch 103 in the first AZ, and the second ECS 104 can be any ECS connected with the second virtual switch 105 in the second AZ. For example, the first ECS 102 can be ECS1 in the first AZ 1, and the second ECS 104 can be ECS7 in the second AZ 2. Figure 3 Specifically, when the mounting object of the virtual switch HAVIP address is an ECS, the first ECS 102 can be any ECS connected with the first virtual switch 103 in the first AZ, and the second ECS 104 can be any ECS connected with the second virtual switch 105 in the second AZ. For example, the first ECS 102 can be ECS1 in the first AZ 1, and the second ECS 104 can be ECS7 in the second AZ 2. Figure 3 Specifically, when the mounting object of the virtual switch HAVIP address is an ECS, the first ECS 102 can be any ECS connected with the first virtual switch 103 in the first AZ, and the second ECS 104 can be any ECS connected with the second virtual switch 105 in the second AZ. For example, the first ECS 102 can be ECS1 in the first AZ 1, and the second ECS 104 can be ECS7 in the second AZ 2.
[0065] Specifically, when the mounting object of the virtual switch HAVIP address is an ECS, the first ECS 102 can be any ECS connected with the first virtual switch 103 in the first AZ, and the second ECS 104 can be any ECS connected with the second virtual switch 105 in the second AZ. For example, the first ECS 102 can be ECS1 in the first AZ 1, and the second ECS 104 can be ECS7 in the second AZ 2. Figure 3 Specifically, when the mounting object of the virtual switch HAVIP address is an ECS, the first ECS 102 can be any ECS connected with the first virtual switch 103 in the first AZ, and the second ECS 104 can be any ECS connected with the second virtual switch 105 in the second AZ. For example, the first ECS 102 can be ECS1 in the first AZ 1, and the second ECS 104 can be ECS7 in the second AZ 2. Figure 3 Specifically, when the mounting object of the virtual switch HAVIP address is an ECS, the first ECS 102 can be any ECS connected with the first virtual switch 103 in the first AZ, and the second ECS 104 can be any ECS connected with the second virtual switch 105 in the second AZ. For example, the first ECS 102 can be ECS1 in the first AZ 1, and the second ECS 104 can be ECS7 in the second AZ 2.
[0066] Specifically, when the mounting object of the virtual switch HAVIP address is an ECS, the first ECS 102 can be any ECS connected with the first virtual switch 103 in the first AZ, and the second ECS 104 can be any ECS connected with the second virtual switch 105 in the second AZ. For example, the first ECS 102 can be ECS1 in the first AZ 1, and the second ECS 104 can be ECS7 in the second AZ 2. Figure 3 Specifically, when the mounting object of the virtual switch HAVIP address is an ECS, the first ECS 102 can be any ECS connected with the first virtual switch 103 in the first AZ, and the second ECS 104 can be any ECS connected with the second virtual switch 105 in the second AZ. For example, the first ECS 102 can be ECS1 in the first AZ 1, and the second ECS 104 can be ECS7 in the second AZ 2. Figure 3 Specifically, when the mounting object of the virtual switch HAVIP address is an ECS, the first ECS 102 can be any ECS connected with the first virtual switch 103 in the first AZ, and the second ECS 104 can be any ECS connected with the second virtual switch 105 in the second AZ. For example, the first ECS 102 can be ECS1 in the first AZ 1, and the second ECS 104 can be ECS7 in the second AZ 2.
[0067] In actual scenarios, the VPC network structure is relatively complex, and can include at least two of ECSs, aggregation ports, and virtual switch HAVIP addresses, and the mounting object of the virtual router HAVIP address can be an ECS, an aggregation port, and a virtual switch HAVIP address, etc. Therefore, the first ECS 102 can be any of an ECS connected with the first virtual switch 103 in the first AZ, a plurality of ECSs connected with the first aggregation port in the first AZ, and an ECS configured with the first virtual switch HAVIP address in the first AZ, and the second ECS 104 can be any of an ECS connected with the second virtual switch 105 in the second AZ, a plurality of ECSs connected with the second aggregation port in the second AZ, and an ECS configured with the second virtual switch HAVIP address in the second AZ. That is, the first ECS 102 and the second ECS 104 include the following cases:
[0068] Case One, the first ECS 102 is any ECS connected to the first virtual switch 103 in the first AZ, and the second ECS 104 is any ECS connected to the second virtual switch 105 in the second AZ. For example, the first ECS 102 is ECS1 in Figure 3 , and the second ECS 104 is ECS7 in Figure 3 .
[0069] Case Two, the first ECS 102 is any ECS connected to the first virtual switch 103 in the first AZ, and the second ECS 104 is a plurality of ECSs connected to the second aggregation port in the second AZ. For example, the first ECS 102 is ECS1 in Figure 3 , and the second ECS 104 is ECS8, ECS9 and ECS10 connected to ENI bonging2 in Figure 3 .
[0070] Case Three, the first ECS 102 is any ECS connected to the first virtual switch 103 in the first AZ, and the second ECS 104 is an ECS configured with the HAVIP address of the second virtual switch in the second AZ. For example, the first ECS 102 is ECS1 in Figure 3 , and the second ECS 104 is ECS11 or ECS12 connected to Vswitch HAVIP2 in Figure 3 .
[0071] Case Four, the first ECS 102 is a plurality of ECSs connected to the first aggregation port in the first AZ, and the second ECS 104 is any ECS connected to the second virtual switch 105 in the second AZ. For example, the first ECS 102 is ECS2, ECS3 and ECS4 connected to ENI bonging1 in Figure 3 , and the second ECS 104 is ECS7 in Figure 3 .
[0072] Case Five, the first ECS 102 is a plurality of ECSs connected to the first aggregation port in the first AZ, and the second ECS 104 is a plurality of ECSs connected to the second aggregation port in the second AZ. For example, the first ECS 102 is ECS2, ECS3 and ECS4 connected to ENI bonging1 in Figure 3 , and the second ECS 104 is ECS8, ECS9 and ECS10 connected to ENI bonging2 in Figure 3 .
[0073] Case Six, the first ECS 102 is a plurality of ECSs connected to the first aggregation port in the first AZ, and the second ECS 104 is an ECS configured with the HAVIP address of the second virtual switch in the second AZ. For example, the first ECS 102 is ECS2, ECS3 and ECS4 connected to ENI bonging1 in Figure 3ECS2, ECS3 and ECS4 connected with ENI bonging1, the second ECS 104 is Figure 3 ECS11 or ECS12 connected with Vswitch HAVIP2.
[0074] Case seven, the first ECS 102 is an ECS configured with a first virtual switch HAVIP address in a first AZ, and the second ECS 104 is any ECS connected with a second virtual switch 105 in a second AZ. For example, the first ECS 102 is Figure 3 ECS5 or ECS6 connected with Vswitch HAVIP1, and the second ECS 104 is Figure 3 ECS7 in the second AZ.
[0075] Case eight, the first ECS 102 is an ECS configured with a first virtual switch HAVIP address in a first AZ, and the second ECS 104 is a plurality of ECSs connected with a second aggregation port in a second AZ. For example, the first ECS 102 is Figure 3 ECS5 or ECS6 connected with Vswitch HAVIP1, and the second ECS 104 is Figure 3 ECS8, ECS9 and ECS10 connected with ENI bonging2.
[0076] Case nine, the first ECS 102 is an ECS configured with a first virtual switch HAVIP address in a first AZ, and the second ECS 104 is an ECS configured with a second virtual switch HAVIP address in a second AZ. The first ECS 102 is Figure 4 ECS5 or ECS6 connected with Vswitch HAVIP1, and the second ECS 104 is Figure 5 ECS11 or ECS12 connected with Vswitch HAVIP2.
[0077] In the embodiment of the present application, the access device can send an access message for a virtual router HAVIP address. When receiving the access message sent by the access device, the forwarding device obtains the location information of the master ECS, and then sends the access message to the master ECS. According to the network where the access device and the master ECS are located, the forwarding device has multiple cases. Taking the master ECS as the first ECS as an example, referring to the device switching system shown in Figure 6 , when the access device 106 is a third ECS 106 located in the same VPC as the first ECS, the forwarding device 107 is a virtual switch on the physical machine where the third ECS 106 is located, that is, a third virtual switch. Referring to Figures 4 to 6The device switching system is shown. When the access device 106 is a third ECS 106 in VPC2 which is in the same data center as the first ECS, the forwarding device 107 is a private network gateway in VPC2 where the third ECS 106 is located. Referring to Figure 7 The device switching system is shown. When the access device 106 is any client device outside the data center where the first ECS is located, the forwarding device 107 is a public network gateway of the data center.
[0078] The above is an example of taking the first ECS as the primary ECS. When the primary ECS is another ECS in the ECS group, the structure of the device switching system is similar to that of the cross-AZ device switching system shown in any of the above Figure 7 The structure of the cross-AZ device switching system shown in any of the above
[0079] Figure 8 A structural block diagram of an electronic device 700 is shown. The electronic device 700 can be any device involved in the above cross-AZ device switching system. Generally, the electronic device 700 includes a processor 701 and a memory 702.
[0080] The processor 701 can be implemented in at least one of a hardware form of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), and a PLA (Programmable Logic Array). The processor 701 can also include a main processor and a coprocessor. The main processor is a processor for processing data in an awake state, and the coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 701 can be integrated with a GPU (Graphics Processing Unit) which is responsible for rendering and drawing the content required to be displayed on the display screen. In some embodiments, the processor 701 can also include an artificial intelligence processor for processing machine learning related computing operations.
[0081] The memory 702 can include one or more computer-readable storage media that can be non-transitory computer-readable storage media, such as CD-ROM (Compact Disc Read-Only Memory), ROM (Random Access Memory), RAM (Random Access Memory), magnetic tape, floppy disk, and optical data storage devices, etc. The computer-readable storage medium stores at least one computer program which can be executed to implement the above-mentioned cross-AZ device switching method.
[0082] Of course, the above-mentioned electronic device can also include other components, such as an input / output interface, a communication component, etc. The input / output interface provides an interface between the processor and the peripheral interface module, which can be an output device, an input device, etc. The communication component is configured to facilitate wired or wireless communication between the electronic device and other devices.
[0083] Those skilled in the art can understand that, The structure shown in the figure does not constitute a limitation on the electronic device 700, and can include more or fewer components than shown, or combine certain components, or use different component arrangements.
[0084] The embodiment of the present application provides a cross-AZ device switching method. Taking the cross-AZ device switching system as an example, referring to The method provided by the embodiment of the present application includes:
[0085] 801. When it is detected that the virtual router HAVIP address is available on the first ECS, the location service device generates a first routing table item pointing to the first ECS.
[0086] Under the virtual network, the VPC network can deploy at least two AZs, and at least two ECSs are deployed in each AZ. When the VPC creates a virtual router HAVIP address, in order to provide high-availability services to devices accessing the virtual router HAVIP address, the location service device can bind the virtual router HAVIP address to the ECS devices in at least two AZs in the VPC network. The AZ used for binding with the virtual router HAVIP address can be all or part of the AZs deployed by the VPC network, and the ECS in the AZ used for binding with the virtual router HAVIP address can be all or part of the ECSs in the AZ.
[0087] To facilitate management of the multiple ECSs bound to the virtual router HAVIP address, embodiments of the present application can form the multiple ECSs bound to the virtual router HAVIP address into an ECS group. For each ECS in the ECS group, although a binding relationship is established with the virtual router HAVIP address, the ECS only has the use right of the virtual router HAVIP address and cannot use the virtual router HAVIP address to provide services. To use the virtual router HAVIP address to provide services, the bound virtual router HAVIP address needs to be enabled in the ECS. Generally, the virtual router HAVIP address can only be enabled (configured) on one ECS device and cannot be enabled on two or more ECSs at the same time. Therefore, before the virtual router HAVIP address is enabled, one ECS needs to be selected in the ECS group, which is the primary ECS. When selecting the primary ECS, each ECS in the ECS group can be based on a preset software (for example, Keepalive), a preset protocol, tenant settings, the type of each ECS, and the like, which is not specifically limited by embodiments of the present application.
[0088] In embodiments of the application, when the location service device detects that the virtual router HAVIP address is available on the first ECS in the first AZ, the location service device detects whether the current routing table entry points to the first ECS. If the current routing table entry does not point to the first ECS, a first routing table entry pointing to the first ECS is generated. The first routing table entry represents the mapping relationship between the virtual router HAVIP address and the first ECS and is used to indicate the address of the first ECS to forward the packet accessing the virtual router HAVIP address to the first ECS.
[0089] When the location service device detects whether the virtual router HAVIP address is available on the first ECS in the first AZ, the following two methods can be used:
[0090] The first method is that the location server sends a detection packet carrying the virtual router HAVIP address to each ECS in the ECS group at a first preset time interval (which can be set according to requirements). The detection packet is used to trigger the primary ECS in the ECS group configured with the virtual router HAVIP address to respond. The form of the detection packet can be ARP, that is, the detection packet can be an ARP packet. When the first ECS receives the detection packet, the first ECS responds to the detection packet, and other ECSs in the ECS group do not respond to the detection packet. In response to the detection packet, the first ECS sends a first reply packet to the location service device. When the first reply packet is received, the location service device determines that the virtual router HAVIP address is available on the first ECS.
[0091] The second mode is that when becoming the master ECS in the ECS group, the first ECS sends a first master declaration message of the virtual router HAVIP address to the location service device. When receiving the first master declaration message, the location service device determines that the virtual router HAVIP address is available on the first ECS.
[0092] It should be noted that the probe message sent by the location service device to each ECS in the ECS group, the first reply message sent by the first ECS to the location service device, and the first master declaration message sent by the first ECS to the location service device all need to be forwarded by an intermediate device. For the first ECS, the intermediate device is a first virtual switch on the physical machine where the first ECS is located. When the location service device sends the probe message to the first ECS in the first AZ of the VPC, the first virtual switch receives the probe message and then forwards the probe message to the first ECS. When the first ECS sends the first reply message to the location service device, the first virtual switch receives the first reply message and sends the first reply message to the location service device. When the first ECS sends the first master declaration message to the location service device, the first virtual switch receives the first master declaration message and sends the first master declaration message to the location service device.
[0093] In the embodiment of the present application, in order to be able to forward the message of the third ECS accessing the virtual router HAVIP address to the first ECS, the first virtual switch needs to report the location information of the first ECS to the location service device, which includes the MAC address of the first ECS and the IP address of the physical machine where the first ECS is located, etc. When the first virtual switch reports the location information of the first ECS to the location service device, it can be reported by means of the message sent by the first ECS to the location service device. Since the message sent by the first ECS to the location service device is the first reply message or the first master declaration message, for these two messages, the way in which the first virtual switch reports the location information to the location service device includes but is not limited to the following two ways:
[0094] The first way is that when receiving the first reply message sent by the first ECS, the first virtual switch adds the location information of the first ECS to the first reply message to obtain a second reply message, and sends the second reply message to the location service device.
[0095] Further, when receiving the second reply message, the location service device stores the correspondence between the virtual router HAVIP address and the location information of the first ECS. The storage form of the correspondence on the location service device can be in the form of key-value, wherein the virtual router HAVIP address is the key value, and the location information of the first ECS is the value. In response to the second reply message, the location service device converts the correspondence between the virtual router HAVIP address and the location information of the first ECS into the first routing table item.
[0096] The second way, when receiving the first primary announcement message sent by the first ECS, the first virtual switch adds the location information of the first ECS to the first primary announcement message to obtain a second primary announcement message, and sends the second primary announcement message to the location service device.
[0097] Further, when receiving the second primary announcement message, the location service device stores the correspondence between the virtual router HAVIP address and the location information. In response to the second primary announcement message, the location service device converts the correspondence between the virtual router HAVIP address and the location information of the first ECS into the first routing table item.
[0098] In the process of providing services by the first ECS based on the virtual router HAVIP address, when the access device needs to obtain the services provided by the virtual router HAVIP address, the access device generates a first access message carrying the virtual router HAVIP address and sends the first access message. When receiving the first access message sent by the access device, the forwarding device obtains the location information of the first ECS from the location service device according to the virtual router HAVIP address, and encapsulates the first access message according to the location information of the first ECS to obtain a second access message, and further sends the second access message to the first virtual switch. When receiving the second access message, the first virtual switch sends the second access message to the first ECS according to the location information of the first ECS encapsulated by the second access message, so as to realize the access of the third ECS to the virtual router HAVIP address.
[0099] The forwarding device can obtain the location information of the first ECS according to the virtual router HAVIP address by using the following method: the forwarding device sends a location information obtaining request carrying the virtual router HAVIP address to the location service device; when receiving the location information obtaining request, the location service device queries the current routing table item as the first routing table item, and then obtains the location information of the first ECS based on the correspondence between the virtual router HAVIP address and the first ECS location information, and sends the location information of the first ECS to the forwarding device; and the forwarding device receives the location information of the first ECS sent by the location service device, and obtains the location information of the first ECS.
[0100] The forwarding device can encapsulate the first access message according to the location information of the first ECS to obtain the second access message by using the following method: the forwarding device encapsulates the first access message by taking the MAC address of the first ECS as an inner layer address and taking the IP address of the physical machine where the first ECS is located as an outer layer address to obtain the second access message.
[0101] The forwarding device is a device for forwarding the message transmitted and received by the access device, and the forwarding device can have multiple cases according to the network where the access device and the first ECS are located.
[0102] When the access device is a third ECS located in the same VPC as the first ECS, the forwarding device can be a third virtual switch on the physical machine where the third ECS is located; when the access device is any client device located in another VPC in the same data center as the first ECS, the forwarding device can be a private network gateway in the VPC where the client device is located; and when the access device is any client device outside the data center, the forwarding device can be a public network gateway of the data center.
[0103] From the relationship between the above-mentioned access device and the forwarding device, it can be seen that the method provided in the embodiments of the present application can be applied to the following scenarios:
[0104] The first scenario is a scenario in which a client device in the same VPC in the same data center accesses the virtual router HAVIP address;
[0105] The second scenario is a scenario in which a client device in different VPCs in the same data center accesses the virtual router HAVIP address;
[0106] The third scenario is a scenario in which a client device outside the data center accesses the virtual router HAVIP address.
[0107] 802. When it is detected that the virtual router HAVIP address is unavailable on the first ECS and available on the second ECS, the location service device generates a second routing table item pointing to the second ECS.
[0108] To ensure high availability of services accessing the virtual router HAVIP address, avoid the first ECS as the master ECS from failing to provide access services for devices accessing the virtual router HAVIP address, each ECS in the ECS group will probe each other. When each ECS in the ECS group probes each other, each ECS in the ECS group can broadcast a heartbeat packet in the ECS group every second preset time period (the second preset time period can be set according to requirements) based on the Keepalive mechanism, and if other ECSs in the ECS group do not receive the heartbeat packet broadcast by the first ECS, the other ECSs in the ECS group determine that the first ECS has failed. Further, when it is determined that the first ECS has failed, in order to be able to continuously provide services to devices accessing the virtual router HAVIP address, the other ECSs in the ECS group select a second ECS in the second AZ as the master ECS to continue to provide services. The method of selecting the second ECS from the ECS group is the same as the method of selecting the first ECS from the ECS group, and will not be described here.
[0109] In the application embodiment, when the location service device detects that the virtual router HAVIP address is unavailable on the first ECS and available on the second ECS in the second AZ, the location service device detects whether the current routing table entry points to the second ECS, and if the current routing table entry does not point to the second ECS, a second routing table entry pointing to the second ECS is generated. The second routing table entry represents the mapping relationship between the virtual router HAVIP address and the second ECS, and is used to indicate the address of the second ECS to forward the message accessing the virtual router HAVIP address to the second ECS.
[0110] The location service device can use the following two methods to detect whether the virtual router HAVIP address is available on the second ECS in the second AZ.
[0111] The first method is that the location server sends a detection message carrying the virtual router HAVIP to each ECS in the ECS group every first preset time period (the first preset time period can be set according to requirements). When the ECS group selects the second ECS as the master ECS, the second ECS receives the detection message, and the second ECS responds to the detection message, and the other ECSs in the ECS group do not respond to the detection message. In response to the detection message, the second ECS sends a third reply message to the location service device, and when the third reply message is received, the location service device determines that the virtual router HAVIP address is available on the second ECS.
[0112] The second mode is that when becoming the master ECS in the ECS group, the second ECS sends a third master declaration message of the virtual router HAVIP address to the location service device. When receiving the third master declaration message, the location service device determines that the virtual router HAVIP address is available on the second ECS.
[0113] It should be noted that the probe message sent by the location service device to each ECS in the ECS group, the third reply message sent by the second ECS to the location service device, and the third master declaration message sent by the second ECS to the location service device all need to be forwarded by an intermediate device. For the second ECS, the intermediate device is a second virtual switch. When the location service device sends the probe message to the second ECS in the second AZ, the second virtual switch receives the probe message and then forwards the probe message to the second ECS. When the second ECS sends the third reply message to the location service device, the second virtual switch receives the third reply message and sends the third reply message to the location service device. When the second ECS sends the third master declaration message to the location service device, the second virtual switch receives the third master declaration message and sends the third master declaration message to the location service device.
[0114] In the embodiment of the present application, in order to be able to forward the message of the third ECS accessing the virtual router HAVIP address to the second ECS, the second virtual switch needs to report the location information of the second ECS to the location service device, which includes the MAC address of the second ECS and the IP address of the physical machine where the second ECS is located, etc. When the second virtual switch reports the location information of the second ECS to the location service device, it can report by means of the message sent by the second ECS to the location service device. Since the message sent by the second ECS to the location service device is the third reply message or the third master declaration message, for these two messages, the way of the second virtual switch reporting the location information to the location service device includes but is not limited to the following two ways:
[0115] The first way is that when receiving the third reply message sent by the second ECS, the second virtual switch adds the location information of the second ECS to the third reply message to obtain a fourth reply message, and sends the fourth reply message to the location service device.
[0116] Further, when receiving the fourth reply message, the location service device stores the correspondence between the virtual router HAVIP address and the location information of the second ECS. The correspondence is used to indicate the current location of the virtual router HAVIP address, and the storage form of the correspondence on the location service device can be in the form of key-value, where the virtual router HAVIP address is the key value, and the location information of the second ECS is the value. In response to the fourth reply message, the location service device converts the correspondence between the virtual router HAVIP address and the location information of the second ECS into the second routing table item.
[0117] The second way, when receiving the third master declaration message sent by the second ECS, the second virtual switch adds the location information of the second ECS to the third master declaration message to obtain a fourth master declaration message, and sends the fourth master declaration message to the location service device.
[0118] Further, when receiving the fourth master declaration message, the location service device stores the correspondence between the virtual router HAVIP address and the location information. In response to the fourth master declaration message, the location service device converts the correspondence between the virtual router HAVIP address and the location information of the second ECS into the second routing table item.
[0119] 803、The location service device switches the first routing table item to the second routing table item to enable the second ECS to provide services through the virtual router HAVIP address.
[0120] In the embodiments of the present application, the current routing table item is used to indicate the address of the device where the virtual router HAVIP address is currently located. When the first ECS fails to provide services, after the location service device generates the second routing table item for the second ECS, in order to continue to provide services to the device accessing the virtual router HAVIP address, the location service device switches the current routing table item from the first routing table item to the second routing table item, so that when receiving an access message to the virtual router HAVIP address, the access message can be forwarded to the second ECS based on the current routing table item, so that the second ECS continues to provide services through the virtual router HAVIP address.
[0121] The method provided in the embodiments of the present application can realize the second-level switching of the virtual router HAVIP address between devices across AZs, and guarantees the high availability of services, and is particularly effective for application-type network elements (for example, GLSB, gateway, etc.) across AZs and high-availability systems constructed by users across AZs.
[0122] The method provided in the embodiments of the present application is that the virtual router HAVIP address is a global IP address that can cross different AZs, and ECSs in different AZs can bind to the virtual router HAVIP address at the same time, thereby having the use right of the virtual router HAVIP address. In an ECS group composed of multiple ECSs that are bound to the virtual router HAVIP address in different AZs, when a location service device detects that the virtual router HAVIP address is available on a first ECS, a first routing table item pointing to the first ECS is generated, and the first ECS provides services for an access device of the virtual router HAVIP address. When it is detected that the virtual router HAVIP address is not available on the first ECS but available on a second ECS, a second routing table item pointing to the second ECS is generated, and the second routing table item is switched from the first routing table item, so that the second ECS can provide services for the access device of the virtual router HAVIP address. Since the positions of the ECSs in the ECS group are the same, when the first ECS serving as a master ECS fails, the master ECS selected by the ECS group can be an ECS in the same AZ as the first ECS or an ECS in a different AZ from the first ECS. Regardless of which ECS, the location service device can generate a routing table item pointing to the ECS, thereby providing high-availability services for the device accessing the virtual router HAVIP address.
[0123] The embodiment of the present application provides a computer readable storage medium, at least one computer program is stored in the computer readable storage medium, and the at least one computer program can realize the cross-AZ device switching method when executed by a processor.
[0124] The embodiment of the present application provides a computer program product, the computer program product comprises a computer program, and the computer program can realize the cross-AZ device switching method when executed by a processor.
[0125] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system, device and unit described above can refer to the corresponding process in the foregoing method embodiments, which will not be described here.
[0126] The above embodiments are only used to illustrate the technical solutions of the present application, but not limit the same; although the foregoing embodiments of the present application are described in detail, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A cross-AZ device handover system, characterized in that, The system comprises a location service device, at least two virtual switches and at least one ECS connected to each of the virtual switches, the location service device is connected to the at least two virtual switches; The location service device and the at least two virtual switches are located in the same data center, the at least two virtual switches are located in the same VPC of the data center, the VPC comprises at least two AZs, each of the virtual switches and the connected ECS are deployed in one AZ, the ECS connected to the at least two virtual switches all have the use authority of a virtual router HAVIP address, the virtual router HAVIP address is allocated by the VPC, and the virtual router HAVIP address is a global IP address that can cross different AZs; Each of the virtual switches is configured to forward a message between the location service device and the connected ECS. Each of the ECS connected to the virtual switches is configured to provide a service through the virtual router HAVIP address when the ECS becomes a master ECS, and the master ECS is an ECS available for the virtual router HAVIP address. The location service device is configured to generate and manage a routing table item of the master ECS, and the routing table item is used to indicate the address of the master ECS and forward a message accessing the virtual router HAVIP address to the master ECS. When a first access message accessing the virtual router HAVIP address is received, a forwarding device acquires location information from the location service device according to the virtual router HAVIP address. The forwarding device encapsulates the first access message according to the location information to obtain a second access message. The forwarding device sends the second access message to a virtual switch connected to the master ECS. After receiving the second access message, the switch connected to the master ECS sends the second access message to the master ECS, so that the access device accesses the virtual router HAVIP address.
2. The system of claim 1, wherein, The system further comprises a private network gateway, the private network gateway is located in the VPC, the private network gateway is connected to the location service device and the at least two virtual switches in the VPC, and the private network gateway is configured to forward a message accessing the virtual router HAVIP address from a client device in another VPC of the data center to the master ECS.
3. The system of claim 1 or 2, wherein, The system further comprises a public network gateway, the public network gateway is located in the data center, the public network gateway is connected to the location service device, and the public network gateway is configured to forward a message accessing the virtual router HAVIP address from a client device outside the data center to the master ECS.
4. A method for cross-AZ device handover, the method being applied to the cross-AZ device handover system of any one of claims 1 to 3, characterized in that, The method comprises: When it is detected that the virtual router HAVIP address is available on the first ECS, the location service device generates a first routing table item pointing to the first ECS, the first ECS being any ECS in a first AZ of the VPC, the first routing table item being used to indicate an address of the first ECS to forward a packet accessing the virtual router HAVIP address to the first ECS; When an access packet accessing the virtual router HAVIP address is received, a virtual switch connected with the first ECS sends the access packet to the first ECS to realize access to the virtual router HAVIP address; wherein the first ECS's address obtained from the location service device according to the virtual router HAVIP address is encapsulated in the access packet; When it is detected that the virtual router HAVIP address is available on the first ECS, the location service device generates a first routing table item pointing to the first ECS, the first ECS being any ECS in a first AZ of the VPC, the first routing table item being used to indicate an address of the first ECS to forward a packet accessing the virtual router HAVIP address to the first ECS; The location service device switches the first routing table item to the second routing table item to enable the second ECS to provide services through the virtual router HAVIP address.
5. The method of claim 4, wherein, The location service device detects that the virtual router HAVIP address is available on the first ECS, comprising: The location service device sends a detection packet carrying the virtual router HAVIP address to each ECS in an ECS group, the ECS group being composed of ECSs in the VPC having a use right of the virtual router HAVIP address, the detection packet being used to trigger a master ECS in the ECS group to respond; In response to the received detection packet, the first ECS sends a first reply packet to the location service device; When the first reply packet is received, the location service device determines that the virtual router HAVIP address is available on the first ECS.
6. The method of claim 5, wherein, The method further comprises: When the first reply packet sent by the first ECS is received, a first virtual switch adds location information of the first ECS to the first reply packet to obtain a second reply packet, and sends the second reply packet to the location service device, the first virtual switch being a virtual switch connected with the first ECS; The location service device generates a first routing table item pointing to the first ECS, comprising: When the second reply packet is received, the location service device converts a correspondence between the virtual router HAVIP address and the location information into the first routing table item.
7. The method of claim 4, wherein, The location service device detects that the virtual router HAVIP address is available on the first ECS, comprising: When becoming a master ECS in an ECS group, the first ECS sends a first master declaration message of the virtual router HAVIP address to the location service device, the ECS group being composed of ECSs in the VPC having the use right of the virtual router HAVIP address; When receiving the first master declaration message, the location service device determines that the virtual router HAVIP address is available on the first ECS.
8. The method of claim 7, wherein, The method further comprises: When receiving the first master declaration message sent by the first ECS, a first virtual switch connected to the first ECS adds location information of the first ECS to the first master declaration message to obtain a second master declaration message, and sends the second master declaration message to the location service device; The location service device generates a first routing table item pointing to the first ECS, comprising: When receiving the second master declaration message, the location service device converts a correspondence between the virtual router HAVIP address and the location information into the first routing table item.
9. The method of claim 4, wherein, The location information comprises a media access control (MAC) address of the first ECS and an IP address of a physical machine where the first ECS is located, and the forwarding device encapsulates the first access message according to the location information to obtain a second access message, comprising: The forwarding device encapsulates the first access message with the MAC address of the first ECS as an inner layer address and the IP address of the physical machine where the first ECS is located as an outer layer address to obtain the second access message.
10. The method of claim 4, wherein, The access device is any ECS in the VPC, and the forwarding device is a virtual switch connected to the ECS; or, The access device is any client device in another VPC of the data center, and the forwarding device is a private network gateway in the VPC where the client device is located; or, The access device is any client device outside the data center, and the forwarding device is a public network gateway.
11. The method according to any one of claims 4 to 10, characterized in that, When the mounting object of the virtual router HAVIP address is an ECS, the first ECS is any ECS connected to a first virtual switch in the first AZ, and the second ECS is any ECS connected to a second virtual switch in the second AZ; When the mounting object of the virtual router HAVIP address is an aggregation port, the first ECS is a plurality of ECSs connected to a first aggregation port in the first AZ, and the second ECS is a plurality of ECSs connected to a second aggregation port in the second AZ; When the mounting object of the virtual router HAVIP address is a virtual switch HAVIP address, the first ECS is an ECS configured with a first virtual switch HAVIP address in the first AZ, and the second ECS is an ECS configured with a second virtual switch HAVIP address in the second AZ.
12. A computer-readable storage medium, characterized in that, The computer readable storage medium stores at least one computer program, and the at least one computer program is executed by the processor to implement the device switching method across AZs in any one of claims 4 to 11.
13. A computer program product, characterised in that, The computer program product comprises a computer program, and the computer program is executed by the processor to implement the device switching method across AZs in any one of claims 4 to 11.
Citation Information
Patent Citations
Equipment switching method and device, and service system
CN110474802A