Cluster arbitration method, network device and system

By using network devices to arbitrate and elect the master node in a distributed cluster system, the high cost problem caused by shared storage space is solved, achieving cost reduction and improved system availability.

CN116367202BActive Publication Date: 2026-07-10HUAWEI TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HUAWEI TECH CO LTD
Filing Date
2021-12-28
Publication Date
2026-07-10

AI Technical Summary

Technical Problem

The additional shared storage space in existing distributed cluster systems increases hardware and maintenance costs. How can we determine the master node without relying on shared storage space to reduce costs?

Method used

Arbitration is performed by network devices in the cluster to determine the master node. There is no need to set up additional shared storage space in the cluster. The election of the master node is achieved by using network devices to process arbitration messages, which reduces the cost of the distributed cluster system.

Benefits of technology

This reduces the hardware and maintenance costs of distributed cluster systems while improving system availability and election efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116367202B_ABST
    Figure CN116367202B_ABST
Patent Text Reader

Abstract

The application discloses a cluster arbitration method, a network device and a system. A first network device in a cluster acquires a master stealing request message of a first node and determines a master node of the first cluster. In this way, the network device in the cluster is used to realize arbitration master selection, and other shared storage spaces need not be additionally arranged in the cluster, so that the cost of the distributed cluster system can be reduced on the basis of ensuring a certain degree of reliability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computers, and in particular to a cluster arbitration method, network device and system. Background Technology

[0002] Distributed cluster systems are an important technical means to achieve system scalability and high reliability. A distributed cluster system consists of multiple cluster nodes. The "distributed" aspect refers to distributing critical operational information across multiple nodes. When one or more cluster nodes fail, the distributed cluster system can automatically adapt, with the healthy nodes taking over the business operations, thus improving the overall reliability and availability of the distributed cluster system.

[0003] Distributed cluster systems need to ensure data consistency among cluster nodes. For example, consensus algorithms such as Raft and Paxos can be used to achieve data consistency among cluster nodes. These consensus algorithms require the selection of a master node among the cluster nodes. The master node coordinates and manages the other cluster nodes and is responsible for data synchronization. The master node can be determined through negotiation among the cluster nodes or by a third party accessible to all cluster nodes. The method of determining the master node by a third party is also called arbitration. Current arbitration-based master election algorithms require the additional setting of a shared storage space accessible to all cluster nodes in the distributed cluster system. This shared storage space is a third party. Examples of shared storage space include servers and hard drives. When the distributed cluster system needs to elect a master node, the cluster nodes participating in the election send a request to the shared storage space to claim the master. The shared storage space then determines the master node according to certain arbitration rules.

[0004] Setting up additional shared storage space in a distributed cluster system increases hardware and maintenance costs. Therefore, reducing the cost of distributed cluster systems is a technical problem that needs to be solved. Summary of the Invention

[0005] This application provides a cluster arbitration method, network device, and system that can determine the master node of the cluster using network devices in the cluster without the need to set up additional shared storage space in the cluster. This reduces the cost of the distributed cluster system while ensuring a certain degree of reliability.

[0006] Firstly, this application provides a cluster arbitration method, which can be applied to a first network device. The method specifically includes the following steps: the first network device obtains a master election request message from a first node and determines the master node of the first cluster. The first node is a cluster node participating in the master node election within the first cluster. The master election request message includes a first cluster identifier. The first cluster identifier is used to identify the first cluster. Based on the master election request message, the first network device can determine that it is the first node in the first cluster that is requesting the election of a master node, and thus determine the master node of the first cluster. By having the first network device determine the master node of the first cluster, cluster arbitration of the first cluster is achieved. This eliminates the need to set up additional shared storage space for arbitration within the first cluster, thereby reducing the establishment and maintenance costs of the distributed cluster system to a certain extent.

[0007] In one possible implementation, when it is determined that the master node of the first cluster does not exist, the first network device determines the first node as the master node of the first cluster. The first node can be a cluster node among the requesting cluster nodes that conforms to the arbitration rules of the first network device. For example, if the arbitration rule is to make the node that first obtains the master request message the master node, the master request message sent by the first node can be the first master request message obtained by the first network device in this master node selection process. As another example, if the arbitration rule is to make the cluster node with the highest priority the master node, the first node can be the cluster node with the highest priority in the first cluster.

[0008] As an example, the first master node information is used to indicate that the master node of the first cluster does not exist. The first network device can determine that the master node of the first cluster does not exist based on the first master node information and therefore needs to determine the master node of the first cluster. Further, after the first network device sets the first node as the master node of the first cluster, a master node exists in the first cluster, which is the first node. The first network device updates the first master node information so that the updated first master node information indicates that the master node of the first cluster exists, so that the first network device can subsequently determine the master node based on the updated first master node information, achieving timely updates of the master node information.

[0009] As another example, the first network device can obtain second master node information. This second master node information indicates the presence status of the master node in the first cluster. If the first network device does not obtain the second master node information, it determines that the master node of the first cluster does not exist and needs to determine the master node of the first cluster.

[0010] In another possible implementation, the first network device is able to obtain third master node information. This third master node information indicates the existence of a master node in the first cluster. Based on this third master node information, the first network device can determine the master node of the first cluster.

[0011] In one possible implementation, after receiving the master-claiming request message from the first node, the first network device determines whether the first node is the first candidate master node of the first cluster. The first candidate master node of the first cluster is a cluster node that can be set as the master node of the first cluster. If the first node is the first candidate master node of the first cluster, the first network device can determine the first node as the master node of the first cluster.

[0012] In one possible implementation, the first network device can determine whether a first node is the first candidate master node of the first cluster based on a first node information set. The first node information set includes node information of the first candidate master node in the first cluster. The first network device can obtain the node information of the first node included in the master-preemption request message. When the first node information set includes the node information of the first node, it indicates that the first node is the first candidate master node of the first cluster. The first network device is able to determine that the first node is the first candidate master node of the first cluster.

[0013] In one possible implementation, after the first network device determines the first node as the first candidate master node, the list of candidate master nodes in the first cluster that can serve as the cluster master node will change. The first network device can delete the first node information set to avoid selecting an incorrect master node based on the first node information set in subsequent iterations.

[0014] In one possible implementation, after the first network device determines the first node as the first candidate master node, it can obtain the node information of the second candidate master node of the first cluster, thus obtaining a second node information set. The second node information set includes the node information of the second candidate master node of the first cluster. As an example, the first network device can obtain the node information of the second candidate master node of the first cluster from the first node. The second node information set obtained by the first network device is established based on the node information of cluster nodes in the first cluster that can serve as candidate master nodes after the first node becomes the master node. The first network device can then perform the next master node election more accurately based on the second node information set.

[0015] In one possible implementation, the first network device generates a synchronization message and sends it to the second network device. The synchronization message includes node information of the master node of the first cluster. The synchronization message instructs the second network device to back up the node information of the master node of the first cluster. The second network device serves as a backup for the first network device. Based on the acquired synchronization message, the second network device can back up the node information of the master node of the first cluster included in the synchronization message. This enables synchronization of the node information of the master node stored in the primary network node and the backup network node when there are primary and backup network nodes.

[0016] In one possible implementation, the first network device can obtain a synchronization success message sent by the second network device. This synchronization success message indicates that the second network device has successfully backed up the data. Based on the obtained synchronization success message, the first network device can determine the node information of the master node of the first cluster from the synchronization message successfully backed up by the second network device.

[0017] In one possible implementation, the synchronization message also includes node information of the first node. The synchronization message further instructs the second network device to send a first master-preemption response message to the first node. The first master-preemption response message includes the first node's master election result. After receiving the synchronization message, the second network device, in addition to backing up the node information of the master node of the first cluster included in the synchronization message, also sends a first master-preemption response message to the first node. The first node's master election result is used to indicate whether the first node successfully preempted the master.

[0018] In another possible implementation, the first network device can generate a second master-preemption response message and send it to the first node. This second master-preemption response message includes the first node's master election result. The first node's master election result indicates whether the first node successfully preempted the master.

[0019] In one possible implementation, the first network device further acquires a query request message from the second node, where the second node is a cluster node of the second cluster. The query request message includes a second cluster identifier, which identifies the second cluster. The first network device can generate a query response message, which includes the query result of the first network device querying the master node of the second cluster. The first network device sends the query response message to the second node. Based on the query result in the query response message, the second node can determine the existence status of the master node of the second cluster.

[0020] Secondly, this application provides a network device, the network device comprising: a first acquisition unit and a first processing unit. The first acquisition unit is configured to acquire a master-selection request message from a first node, the first node being a cluster node participating in master-selection election within a first cluster, the master-selection request message including a first cluster identifier, the first cluster identifier being used to identify the first cluster; the first processing unit is configured to determine the master node of the first cluster.

[0021] In one possible implementation, the first processing unit is specifically configured to determine the first node as the master node of the first cluster in response to determining that the master node of the first cluster does not exist.

[0022] In one possible implementation, the first processing unit is specifically used to determine that the master node of the first cluster does not exist based on the first master node information, wherein the first master node information is used to indicate that the master node of the first cluster does not exist.

[0023] In one possible implementation, the network device further includes a second processing unit. The second processing unit is used to update the first master node information, and the updated first master node information is used to indicate the existence of a master node in the first cluster.

[0024] In one possible implementation, the first processing unit is specifically used to determine that the master node of the first cluster does not exist in response to the failure to obtain the second master node information, wherein the second master node information is used to indicate the existence status of the master node of the first cluster.

[0025] In one possible implementation, the first processing unit is specifically used to determine the master node of the first cluster based on third master node information, wherein the third master node information is used to indicate the existence of the master node of the first cluster.

[0026] In one possible implementation, the first processing unit is specifically configured to determine the first node as the master node of the first cluster in response to determining that the first node is a first candidate master node of the first cluster.

[0027] In one possible implementation, the master-grabbing request message includes the node information of the first node, and the first processing unit is specifically used to determine that the first node information set includes the node information of the first node, and the first node information set includes the node information of the first candidate master node of the first cluster.

[0028] In one possible implementation, the network device further includes a third processing unit. The third processing unit is used to delete the first node information set.

[0029] In one possible implementation, the network device further includes a second acquisition unit. The second acquisition unit is used to acquire node information of the second candidate master node of the first cluster, obtaining a second node information set, the second node information set including the node information of the second candidate master node of the first cluster.

[0030] In one possible implementation, the network device further includes a third processing unit and a first sending unit. The third processing unit is used to generate a synchronization message, the synchronization message including node information of the master node of the first cluster;

[0031] The first sending unit is used to send the synchronization message to the second network device. The synchronization message is used to instruct the second network device to back up the node information of the master node of the first cluster. The second network device is a backup network device for the first network device.

[0032] In one possible implementation, the network device further includes a third acquisition unit. The third acquisition unit is configured to allow the first network device to acquire a synchronization success message sent by the second network device, the synchronization success message indicating that the second network device has successfully completed the backup.

[0033] In one possible implementation, the synchronization message further includes node information of the first node, and the synchronization message is also used to instruct the second network device to send a first master-preemption response message to the first node based on the node information of the first node, the first master-preemption response message including the master election result of the first node.

[0034] In one possible implementation, the network device further includes: a fourth processing unit and a second sending unit. The fourth processing unit is configured to generate a second master-preemption response message, the second master-preemption response message including the master election result of the first node. The second sending unit is configured to send the second master-preemption response message to the first node.

[0035] In one possible implementation, the network device further includes: a fourth acquisition unit, a fifth processing unit, and a third sending unit. The fourth acquisition unit is used to acquire a query request message from a second node, the query request message including a second cluster identifier, the second cluster identifier being used to identify a second cluster, and the second node being a cluster node of the second cluster. The fifth processing unit is used to generate a query response message, the query response message including a query result, the query result being used to enable the second node to determine the existence status of the master node of the second cluster based on the query result. The third sending unit is used to send the query response message to the second node.

[0036] Thirdly, this application provides a network device, which includes a processor chip and a memory. The memory is used to store instructions or program code, and the processor chip is used to call and run the instructions or program code from the memory to perform the method as described in the first aspect or any implementation thereof.

[0037] Fourthly, this application provides a network system comprising a network device and a first node, the network device being configured to perform the method as described in the first aspect or any implementation thereof.

[0038] Fifthly, this application provides a computer-readable storage medium, characterized in that it includes instructions, programs, or code that, when executed on a computer, cause the computer to perform the method as described in the first aspect or any implementation thereof.

[0039] Sixthly, this application provides a chip including a memory and a processor. The memory is used to store instructions or program code. The processor is used to retrieve and execute the instructions or program code from the memory to perform the methods in the first aspect or any possible implementation thereof.

[0040] In one possible design, the chip described above includes only a processor, which reads and executes instructions or program code stored in memory. When the instructions or program code are executed, the processor performs the method in the first aspect or any possible implementation of the first aspect. Attached Figure Description

[0041] Figure 1 This is a schematic diagram of the architecture of a traditional distributed cluster system;

[0042] Figure 2 This application provides a schematic diagram of the architecture of a distributed cluster system.

[0043] Figure 3 This is a schematic diagram of another distributed cluster system architecture provided in an embodiment of this application;

[0044] Figure 4 A flowchart illustrating a cluster arbitration method provided in an embodiment of this application;

[0045] Figure 5 This is a schematic diagram of the network device provided in the embodiments of this application;

[0046] Figure 6 This is a schematic diagram of the network system provided in an embodiment of this application;

[0047] Figure 7 This is a schematic diagram of the device provided in the embodiments of this application;

[0048] Figure 8 This is a schematic diagram of the device provided in an embodiment of this application. Detailed Implementation

[0049] The master node in a distributed cluster system coordinates and manages the other cluster nodes. Currently, master node election methods include voting, default configuration, and competitive arbitration. The following is a brief introduction to the competitive arbitration method.

[0050] The competitive arbitration method for electing a master node requires additional shared storage space configured within the distributed cluster system. This shared storage space needs to establish connections with each cluster node in the distributed cluster system. When the distributed cluster system needs to elect a master node, each participating cluster node sends a preemptive request to the shared storage space. The shared storage space receives the preemptive requests and, based on the arbitration rules, determines the master node from among the cluster nodes. The competitive arbitration method relies on the shared storage space within the distributed cluster system. Shared storage space can typically be devices such as servers, hard drives, or virtual machines. See also... Figure 1 As shown in the diagram, this is a schematic diagram of the architecture of a traditional distributed cluster system 100. The distributed cluster system 100 includes cluster nodes 101-105, a switch 106, and a server 107. Cluster nodes 101-105 are connected to the switch 106 and access the cluster system through the switch. Server 107 is an additional shared storage space configured in the distributed cluster system 100. Server 107 is connected to cluster nodes 101-105. Server 107 is used to receive master-claiming requests from cluster nodes 101-105 and determine the master node of the cluster.

[0051] The competitive arbitration method for selecting a master node is not affected by the parity of the number of cluster nodes and can flexibly determine the master node based on the operational status of the distributed cluster system. However, the additional shared storage space in a distributed cluster system leads to higher hardware and maintenance costs. Especially in some scenarios, such as edge scenarios with distributed storage hyperconverged infrastructure, a corresponding shared storage space is configured for every two cluster nodes, significantly increasing the cost of the distributed cluster.

[0052] To address the aforementioned issues, this application provides a cluster arbitration method in which network devices within the cluster conduct arbitration to determine the master node. This eliminates the need for additional shared storage space within the cluster, thereby reducing the cost of building and maintaining the cluster.

[0053] To facilitate understanding, the application scenarios of the cluster arbitration method provided in the embodiments of this application will be introduced first. See [link to relevant documentation]. Figure 2As shown in the figure, this figure is a schematic diagram of the architecture of a distributed cluster system provided in an embodiment of this application.

[0054] The distributed cluster system 200 includes cluster nodes 201-205 and network device 206. Cluster nodes 201-205 are connected to network device 206. Cluster nodes 201-205 access the network via network device 206. Network device 206 can be a switch, router, or other device with forwarding capabilities within the distributed cluster system. Network device 206 can process arbitration messages and implement arbitration for leader election. Furthermore, network device 206 can have storage capabilities or access to storage space. Specifically, network device 206 can implement the arbitration for leader election function based on a switching chip, or it can utilize virtualization technology to provide an isolated virtualized open space on network device 206 to run the arbitration for leader election function.

[0055] In addition, the cluster may include multiple network devices. See also Figure 3 As shown in the figure, this figure is a schematic diagram of the architecture of another distributed cluster system provided in an embodiment of this application.

[0056] The distributed cluster system 300 includes cluster nodes 301-305 and network devices 306-308. Cluster nodes 301-305 are connected to network devices 306-308 respectively. Cluster nodes 301-305 access the network via network devices 306-308. Network devices 306-308 can be switches, routers, or other devices with forwarding functions in the distributed cluster system. Network device 306 can be the primary network device, and network devices 307-308 can be backup network devices. Network devices 306-308 can process arbitration messages and implement arbitration for leader election. Network devices 306-308 can implement the arbitration for leader election function based on a switching chip. Alternatively, virtualization technology can be used to provide an isolated virtualized open space on network devices 306-308 to run the arbitration for leader election function. Furthermore, network devices 306-308 have storage capabilities or can access storage space on other devices.

[0057] See Figure 4 As shown in the figure, this is a schematic flowchart of a cluster arbitration method provided in an embodiment of this application. The cluster arbitration method provided in this embodiment includes steps S401-S402.

[0058] S401: The first network device obtains the master-claiming request message from the first node.

[0059] The first node is a cluster node in the first cluster. Combined Figure 2As shown, the first node can be any of the cluster nodes 201-205. When the first node participates in the master node election, it generates a master-preemption request message and sends it to the first network device. The master-preemption request message includes the first cluster identifier. The first cluster identifier is used to identify the first cluster to which the first node belongs.

[0060] The first network device connects to the cluster nodes in the first cluster to which the first node belongs. The first network device can connect directly to the first node or indirectly through other network devices. In one possible implementation, the first network device is the network device that connects the cluster nodes to the network. The first network device is located at the center of the distributed cluster system, facilitating interaction with the cluster nodes. The first network device is a network device with storage and programmable functions. The first network device can access storage space and can perform arbitration and leader election.

[0061] The first network device can directly obtain the master-claiming request message sent by the first node, or it can obtain it through other devices.

[0062] In one possible implementation, combining Figure 2 As shown, the first network device can be Figure 2 Network device 206, the first node is Figure 2 Cluster node 201. Network device 206 can obtain the master-claiming request message sent by cluster node 201.

[0063] In another possible implementation, combining Figure 3 As shown, the first network device can be network device 306, and the first node is... Figure 3 Cluster node 301. Network device 306 can obtain the master-claiming request message sent by cluster node 301 through network device 307.

[0064] The first network device receives the master-selection request message sent by the first node and, based on the first cluster identifier in the message, can determine the first cluster for which a master node needs to be selected. In one possible implementation scenario, the first network device is connected to cluster nodes of multiple clusters. Based on the first cluster identifier in the master-selection request message, the first network device can distinguish clusters and determine the first cluster for which the first node wants to request master selection.

[0065] In this embodiment of the application, a possible arbitration message is provided. A first network device can recognize and process the arbitration message. See Table 1, which lists the fields included in the arbitration message.

[0066] op cluster ID sequence verify sync ID status owner error code

[0067] Table 1

[0068] The `option` (or `op`) field identifies the operation type. The `identity` (or `ID`) field stores the cluster identifier. The `sequence` field identifies the response message. The `verify` field verifies whether the message is out of order. The `synchronization` (or `sync`) field determines the validity of the synchronized content. The `status` field identifies the existence status of the cluster's master node. The `owner` field stores the master node's Internet Protocol (IP) address. The `error code` field carries information.

[0069] In one possible implementation, when the arbitration message is specifically a master-preemption request message, it may include, for example, an op field, a cluster ID field, a sequence field, a verify field, and an owner field. The op field has a value of preempt, indicating that the operation type is master-preemption. The cluster ID field carries the identifier of the first cluster. The owner field carries the IP address of the first node, indicating that the first node is vying for master status. The sequence field identifies the request message. The verify field verifies whether the message is out of order. The sequence field can be a predefined string of letters, numbers, etc. The verify field can also be a predefined string of letters, numbers, etc.

[0070] S402: The first network device determines the master node of the first cluster.

[0071] The first network device can obtain the master-claiming request message of the first packet and process the master-claiming request message to determine the master node of the first cluster.

[0072] The first network device connects to the cluster nodes in the first cluster to which the first node belongs, enabling interaction with the cluster nodes to achieve arbitration-based leader election. This eliminates the need for additional shared storage space in the cluster, significantly reducing the cost of third-party arbitration in the distributed cluster system and improving its availability. Furthermore, compared to majority-based leader election, arbitration-based leader election using the first network device eliminates the need for negotiation among cluster nodes, resulting in a shorter election time.

[0073] This application provides two possible implementation methods for determining the master node of the first cluster. These methods are only used to illustrate the technical solutions of this application and are not intended to limit the methods for determining the master node of the first cluster.

[0074] The first method: In one possible way of determining the master node of the first cluster, the first network device first determines whether the master node of the cluster exists, and then determines the master node of the first cluster based on the existence status of the master node of the first cluster.

[0075] Specifically, it includes the following two methods:

[0076] Method 1: In response to the determination that the master node of the first cluster does not exist, the first network device determines the first node as the master node of the first cluster.

[0077] When the first network device determines that the master node of the first cluster does not exist, it can determine the first node that sent the master request message as the master node of the first cluster. This application embodiment does not limit the master election rules used by the first network device to determine the master node of the first cluster. For example, the first network device can determine the master node based on a master election rule that determines the node that requests the master first. If the first master request message received by the first network device is sent by the first node, then the first network device determines the first node as the master node of the first cluster based on the master election rules. Alternatively, the first network device can determine the master node based on the priority of the cluster nodes participating in the master competition. If the first node is the node with the highest priority among the cluster nodes participating in the master competition, then the first network device determines the first node as the master node.

[0078] The absence of a master node can include the following two situations:

[0079] Scenario 1: In one implementation, the first network device can obtain the first master node information. This first master node information indicates that the master node of the first cluster does not exist. The absence of a master node could be due to a failure of the previous master node, a disconnection, or other situations requiring a new master node to be determined.

[0080] Specifically, the first master node information may include a first status identifier. The first status identifier is a status identifier indicating that the master node does not exist. For example, the first status identifier can be "idle".

[0081] The first master node information can be generated by the first network device based on the operating status of the master nodes in the first cluster. The first master node information can be stored in an information table. This application embodiment does not limit the storage location of the first master node information. If the first network device has storage capabilities, it can store the first master node information in an information table in its local storage space. If the first network device can access other storage spaces, it can store the first master node information in an information table in those other storage spaces. For example, if the first network device can access storage spaces located on other devices, it can store the first master node information in an information table in the storage space of those other devices. When it is necessary to obtain the first master node information, the first network device accesses the information table in the storage space of the other device and retrieves the first master node information from the information table.

[0082] The first master node information can correspond to the first cluster identifier. The first network device can store the correspondence between the first master node information and the first cluster identifier in an information table in its local storage space or in an information table in other storage spaces. Based on the first cluster identifier in the master-contending request message and the correspondence between the first master node information and the first cluster identifier in the information table, the first network device can retrieve the first master node information.

[0083] In the scenario corresponding to Case 1, after determining that the first node is the master node of the first cluster, the first network device can update the first master node information accordingly. The updated first master node information is used to indicate that the master node of the first cluster exists. Specifically, the updated first master node information may include a second status identifier. The second status identifier is a status identifier indicating that the master node exists. The second status identifier can be, for example, "in use". The updated first master node information may also include the node information of the first node. The node information of the first node can be obtained by the first network device. The node information of the first node can be the IP address of the first node.

[0084] Scenario 2: In another implementation, if the first network device fails to obtain the second master node information, it determines that the master node of the first cluster does not exist. The second master node information is used to indicate the presence status of the master node in the first cluster. The presence status includes two states: present and absent. The first network device may be unable to obtain the second master node information, for example, because the cluster has not yet started electing a master node, or because the first network device has not obtained information related to the master node.

[0085] Specifically, the information of the second master node can be stored in an information table. The first network device can query the information table in its local storage space or in other storage spaces. If the second master node information cannot be found, the first network device cannot determine whether the master node of the first cluster exists. For the first cluster to function properly, the first network device needs to determine the master node if it determines that the master node of the first cluster does not exist.

[0086] In the scenario corresponding to Case 2, the first network device determines the master node of the first cluster according to the master election rules. Similarly, the first network device can determine the first node as the master node of the first cluster based on the master election rules. Correspondingly, the first network device generates second master node information. The generated second master node information indicates that the master node of the first cluster exists and may include a second status identifier. The first network device writes the second master node information into an information table.

[0087] As an example, the following describes a possible implementation method for the first network device to determine that the master node of the first cluster does not exist and to determine that the first node is the master node of the first cluster, based on the above master request message.

[0088] The first network device receives the master-preemption request message. Based on the value of the op field as preempt, it determines to perform the master-preemption operation. The first network device first obtains the value of verify, pkt.verify, from the master-preemption request message. It then compares pkt.verify with switch0.verify stored in the first network device.

[0089] If pkt.verify is greater than switch0.verify, then the master-preemption request message is determined to be not an out-of-order message. The first network device obtains the first cluster identifier from the cluster ID field in the master-preemption request message.

[0090] In one scenario, the first network device queries an information table based on a first cluster identifier to obtain the corresponding first master node information. The first master node information includes a first status identifier, which is "idle". The first network device then determines the first node as the master node of the first cluster. Correspondingly, the first network device updates the first master node information. The updated first master node information includes a second status identifier, which is "inuse", and also includes the first node's IP address. The first node's IP address is obtained from the master-claiming request message.

[0091] In another scenario, the first network device fails to find the second master node information corresponding to the first cluster identifier in the information table. The first network device determines that the master node of the first cluster does not exist and designates the first node as the master node of the first cluster. Correspondingly, the first network device writes the second master node information corresponding to the first cluster identifier into the information table. The second master node information includes a second status identifier, i.e., "inuse," and also includes the IP address of the first node.

[0092] In addition, the first network device will update switch0.verify to pkt.verify.

[0093] If `pkt.verify` is less than or equal to `switch0.verify`, then the master-preemption request message is determined to be out-of-order. In the case of an out-of-order master-preemption request message, the first network device can generate a corresponding response message. The response message carries an error code field. The error code field carries information about a checksum error.

[0094] Method 2: In response to the determination that the master node of the first cluster exists, the first network device determines the master node of the first cluster.

[0095] When the master node of the first cluster exists, the first network device can determine the master node of the first cluster. If the master node already exists, the first node fails to elect a master node.

[0096] In one possible implementation, the first network device can obtain third master node information. This third master node information indicates the existence of the master node in the first cluster. Specifically, the third master node information can indicate that the master node of the first cluster is present. For example, the third master node information includes a second status identifier. Alternatively, the third master node information can include the node information of the master node in the first cluster. The first network device can determine the master node of the first cluster based on the node information of the master node in the first cluster.

[0097] The third master node information can be generated by the first network device based on the operational status of the master nodes in the cluster. This third master node information can be stored in an information table. Similarly, if the first network device has storage capabilities, it can store the third master node information in an information table within its local storage space. If the first network device can access other storage spaces, it can store the third master node information in information tables within those other storage spaces. For example, if the first network device can access storage spaces located on other devices, it can store the third master node information in the information tables of those other devices' storage spaces. When it needs to retrieve the third master node information, the first network device accesses the information tables in the storage spaces of those other devices and obtains the information from them.

[0098] The third master node information can correspond to the first cluster identifier. The first network device can store the correspondence between the third master node information and the first cluster identifier in an information table in its local storage space, or in an information table in the storage space of another device. Based on the first cluster identifier in the master-contending request message, and the correspondence between the third master node information and the cluster identifier in the information table, the first network device can query the third master node information.

[0099] As an example, the following describes the possible implementation methods for the first network device to determine the master node of the first cluster when the master node of the first cluster exists, based on the above master request message.

[0100] The format and verification method of the master grabbing request message are similar to those in the above example, and will not be repeated here.

[0101] If the verification passes, the first network device retrieves the corresponding third master node information from the information table based on the first cluster identifier. The third master node information includes the second status identifier, which is "inuse". It also includes the master node's IP address. Based on the third master node information, the first network device can determine the existence of the first cluster's master node, and based on the master node's IP address, it can identify the master node of the first cluster.

[0102] The second method: In another possible way to determine the master node of the first cluster, the first network device determines whether the first node is the first candidate master node. If the first node is the first candidate master node, the first network device, after receiving the master-claiming request message from the first node, determines the first node as the master node of the first cluster.

[0103] Specifically, in response to determining the first node as the first candidate master node of the first cluster, the first network device determines the first node as the master node of the first cluster.

[0104] In this system, the first candidate master node of the first cluster is predetermined by the first network device. The first candidate master node is a cluster node that can elect itself as the master node when the master node fails or becomes unreachable. The first candidate master node is related to the master node of the first cluster. For example, the first candidate master node can be any cluster node other than the master node that can provide services externally. When the master node of the first cluster changes, the corresponding first candidate master node changes accordingly.

[0105] In one possible implementation, the first network device can obtain the node information of the first candidate master node of the first cluster and store it in a first node information set. The first node information set includes the node information of the first candidate master node. The node information of the first candidate master node can be an IP address. The first network device obtains the master-claiming request message of the first node, which includes the node information of the first node. The first network device can obtain the node information of the first node based on the master-claiming request message of the first node, and then determine whether the first node information set includes the node information of the first node. If it does, the first node can be determined as the first candidate master node, and then the first node can be designated as the master node of the first cluster.

[0106] In this embodiment, the first network device can obtain node information of the first candidate master node through the master node. Specifically, when initially determining the master node of the first cluster, the master node can be determined through negotiation among the cluster nodes in the first cluster, or the first network device can determine the master node. As an example, when initially determining the master node of the first cluster, the first network device can obtain the node information of the cluster nodes in the first cluster. The first network device determines the master node from among the cluster nodes participating in the master election based on the obtained node information and the master election rules. The master election rules can, for example, be based on the priority of the cluster nodes. Alternatively, it can be based on the time sequence of the obtained cluster node information. After determining the master node of the first cluster, the master node interacts with other cluster nodes in the first cluster to obtain their node information. The master node then sends the obtained node information of the other cluster nodes to the first network device. Specifically, the master node can send the node information of cluster nodes capable of providing services to the first network device. The first network device uses the cluster node corresponding to the obtained node information as the first candidate master node and generates a first node information set.

[0107] When the first network device has storage capabilities, it can store the first node information set in its local storage space. When the first network device can access other storage spaces, it can also store the first node information set in those other storage spaces. For example, the first network device can access the storage space of another device. When it needs to query the first node information set, the first network device accesses the storage space of that other device to check whether the first node's node information is included in the first node information set.

[0108] The first node information set can correspond to the first cluster identifier. The first network device can store the correspondence between the first node information set and the first cluster identifier in its local storage space or in other storage space. Based on the first cluster identifier in the master-contending request message and the correspondence between the first node information set and the first cluster identifier, the first network device can obtain the first node information set and thus determine whether the first node information set includes the node information of the first node.

[0109] Furthermore, after the first network device determines the first node as the master node of the first cluster, the candidate master nodes of the first cluster need to be changed accordingly. The first network device can delete the first node information set. The first network device can also obtain the node information of the second candidate master node of the first cluster and generate a second node information set. The first node, which is the newly determined master node of the first cluster, can obtain the node information of other cluster nodes and send this information to the first network device. The first network device will use the cluster node whose node information has been obtained as the second candidate master node and generate the second node information set based on the node information of the second candidate master node.

[0110] As an example, the following describes a possible implementation method for a first network device to determine the first node as the first candidate master node and to use the first node as the master node of the first cluster, based on the above master request message.

[0111] The format and verification method of the master grabbing request message are similar to those in the above example, and will not be repeated here.

[0112] After successful verification, the first network device retrieves the corresponding first node information set from the storage space based on the first cluster identifier carried in the "cluster id" field of the master-preemption request message. The first network device then determines whether the first node's IP address is included in the first node information set. The first node's IP address is obtained from the "owner" field of the master-preemption request message.

[0113] When a cluster includes multiple network devices, these devices need to synchronize information. This application does not limit the method used to trigger information synchronization between network devices; for example, it could be due to a change in the information stored by the network devices, or it could be due to the arrival of a synchronization time.

[0114] This application provides a specific implementation method for synchronizing data between network devices.

[0115] In this embodiment, the first cluster includes a first network device and a second network device. The second network device serves as a backup for the first network device. Both the first and second network devices are connected to the cluster nodes of the first cluster. The second network device also has cluster arbitration functionality and can access storage space. Figure 3 As shown, the first network device can be network device 306, and the second network device can be network device 307 and network device 308.

[0116] After the first network device determines the first node as the master node of the first cluster, it needs to synchronize the relevant information that the master node of the first cluster is the first node with the second network device.

[0117] The first network device generates a synchronization message. The synchronization message includes the node information of the master node of the first cluster. Specifically, after determining that the first node is the master node of the first cluster, the synchronization message generated by the first network device includes the node information of the first node. The node information of the first node can be, for example, the IP address of the first node.

[0118] The first network device sends a synchronization message to the second network device. Upon receiving the synchronization message, the second network device can back up the node information of the master node of the first cluster from the synchronization message, thus achieving data synchronization with the first network device. There can be multiple second network devices. "Multiple" can mean at least two.

[0119] It should be noted that in some scenarios, certain second network devices are not directly connected to the first network device. In such scenarios, synchronization messages can be forwarded through other second network devices. Figure 3 Taking network devices 306-308 as an example, the first network device, namely network device 306, is connected to a second network device, namely network device 307. The second network device, namely network device 307, is connected to another second network device, namely network device 308. Network device 306 generates and sends a synchronization message to network device 307. Network device 307 then forwards the synchronization message to network device 308.

[0120] Taking the arbitration message in Table 1 as an example, this application embodiment provides a synchronization message.

[0121] In one possible implementation, when the arbitration message is specifically a synchronization message, the synchronization message may include, for example, an op field, a cluster ID field, a sequence field, a sync ID field, a verify field, a status field, and an owner field. The op field has a value of 'sync', indicating that the operation type is synchronous. The cluster ID field carries the identifier of the first cluster. The owner field carries the IP address of the first node, representing the node information of the master node. The sync ID field is used to verify whether the query synchronization message is valid. The first network device increments the value of the sync ID field each time it generates a synchronization message. The verify field is used to verify whether the synchronization message is out of order when the first network device sends a synchronization message to the second network device.

[0122] The second network device determines that a synchronization operation is needed based on the value of the `op` field being `sync`. The second network device first retrieves the value of the `sync ID` field, `pkt.sync ID`, from the synchronization message. It then compares `pkt.sync ID` with the `switch1.sync ID` stored in the second network device. If `pkt.sync ID` is greater than `switch1.sync ID`, the content carried in the synchronization message is deemed valid for the second network device. The second network device then retrieves the information carried in the `cluster ID`, `sync ID`, `status`, and `owner` fields and stores it in its corresponding storage space. If the second network device already stores the information carried in these fields, it updates the stored information accordingly. Furthermore, if the second network device is not the last device in the synchronization message forwarding path, it continues to forward the synchronization message to other second network devices.

[0123] If pkt.sync ID is less than or equal to witch1.sync ID, it means that the content carried by the synchronization message is invalid for the second network device, that is, the second network device has already synchronized the content carried by the synchronization message. If the second network device is not the last device in the forwarding path of the synchronization message, the synchronization message continues to be forwarded to other second network devices.

[0124] If the second network device is the last device in the forwarding path of the synchronization message, it can generate a synchronization success message and send it to the first network device. Based on the obtained synchronization success message, the first network device can determine that the second network device in the forwarding path of the synchronization message has successfully synchronized.

[0125] In one possible implementation, if the first network device fails to receive a synchronization success message within a preset time, the synchronization message is repeatedly sent until the first network device receives the synchronization success message.

[0126] Combination Figure 3 Network device 308 is the last network device in the forwarding path of the synchronization message. After receiving the synchronization message and synchronizing the content carried in the synchronization message, network device 308 generates a synchronization success message. Network device 308 then sends the synchronization success message to network device 306.

[0127] As an example, taking the arbitration message in Table 1 above as an example, this application embodiment provides a synchronization success message.

[0128] In one possible implementation, when the arbitration message is specifically a synchronization message, the synchronization message may include, for example, an op field, a cluster ID field, a sequence field, and a sync ID field. The op field has a value of sync-ack, indicating that the operation was successful. The cluster ID field carries the identifier of the first cluster. The sync ID field carries the same content as the sync ID field in the synchronization message.

[0129] The second network device sends a synchronization success message to the first network device. Based on the value of the `op` field in the synchronization success message being `sync-ack`, the first network device can determine that the message is a synchronization success message. Furthermore, based on the `cluster ID` field, the first network device can determine that the successfully synchronized node information is the master node information of the first cluster corresponding to the first cluster identifier. Based on the `sync ID` field, the first network device can determine the content of the specific synchronization success message.

[0130] After the first network device determines the master node of the first cluster, it also needs to send a master-claiming response message to the first node so that the first node can obtain the master election result.

[0131] When the cluster only includes the first network device, the first network device can send a second master-claiming response message to the first node.

[0132] When a cluster contains multiple network devices, including a first network device and a second network device, the second network device can send a first master election response message to the first node, or the first network device can send a second master election response message to the first node. Both the first and second master election response messages include the master election result for the first node. If the first network device determines the first node as the master node of the first cluster, or if the master node of the first cluster exists and is the first node, the master election result is successful. If the master node of the first cluster exists, but is not the first node, the master election result is unsuccessful.

[0133] In one possible implementation, when the first network device determines that the master node of the first cluster exists, or that the master node of the first cluster is the first node, the information stored in the first network device has not been updated and does not need to be synchronized with the second network device. The first network device generates a second master-preemption response message and sends it to the first node. However, if the first network device determines the first node as the master node of the first cluster, the information stored in the first network device has been updated and needs to be synchronized with the second network device. In this case, either the first network device or the second network device can send the second master-preemption response message to the first node. When the second network device sends the first master-preemption response message to the first node, the synchronization message sent by the first network device includes the node information of the first node. Based on the node information of the master node of the first cluster and the node information of the first node in the synchronization message, the second network device can determine the master election result of the first node. The second network device that sends the first master-preemption response message can be the last second network device in the forwarding path of the synchronization message.

[0134] by Figure 3 Taking the architecture of the distributed cluster system 300 as an example, cluster node 301 is the first node, network device 306 is the first network device, and network devices 307 and 308 are the second network devices. The forwarding path of synchronization messages includes network devices 306, 307, and 308. Network device 308 is the last network device in the forwarding path.

[0135] When network device 306 determines that the master node of the first cluster exists and is not cluster node 301, it generates a master-preemption response message including the master election result of failure and sends the master-preemption response message to cluster node 301. When network device 306 determines that the master node of the first cluster exists and is cluster node 301, it generates a master-preemption response message including the master election result of success and sends the master-preemption response message to cluster node 301. When network device 306 determines cluster node 301 as the master node of the first cluster, it generates a synchronization message and sends the synchronization message to network device 307. In one possible implementation, network device 306 generates a master-preemption response message including the master election result of success and sends the master-preemption response message to cluster node 301. In another possible implementation, after obtaining the synchronization message through network device 307, network device 308 generates a master-preemption response message including the master election result of success based on the node information of the first node in the synchronization message and sends the master-preemption response message to cluster node 301.

[0136] As an example, taking the arbitration message in Table 1 above as an example, this application embodiment provides a preemptive response message.

[0137] In one possible implementation, the master-preemption response message may include, for example, the op field, cluster ID field, sequence field, sync ID field, verify field, status field, owner field, and error code field.

[0138] The `op` field has a value of `preempt`, indicating that the operation type is master election. The `cluster ID` field carries the identifier of the first cluster. The `sequence` field can contain the same information as the master election request message, indicating that it is the master election response message corresponding to the master election request message. The `sync ID` field is used to verify whether the master election response message is valid. The `verify` field is used to verify whether the master election response message is out of order. The `status` field carries a second status indicator, indicating that the master node of the first cluster exists. The `owner` field carries the IP address of the first node, indicating that the master node is the first node. The `error code` field carries the master election result.

[0139] In addition to the arbitration function mentioned above, the first network device can also be used to query the master node.

[0140] Specifically, querying the cluster's master node using the first network device can include the following three steps:

[0141] Step 1: The first network device obtains the query request message from the second node.

[0142] It should be noted that the first network device can connect to cluster nodes in multiple clusters. The first network device is directly or indirectly connected to cluster nodes in the second cluster. The second node is a cluster node in the second cluster. The second cluster can be a different cluster from the first cluster, or it can be part of the first cluster. Specifically, when the second cluster is the first cluster, the second node can be a different cluster node from the first node, or it can be part of the first node.

[0143] The first network device can directly obtain the query request message sent by the second node, or it can obtain the query request message through other devices, such as the second network device.

[0144] The query request message includes a second cluster identifier. This second cluster identifier corresponds to a second cluster. Based on the second cluster identifier in the query request message, the first network device can determine the node information of the master node of the second cluster that needs to be queried.

[0145] As an example, taking the arbitration message in Table 1 above as an example, this application embodiment provides a query request message.

[0146] In one possible implementation, the query request message may include, for example, the op field, the cluster ID field, and the sequence field.

[0147] The `op` field has a value of `read`, indicating that the operation type is a query. The `cluster ID` field carries a secondary cluster identifier.

[0148] The first network device can query the node information of the master node of the second cluster in the storage space and generate the corresponding query results.

[0149] Specifically, if the first network device cannot find the node information of the master node of the second cluster, the query result can be "query failed." If the first network device finds that the master node of the second cluster is not determined, the query result can include a status flag indicating that the master node of the second cluster does not exist. For example, this could be a first status flag. If the first network device determines that the master node of the second cluster exists, the query result can include a status flag indicating that the master node of the second cluster exists, for example, a second status flag, and / or the node information of the master node of the second cluster. The node information of the master node of the second cluster can be the IP address of the master node of the second cluster.

[0150] The first network device can store the node information of the master node of the second cluster, and / or the existence status information of the master node of the second cluster in its storage space. Specifically, the first network device can pre-obtain the node information of the master node of the second cluster, and / or the existence status information of the master node of the second cluster, and store it in the storage space of its local device or other devices.

[0151] Step 2: The first network device generates a query response message.

[0152] The first network device generates a query response message based on the query results.

[0153] The query response message includes the query results.

[0154] As an example, taking the arbitration message in Table 1 above as an example, this application embodiment provides an arbitration message with a specific operation type of query. In this example, the query result includes a status identifier indicating the existence of the master node of the second cluster and node information of the master node of the second cluster.

[0155] In one possible implementation, when the arbitration message is specifically a query response message, the query response message may include, for example, the op field, cluster ID field, sequence field, verify field, status field, owner field, and error code field.

[0156] The `op` field, with a value of `read`, indicates that the operation type is a query. The `cluster ID` field carries the identifier of the second cluster. The `sequence` field can contain the same information as the `sequence` field in the query request message, indicating that it is a query response message. The `sync ID` field is used to verify the validity of the query response message. The `verify` field is used to verify whether the query response message is out of order. The `status` field carries a second status identifier, indicating that the master node of the second cluster exists. The `owner` field carries the IP address of the master node of the second cluster. The `error code` field carries a success identifier, indicating that the query was successful. For example, the success identifier could be "succeed".

[0157] Step 3: The first network device sends a query response message to the second node.

[0158] The first network device sends a generated query response message to the second node. The second node receives the query response message. Based on the query result carried in the query response message, the second node can determine whether the master node of the second cluster exists. This facilitates the second node's application to become the master node or its interaction with the master node.

[0159] Figure 5 This diagram illustrates a possible structure of the network device involved in the above embodiments. The network device 500 can implement... Figure 4 The function of the first network device in the example shown. See also... Figure 5 The network device 500 includes a first acquisition unit 501 and a first processing unit 502.

[0160] These units can perform the corresponding functions of the first network device in the above method example. The first acquisition unit 501 is used to support the network device 500 in performing... Figure 4 S401; First processing unit 502, used to support network device 500 in execution Figure 4 S402 in the above method embodiment; and / or other processes performed by the first network device in the technology described herein. For example, the first acquisition unit 501 is used to perform various acquisition operations performed by the first network device in the above method embodiment; the first processing unit 502 is used to perform various processing operations of the first network device in the above method embodiment. For example, the first acquisition unit 501 is used to acquire the master-claiming request message of the first node; the first processing unit 502 is used to determine the master node of the first cluster. For specific execution processes, please refer to the above. Figure 4 The detailed descriptions of the corresponding steps in the illustrated embodiments will not be repeated here.

[0161] It should be noted that the division of units in this embodiment is illustrative and represents only one logical functional division; in actual implementation, other division methods may be used. The functional units in this embodiment can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. For example, in the above embodiment, the acquisition unit and the processing unit can be the same unit or different units. The integrated unit can be implemented in hardware or as a software functional unit.

[0162] See Figure 6 As shown, an embodiment of the invention provides a cluster arbitration system 600, which is used to implement the cluster arbitration method in the aforementioned method embodiments. The system 600 includes a network device 601 and a first node 602. The network device 601 can implement... Figure 4 The first network device in the illustrated embodiment has the following functions. Please refer to the above for the specific execution process. Figure 4 The detailed descriptions of the corresponding steps in the illustrated embodiments will not be repeated here.

[0163] Figure 7 This is a schematic diagram of the structure of a device 700 provided in an embodiment of this application. Figure 5 The network device 500 can be accessed through Figure 7 This is achieved using the device shown. See also Figure 7 The device 700 includes at least one processor 701, a communication bus 702, and at least one network interface 704. Optionally, the device 700 may also include a memory 703.

[0164] The processor 701 can be a general-purpose central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits (ICs) used to control the execution of programs according to the present application. The processor can be used to process messages to implement the cluster arbitration method provided in the embodiments of the present application.

[0165] For example, when Figure 4 The first network device in the middle passes through Figure 7 When implemented using the device shown, the processor can be used to obtain the master-claiming request message of the first node and determine the master node of the first cluster. For specific functional implementation, please refer to the processing part of the corresponding first network device in the method embodiment.

[0166] The communication bus 702 is used to transfer information between the processor 701, the network interface 704, and the memory 703.

[0167] The memory 703 may be a read-only memory (ROM) or other type of static storage device capable of storing static information and instructions. It may also be a random access memory (RAM) or other type of dynamic storage device capable of storing information and instructions. Furthermore, it may be a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media, or other magnetic storage devices, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures that can be accessed by a computer, but is not limited thereto. The memory 703 may exist independently and be connected to the processor 701 via a communication bus 702. Alternatively, the memory 703 may be integrated with the processor 701.

[0168] Optionally, the memory 703 stores program code or instructions for executing the present application's solution, and the processor 701 controls the execution of these instructions. The processor 701 executes the program code or instructions stored in the memory 703. The program code may include one or more software modules. Optionally, the processor 701 may also store program code or instructions for executing the present application's solution, in which case the processor 701 does not need to read the program code or instructions from the memory 703.

[0169] Network interface 704 can be a transceiver or similar device used to communicate with other devices or communication networks, such as Ethernet, Radio Access Network (RAN), or Wireless Local Area Network (WLAN). In this embodiment, network interface 704 can be used to receive messages sent by other nodes in the segmented routing network, and can also send messages to other nodes in the segmented routing network. Network interface 704 can be an Ethernet interface, a Fast Ethernet (FE) interface, or a Gigabit Ethernet (GE) interface, etc.

[0170] In a specific implementation, as one example, device 700 may include multiple processors, for example... Figure 7 The processors 701 and 405 are shown. Each of these processors can be a single-core (single-CPU) processor or a multi-core (multi-CPU) processor. A processor here can refer to one or more devices, circuits, and / or processing cores used to process data (e.g., computer program instructions).

[0171] Figure 8 This is a schematic diagram of the structure of a device 800 provided in an embodiment of this application. Figure 4 The first network device in the middle can be Figure 8 This is achieved using the device shown. See also Figure 8The illustrated device structure diagram shows that device 800 includes a main control board and one or more interface boards. The main control board is communicatively connected to the interface boards. The main control board, also called a main processing unit (MPU) or route processor card, includes a CPU and memory. It is responsible for controlling and managing the various components in device 800, including routing calculations, device management, and maintenance functions. The interface boards, also called line processing units (LPUs) or line cards, are used to receive and send messages. In some embodiments, the main control board and interface boards, or interface boards themselves, communicate via a bus. In some embodiments, the interface boards communicate via a switch fabric unit (SFU). In this case, device 800 also includes a switch fabric unit, which is communicatively connected to the main control board and interface boards. The switch fabric unit is used to forward data between the interface boards and can also be called a switch fabric unit (SFU). Each interface board includes a CPU, memory, a forwarding engine, and an interface card (IC). The interface card may include one or more network interfaces. These network interfaces can be Ethernet, FE, or GE interfaces, etc. The CPU communicates with the memory, forwarding engine, and interface card. The memory stores the forwarding table. The forwarding engine forwards received packets based on the forwarding table stored in the memory. If the destination address of the received packet is the IP address of device 800, the packet is sent to the CPU of the main control board or interface board for processing. If the destination address of the received packet is not the IP address of device 800, the forwarding table is consulted based on the destination. If the next hop and outgoing interface corresponding to the destination address are found in the forwarding table, the packet is forwarded to the outgoing interface corresponding to the destination address. The forwarding engine can be a network processor (NP). The interface card, also called a daughter card, can be installed on the interface board and is responsible for converting photoelectric signals into data frames, performing validity checks on the data frames, and forwarding them to the forwarding engine for processing or the interface board CPU. In some embodiments, the CPU can also perform the functions of the forwarding engine, such as implementing soft forwarding based on a general-purpose CPU, thus eliminating the need for a forwarding engine on the interface board. In some embodiments, the forwarding engine can be implemented using an ASIC or a field-programmable gate array (FPGA). In some embodiments, the memory storing the forwarding table can also be integrated into the forwarding engine as part of the forwarding engine.

[0172] This application also provides a chip system, including: a processor coupled to a memory, the memory being used to store programs or instructions, wherein when the program or instructions are executed by the processor, the chip system performs the aforementioned functions. Figure 4 The method performed by the first network device in the illustrated embodiment.

[0173] Optionally, the chip system may contain one or more processors. These processors can be implemented in hardware or software. When implemented in hardware, the processor can be a logic circuit, an integrated circuit, etc. When implemented in software, the processor can be a general-purpose processor, implemented by reading software code stored in memory.

[0174] Optionally, the chip system may contain one or more memories. The memory may be integrated with the processor or disposed separately from it; this application does not limit this. For example, the memory may be a non-transient processor, such as a read-only memory (ROM), which may be integrated with the processor on the same chip or disposed separately on different chips. This application does not specifically limit the type of memory or the arrangement of the memory and processor.

[0175] For example, the chip system can be an FPGA, an ASIC, a system on chip (SoC), a CPU, an NP, a digital signal processor (DSP), a micro controller unit (MCU), a programmable logic device (PLD), or other integrated chips.

[0176] It should be understood that each step in the above method embodiments can be completed by integrated logic circuits in the processor hardware or by instructions in software form. The method steps disclosed in the embodiments of this application can be directly manifested as being executed by a hardware processor, or being executed by a combination of hardware and software modules in the processor.

[0177] This application also provides a computer-readable storage medium including instructions that, when run on a computer, cause the computer to perform the methods described in the foregoing embodiments.

[0178] The terms "first," "second," "third," "fourth," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in a sequence other than that illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0179] In this application, "at least one" means one or more, and "more than one" means two or more. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or multiple items. For example, at least one of a, b, or c can represent: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple. In this application, "A and / or B" is considered to include a single A, a single B, and A+B.

[0180] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0181] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical module division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between apparatuses or units through some interfaces, and may be electrical, mechanical, or other forms.

[0182] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be obtained according to actual needs to achieve the purpose of this embodiment.

[0183] Furthermore, the module units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software module unit.

[0184] If the integrated unit is implemented as a software module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0185] Those skilled in the art will recognize that, in one or more of the examples above, the functions described in this invention can be implemented using hardware, software, firmware, or any combination thereof. When implemented in software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or code on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein communication media include any medium that facilitates the transfer of a computer program from one place to another. Storage media can be any available medium accessible to a general-purpose or special-purpose computer.

[0186] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention.

[0187] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit it. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.

Claims

1. A cluster arbitration method, characterized in that, The method includes: The first network device obtains a master election request message from a first node. The first node is a cluster node in the first cluster that participates in the master election. The master election request message includes a first cluster identifier, which is used to identify the first cluster. The first network device determines the master node of the first cluster; The first network device generates a synchronization message, which includes node information of the master node of the first cluster; The first network device sends the synchronization message to the second network device. The synchronization message is used to instruct the second network device to back up the node information of the master node of the first cluster. The second network device is a backup network device for the first network device.

2. The method according to claim 1, characterized in that, The first network device determines the master node of the first cluster, including: In response to determining that the master node of the first cluster does not exist, the first network device determines the first node as the master node of the first cluster.

3. The method according to claim 2, characterized in that, The determination that the master node of the first cluster does not exist includes: Based on the first master node information, it is determined that the master node of the first cluster does not exist. The first master node information is used to indicate that the master node of the first cluster does not exist.

4. The method according to claim 3, characterized in that, The method further includes: The first network device updates the first master node information, and the updated first master node information is used to indicate that the master node of the first cluster exists.

5. The method according to claim 2, characterized in that, The determination that the master node of the first cluster does not exist includes: In response to the failure to obtain the second master node information, it is determined that the master node of the first cluster does not exist. The second master node information is used to indicate the existence status of the master node of the first cluster.

6. The method according to claim 1, characterized in that, The first network device determines the master node of the first cluster, including: The first network device determines the master node of the first cluster based on the third master node information, which is used to indicate the existence of the master node of the first cluster.

7. The method according to claim 1, characterized in that, The first network device determines the master node of the first cluster, including: In response to determining that the first node is the first candidate master node of the first cluster, the first network device determines the first node as the master node of the first cluster.

8. The method according to claim 7, characterized in that, The master-grabbing request message includes the node information of the first node, and determining the first node as the first candidate master node of the first cluster includes: The first node information set is determined to include the node information of the first node, and the first node information set includes the node information of the first candidate master node of the first cluster.

9. The method according to claim 8, characterized in that, The method further includes: The first network device deletes the first node information set.

10. The method according to claim 7, characterized in that, The method further includes: The first network device obtains the node information of the second candidate master node of the first cluster to obtain a second node information set, which includes the node information of the second candidate master node of the first cluster.

11. The method according to claim 1, characterized in that, The method further includes: The first network device receives a synchronization success message sent by the second network device, which indicates that the second network device has successfully backed up the data.

12. The method according to claim 1 or 11, characterized in that, The synchronization message also includes the node information of the first node, and the synchronization message is also used to instruct the second network device to send a first master-preemption response message to the first node based on the node information of the first node. The first master-preemption response message includes the master election result of the first node.

13. The method according to claim 1, characterized in that, The method further includes: The first network device generates a second master election response message, which includes the master election result of the first node; The first network device sends the second master-claiming response message to the first node.

14. The method according to claim 1, characterized in that, The method further includes: The first network device obtains a query request message from the second node. The query request message includes a second cluster identifier, which is used to identify the second cluster. The second node is a cluster node of the second cluster. The first network device generates a query response message, which includes a query result. The query result is used to enable the second node to determine the existence status of the master node of the second cluster based on the query result. The first network device sends the query response message to the second node.

15. A first network device, characterized in that, The first network device includes: The first acquisition unit is used to acquire the master-preemption request message of the first node, the first node being a cluster node in the first cluster participating in the master-node election, and the master-preemption request message including the first cluster identifier, which is used to identify the first cluster; The first processing unit is used to determine the master node of the first cluster; The third processing unit is used to generate a synchronization message, which includes the node information of the master node of the first cluster. The first sending unit is used to send the synchronization message to the second network device. The synchronization message is used to instruct the second network device to back up the node information of the master node of the first cluster. The second network device is a backup network device for the first network device.

16. The first network device according to claim 15, characterized in that, The first processing unit is specifically configured to determine the first node as the master node of the first cluster in response to determining that the master node of the first cluster does not exist.

17. The first network device according to claim 16, characterized in that, The first processing unit is specifically used to determine that the master node of the first cluster does not exist based on the first master node information, wherein the first master node information is used to indicate that the master node of the first cluster does not exist.

18. The first network device according to claim 17, characterized in that, The first network device also includes: The second processing unit is used to update the first master node information, and the updated first master node information is used to indicate that the master node of the first cluster exists.

19. The first network device according to claim 16, characterized in that, The first processing unit is specifically used to determine that the master node of the first cluster does not exist in response to the failure to obtain the second master node information, wherein the second master node information is used to indicate the existence status of the master node of the first cluster.

20. The first network device according to claim 15, characterized in that, The first processing unit is specifically used to determine the master node of the first cluster based on the third master node information, wherein the third master node information is used to indicate that the master node of the first cluster exists.

21. The first network device according to claim 15, characterized in that, The first processing unit is specifically configured to determine the first node as the master node of the first cluster in response to determining that the first node is the first candidate master node of the first cluster.

22. The first network device according to claim 21, characterized in that, The master-grabbing request message includes the node information of the first node. The first processing unit is specifically used to determine that the first node information set includes the node information of the first node, and the first node information set includes the node information of the first candidate master node of the first cluster.

23. The network device according to claim 22, characterized in that, The network device also includes: The third processing unit is used to delete the first node information set.

24. The first network device according to claim 21, characterized in that, The first network device also includes: The second acquisition unit is used to acquire the node information of the second candidate master node of the first cluster and obtain a second node information set, wherein the second node information set includes the node information of the second candidate master node of the first cluster.

25. The first network device according to claim 15, characterized in that, The first network device also includes: The third acquisition unit is used for the first network device to acquire the synchronization success message sent by the second network device, wherein the synchronization success message is used to indicate that the second network device has successfully backed up.

26. The first network device according to claim 15 or 25, characterized in that, The synchronization message also includes the node information of the first node, and the synchronization message is also used to instruct the second network device to send a first master-preemption response message to the first node based on the node information of the first node. The first master-preemption response message includes the master election result of the first node.

27. The first network device according to claim 15, characterized in that, The first network device also includes: The fourth processing unit is used to generate a second master-preemption response message, which includes the master election result of the first node; The second sending unit is used to send the second master-claiming response message to the first node.

28. The first network device according to claim 15, characterized in that, The first network device also includes: The fourth acquisition unit is used to acquire the query request message of the second node, the query request message including the second cluster identifier, the second cluster identifier is used to identify the second cluster, and the second node is the cluster node of the second cluster; The fifth processing unit is used to generate a query response message, the query response message including a query result, the query result being used to enable the second node to determine the existence status of the master node of the second cluster based on the query result; The third sending unit is used to send the query response message to the second node.

29. A network device, characterized in that, The network device includes a processor chip and a memory, the memory being used to store instructions or program code, and the processor chip being used to call and run the instructions or program code from the memory to perform the method as described in any one of claims 1-14.

30. A network system, characterized in that, The network system includes a network device and a first node, the network device being configured to perform the method as described in any one of claims 1-14.

31. A computer-readable storage medium, characterized in that, Includes instructions, programs, or code that, when executed on a computer, cause the computer to perform the method as described in any one of claims 1-14.

32. A chip, characterized in that, It includes a memory and a processor, the memory being used to store instructions or program code, and the processor being used to retrieve and execute the instructions or program code from the memory to perform the method as described in any one of claims 1-14.