Troubleshooting methods, products, equipment and media
By setting a regular detection cycle for virtual network addresses in large-scale clusters, analyzing network status and taking corresponding actions, network failures and split-brain problems are solved, the stability and reliability of the cluster are improved, and the continuity and reliability of training tasks are ensured. Progress security.
Patent Information
- Application Number
- CN202410850589.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-27
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2044-06-27
AI Technical Summary
In large-scale cluster environments, network failures often lead to packet loss and increased latency, affecting the processing performance of the entire cluster. Existing technologies are difficult to effectively solve the split-brain phenomenon and virtual IP loss, leading to service interruption and loss of training progress.
By setting the timing detection cycle corresponding to the virtual network address, traverse the virtual network address management service of the management node, determine the network status according to the number and urgency of the virtual network address, and adopt different fault handling methods to avoid the loss of virtual IP caused by non-network faults. , to ensure network fault recovery capabilities.
It improves the stability and reliability of cluster services, ensures that training tasks can continue when network problems occur, avoids the loss of training progress due to interruptions, and reduces the complexity and cost of operation and maintenance.
Smart Images

Figure CN118413436B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a fault handling method, a computer program product, an electronic device and a storage medium. Background Art
[0002] In a large-scale cluster environment, network stability is critical to the performance and reliability of the entire system. The network is the medium for communication between nodes in a distributed system, and the stability of the network directly affects the efficiency and speed of data transmission. However, network failures often occur in large-scale clusters, and unstable networks may cause packet loss and increased latency, which in turn affects the processing performance of the entire cluster. Summary of the invention
[0003] In view of the above problems, embodiments of the present invention are proposed to provide a fault handling method, a computer program product, an electronic device and a storage medium that overcome the above problems or at least partially solve the above problems.
[0004] In a first aspect, an embodiment of the present invention discloses a fault handling method, which is applied to a server cluster, wherein the server cluster includes a plurality of computing nodes and a management node, and the method includes:
[0005] According to the timing detection cycle corresponding to the virtual network address to be tested, traverse the virtual network address management services of all management nodes to obtain the number of the virtual network address to be tested in the server cluster;
[0006] A network state is determined according to the number of virtual network addresses to be tested, and a fault handling method is determined according to the network state.
[0007] As in the above method, optionally, determining the network status according to the number of the virtual network addresses to be tested includes:
[0008] If the number of the virtual network addresses to be tested is equal to 1, it is determined that the server cluster network is normal;
[0009] Otherwise, it is determined that a network failure occurs in the server cluster.
[0010] As in the above method, optionally, determining a fault handling method according to the network status includes:
[0011] If the number of virtual network addresses to be tested is greater than 1, then
[0012] Retain the virtual network address to be tested in one of the management nodes, and clear the virtual network address to be tested in other management nodes;
[0013] If the number of the virtual network addresses to be tested is 0, restarting the virtual network address management service in all the management nodes.
[0014] As in the above method, optionally, before traversing the virtual network address management services of all management nodes according to the timing detection cycle corresponding to the virtual network address to be tested, the method further includes:
[0015] According to the urgency of each virtual network address in the server cluster, a timing detection period corresponding to each virtual network address is determined.
[0016] As the above method, optionally, it also includes:
[0017] If a first virtual network address in the server cluster fails, then a second virtual network address must fail, and it is determined that the first virtual network address has a dependency relationship with the second virtual network address;
[0018] The timing detection period of the first virtual network address and the timing detection period of the second virtual network address are set to the same timing detection period.
[0019] As the above method, optionally, it also includes:
[0020] If the first virtual network address and the second virtual network address have no dependency relationship, the timing detection period of the first virtual network address and the timing detection period of the second virtual network address are set to two different timing detection periods.
[0021] As in the above method, optionally, retaining the virtual network address to be tested in one of the management nodes and clearing the virtual network address to be tested in other management nodes includes:
[0022] Traverse and log in to the virtual network address management services of all management nodes;
[0023] Recording the management nodes having the virtual network address to be tested in a traversal list in traversal order;
[0024] The virtual network addresses to be tested in the management nodes other than the first management node in the traversal list are cleared.
[0025] As in the above method, optionally, retaining the virtual network address to be tested in one of the management nodes and clearing the virtual network address to be tested in other management nodes includes:
[0026] Traverse and log in to the virtual network address management services of all management nodes;
[0027] Recording the management nodes having the virtual network address to be tested in a traversal list in traversal order;
[0028] Randomly select a management node from the traversal list as a reserved node;
[0029] The virtual network addresses to be tested in other management nodes except the reserved node in the traversal list are cleared.
[0030] As in the above method, optionally, retaining the virtual network address to be tested in one of the management nodes and clearing the virtual network address to be tested in other management nodes includes:
[0031] Traverse and log in to the virtual network address management services of all management nodes;
[0032] Recording the management nodes having the virtual network address to be tested in a traversal list in traversal order;
[0033] The virtual network addresses to be tested in the management nodes other than the last management node in the traversal list are cleared.
[0034] As in the above method, optionally, retaining the virtual network address to be tested in one of the management nodes and clearing the virtual network address to be tested in other management nodes includes:
[0035] Traverse and log in to the virtual network address management services of all management nodes;
[0036] Recording the management nodes having the virtual network address to be tested in a traversal list in traversal order; obtaining the management node with the highest priority in the traversal list as a reserved node;
[0037] The virtual network addresses to be tested in other management nodes except the reserved node in the traversal list are cleared.
[0038] As in the above method, optionally, before traversing and logging into the virtual network address management services of all management nodes, the method further includes:
[0039] Determine the priority of each management node.
[0040] As in the above method, optionally, traversing the virtual network address management services of all management nodes to obtain the number of the virtual network addresses to be tested in the server cluster includes:
[0041] Traverse and log in to the virtual network address management services of all management nodes;
[0042] Record the number of virtual network addresses to be tested in each management node;
[0043] The sum of the numbers of the virtual network addresses to be tested in all management nodes is used as the number of the virtual network addresses to be tested in the server cluster.
[0044] In a second aspect, an embodiment of the present invention discloses a computer program product, which is applied to a server cluster, wherein the server cluster includes multiple computing nodes and a management node. The computer program product includes: a computer program / instructions, which, when executed by a processor, implement the steps of the fault handling method described in any one of the above-mentioned first aspects.
[0045] In a third aspect, the present invention further discloses an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein when the computer program is executed by the processor, the steps of the fault handling method as described in any one of the first aspects above are implemented.
[0046] In a fourth aspect, the present invention further discloses a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the fault handling method as described in any one of the above-mentioned first aspects are implemented.
[0047] The embodiments of the present invention include the following advantages:
[0048] By setting a timed detection cycle corresponding to the virtual network address, network processing caused by virtual IP loss caused by non-network failures can be avoided. When the timed detection cycle arrives, the current network status is analyzed by detecting the number of virtual network addresses in the server cluster. Different fault handling methods are used for different network statuses. The network fault recovery capability ensures that training tasks can continue even when network problems occur, avoiding the loss of training progress due to interruptions and improving the stability of cluster services. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 is a flowchart of a fault handling method provided by an embodiment of the present invention;
[0050] Figure 2 It is a structural block diagram of an artificial intelligence training platform in a fault handling method provided by an embodiment of the present invention;
[0051] Figure 3 is a structural block diagram of a management node in a processing method provided by an embodiment of the present invention;
[0052] Figure 4 is a flowchart of another fault handling method provided by an embodiment of the present invention;
[0053] Figure 5is a flowchart of another method for troubleshooting provided by an embodiment of the present invention;
[0054] Figure 6 is a structural block diagram of a computer program product provided by an embodiment of the present invention;
[0055] Figure 7 is a structural block diagram of an electronic device provided by an embodiment of the present invention;
[0056] Figure 8 It is a structural block diagram of a computer-readable storage medium provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0057] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0058] Since the virtual network address management service (Keepalived) has key functions and advantages such as automatic failover, load balancing, and health checks, it can quickly switch network traffic to the backup server when the main server has a network failure, thereby reducing service interruption time, and can be used in conjunction with load balancers such as load balancing proxy software (HAProxy) to distribute network traffic and requests to multiple servers in the cluster, improving the overall processing power and availability of the system, etc. Therefore, Keepalived has become one of the preferred components for achieving high network availability in large-scale clusters. Based on the above features, it not only improves the stability and reliability of the cluster system, but also reduces the complexity and cost of operation and maintenance. High availability is the key to ensuring service stability and reliability, and is crucial to protecting customer interests, supporting business development, and maintaining corporate reputation.
[0059] Although Keepalived has many advantages in achieving high availability, it also has some limitations and disadvantages:
[0060] When a failure occurs and the master-slave switch is performed, the virtual network address (Internet Protocol, IP) may be abnormal, for example, the virtual IP is lost, that is, there is no virtual IP in the cluster; the brain split phenomenon, that is, multiple nodes think they are the master node, then there may be multiple virtual IPs, resulting in service interruption. For the above fault problems, the conventional solution is to directly restart the Keepalived service of all management nodes and wait for the virtual IP to return to normal. However, this method often cannot effectively solve the brain split problem, and the entire cluster service will be unavailable during the Keepalived service recovery process.
[0061] One of the core concepts of an embodiment of the present invention is to avoid network processing caused by virtual IP loss problems caused by non-network failures by setting a timed detection period corresponding to the virtual network address. When the timed detection period arrives, the current network status is analyzed by detecting the number of virtual network addresses in the server cluster, and different fault handling methods are used for different network statuses. The network fault recovery capability ensures that the training task can continue even when network problems occur, avoids the loss of training progress due to interruptions, and improves the stability of cluster services.
[0062] like Figure 1 , shows a flowchart of a fault handling method provided by an embodiment of the present invention, which is applied to a server cluster, wherein the server cluster includes multiple computing nodes and management nodes. The method may include the following steps:
[0063] Step S101, according to the timing detection cycle corresponding to the virtual network address to be tested, traverse the virtual network address management services of all management nodes to obtain the number of the virtual network address to be tested in the server cluster;
[0064] Specifically, Figure 2 is a structural block diagram of an artificial intelligence training platform in a fault handling method provided by an embodiment of the present invention, such as Figure 2 As shown, the artificial intelligence training platform includes a server cluster, which is divided into management nodes and computing nodes. The artificial intelligence training platform high-availability cluster generally includes 3 or more odd management nodes, and the rest are computing nodes. The management node deploys platform services, databases, virtual network address management services (Keepalived services), load balancing proxy software (HAProxy) services, detection and processing services, etc., and an artificial intelligence training platform network fault handling method provided in an embodiment of the present invention is applied to the management node. The computing node deploys node services, development environment, training tasks, etc. The development environment generally refers to a set of tools and service platforms that integrate functions such as code editing, running, debugging, and version control, which can support developers in the development and testing of artificial intelligence applications. The training task refers to the process of training a machine learning model using a data set in the field of artificial intelligence. This process involves selecting a suitable algorithm model and using a training data set to adjust the model parameters until the model can make accurate predictions or classifications of new data. The purpose of the training task is to optimize the performance of the model and improve its accuracy and efficiency in specific tasks.
[0065] The function of the Keepalived service in the artificial intelligence training platform is to detect the status of the server. If a server goes down or fails to work, Keepalived will detect it and remove the faulty server from the system, and use other servers to replace the server. When the server works normally, Keepalived automatically adds the server to the server group. All these tasks are completed automatically without human intervention. The only thing that needs to be done manually is to repair the faulty server.
[0066] Keepalive uses virtual network address (Internet Protocol, IP) switching technology to ensure that when a server in a group of servers fails, it can quickly switch to another healthy server to ensure service continuity. In Keepalive virtual IP switching technology, a group of servers share a virtual IP address. When one of the servers fails, the other servers will detect the failure through a certain mechanism and quickly switch the virtual IP address to another healthy server, so that it can take over the work of the failed server and continue to provide services.
[0067] Although Keepalived has many advantages in achieving high availability, it also has some limitations and disadvantages:
[0068] (1) "Split brain problem": If the cluster node time is not synchronized, the network connection is abnormal, or the Keepalived configuration is improper, the so-called "split brain" phenomenon may occur when the master-slave switch occurs. That is, multiple nodes think they are the master node. At this time, multiple virtual IPs may appear, resulting in service interruption. When this scenario occurs, the conventional solution is to directly restart the keepalived service of all management nodes and wait for the virtual IP to automatically return to normal. However, this method often cannot effectively solve the split brain problem, and will cause the entire cluster service to be unavailable during the Keepalived service recovery process.
[0069] (2) Limitations of complex cluster environments: For example, in some complex network environments, although Keepalived can achieve automatic failover, it may not be able to effectively handle all failover situations, especially when there are multiple virtual IPs in the cluster that need to be maintained. For example, in large-scale artificial intelligence clusters, when the virtual IP used to access the cluster page has a network failure, it is usually necessary to quickly complete the failover to ensure that customers can log in to the cluster function normally. The virtual IP used to access the image repository may be lost due to problems with all the image repositories themselves. The virtual IP will not be restored until the image repository itself is restored. Therefore, a longer waiting time is required. Therefore, when the cluster virtual IP is lost, the Keepalived service method of forcibly restarting all nodes may cause other normal virtual IPs to be unable to be used normally, resulting in the unavailability of the cluster. Therefore, how to achieve effective failover is also an important issue.
[0070] Artificial intelligence training platforms usually require a lot of computing resources and uninterrupted data processing, involving large-scale data sets and complex models. In order to reduce training delays caused by network problems, the timed detection cycle corresponding to the virtual IP in the server cluster is pre-set. When the timed detection cycle arrives, the network status corresponding to the virtual IP is detected. By setting the timed detection cycle, network processing caused by virtual IP loss caused by non-network failures can be avoided. For example, the scenario where the virtual IP is automatically restored within the timed detection cycle improves the reliability of the cluster.
[0071] Specifically, Figure 3 is a structural block diagram of a management node in a fault handling method provided by an embodiment of the present invention, such as Figure 3 As shown in the figure, there are four modules deployed in the management node, namely the virtual network address management service (Keepalived) configuration module, the timing strategy module, the network detection module, and the network processing module. Among them, 1) Keepalived configuration module: used to configure multiple virtual IPs in the server cluster and set different priorities in the Keepalived configuration of each management node; 2) Timing strategy module: set timing detection strategy for the virtual IP in the server cluster; 3) Network detection module: analyze the current network status according to the number of current virtual IPs in the cluster; 4) Network processing module: adopt different network processing methods for different network states.
[0072] First, configure the Keepalived service, traverse the N management nodes in the server cluster where the Keepalived service is installed, and define the Virtual Router Redundancy Protocol (VRRP) in the Keepalived configuration file of each management node. The VRRP instance is a network protocol used to achieve fault tolerance and load balancing of routers. The VRRP instance corresponds to the configuration information of the virtual IP in the cluster, and the priority of the instance is reduced in turn. When a high-priority node fails, it can quickly switch to other backup nodes;
[0073] After the Keepalived configuration is completed and the service is started, determine the corresponding timing detection strategy for the virtual IP and set the timing detection cycle.
[0074] A network detection module is added to the scheduled task detection script. For a certain virtual IP (referred to as the virtual IP to be tested), when its corresponding scheduled detection cycle arrives, the Keepalive services of all management nodes in the artificial intelligence training platform are traversed to obtain the number of the virtual IP to be tested in the server cluster, and the network status is detected by the number of virtual IPs.
[0075] Step S102: determining a network status according to the number of the virtual network addresses to be tested, and determining a fault handling method according to the network status.
[0076] Specifically, if the number of virtual IPs in the server cluster is equal to 1, it means that the network status is normal and no processing is required; if the number of virtual IPs in the server cluster is not equal to 1, it means that the network status is abnormal and fault processing is required. The number of virtual IPs in the server cluster is not equal to 1, including: the number of virtual IPs in the server cluster is equal to 0 and the number of virtual IPs in the server cluster is greater than 1. If the number of virtual IPs in the server cluster is equal to 0, it means that the virtual IP is lost. If the number of virtual IPs in the server cluster is greater than 1, it means that a brain split occurs.
[0077] Add a network processing module to the scheduled task detection script, and perform fault handling on the virtual IP for different network states to ensure the uniqueness of the same virtual IP, thereby ensuring the stability of cluster services. Artificial intelligence training platforms usually require a large amount of computing resources and uninterrupted data processing, involving large-scale data sets and complex models. A fast network fault recovery mechanism can reduce training delays caused by network problems and improve overall training efficiency. The network fault recovery capability ensures that training tasks can continue even when network problems occur, avoiding the loss of training progress due to interruptions.
[0078] Figure 4is a flowchart of another fault handling method provided by an embodiment of the present invention. Figure 4 As shown, the following steps may be included:
[0079] Step S401, the virtual network address management service configures the virtual network address;
[0080] Step S402, adding a timing detection strategy;
[0081] Step S403, traversing the nodes in the cluster where the virtual network address management service is installed;
[0082] Step S404, adding a network detection module to count the total number of each virtual IP in the cluster;
[0083] Step S405, adding a network processing module, and using different network processing methods according to the number of virtual IPs in the cluster.
[0084] The fault handling method provided in the embodiment of the present invention traverses the virtual network address management services of all management nodes according to the timing detection cycle corresponding to the virtual network address to be tested, and obtains the number of the virtual network addresses to be tested in the server cluster; determines the network status according to the number of the virtual network addresses to be tested, and determines the fault handling method according to the network status. It can be seen from this that in the embodiment of the present invention, by setting the timing detection cycle corresponding to the virtual network address, the network processing caused by the virtual IP loss problem caused by non-network failures is avoided. When the timing detection cycle arrives, the current network status is analyzed by detecting the number of virtual network addresses in the server cluster, and different fault handling methods are used for processing according to different network states, thereby avoiding the unavailability of the cluster caused by directly restarting the Keepalived service. The network fault recovery capability ensures that the training task can continue even when network problems occur, avoiding the loss of training progress due to interruptions, and improving the stability of cluster services.
[0085] On the basis of the above embodiment, further, the method for handling a fault according to the network state includes:
[0086] If the number of virtual network addresses to be tested is greater than 1, then
[0087] Retain the virtual network address to be tested in one of the management nodes, and clear the virtual network address to be tested in other management nodes;
[0088] If the number of virtual network addresses to be tested is 0,
[0089] Then restart the virtual network address management service in all the management nodes.
[0090] Specifically, if the number of a virtual IP in a server cluster is greater than 1, it means that the server cluster may have a split-brain phenomenon when performing network failover, that is, multiple nodes believe that they are the master node, resulting in service interruption. In response to the split-brain failure, the virtual IP to be tested can be retained in one of the management nodes and the virtual IP to be tested can be cleared in other management nodes to ensure the uniqueness of the virtual IP to be tested in the server cluster.
[0091] Reserving the virtual network address to be tested in one of the management nodes and clearing the virtual network address to be tested in other management nodes may include at least the following four situations:
[0092] (1) traversing and logging into the virtual network address management services of all management nodes; recording the management nodes having the virtual network address to be tested in a traversal list in a traversal order; and clearing the virtual network address to be tested from other management nodes except the first management node in the traversal list.
[0093] Specifically, first traverse the Keepalived services of all management nodes in the login server cluster, and use the "ip a| grep -w IP1| wc -l" command to view the virtual IP1 value d of the current node. If d=0, traverse the next node where Keepalived is installed. When d=1, record the physical IP address of the current node and the network card name bound to the virtual IP1 (taking eth_x as an example). Finally, get a traversal list of physical addresses with virtual IP1, taking p1, p2, ..., pn as an example (where p1, p2, pn, etc. refer to the physical IP address of the node where the virtual IP1 is located), and then traverse the login p1, p2, ..., pn addresses. In order to ensure that there is only one virtual IP1 in the cluster, when traversing the first p1 node in the login list, skip it directly without doing any processing, and then traverse the remaining address list, and execute the "ip addr del IP1 dev eth_x" command on the node to clear the virtual IP1 of the current node, and finally ensure that the virtual IP1 only exists on the p1 node.
[0094] (2) traversing and logging into the virtual network address management services of all management nodes; recording the management nodes having the virtual network address to be tested in a traversal list in a traversal order; randomly selecting a management node from the traversal list as a reserved node; and clearing the virtual network address to be tested from other management nodes in the traversal list except the reserved node.
[0095] Specifically, first traverse the Keepalived services of all management nodes in the login server cluster, and use the "ip a| grep -w IP1| wc -l" command to view the virtual IP1 value d of the current node. If d=0, traverse the next Keepalived installation node. When d=1, record the physical IP address of the current node and the network card name bound to the virtual IP1. Finally, get a traversal list of physical addresses with virtual IP1, taking p1, p2, ..., pn as an example, and then traverse the login p1, p2, ..., pn addresses. In order to ensure that there is only one virtual IP1 in the cluster, when traversing the px node in the login list, skip it directly without doing any processing, and then traverse the remaining address list, and execute the "ip addr del IP1 dev eth_x" command on the node to clear the virtual IP1 of the current node, and finally ensure that the virtual IP1 only exists on the px node, where the px node is a random node in the traversal list.
[0096] (3) traversing and logging into the virtual network address management services of all management nodes; recording the management nodes having the virtual network address to be tested in a traversal list in a traversal order; and clearing the virtual network address to be tested from other management nodes except the last management node in the traversal list.
[0097] Specifically, first traverse the Keepalived services of all management nodes in the login server cluster, and use the "ip a| grep -w IP1| wc -l" command to view the virtual IP1 value d of the current node. If d=0, traverse the next node where Keepalived is installed. When d=1, record the physical IP address of the current node and the name of the network card bound to the virtual IP1. Finally, get a traversal list of physical addresses with virtual IP1. Take p1, p2, ..., pn as an example, and then traverse the login p1, p2, ..., pn addresses. To ensure that there is only one virtual IP1 in the cluster, when traversing the p1-pn-1 node in the login list, execute the "ip addr del IP1 dev eth_x" command on the node to clear the virtual IP1 of the current node. When traversing the pn node, skip it directly without doing any processing, and finally ensure that the virtual IP1 only exists on the pn node.
[0098] (4) traverse and log in to the virtual network address management services of all management nodes; record the management nodes with the virtual network address to be tested in a traversal list in the traversal order; obtain the management node with the highest priority in the traversal list as a reserved node; and clear the virtual network address to be tested from other management nodes in the traversal list except the reserved node.
[0099] Specifically, the priority of each management node may be determined first, and the nodes may be processed according to the priority. First, traverse the Keepalived services of all management nodes in the login server cluster, and use the "ip a | grep -w IP1 | wc -l" command to view the virtual IP1 value d of the current node. If d=0, traverse the next node where Keepalived is installed. When d=1, record the physical IP address of the current node and the network card name bound to the virtual IP1. Finally, get a traversal list of physical addresses with virtual IP1. Take p1, p2, ..., pn as an example, and then traverse the login p1, p2, ..., pn addresses. To ensure that there is only one virtual IP1 in the cluster, first check the priority corresponding to each node in the traversal list, and filter out the node py with the highest priority. When traversing the py node in the login list, skip it directly without doing any processing, and then traverse the remaining address list, and execute the "ip addr del IP1 dev eth_x" command on the node to clear the virtual IP1 of the current node, and finally ensure that the virtual IP1 only exists on the py node. Among them, the py node is the node with the highest priority in the traversal list. The node is reserved by priority, making the node switching more reasonable.
[0100] In the embodiment of the present invention, when a server cluster fails over, the current network status is analyzed by a network detection module, and different network processing methods are adopted for different network statuses. In particular, when a split-brain scenario occurs in the cluster, the virtual IP to be tested in one of the nodes is retained to clear the virtual IP to be tested in other nodes, thereby ensuring the uniqueness of the virtual IP in the cluster, avoiding the conventional method of directly restarting the Keepalived service to cause the cluster to be unavailable, and improving the stability of the cluster service.
[0101] When the number of virtual IPs to be tested is 0, it means that the nodes where the Keepalived service is located in the server cluster have experienced network failures. At this time, the cluster can no longer be accessed normally. By traversing and logging into the N nodes where the Keepalived service is located in the cluster, and then restarting the Keepalived service on each node, network failure recovery is performed.
[0102] In the embodiment of the present invention, when a server cluster fails over, the current network status is first analyzed by the network detection module, and then different methods are used to handle different network statuses. The Keepalived service is restarted only when the virtual IP is lost in the network, thereby avoiding service unavailability caused by unnecessary restarts. The network fault recovery capability ensures that the training task can continue even when network problems occur, avoiding the loss of training progress due to interruptions, and improving the stability of the cluster service.
[0103] On the basis of the above embodiments, further, before traversing the virtual network address management services of all management nodes according to the timing detection cycle corresponding to the virtual network address to be tested, the method further includes:
[0104] According to the urgency of each virtual network address in the server cluster, a timing detection period corresponding to each virtual network address is determined.
[0105] Specifically, according to the urgency of the virtual IP in the server cluster, that is, whether the virtual IP has the urgency of recovery in the actual scenario, the scheduled detection period can be selected from two levels: second-level Sk or minute-level Mk. The numerical range of the k parameter in both levels is 1~60. For example: S5 means that the detection script is triggered once every 5 seconds, and M5 means that the detection script is triggered once every 5 minutes. The specific k value can be freely configured according to the actual situation of the cluster environment.
[0106] For example, in a large-scale AI cluster, when a network failure occurs in the virtual IP used to access the cluster page, it is usually necessary to quickly complete the failover to ensure that customers can log in to the cluster function normally. Therefore, the virtual IP timing detection cycle can be S10 in seconds; while the virtual IP used to access the image warehouse may be lost due to problems with all the image warehouses themselves. The virtual IP will not be restored until the image warehouse itself is restored. Therefore, a longer waiting time is required, and the virtual IP timing detection cycle can be M30 in minutes.
[0107] In some complex network environments, although Keepalived can achieve automatic failover, it may not be able to effectively handle all failover situations, especially when there are multiple virtual IPs in the cluster that need to be maintained. For example, in large-scale AI clusters, when the virtual IP used to access the cluster page has a network failure, it is usually necessary to quickly complete the failover to ensure that customers can log in to the cluster function normally. The virtual IP used to access the image warehouse may be lost due to problems with all the image warehouses themselves. The virtual IP must wait for the image warehouse itself to recover before it can be restored. Therefore, a longer waiting time is required. Therefore, when the cluster virtual IP is lost, the Keepalived service method of forcibly restarting all nodes may cause other normal virtual IPs to be unable to be used normally, resulting in the unavailability of the cluster. Therefore, how to achieve effective failover is also an important issue. When there are multiple virtual IPs in the cluster, determine the timing detection cycle of each virtual network address according to the urgency of each virtual network address.
[0108] For example, when a network failure occurs in the virtual IP1 used to access the cluster page, it is usually necessary to quickly complete the failover to ensure that the customer can log in to the cluster function normally. Therefore, the timing detection cycle of virtual IP1 can be S10 in seconds; while the virtual IP2 used to access the image warehouse may be lost due to problems with all the image warehouses themselves. It is necessary to wait for the image warehouse itself to recover before the virtual IP2 can be restored. Therefore, a longer waiting time is required, and the timing detection cycle of virtual IP2 can be M30 in minutes.
[0109] In the embodiment of the present invention, when multiple virtual IPs are managed simultaneously in a high-availability cluster, different timing detection strategies are adopted for different virtual IPs according to the degree of urgency, so as to avoid the situation where only one timing strategy is used on the same node when a fault switching occurs, which cannot meet the scenario requirements of a complex cluster environment, thereby improving the reliability of the cluster.
[0110] On the basis of the above embodiments, further comprising:
[0111] If a first virtual network address in the server cluster fails, then a second virtual network address must fail, and it is determined that the first virtual network address has a dependency relationship with the second virtual network address;
[0112] The timing detection period of the first virtual network address and the timing detection period of the second virtual network address are set to the same timing detection period.
[0113] Specifically, there may be a dependency relationship between multiple virtual IPs. The dependency relationship refers to two virtual network addresses in the server cluster, the first virtual network address and the second virtual network address. If the first virtual network address fails, the second virtual network address must fail, which means that there is a dependency relationship between the first virtual network address and the second virtual network address. The dependency relationship can be manually marked in the configuration file of the virtual network address through historical data.
[0114] After the Keepalived configuration is completed and the service is started, different timing detection strategies are adopted according to whether there is dependency between different virtual IPs. This is to better meet the scenario requirements of the artificial intelligence training platform cluster environment. For example, when a network failure occurs in the virtual IP1 used for cluster page access, it is usually necessary to quickly complete the failover to ensure that customers can log in to the cluster function normally. The virtual IP2 used to access the image warehouse may be lost due to problems in all image warehouses themselves, which may cause the virtual IP2 to be unavailable. There is no dependency between the two virtual IPs. For the above reasons, the timing detection cycle of virtual IP1 is set to T1, and the timing detection cycle of virtual IP2 is set to T2. At the same time, according to whether the virtual IP has the urgency of recovery in the actual scenario, the timing time of T1 and T2 can be selected from the second level Sk or the minute level Mk. The value range of the k parameter in both levels is 1~60. For example: S5 means that the detection script is triggered once every 5 seconds, and M5 means that the detection script is triggered once every 5 minutes. The specific k value can be freely configured according to the actual situation of the cluster environment.
[0115] In an embodiment of the present invention, when multiple virtual IPs are managed simultaneously in a high-availability cluster, different timing detection strategies are adopted according to whether different virtual IPs have dependencies, which can meet the scenario requirements of complex cluster environments and avoid network processing caused by virtual IP loss problems caused by non-network failures, thereby improving the reliability of the cluster.
[0116] If virtual IP1 and virtual IP2 have a dependency relationship, you only need to enable one scheduled task detection script, and if the recovery urgency of one of the two virtual IPs is true (true), the scheduled time needs to be set to T1=T2=Sk. If the recovery urgency of both virtual IPs is false (false), then T1=T2=Mk.
[0117] If virtual IP1 and virtual IP2 have no dependency, two scheduled task detection scripts need to be enabled, and different scheduled times are used for service checks. If the urgency of virtual IP1 recovery is true, then T1=Sk, otherwise, then T1=Mk. Similarly, the timing strategy of virtual IP2 refers to the timing strategy of virtual IP1 mentioned above.
[0118] like Figure 3As shown, if there are two virtual network addresses in the cluster, virtual IP1 and virtual IP2, the timing policy module calls the Keepalived configuration to determine whether the two virtual IPs are dependent. The Keepalived configuration returns yes or no based on whether the two virtual IPs are dependent. If yes, the timing policy module defines a timing detection cycle as the timing detection cycle of virtual IP1 and virtual IP2. If no, the timing policy module sets timing detection cycles for virtual IP1 and virtual IP2 respectively, and defines two timing detection cycles in total. The network detection module is called to perform network detection. The network detection module returns the number of each virtual IP in the cluster. The network processing module calls the network detection module result and performs different network processing according to the network status.
[0119] For two virtual IPs that have no dependency, when the urgency of the two is different, the timing detection cycle is set to two different timing detection cycles. When the urgency of the two is the same, the timing detection cycle can be set to two different timing detection cycles, such as M5 and M6, or can be set to the same timing detection cycle, such as both set to M5. In actual applications, when the two virtual IPs have no dependency, setting the two virtual IPs to different timing detection cycles can improve detection efficiency.
[0120] In the embodiment of the present invention, when multiple virtual IPs are managed simultaneously in a high-availability cluster, different timing detection strategies are adopted according to whether different virtual IPs have dependencies, so as to avoid that when a fault switch occurs, the health check of the virtual IP on the same node uses only one timing strategy, which cannot meet the scenario requirements of a complex cluster environment, thereby improving the reliability of the cluster.
[0121] On the basis of the above embodiments, further, traversing the virtual network address management services of all management nodes to obtain the number of the virtual network addresses to be tested in the server cluster includes:
[0122] Traverse and log in to the virtual network address management services of all management nodes;
[0123] Record the number of virtual network addresses to be tested in each management node;
[0124] The sum of the numbers of the virtual network addresses to be tested in all management nodes is used as the number of the virtual network addresses to be tested in the server cluster.
[0125] Specifically, a network detection module is added to the scheduled task detection script to detect whether each virtual IP is unique. The total number of virtual IP1 and virtual IP2 in the entire cluster is calculated as follows:
[0126] Traverse the N nodes where the Keepalived service is located in the login cluster, and use the "ip a | grep -w IP1 | wc-l" command to view the number of virtual IP1s of the current node. Assuming that the statistical values on the N nodes are a1, a2, ..., an, the total number of virtual IP1s in the cluster is b1 = a1 + a2 + ... + an;
[0127] The total number of virtual IP2s in the cluster is calculated in the same way as above. Assuming that the statistical results on N nodes are c1, c2, …, cn, the total number of virtual IP2s in the cluster is b2 = c1 + c2 + … + cn.
[0128] It should be noted that the virtual IP value counted on each node is 0 or 1.
[0129] After the total number of virtual IPs is counted, the network status is determined according to the total number of virtual IPs, and different network processing processes are performed.
[0130] The fault handling method provided by the embodiment of the present invention, on the one hand, when the cluster encounters a single point failure and the master-slave node switches, first analyzes the current network status through the network detection module, and then processes the virtual IP respectively according to different network statuses to ensure the uniqueness of the same virtual IP, avoid the occurrence of multiple identical virtual IPs causing service interruption, thereby ensuring the stability of cluster services; on the other hand, when multiple virtual IPs are managed simultaneously in a high-availability cluster, different timing detection strategies are adopted according to whether there is a dependency between different virtual IPs, to avoid the simultaneous drift of multiple virtual IPs, causing service unavailability.
[0131] Figure 5 is a flowchart of another method for troubleshooting provided by an embodiment of the present invention. Figure 5 As shown, taking the high-availability cluster of the artificial intelligence training platform as an example, assuming that there are two virtual IPs in the cluster, namely virtual IP1 and virtual IP2, where virtual IP1 is used to access the cluster page and virtual IP2 is used to access the cluster image warehouse. When a network failure occurs in the cluster, virtual IP1 and virtual IP2 are required to be able to quickly switch to other normal management nodes. Assuming that there are N (N>1) management nodes in the cluster and the Keepalived service is installed, taking virtual IP1 as an example (the processing method of virtual IP2 is the same as that of virtual IP1), the specific implementation method is as follows:
[0132] Step S501, according to the different values b of the current virtual network address in the cluster, different network processing methods are adopted; traverse the N nodes where the Keepalived service is located in the login cluster, and use the "ip a | grep -w IP1 | wc -l" command to check the number of virtual IP1 of the current node. Assuming that the values counted on the N nodes are a1, a2, ..., an, the total number of virtual IP1 in the cluster is b1=a1+a2+...+an;
[0133] Step S502, when b1=1, it means that virtual IP1 is normal in the cluster and no processing is required, so it is skipped directly;
[0134] Step S503, when b1=0, it indicates that the nodes where the Keepalived service is located in the cluster have all experienced network failures. At this time, the cluster can no longer be accessed normally. The network failure is recovered by traversing the N nodes where the Keepalived service is located in the cluster and restarting the Keepalived service on each node.
[0135] Step S504, when b1>1, it indicates that a "brain split" phenomenon may have occurred when the cluster performs network failure switching. At this time, first traverse and log in to N Keepalived service nodes.
[0136] Step S505, when checking the value of the virtual IP1 of the current node through the "ip a | grep -w IP1 | wc -l" command, check whether the current virtual network address exists. If d=0, it means that the virtual IP1 does not exist in the current node, then traverse the next Keepalived node.
[0137] Step S506, when d=1, it means that the current node has a virtual IP1, then the physical IP address of the current node and the network card name bound to the virtual IP1 are recorded, and finally a list of physical addresses with virtual IP1 is obtained, for example, the list is p1, p2, ..., pn.
[0138] Step S507, traverse and log in addresses p1, p2, ..., pn.
[0139] Step S508, in order to ensure that there is only one virtual IP1 in the cluster, when traversing and logging into the p1 node in the first list, it is directly skipped without any processing, and then the remaining address lists are traversed, and the "ip addr del IP1dev eth_x" command is executed on the node to clear the virtual IP1 of the current node, and finally ensure that the virtual IP1 only exists on the p1 node.
[0140] The fault handling method provided by the embodiment of the present invention, on the one hand, when a cluster fails over, first analyzes the current network status through the network detection module, and then adopts different methods to handle different network statuses. The network fault recovery capability ensures that the training task can continue even when a network problem occurs, avoiding the loss of training progress due to interruption, and improving the stability of the cluster service; on the other hand, when multiple virtual IPs are managed simultaneously in a high-availability cluster, different timing detection strategies are adopted to determine whether there is a dependency between the recovery of different virtual IPs, which can reduce the network processing caused by the loss of virtual IPs caused by non-network failures. The fast network fault recovery mechanism can reduce the training delay caused by network problems, improve the overall training efficiency, enhance the flexibility of the cluster in handling problems, and reduce the complexity and cost of operation and maintenance.
[0141] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0142] like Figure 6 , shows a structural block diagram of a computer program product 60 provided in an embodiment of the present invention, including a computer program / instruction 601. When the computer program / instruction 601 is executed by a processor, the various processes of the above-mentioned fault handling method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0143] like Figure 7 , showing a structural block diagram of an electronic device 70 provided in an embodiment of the present invention, including:
[0144] A processor 701, a memory 702, and a computer program 7021 stored in the memory 702 and capable of running on the processor 701. When the computer program 7021 is executed by the processor 701, each process of the above-mentioned processing method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0145] like Figure 8 , shows a structural block diagram of a computer-readable storage medium 80 provided in an embodiment of the present invention. A computer program 801 is stored on the computer-readable storage medium 80. When the computer program 801 is executed by the processor, the various processes of the above-mentioned processing method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0146] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0147] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0148] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0149] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0150] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0151] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.
[0152] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0153] The above describes in detail a fault handling method, a computer program product, an electronic device and a storage medium provided by the present invention. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A fault handling method, characterized in that: Applied to a server cluster, the server cluster includes multiple computing nodes and management nodes, the method includes: According to the timing detection cycle corresponding to the virtual network address to be tested, traverse the virtual network address management services of all management nodes to obtain the number of the virtual network address to be tested in the server cluster; Determine a network state according to the number of virtual network addresses to be tested, and determine a fault handling method according to the network state; If a first virtual network address in the server cluster fails, then a second virtual network address must fail, and it is determined that the first virtual network address has a dependency relationship with the second virtual network address; The timing detection period of the first virtual network address and the timing detection period of the second virtual network address are set to the same timing detection period.
2. The method according to claim 1, characterized in that The determining of the network status according to the number of the virtual network addresses to be tested includes: If the number of the virtual network addresses to be tested is equal to 1, it is determined that the server cluster network is normal; Otherwise, it is determined that a network failure occurs in the server cluster.
3. The method according to claim 2, characterized in that The method of determining a fault handling method according to the network state includes: If the number of the virtual network addresses to be tested is greater than 1, the virtual network addresses to be tested are retained in one of the management nodes, and the virtual network addresses to be tested are cleared in other management nodes; If the number of virtual network addresses to be tested is 0, Then restart the virtual network address management service in all the management nodes.
4. The method according to claim 1, characterized in that: Before traversing the virtual network address management services of all management nodes according to the timing detection cycle corresponding to the virtual network address to be tested, the method further includes: According to the urgency of each virtual network address in the server cluster, a timing detection period corresponding to each virtual network address is determined.
5. The method according to claim 1, characterized in that Also includes: If the first virtual network address and the second virtual network address have no dependency relationship, the timing detection period of the first virtual network address and the timing detection period of the second virtual network address are set to two different timing detection periods.
6. The method according to claim 3, characterized in that The step of retaining the virtual network address to be tested in one of the management nodes and clearing the virtual network address to be tested in other management nodes includes: Traverse and log in to the virtual network address management services of all management nodes; Recording the management nodes having the virtual network address to be tested in a traversal list in traversal order; The virtual network addresses to be tested in the management nodes other than the first management node in the traversal list are cleared.
7. The method according to claim 3, characterized in that The step of retaining the virtual network address to be tested in one of the management nodes and clearing the virtual network address to be tested in other management nodes includes: Traverse and log in to the virtual network address management services of all management nodes; Recording the management nodes having the virtual network address to be tested in a traversal list in traversal order; Randomly select a management node from the traversal list as a reserved node; The virtual network addresses to be tested in other management nodes except the reserved node in the traversal list are cleared.
8. The method according to claim 3, characterized in that The step of retaining the virtual network address to be tested in one of the management nodes and clearing the virtual network address to be tested in other management nodes includes: Traverse and log in to the virtual network address management services of all management nodes; Recording the management nodes having the virtual network address to be tested in a traversal list in traversal order; The virtual network addresses to be tested in the management nodes other than the last management node in the traversal list are cleared.
9. The method according to claim 3, characterized in that: The step of retaining the virtual network address to be tested in one of the management nodes and clearing the virtual network address to be tested in other management nodes includes: Traverse and log in to the virtual network address management services of all management nodes; Recording the management nodes having the virtual network address to be tested in a traversal list in traversal order; obtaining the management node with the highest priority in the traversal list as a reserved node; The virtual network addresses to be tested in other management nodes except the reserved node in the traversal list are cleared.
10. The method according to claim 9, characterized in that Before traversing and logging into the virtual network address management service of all management nodes, it also includes: Determine the priority of each management node.
11. The method according to claim 1, characterized in that: The traversing the virtual network address management services of all management nodes to obtain the number of the virtual network addresses to be tested in the server cluster includes: Traverse and log in to the virtual network address management services of all management nodes; Record the number of virtual network addresses to be tested in each management node; The sum of the numbers of the virtual network addresses to be tested in all management nodes is used as the number of the virtual network addresses to be tested in the server cluster.
12. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the fault handling method described in any one of claims 1-11 are implemented.
13. An electronic device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein when the computer program is executed by the processor, the steps of the fault handling method according to any one of claims 1 to 11 are implemented.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the fault handling method according to any one of claims 1 to 11 are implemented.
Citation Information
Patent Citations
Deployment and management method and device of virtual IP service system and electronic equipment
CN112087336A
Virtual machine high availability method and computing cluster
CN114880080A
Method and device for realizing high availability of virtual machine
CN115190040A
Database management method and device
CN116225607A
