CN117857315A - Node switching method, device, computer equipment, storage medium and product - Google Patents

Node switching method, device, computer equipment, storage medium and product Download PDF

Info

Publication number
CN117857315A
CN117857315A CN202311783016.XA CN202311783016A CN117857315A CN 117857315 A CN117857315 A CN 117857315A CN 202311783016 A CN202311783016 A CN 202311783016A CN 117857315 A CN117857315 A CN 117857315A
Authority
CN
China
Prior art keywords
node
address
standby
service
main
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
Application number
CN202311783016.XA
Other languages
Chinese (zh)
Inventor
盛薇
孙会首
李明达
任超
张伟
袁崇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shuguang Cloud Computing Group Co ltd
Original Assignee
Shuguang Cloud Computing Group Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shuguang Cloud Computing Group Co ltd filed Critical Shuguang Cloud Computing Group Co ltd
Priority to CN202311783016.XA priority Critical patent/CN117857315A/en
Publication of CN117857315A publication Critical patent/CN117857315A/en
Pending legal-status Critical Current

Links

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application relates to a node switching method, a node switching device, computer equipment, a storage medium and a product. The method is applied to an address resolution protocol ARP proxy, wherein the ARP proxy is any proxy in a data link layer deployed on each node in a cluster, and comprises the following steps: and responding to an address release request of the target service, releasing a virtual service address of the target service, and drifting the virtual service address to the standby node so as to switch from the main node to the standby node to provide the target service, wherein the address release request is triggered under the condition that the main node in the cluster cannot provide the target service. By adopting the method, under the condition that the main node in the cluster can not provide the target service, the node switching can be realized through the ARP agent deployed at the data link layer of each node in the cluster, so that the complexity of the node switching mode is reduced, and in the process of realizing the node switching, each application of the node to which the ARP agent belongs can be commonly used, and the condition that the application cannot be commonly used does not occur.

Description

Node switching method, device, computer equipment, storage medium and product
Technical Field
The present invention relates to the field of computers, and in particular, to a node switching method, a node switching device, a computer device, a storage medium, and a product.
Background
With the continuous development of cloud computing technology, different services provided by a cloud computing platform are widely applied to various fields. To ensure high availability of services, services are typically deployed in distributed clusters.
Taking platform as a service (Platform as a Service, paaS) as an example, in practical application, multiple nodes that deploy the same PaaS service in a distributed cluster share a virtual service address to provide service externally, when a master node that is providing the PaaS service needs to be upgraded or failed, a standby node needs to be selected to take over the master node to provide the corresponding PaaS service.
However, the node switching method in the related art has a relatively complex and non-universal problem.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a node switching method, apparatus, computer device, storage medium, and product, which can reduce complexity of a node switching method, and on the basis of low complexity, have versatility in each application on a standby node that replaces a master node after node switching.
In a first aspect, an embodiment of the present application provides a node switching method, applied to an ARP proxy, where the ARP proxy is any one of data link layers deployed on each node in a cluster, and the method includes:
releasing the virtual service address of the target service in response to the address release request of the target service; the address release request is triggered when the main node in the cluster cannot provide the target service;
drifting the virtual service address to the standby node to switch from the master node to the standby node to provide the target service; the standby node is any node except the main node.
The technical scheme of the embodiment of the application is applied to an Address Resolution Protocol (ARP) agent, wherein the ARP agent is any agent deployed in a data link layer of each node in a cluster, responds to an address release request of target service, releases a virtual service address of the target service, and drifts the virtual service address to a standby node so as to switch from a main node to the standby node to provide the target service, wherein the address release request is triggered under the condition that the main node in the cluster cannot provide the target service; according to the method, under the condition that a main node in the cluster cannot provide target service, node switching can be realized through the ARP agents deployed in the data link layers of all nodes in the cluster, wherein the data link layers belong to the bottom layers, so that after the ARP agents are deployed in the data link layers of all nodes, the node switching can be realized without carrying out compatible configuration on all the ARP agents and all the applications of the nodes to which the ARP agents belong, the complexity of a node switching mode is reduced, and in the process of realizing the node switching, all the applications of the nodes to which the ARP agents belong can be commonly used, and the condition that the applications cannot be commonly used does not occur; meanwhile, after the virtual service address of the corresponding service is released, the virtual service address can be quickly shifted to the standby node so as to be switched from the main node to the standby node to provide the corresponding service, so that the corresponding service is not interrupted, the accessed client cannot sense the change, and the high availability of the service is realized.
In one embodiment, the address release request carries a master node identifier; releasing the virtual service address of the target service, comprising:
determining main address mapping information of a main node from an address resolution protocol table of the node according to the main node identification; the master address mapping information represents a binding relationship between a master node address of the master node and the virtual service address;
and releasing the virtual service address according to the main address mapping information in the address resolution protocol table.
According to the technical scheme, main address mapping information of a main node is determined from an address resolution protocol table of the node to which the main node belongs according to the main node identification, and the main address mapping information of the main node is determined from the address resolution protocol table of the node to which the main node belongs according to the main node identification; under the condition that a main node in the cluster cannot provide target service, the method can release the virtual service address of the target service through the main address mapping information in the address resolution protocol table of the node to which each APR agent belongs, so as to prepare for further successfully realizing node switching, ensure that the service is not interrupted, and simultaneously, the processing process is simpler, thereby improving the speed and efficiency of releasing the virtual service address.
In one embodiment, releasing the virtual service address according to the primary address mapping information in the address resolution protocol table includes:
the primary address mapping information is deleted from the address resolution protocol table to release the virtual service address.
According to the technical scheme, the main address mapping information can be deleted from the address resolution protocol table to release the virtual service address, the processing process is simple, the time consumption of releasing the virtual service address can be shortened, the speed and efficiency of releasing the virtual service address can be improved, the speed and efficiency of switching the nodes can be improved on the basis, the corresponding service is ensured not to be interrupted, and the accessed client cannot sense change.
In one embodiment, drifting the virtual service address to the backup node includes:
acquiring a standby node address of a standby node;
and establishing a binding relation between the standby node address and the virtual service address in the address resolution protocol table, and generating standby address mapping information.
According to the technical scheme, the standby node address of the standby node is obtained, a binding relation between the standby node address and the virtual service address is established in an address resolution protocol table, and standby address mapping information is generated; the method does not need complex algorithm realization, reduces the data quantity processed in the virtual service address drifting process, and can accelerate the drifting speed of the virtual service address, thereby enabling the releasing operation and the drifting operation of the virtual service address to achieve seamless connection and ensuring that the target service is not interrupted.
In one embodiment, the method further comprises:
and under the condition that the node to which the ARP agent belongs is a standby node and the ARP agents on other nodes do not establish standby address mapping information, the standby address mapping information is sent to the other nodes, and the other nodes are indicated to be stored in the respective address resolution protocol tables.
According to the technical scheme, when the node to which the ARP agent belongs is a standby node and the ARP agents on other nodes do not establish standby address mapping information, the standby address mapping information is sent to the other nodes, and the other nodes are indicated to be stored in respective address resolution protocol tables; in the method, the ARP agent on the standby node can directly send the standby address mapping information to other nodes except the standby node in the cluster, so that the other nodes do not need to establish a binding relationship, the standby address mapping information can be directly stored in the respective address resolution protocol table to finish the virtual service address drift, and the process can greatly improve the drift speed of the virtual service address.
In one embodiment, before drifting the virtual service address to the standby node, the method further comprises:
and responding to the standby node selection request sent by the main node, and executing a preset standby node selection mechanism to determine the standby node from all nodes except the main node.
According to the technical scheme, a preset equipment node selection mechanism is executed in response to an equipment node selection request sent by a main node so as to determine the equipment node from all nodes except the main node; in the method, when the main node cannot provide service, the main node can actively trigger the standby node selection request, so that the standby node which takes over the main node can be selected quickly and successfully, and effective reference information can be provided for further drifting the virtual service address to the standby node.
In a second aspect, an embodiment of the present application provides a node switching apparatus, including:
the release module is used for responding to the address release request of the target service and releasing the virtual service address of the target service; the address release request is triggered when the main node in the cluster cannot provide the target service;
the address drifting module is used for drifting the virtual service address to the standby node so as to switch from the main node to the standby node to provide the target service; the standby node is any node except the main node.
In a third aspect, embodiments of the present application further provide a computer device, the computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the steps of the method of any of the embodiments of the first aspect described above when the computer program is executed.
In a fourth aspect, embodiments of the present application further provide a computer readable storage medium having a computer program stored thereon, the computer program, when executed by a processor, implementing the steps of the method of any of the embodiments of the first aspect.
In a fifth aspect, embodiments of the present application also provide a computer program product comprising a computer program which, when executed by a processor, implements the steps of the method of any of the embodiments of the first aspect described above.
The foregoing description is only an overview of the technical solutions of the present application, and may be implemented according to the content of the specification in order to make the technical means of the present application more clearly understood, and in order to make the above-mentioned and other objects, features and advantages of the present application more clearly understood, the following detailed description of the present application will be given.
Drawings
FIG. 1 is an application environment diagram of a node switching method in one embodiment;
FIG. 2 is a flow chart of a node switching method in one embodiment;
FIG. 3 is a flow chart of a node switching method according to another embodiment;
FIG. 4 is a flow chart of a node switching method according to another embodiment;
FIG. 5 is a scenario diagram of a node switch implementation of cluster upgrades in one embodiment;
FIG. 6 is a block diagram of a node switching apparatus according to another embodiment;
fig. 7 is an internal structural diagram of a computer device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
In the field of cloud computing, different services provided by a cloud computing platform are widely used in various fields. To ensure high availability of each service, each service is typically deployed in a distributed cluster. Taking PaaS service as an example, in practical application, multiple nodes that deploy the same PaaS service in a distributed cluster share a virtual address to provide service to the outside, and when a master node that is providing the PaaS service needs to be upgraded or fails, a standby node needs to be selected to take over the master node to provide the corresponding PaaS service.
In the related art, before each node in the distributed cluster provides PaaS service, a high-availability keepalive component needs to be deployed on an application layer of at least one node, and compatible configuration is performed on the keepalive component and an application on the node, when a main node in the distributed cluster provides PaaS service, the keepalive component is started, the keepalive component generates a main process, and the main process generates two sub-processes, namely a virtual router redundancy protocol (Virtual Router Redundancy Protocol, VRRP) stack sub-process and a health status detection Checkers sub-process, and node switching is realized mainly through the two sub-processes in application. However, the node switching method in the related art has a relatively complex and non-general problem. Based on the above, the embodiment of the application provides a node switching method, which can reduce the complexity of a node switching mode, and has universality on each application on the standby node of the replacement master node after the node switching on the basis of lower complexity.
The method for switching the nodes provided in the embodiment of the present application may be applied to an application environment diagram shown in fig. 1, where the application environment includes a management node and a service cluster (i.e., a cluster), the cluster includes a plurality of nodes, communication connection may be between the management node and each node in the cluster, and the communication manner may be Wi-Fi, mobile network or bluetooth connection. The management and control nodes and each node may be, but not limited to, a computer device, an independent server, or a server cluster formed by a plurality of servers, where the computer device may be a personal computer, a notebook computer, a tablet computer, a smart phone, etc., the specific forms of the management and control nodes and each node are not limited in this embodiment, fig. 1 illustrates a node switching system by taking the cluster including 3 nodes (node 1, node 2, and node 3), and the management and control nodes and each node are servers as an example.
Fig. 2 is a schematic flow chart of a node switching method according to an embodiment of the present application, where the method is applied to an ARP proxy, and the ARP proxy is any one of the proxies deployed in a data link layer of each node in a cluster, and the method may be implemented by the following steps:
S100, responding to an address release request of the target service, and releasing the virtual service address of the target service. The address release request is triggered when the master node in the cluster cannot provide the target service.
In the embodiment of the application, an ARP proxy may be deployed at the data link layer of each node in the cluster, so that node switching can be implemented through the ARP proxy deployed at the data link layer of each node in the case that the master node cannot provide the target service. Wherein, all nodes or part of nodes in the cluster are deployed with the target service.
In practical applications, the target service may be an infrastructure as a service (Infrastructure as a Service, iaaS), a software as a service (Software as a Service, saaS) or PaaS service, or may be a sub-service provided by the IaaS service, the SaaS service or the PaaS service.
The sub-services provided by the IaaS service can be services such as virtual machines, storage, networks, load balancing, security and the like; the sub-services provided by the SaaS service can be services such as calculation, storage, database, artificial intelligence, data encryption, identity authentication, access control and the like; the sub-services provided by the PaaS service can be development, operation, maintenance, management and other services. In the embodiment of the present application, an example is described in which the target service is each sub-service in the PaaS service.
It should be noted that, when multiple nodes provide the same sub-service, the multiple nodes may share a virtual service address to provide services to the outside, that is, an entry of the services; the virtual service address may be an internal service address, which is visible only inside the cluster, or a public service address, which is accessible externally. Optionally, the virtual service address of the target service may be a virtual logical address, and may also be a virtual physical address; in practical application, virtual service addresses corresponding to different services are different. In embodiments of the present application, the virtual service address may be a virtual internet protocol (Internet Protocol, IP) address.
Specifically, in the process that the master node in the cluster provides the target service, if the master node needs to be upgraded, is being upgraded, fails or the cluster is upgraded, it may be determined that the master node in the cluster cannot provide the target service currently. The master node upgrade can be understood as configuration upgrade, version upgrade, function upgrade and the like of the master node, and the cluster upgrade can be understood as adding and deleting nodes in the cluster to form a new cluster, or a target node fault in the cluster needs to rapidly deploy a new node to form the new cluster, so that the number of the nodes in the original cluster and the new cluster is unchanged.
Optionally, in the case that the master node cannot provide the target service, the user may send an address release request of the target service to each node in the cluster through the third party device; alternatively, the user may directly input an address release request of the target service to each node. Alternatively, the manner in which the user inputs the address release request may be voice, key, gesture, keyboard, etc.
In the embodiment of the present application, in the process of providing the target service by the master node, a heartbeat signal may be periodically sent to the management and control node, so as to notify the management and control node that the management and control node is serving. However, when the management and control node does not receive the heartbeat signal sent by the master node within a certain period of time, the management and control node can determine that the master node currently needs to be upgraded, is being upgraded, has failed or has been subjected to cluster upgrade, and at this time, can send an address release request of the target service to each node in the cluster.
Correspondingly, after each node receives the address release request of the target service, ARP proxies deployed on each node may respectively respond to the address release request and simultaneously release the virtual service address of the target service.
It should be noted that, in the process that the host node provides the target service, the virtual service address of the target service points to the host node, and naturally, the address release request may carry the host node identifier, so as to instruct each node to release the virtual service address of the target service corresponding to the host node. After the virtual service address of the target service is released, it indicates that the virtual service address of the target service does not execute any node, that is, there is no node capable of providing the target service.
The process of triggering the master node in the cluster to provide the target service before performing the step in S100 described above is described herein. In practical application, the client may receive and respond to the client request, find whether the address resolution protocol table of the client has a virtual service address carried in the client request in the network layer, if the address resolution protocol table has a virtual service address, obtain a media access control (Media Access Control, MAC) address corresponding to the virtual service address from the address resolution protocol table of the client, use the MAC address as the MAC address of the master node, encapsulate the client request to generate a data packet, send the data packet to the MAC address of the master node, and correspondingly, the master node in the cluster parses the data packet to respond to the client request and provide the target service in the process of responding to the client request.
The client request may carry a virtual service address and a source IP address that need to provide the target service in the process of responding to the client request. Optionally, the address resolution protocol table of the client may store a binding relationship between a virtual service address and a MAC address; the information for encapsulating the client request may be the MAC address, the transmission protocol type, the hardware information, etc. of the master node.
Meanwhile, if the address resolution protocol table of the client does not have a virtual service address, the client may buffer the client request first, and send an ARP request (the APR request carries the IP address and MAC address of the client and the virtual service address) to each node in the cluster in a broadcast manner.
Correspondingly, each node responds to the ARP request, the virtual service address carried in the ARP request is compared with the own IP address, the node consistent with the ARP request can be determined as the master node responding to the client request, further, the master node can store the binding relation between the virtual service address and the own MAC address into the own address resolution protocol table, then the master node feeds back the ARP response (comprising the MAC address of the master node) to the client in a unicast mode, the client establishes the binding relation between the MAC address of the master node and the virtual service address, the binding relation is stored into the address resolution protocol table of the client, the client request is encapsulated to generate a data packet, and the data packet is sent to the MAC address of the master node, so that the master node receives the data packet and provides the target service in response to the client request.
In practical application, there may be multiple master nodes that provide the target service in response to the client request, and in this case, load balancing may be implemented by multiple master nodes in response to the client request, so as to improve the high availability of the target service.
S200, the virtual service address is shifted to the standby node, so that the target service is provided by switching from the main node to the standby node. Wherein the standby node is any node except the main node.
In order to provide normal target service to the outside, after releasing the virtual service address of the target service, each node can quickly drift the virtual service address of the target service to the standby node immediately, that is, direct the virtual service address of the target service to the standby node, so as to switch from the main node to the standby node to provide normal target service to the outside.
In this embodiment of the present application, after each node except the master node in the cluster drifts the virtual service address of the target service to the standby node, it can be determined that the master node has been successfully switched, and at this time, the standby node may take over the master node to provide the target service. Alternatively, any node in the cluster other than the master node may serve as a standby node.
It should be noted here that ARP proxies on different nodes may perform drifting of the virtual service address of the target service to the backup node in a synchronous manner or an asynchronous manner.
In an embodiment, the manner of drifting the virtual service address of the target service to the standby node may be that the ARP proxy establishes a correspondence between the virtual service address of the target service and the standby node identifier of the standby node, and stores the correspondence to a corresponding location, so as to complete the virtual service address drifting.
In another embodiment, the manner of drifting the virtual service address of the target service to the backup node may be that the ARP proxy indirectly forwards the virtual service address of the target service and then stores the virtual service address to complete the virtual service address drifting.
The technical scheme of the embodiment of the application is applied to an Address Resolution Protocol (ARP) agent, wherein the ARP agent is any agent deployed in a data link layer of each node in a cluster, responds to an address release request of target service, releases a virtual service address of the target service, and drifts the virtual service address to a standby node so as to switch from a main node to the standby node to provide the target service, wherein the address release request is triggered under the condition that the main node in the cluster cannot provide the target service; according to the method, under the condition that a main node in the cluster cannot provide target service, node switching can be realized through the ARP agents deployed in the data link layers of all nodes in the cluster, wherein the data link layers belong to the bottom layers, so that after the ARP agents are deployed in the data link layers of all nodes, the node switching can be realized without carrying out compatible configuration on all the ARP agents and all the applications of the nodes to which the ARP agents belong, the complexity of a node switching mode is reduced, and in the process of realizing the node switching, all the applications of the nodes to which the ARP agents belong can be commonly used, and the condition that the applications cannot be commonly used does not occur; meanwhile, after the virtual service address of the corresponding service is released, the virtual service address can be quickly shifted to the standby node so as to be switched from the main node to the standby node to provide the corresponding service, so that the corresponding service is not interrupted, the accessed client cannot sense the change, and the high availability of the service is realized.
The procedure for releasing the virtual service address of the target service will be described below. In an embodiment, the address release request carries a master node identifier; as shown in fig. 3, the step of releasing the virtual service address of the target service in S100 may be implemented as follows:
s110, determining main address mapping information of the main node from an address resolution protocol table of the affiliated node according to the main node identification. The primary address mapping information indicates a binding relationship between a primary node address of the primary node and a virtual service address.
The address release request may carry information such as an address type, an address release period, a release destination, and the like, in addition to the main node identifier. In this case, for the APR agent on each node in the cluster, a keyword extraction algorithm or a feature extraction algorithm or the like may be adopted, and information extraction may be performed on all the information in the address release request to obtain the main node identifier.
Meanwhile, under the condition that the address release request only carries the main node identifier, the APR agent on each node in the cluster can directly acquire the information carried in the address release request to obtain the main node identifier.
For the APR agent on each node in the cluster, based on the obtained address release request carrying the main node identifier, the main node can be determined according to the main node identifier, and then the main address mapping information of the main node is determined from the address resolution protocol table of the node to which each node belongs.
It should be noted that, different nodes have respective corresponding address resolution protocol tables, and the information in the address resolution protocol tables of the different nodes is the same; each address resolution protocol table is stored in a cache of the corresponding node. In the process that the master node provides the target service, the address resolution protocol table of each node stores master address mapping information, and the master address mapping information can represent a binding relationship between the master node address of the master node and the virtual service address.
Alternatively, the master node address of the master node may be a physical address (e.g., an IP address), but in the embodiment of the present application, the master node address may be a logical address, such as a MAC address.
S120, releasing the virtual service address according to the main address mapping information in the address resolution protocol table.
Specifically, for the APR agent on each node in the cluster, the main address mapping information in the address resolution protocol table of the node to which the proxy belongs may be updated to release the virtual service address of the target service.
The method for updating the main address mapping information in the address resolution protocol table may be to train an information updating model in advance, and then input the address resolution protocol table into the information updating model, where the information updating model updates the main address mapping information in the address resolution protocol table.
Alternatively, the information updating model may be formed by at least one of a convolutional neural network model, a fully-connected neural network model, a long-short-term memory neural network model, a graph convolution neural network model, and the like.
In addition, the main address mapping information in the address resolution protocol table may be updated by deleting the main node address of the main node in the main address mapping information in the address resolution protocol table.
According to the technical scheme, main address mapping information of a main node is determined from an address resolution protocol table of the node to which the main node belongs according to the main node identification, and the main address mapping information of the main node is determined from the address resolution protocol table of the node to which the main node belongs according to the main node identification; under the condition that a main node in the cluster cannot provide target service, the method can release the virtual service address of the target service through the main address mapping information in the address resolution protocol table of the node to which each APR agent belongs, so as to prepare for further successfully realizing node switching, ensure that the service is not interrupted, and simultaneously, the processing process is simpler, thereby improving the speed and efficiency of releasing the virtual service address.
In one embodiment, the step of releasing the virtual service address in S120 according to the primary address mapping information in the address resolution protocol table may include: the primary address mapping information is deleted from the address resolution protocol table to release the virtual service address.
In this embodiment of the present application, for an APR agent on each node in the cluster, the primary address mapping information may be directly deleted from the address resolution protocol table of the node to which the agent belongs, so as to release the virtual service address.
According to the technical scheme, the main address mapping information can be deleted from the address resolution protocol table to release the virtual service address, the processing process is simple, the time consumption of releasing the virtual service address can be shortened, the speed and efficiency of releasing the virtual service address can be improved, the speed and efficiency of switching the nodes can be improved on the basis, the corresponding service is ensured not to be interrupted, and the accessed client cannot sense change.
The process of drifting the virtual service address to the standby node is described below. In an embodiment, as shown in fig. 4, the step of drifting the virtual service address to the standby node in S200 may be implemented by the following manner:
S210, obtaining the standby node address of the standby node.
In practical application, the control node can monitor the running state of each node in the cluster, and then select any node in the normal running state from all nodes except the main node in the cluster as the standby node according to the running state of each node.
Alternatively, the operation state of the node may be a normal operation state, and may also be a fault state. If the node is in a normal running state, the node can normally provide the target service; if the node is in a fault state, the node can not normally provide the target service. In the embodiment of the present application, when the master node cannot provide the target service, it may be determined that the running state of the master node is a fault state.
Further, the management and control node may send a standby node identifier to each node in the cluster. Correspondingly, the ARP agents on the nodes can receive the standby node identification sent by the management and control node, and acquire the standby node address of the standby node according to the standby node identification.
The method for obtaining the standby node address of the standby node according to the standby node identifier may be that the node identifier matched with the standby node identifier is searched in an address information base, and the node address corresponding to the searched node identifier is determined as the standby node address of the standby node. Optionally, the address information base may include a correspondence between a node identifier of each node in the cluster and a node address of each node.
Alternatively, the node address and the standby node address may be IP addresses, but in the embodiment of the present application, the node address and the standby node address may be MAC addresses. In this embodiment of the present application, the types of the node address, the standby node address, and the master node address are all consistent.
Meanwhile, the management and control node can directly send the standby node address of the standby node to each node in the cluster. Correspondingly, the ARP agents on the nodes can directly receive and acquire the standby node addresses of the standby nodes.
In addition, the ARP proxy on each node may obtain the standby node address of the standby node, or the standby node may send the standby node address to other nodes except for the standby node in each node, and correspondingly, the other nodes receive the standby node address sent by the standby node.
S220, establishing a binding relation between the standby node address and the virtual service address in the address resolution protocol table, and generating standby address mapping information.
Specifically, for the APR agent on each node in the cluster, the virtual service address of the target service can be searched in the address resolution protocol table of the node to which the proxy agent belongs, and then a binding relation between the standby node address and the virtual service address is established in the address resolution protocol table to generate standby address mapping information.
In addition, the virtual service address of the target service can be obtained from the service address library, and then a binding relation between the standby node address and the virtual service address is established at a corresponding position in the address resolution protocol table of the node to which each node belongs, so as to generate standby address mapping information.
Optionally, the service address library may include a correspondence between different services and different virtual service addresses.
In an exemplary embodiment, fig. 5 is a view of a cluster upgrade implementation scenario for node switching, where an original cluster includes 4 nodes (node 1, node 2, node 3 and node 4), node 4 is a master node, and when the original cluster is upgraded, the node 4 in the original cluster cannot provide a target service, and when the original cluster is upgraded, a new node 5 may be quickly deployed to form a new cluster formed by node 1, node 2, node 3 and node 5, and then node 3 in the new cluster is selected as a standby node, so that a virtual service address of the target service is drifted to the standby node.
According to the technical scheme, the standby node address of the standby node is obtained, a binding relation between the standby node address and the virtual service address is established in an address resolution protocol table, and standby address mapping information is generated; the method does not need complex algorithm realization, reduces the data quantity processed in the virtual service address drifting process, and can accelerate the drifting speed of the virtual service address, thereby enabling the releasing operation and the drifting operation of the virtual service address to achieve seamless connection and ensuring that the target service is not interrupted.
In some scenarios, after the ARP proxy on the standby node stores the standby address mapping information in the address resolution protocol table of the standby node, the standby address mapping information may be directly sent to other nodes in the cluster except for the standby node, so as to increase the node switching speed, and a process of how to implement virtual service address drift in this case is described below. In an embodiment, after the step in S220 is performed, the repeating the processing may further include:
and under the condition that the node to which the ARP agent belongs is a standby node and the ARP agents on other nodes do not establish standby address mapping information, the standby address mapping information is sent to the other nodes, and the other nodes are indicated to be stored in the respective address resolution protocol tables.
Specifically, if the node to which the current ARP proxy belongs is a standby node and ARP proxies on other nodes except the standby node in the cluster do not establish standby address mapping information, the ARP proxy deployed on the standby node may send an endless ARP request carrying the standby address mapping information to the other nodes in a synchronous manner or an asynchronous manner, so as to send the standby address mapping information to the other nodes, and instruct the other nodes to store the standby address mapping information in respective address resolution protocol tables.
According to the technical scheme, when the node to which the ARP agent belongs is a standby node and the ARP agents on other nodes do not establish standby address mapping information, the standby address mapping information is sent to the other nodes, and the other nodes are indicated to be stored in respective address resolution protocol tables; in the method, the ARP agent on the standby node can directly send the standby address mapping information to other nodes except the standby node in the cluster, so that the other nodes do not need to establish a binding relationship, the standby address mapping information can be directly stored in the respective address resolution protocol table to finish the virtual service address drift, and the process can greatly improve the drift speed of the virtual service address.
In an embodiment, before performing the step of drifting the virtual service address to the standby node in S200, the method may further include: and responding to the standby node selection request sent by the main node, and executing a preset standby node selection mechanism to determine the standby node from all nodes except the main node.
In practical application, after receiving the address release request, the master node may send a standby node selection request to all nodes except the master node in the cluster, so as to instruct all nodes except the master node to cooperatively process, and select one standby node from all nodes except the master node.
For any node except the main node in the cluster, a standby node selection request sent by the main node can be responded, the standby node selection request is cooperatively processed with all nodes except the main node and the current node in the cluster, and a preset standby node selection mechanism is executed to determine the standby node from all the nodes except the main node.
Optionally, executing the preset device node selection mechanism may be a process of selecting a device node according to a condition that the node is in a normal operation state and the idle operation resource amount of the node is greater than a preset resource amount threshold, or may be a process of selecting any node from all the nodes in the normal operation state as the device node.
Alternatively, the amount of idle running resources may be the size of idle memory, the number of CPUs, the number of hard disks, the number of disks, and the like.
According to the technical scheme, a preset equipment node selection mechanism is executed in response to an equipment node selection request sent by a main node so as to determine the equipment node from all nodes except the main node; in the method, when the main node cannot provide service, the main node can actively trigger the standby node selection request, so that the standby node which takes over the main node can be selected quickly and successfully, and effective reference information can be provided for further drifting the virtual service address to the standby node.
In an embodiment, the embodiment of the present application further provides a node switching method, which is applied to an ARP proxy, where the ARP proxy is any one of data link layers deployed at each node in a cluster, and the method includes the following procedures:
(1) Responding to an address release request of a target service; the address release request is triggered when the main node in the cluster cannot provide the target service; the address release request carries a main node identifier;
(2) Determining main address mapping information of a main node from an address resolution protocol table of the node according to the main node identification; the master address mapping information represents a binding relationship between a master node address of the master node and the virtual service address;
(3) Deleting the main address mapping information from the address resolution protocol table to release the virtual service address;
(4) Responding to a standby node selection request sent by a main node, and executing a preset standby node selection mechanism to determine standby nodes from all nodes except the main node;
(5) Acquiring a standby node address of a standby node;
(6) Establishing a binding relation between a standby node address and a virtual service address in an address resolution protocol table, and generating standby address mapping information so as to switch from a main node to a standby node to provide target service; the standby node is any node except the main node;
And sending the spare address mapping information to other nodes to instruct the other nodes to store in the respective address resolution protocol tables under the condition that the nodes to which the ARP agents belong are spare nodes and the ARP agents on the other nodes do not establish the spare address mapping information.
The implementation process of the above (1) to (6) can be specifically referred to the description of the above embodiment, and its implementation principle and technical effects are similar, and will not be described herein again.
It should be understood that, although the steps in the flowcharts related to the above embodiments are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the application also provides a node switching device for realizing the above-mentioned related node switching method. The implementation of the solution provided by the device is similar to the implementation described in the above method, so the specific limitation in the embodiments of one or more node switching devices provided below may be referred to the limitation of the node switching method hereinabove, and will not be repeated here.
In one embodiment, fig. 6 is a schematic structural diagram of a node switching device according to one embodiment of the present application, where the node switching device provided in the embodiment of the present application may be applied to an ARP proxy, which is any proxy deployed in a data link layer of each node in a cluster. As shown in fig. 6, the node switching apparatus of the embodiment of the present application may include: a release module 11 and an address drift module 12, wherein:
a releasing module 11, configured to respond to an address releasing request of the target service, and release a virtual service address of the target service; the address release request is triggered when the main node in the cluster cannot provide the target service;
an address drift module 12, configured to drift a virtual service address to a standby node, so as to switch from a master node to the standby node to provide a target service; the standby node is any node except the main node.
The node switching device provided in the embodiment of the present application may be used to execute the technical scheme in the embodiment of the node switching method, and its implementation principle and technical effect are similar, and are not repeated here.
In one embodiment, the address release request carries a master node identifier; the release module 11 includes: a determination unit and an address release unit, wherein:
the determining unit is used for determining main address mapping information of the main node from the address resolution protocol table of the affiliated node according to the main node identification; the master address mapping information represents a binding relationship between a master node address of the master node and the virtual service address;
and the address releasing unit is used for releasing the virtual service address according to the main address mapping information in the address resolution protocol table.
The node switching device provided in the embodiment of the present application may be used to execute the technical scheme in the embodiment of the node switching method, and its implementation principle and technical effect are similar, and are not repeated here.
In one embodiment, the address release unit is specifically configured to:
the primary address mapping information is deleted from the address resolution protocol table to release the virtual service address.
The node switching device provided in the embodiment of the present application may be used to execute the technical scheme in the embodiment of the node switching method, and its implementation principle and technical effect are similar, and are not repeated here.
In one embodiment, the address drift module 12 includes: an address acquisition unit and a binding relationship establishment unit, wherein:
the address acquisition unit is used for acquiring the standby node address of the standby node;
and the binding relation establishing unit is used for establishing a binding relation between the standby node address and the virtual service address in the address resolution protocol table and generating standby address mapping information.
The node switching device provided in the embodiment of the present application may be used to execute the technical scheme in the embodiment of the node switching method, and its implementation principle and technical effect are similar, and are not repeated here.
In one embodiment, the address drift module 12 further includes: and a mapping information transmitting unit, wherein the mapping information transmitting unit is specifically configured to:
and under the condition that the node to which the ARP agent belongs is a standby node and the ARP agents on other nodes do not establish standby address mapping information, the standby address mapping information is sent to the other nodes, and the other nodes are indicated to be stored in the respective address resolution protocol tables.
The node switching device provided in the embodiment of the present application may be used to execute the technical scheme in the embodiment of the node switching method, and its implementation principle and technical effect are similar, and are not repeated here.
In one embodiment, the node switching device further includes: the standby node determining module is specifically configured to:
and responding to the standby node selection request sent by the main node, and executing a preset standby node selection mechanism to determine the standby node from all nodes except the main node.
The node switching device provided in the embodiment of the present application may be used to execute the technical scheme in the embodiment of the node switching method, and its implementation principle and technical effect are similar, and are not repeated here.
For specific limitations of the node switching apparatus, reference may be made to the above limitations of the node switching method, and no further description is given here. The above-described respective modules in the node switching apparatus may be implemented in whole or in part by software, hardware, and combinations thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is also provided, which may be a server, and the internal structure of which may be as shown in fig. 7. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured to provide processing power. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is for storing virtual service addresses of the target service. The network interface of the computer device is for communicating with an external endpoint via a network connection. The computer program is executed by a processor to implement a node switching method.
It will be appreciated by those skilled in the art that the structure shown in fig. 7 is merely a block diagram of some of the structures associated with the present application and is not limiting of the computer device to which the present application may be applied, and that a particular computer device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
In an embodiment, a computer device is further provided, including a memory and a processor, where the memory stores a computer program, and the processor implements the technical solution in the embodiment of the node switching method described in the application when executing the computer program, and the implementation principle and the technical effect are similar, and are not repeated herein.
In an embodiment, a computer readable storage medium is further provided, on which a computer program is stored, where the computer program when executed by a processor implements the technical solution of the node switching method described in the present application, and the implementation principle and technical effects are similar, and are not repeated herein.
In an embodiment, a computer program product is also provided, where the computer program is implemented by a processor to implement the technical scheme of the node switching method described in the application, and the implementation principle and technical effect are similar, and are not repeated herein.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, or the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples merely represent a few embodiments of the present application, which are described in more detail and are not to be construed as limiting the scope of the invention. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application is to be determined by the claims appended hereto.

Claims (10)

1. A node switching method, applied to an address resolution protocol ARP proxy, the ARP proxy being any one of data link layers deployed at nodes in a cluster, the method comprising:
releasing a virtual service address of a target service in response to an address release request of the target service; the address release request is triggered when the target service cannot be provided by a master node in the cluster;
drifting the virtual service address to a standby node to switch from the master node to the standby node to provide the target service; the standby node is any node except the main node.
2. The method of claim 1, wherein the address release request carries a master node identifier; the releasing the virtual service address of the target service includes:
Determining main address mapping information of the main node from an address resolution protocol table of the node according to the main node identification; the master address mapping information represents a binding relationship between a master node address of the master node and the virtual service address;
and releasing the virtual service address according to the main address mapping information in the address resolution protocol table.
3. The method of claim 2, wherein releasing the virtual service address according to the primary address mapping information in the address resolution protocol table comprises:
and deleting the main address mapping information from the address resolution protocol table to release the virtual service address.
4. A method according to any of claims 1-3, wherein said drifting the virtual service address to a standby node comprises:
acquiring a standby node address of the standby node;
and establishing a binding relation between the standby node address and the virtual service address in the address resolution protocol table, and generating standby address mapping information.
5. The method according to claim 4, wherein the method further comprises:
and under the condition that the node to which the ARP agent belongs is the standby node and the ARP agents on other nodes do not establish the standby address mapping information, sending the standby address mapping information to the other nodes, and indicating the other nodes to store the standby address mapping information in respective address resolution protocol tables.
6. A method according to any of claims 1-3, characterized in that before said drifting the virtual service address to a standby node, the method further comprises:
and responding to the standby node selection request sent by the main node, and executing a preset standby node selection mechanism to determine the standby node from all nodes except the main node.
7. A node switching apparatus, the apparatus comprising:
the release module is used for responding to the address release request of the target service and releasing the virtual service address of the target service; the address release request is triggered when the main node in the cluster cannot provide the target service;
the address drifting module is used for drifting the virtual service address to a standby node so as to switch from the main node to the standby node to provide the target service; the standby node is any node except the main node.
8. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1-6 when the computer program is executed.
9. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1-6.
10. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the steps of the method according to any of claims 1-6.
CN202311783016.XA 2023-12-22 2023-12-22 Node switching method, device, computer equipment, storage medium and product Pending CN117857315A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311783016.XA CN117857315A (en) 2023-12-22 2023-12-22 Node switching method, device, computer equipment, storage medium and product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311783016.XA CN117857315A (en) 2023-12-22 2023-12-22 Node switching method, device, computer equipment, storage medium and product

Publications (1)

Publication Number Publication Date
CN117857315A true CN117857315A (en) 2024-04-09

Family

ID=90532325

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311783016.XA Pending CN117857315A (en) 2023-12-22 2023-12-22 Node switching method, device, computer equipment, storage medium and product

Country Status (1)

Country Link
CN (1) CN117857315A (en)

Similar Documents

Publication Publication Date Title
US20210042160A1 (en) Method and system for distributed edge cloud computing
CN110113441B (en) Computer equipment, system and method for realizing load balance
CN105610632B (en) Virtual network equipment and related method
EP3353952B1 (en) Managing groups of servers
CN112470436A (en) Multi-cloud connectivity using SRV6 and BGP
CN113572831B (en) Communication method, computer equipment and medium between Kubernetes clusters
CN111857873A (en) Method for realizing cloud native container network
CN108737224B (en) Message processing method and device based on micro-service architecture
CN112905305B (en) VPP-based cluster type virtualized data forwarding method, device and system
TW201824823A (en) Methods and devices for switching a virtual internet protocol address
CN109213571B (en) Memory sharing method, container management platform and computer readable storage medium
CN111338806B (en) Service control method and device
CA3152892A1 (en) Method and system for distributed edge cloud computing
US9921878B1 (en) Singleton coordination in an actor-based system
CN111352716A (en) Task request method, device and system based on big data and storage medium
CN113268308B (en) Information processing method, device and storage medium
CN113411363A (en) Uploading method of image file, related equipment and computer storage medium
CN114172853B (en) Configuration method and device of traffic forwarding and bare computer server
US11595471B1 (en) Method and system for electing a master in a cloud based distributed system using a serverless framework
CN111600833A (en) Network operating system and message forwarding method
CN117857315A (en) Node switching method, device, computer equipment, storage medium and product
CN106803804B (en) Method and device for transmitting message
US20220019485A1 (en) Preserving eventually consistent distributed state of multi-layer applications
KR101382177B1 (en) System and method for dynamic message routing
CN115242791A (en) Service platform access method, device, equipment and storage medium

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