CN116367202A - Cluster arbitration method, network equipment and system - Google Patents

Cluster arbitration method, network equipment and system Download PDF

Info

Publication number
CN116367202A
CN116367202A CN202111633349.5A CN202111633349A CN116367202A CN 116367202 A CN116367202 A CN 116367202A CN 202111633349 A CN202111633349 A CN 202111633349A CN 116367202 A CN116367202 A CN 116367202A
Authority
CN
China
Prior art keywords
node
cluster
network device
master node
master
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111633349.5A
Other languages
Chinese (zh)
Inventor
张翠敏
王巧灵
张君逸
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN202111633349.5A priority Critical patent/CN116367202A/en
Priority to PCT/CN2022/133885 priority patent/WO2023124663A1/en
Publication of CN116367202A publication Critical patent/CN116367202A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W84/00Network topologies
    • H04W84/02Hierarchically pre-organised networks, e.g. paging networks, cellular networks, WLAN [Wireless Local Area Network] or WLL [Wireless Local Loop]
    • H04W84/04Large scale networks; Deep hierarchical networks
    • H04W84/08Trunked mobile radio systems
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W24/00Supervisory, monitoring or testing arrangements
    • H04W24/04Arrangements for maintaining operational condition

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Hardware Redundancy (AREA)

Abstract

The application discloses a cluster arbitration method, network equipment and a system, wherein a first network equipment in a cluster is used for acquiring a first node preemption request message and determining a master node of the first cluster. Therefore, arbitration and selection are realized by using network equipment in the cluster, other shared storage spaces are not required to be additionally arranged in the cluster, and the cost of the distributed cluster system can be reduced on the basis of ensuring reliability to a certain extent.

Description

Cluster arbitration method, network equipment and system
Technical Field
The present disclosure relates to the field of computers, and in particular, to a cluster arbitration method, network device, and system.
Background
The distributed cluster system is an important technical means for realizing system expansibility and high reliability. The distributed cluster system includes a plurality of cluster nodes. The distributed operation information is distributed on a plurality of nodes, when one or more cluster nodes in the distributed cluster system fail, the distributed cluster system can automatically adapt, and the normal cluster nodes are responsible for the service, so that the reliability and the availability of the whole distributed cluster system are improved.
The distributed cluster system needs to ensure the consistency of data among cluster nodes. For example, consistency algorithms such as Raft, paxos and the like can be adopted to realize consistency of data among cluster nodes. Such a consistency algorithm requires determining a master node among the cluster nodes of the distributed cluster system. The master node can coordinate and manage other cluster nodes and is responsible for data synchronization. The master node may be determined by a cluster node negotiation in the cluster, or may be arbitrated by a third party accessible to both cluster nodes. The manner in which the master node is determined by a third party is also known as arbitration. The current arbitration-based master selection algorithm needs to additionally set a shared storage space which can be accessed by each cluster node in the distributed cluster system. The shared memory space is a third party. The shared memory space may be, for example, a server, a hard disk, or the like. When the distributed cluster system needs to elect a master node, the cluster nodes participating in master election send a master preemption request to the shared storage space. The shared memory space determines the master node according to certain arbitration rules.
Additional placement of shared memory in a distributed cluster system increases hardware costs and maintenance costs. Therefore, how to reduce the cost of the distributed cluster system is a technical problem to be solved.
Disclosure of Invention
The embodiment of the application provides a cluster arbitration method, network equipment and a system, which can determine a main node of a cluster by utilizing the network equipment in the cluster, and can reduce the cost of a distributed cluster system on the basis of ensuring reliability to a certain extent without additionally arranging other shared storage spaces in the cluster.
In a first aspect, the present application provides a cluster arbitration method, which may be applied to a first network device. The method specifically comprises the following steps: the first network device obtains a preemptive request message of the first node and determines a master node of the first cluster. The first node is a cluster node participating in the election of the master node in the first cluster. The preemptive request message comprises a first cluster identifier. The first cluster identification is used to identify the first cluster. The first network device can determine that the first node in the first cluster requests to elect the master node based on the master request message, and further determine the master node of the first cluster. The main node of the first cluster is determined by the first network equipment, so that cluster arbitration of the first cluster is realized, a shared storage space for arbitration is not required to be additionally arranged in the first cluster, and the establishment cost and the maintenance cost of the distributed cluster system can be reduced to a certain extent.
In one possible implementation, upon determining that the primary node of the first cluster is not present, the first network device determines the first node as the primary node of the first cluster. The first node may be a cluster node conforming to an arbitration rule of the first network device among cluster nodes requesting election. For example, when the arbitration rule is that a node that first acquires the preemptive request message is taken as a master node, the preemptive request message sent by the first node may be the first preemptive request message acquired by the first network device in the process of selecting the master node at this time. For another example, when the arbitration rule is to use the cluster node with the highest priority as the master node, the first node may be the cluster node with the highest priority in the first cluster.
As an example, the first master node information is used to indicate that the master node of the first cluster is not present. The first network device is capable of determining that a master node of the first cluster is not present based on the first master node information, and 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, the master node, that is, the first node, exists in the first cluster. 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, and the first network device can determine the master node based on the updated first master node information later, thereby realizing timely updating of the master node information.
As another example, the first network device may obtain the second master node information. The second master node information is used for indicating the existence state of the master node of the first cluster. If the first network device does not acquire the second master node information, the first network device determines that the master node of the first cluster does not exist, and needs to determine the master node of the first cluster.
In another possible implementation, the first network device is capable of acquiring third master node information. The third master node information is used to indicate that a master node of the first cluster exists. The first network device is capable of determining a master node of the first cluster based on the third master node information.
In one possible implementation, after obtaining the preemption request packet of the first node, the first network device determines whether the first node is a first candidate master node of the first cluster. The first candidate master node of the first cluster is a cluster node capable of being set as a master node of the first cluster. If the first node is a first candidate master node of the first cluster, the first network device may determine the first node as a master node of the first cluster.
In one possible implementation, the first network device is capable of determining whether the first node is a first candidate master node for the first cluster based on the first set of node information. The first set of node information includes node information for a first candidate master node in the first cluster. The first network device may obtain node information of a first node included in the preemption request packet. When the first node information set includes node information of the first node, the first node is described as a first candidate master node of the first cluster. The first network device can determine that the first node is a first candidate master node for the first cluster.
In one possible implementation, after the first network device determines the first node that is the first candidate master node as the master node, the candidate master nodes in the first cluster that can be the cluster master node may change. The first network device may delete the first node information set to avoid subsequent selection of a wrong master node based on the first node information set.
In one possible implementation, after the first network device determines the first node that is the first candidate master node as the master node, the first network device may obtain node information of a second candidate master node of the first cluster, to obtain the second node information set. The second set of node information includes node information for a second candidate master node of the first cluster. As one example, the first network device may obtain node information for a 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 the cluster node capable of serving as the candidate master node in the first cluster after the first node serves as the master node. The first network device can more accurately select the next master node based on the second node information set.
In one possible implementation, the first network device is capable of generating and transmitting a synchronization message to the second network device. The synchronization message includes node information of a master node of the first cluster. The synchronization message is used for indicating the second network equipment to backup the node information of the main node of the first cluster. Wherein the second network device is a standby network device of the first network device. The second network device can backup node information of the master node of the first cluster included in the synchronization message based on the acquired synchronization message. This enables synchronization of the node information of the primary node stored in the primary network node with the node information of the secondary network node when the primary network node and the secondary network node are present.
In one possible implementation, the first network device may be capable of acquiring the synchronization success message sent by the second network device. The synchronization success message is used for indicating that the second network equipment is successful in backup. The first network device can determine node information of a master node of the first cluster in the second network device successful backup synchronization message based on the acquired synchronization success message.
In a possible implementation manner, the synchronization message further includes node information of the first node. The synchronization message is further used for indicating the second network device to send a first preemptive response message to the first node. The first preemptive response message includes a election result of the first node. After the second network device acquires the synchronous message, the second network device sends a first preemptive response message to the first node in addition to the node information backup of the master node of the first cluster included in the synchronous message. The master selection result of the first node is used for identifying whether the first node successfully preempts the master.
In another possible implementation, the first network device may generate a second preemptive response message and send the second preemptive response message to the first node. The second preemptive response message comprises a main selection result of the first node. The master selection result of the first node is used for identifying whether the first node successfully preempts the master.
In one possible implementation, the first network device further obtains a query request message of the second node. The second node is a cluster node of the second cluster. The query request message includes a second cluster identity. The second cluster identity is capable of identifying the second cluster. The first network device may generate a query response message. The query response message includes a query result of the first network device querying the master node of the second cluster. The first network device sends a query response message to the second node. The second node can determine the presence status of the master node of the second cluster based on the query result in the query response message.
In a second aspect, the present application provides a network device comprising: a first acquisition unit and a first processing unit. The first acquisition unit is used for acquiring a preemptive request message of a first node, wherein the first node is a cluster node participating in election of a master node in a first cluster, the preemptive request message comprises a first cluster identifier, and the first cluster identifier is used for identifying the first cluster; and the first processing unit is used for determining the master node of the first cluster.
In one possible implementation, the first processing unit is specifically configured to determine the first node as a master node of the first cluster in response to determining that the master node of the first cluster is not present.
In a possible implementation manner, the first processing unit is specifically configured to determine that a master node of the first cluster does not exist based on first master node information, where the first master node information is used to indicate that the master node of the first cluster does not exist.
In one possible implementation, the network device further includes: and a second processing unit. The second processing unit is used for updating the first master node information, and the updated first master node information is used for indicating that the master node of the first cluster exists.
In a possible implementation manner, the first processing unit is specifically configured to determine that the master node of the first cluster does not exist in response to not acquiring second master node information, where the second master node information is used to indicate a presence state of the master node of the first cluster.
In a possible implementation manner, the first processing unit is specifically configured to determine a master node of the first cluster based on third master node information, where the third master node information is used to indicate that the master node of the first cluster exists.
In a possible implementation manner, the first processing unit is specifically configured to determine the first node as a master node of the first cluster in response to determining that the first node is a first candidate master node of the first cluster.
In a possible implementation manner, the preemption request packet includes node information of the first node, and the first processing unit is specifically configured to determine that a first node information set includes node information of the first node, where the first node information set includes node information of a first candidate master node of the first cluster.
In one possible implementation, the network device further includes: and a third processing unit. The third processing unit is configured to delete the first node information set.
In one possible implementation, the network device further includes: and a second acquisition unit. The second obtaining unit is configured to obtain node information of a second candidate master node of the first cluster, and obtain a second node information set, where the second node information set includes node information of the second candidate master node of the first cluster.
In one possible implementation, the network device further includes: a third processing unit and a first transmitting unit. The third processing unit is used for generating a synchronous message, and the synchronous message comprises node information of a main node of the first cluster;
The first sending unit is configured to send the synchronization packet to a second network device, where the synchronization packet is used to instruct the second network device to backup node information of a primary node of the first cluster, and the second network device is a standby network device of the first network device.
In one possible implementation, the network device further includes: and a third acquisition unit. The third obtaining unit is configured to obtain, by using the first network device, a synchronization success packet sent by the second network device, where the synchronization success packet is used to indicate that the backup of the second network device is successful.
In a possible implementation manner, the synchronization message further includes node information of the first node, and is further configured to instruct the second network device to send a first preemptive response message to the first node based on the node information of the first node, where the first preemptive response message includes a election result of the first node.
In one possible implementation, the network device further includes: a fourth processing unit and a second transmitting unit. And the fourth processing unit is used for generating a second preemptive response message, and the second preemptive response message comprises a main selection result of the first node. And the second sending unit is used for sending the second preemptive response message to the first node.
In one possible implementation, the network device further includes: a fourth acquisition unit, a fifth processing unit and a third transmission unit. A fourth obtaining unit, configured to obtain a query request packet of a second node, where the query request packet includes a second cluster identifier, where the second cluster identifier is used to identify a second cluster, and the second node is a cluster node of the second cluster. And the fifth processing unit is used for generating a query response message, wherein the query response message comprises a query result, and the query result is used for enabling the second node to determine the existence state of the master node of the second cluster according to the query result. And the third sending unit is used for sending the query response message to the second node.
In a third aspect, the present application provides a network device comprising a processor chip and a memory, the memory being for storing instructions or program code, the processor chip being for invoking and executing the instructions or program code from the memory to perform a method as in the first aspect or any implementation of the first aspect.
In a fourth aspect, the present application provides a network system comprising a network device and a first node, the network device being configured to perform a method as in the first aspect or any implementation of the first aspect.
In a fifth aspect, the present application provides a computer readable storage medium comprising instructions, a program or code which, when executed on a computer, causes the computer to perform a method according to the first aspect or any implementation manner of the first aspect.
In a sixth aspect, the present application provides a chip comprising a memory and a processor. The memory is used to store instructions or program code. The processor is configured to call and execute the instructions or program code from the memory to perform the method of the first aspect or any one of the possible implementations of the first aspect.
In one possible design, the chip includes only a processor for reading and executing instructions or program code stored in a memory, the processor performing the method of the first aspect or any one of the possible implementations of the first aspect when the instructions or program code is executed.
Drawings
FIG. 1 is a schematic diagram of a conventional distributed cluster system;
fig. 2 is a schematic architecture diagram of a distributed cluster system according to an embodiment of the present application;
FIG. 3 is a schematic diagram of another distributed cluster system according to an embodiment of the present disclosure;
FIG. 4 is a flowchart of a cluster arbitration method according to an embodiment of the present disclosure;
fig. 5 is a schematic structural diagram of a network device according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of a network system according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of an apparatus according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of an apparatus according to an embodiment of the present application.
Detailed Description
The master node of the distributed cluster system is used for coordinating and managing other cluster nodes. The master node of the cluster can be determined by adopting a voting choice, a default configuration or a competition arbitration choice method. The main selection method of the contention arbitration is briefly described below.
The main selection method of the contention arbitration needs to additionally configure the shared memory space in the distributed cluster system. The shared storage space needs to establish a connection with each cluster node in the distributed cluster system. When the distributed cluster system needs to select a master node, each cluster node participating in master selection sends a master-robbing request to the shared storage space. The shared memory space obtains the preemption request and determines a master node among the cluster nodes based on the arbitration rules. The main selection method of the competition arbitration relies on the shared memory space in the distributed cluster system. The shared memory space may be a server, hard disk, virtual machine, etc. in general. Referring to FIG. 1, a schematic architecture of a conventional distributed cluster system 100 is shown. Wherein distributed cluster system 100 includes cluster nodes 101-105, switch 106, and server 107. Cluster nodes 101-105 are connected to switch 106 and access the cluster system through switch 106. Server 107 is an additional configured shared storage space in distributed cluster system 100. Server 107 is coupled to cluster nodes 101-105, respectively. Server 107 is configured to obtain preemption requests from cluster nodes 101-105 and determine the master node of the cluster.
The master selecting method of the competition arbitration is not influenced by the parity of the number of the cluster nodes, and the master node can be flexibly determined based on the running condition of the distributed cluster system. However, the additional provision of shared memory in a distributed cluster system results in higher hardware and maintenance costs. Particularly, in some scenarios, for example, the edge scenario of the distributed storage super-fusion base device configures a corresponding shared storage space for every two cluster nodes, which greatly increases the cost of the distributed clusters.
In order to solve the above problems, the embodiments of the present application provide a cluster arbitration method, in which network devices in a cluster implement arbitration, determine a master node in the cluster, and do not need to additionally set a shared storage space in the cluster, thereby reducing the cost of constructing the cluster and the cost of maintaining the cluster.
For easy understanding, first, an application scenario of the cluster arbitration method provided in the embodiments of the present application is described. Referring to fig. 2, the architecture diagram of a distributed cluster system according to an embodiment of the present application is shown.
The distributed cluster system 200 includes cluster nodes 201-205 and network devices 206. The cluster nodes 201-205 are connected to a network device 206. Cluster nodes 201-205 access the network based on network device 206. The network device 206 may be a switch, a router, or other devices with forwarding functions in a distributed cluster system. The network device 206 is capable of processing arbitration messages to implement arbitration master selection. And the network device 206 may have storage capabilities or access to storage space. Wherein the network device 206 may implement an arbitration master function based on the switch chip. Or by using virtualization techniques to provide isolated virtualized open space operation arbitration master functions on network device 206.
Furthermore, a plurality of network devices may be included in a cluster. Referring to fig. 3, a schematic architecture diagram of another distributed cluster system according to an embodiment of the present application is shown.
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 based on network devices 306-308. Network devices 306-308 may be switches, routers, or other devices with forwarding functionality in a distributed cluster system, among others. Network device 306 may be a primary network device and network devices 307-308 may be backup network devices. Network devices 306-308 are capable of processing arbitration messages to implement arbitration masters. Network devices 306-308 may implement an arbitration master function based on the switch chip. Or by using virtualization techniques to provide isolated virtualized open space operation arbitration master functions on network devices 306-308. In addition, network devices 306-308 may have storage capabilities or may be able to access storage space on other devices.
Referring to fig. 4, a flow chart of a cluster arbitration method according to an embodiment of the present application is shown. The cluster arbitration method provided by the embodiment of the application comprises S401-S402.
S401: the first network device obtains a preemption request message of the first node.
The first node is a cluster node in a first cluster. As shown in connection with fig. 2, the first node may be any of the cluster nodes 201-205. When the first node participates in the election of the master node, a preemption request message is generated, and the preemption request message is sent to the first network equipment. The preemptive request message comprises a first cluster identifier. The first cluster identification is used to identify a first cluster to which the first node belongs.
The first network device is connected with a cluster node in a first cluster to which the first node belongs. The first network device may be directly connected to the first node or may be indirectly connected through other network devices. In one possible implementation, the first network device is a network device that accesses the cluster node to the network. The first network device is located in a central position of the distributed cluster system, and is convenient to interact with the cluster nodes. The first network device is a network device having a storage function and a programmable function. The first network device has access to the storage space and is capable of implementing arbitration.
The first network device may directly obtain the preemption request message sent by the first node, or may obtain the preemption request message by another device.
In one possible implementation, as shown in connection with fig. 2, the first network device may be the network device 206 in fig. 2, and the first node is the cluster node 201 in fig. 2. The network device 206 may obtain the preemption request message sent by the cluster node 201.
In another possible implementation, as shown in connection with fig. 3, the first network device may be network device 306, and the first node is cluster node 301 in fig. 3. Network device 306 may obtain the preemption request message sent by cluster node 301 through network device 307.
The first network device obtains a first cluster request message sent by the first node, and can determine a first cluster needing to determine the master node based on a first cluster identifier in the first node request message. In one possible implementation scenario, a first network device is connected with a cluster node of a plurality of clusters. Based on the first cluster identification in the preemptive request message, the first network device can distinguish clusters and determine a first cluster to be requested to be selected by the first node.
In an embodiment of the present application, a possible arbitration message is provided. The first network device may identify and process arbitration messages. See table 1, which is a table of fields included in the arbitration message.
op cluster ID sequence verify sync ID status owner error code
TABLE 1
Wherein a select (op) field is used to identify the type of operation. The value of the cluster (identity) field is the cluster identity. A sequence field is used to identify the message to respond to. The verify (verify) field is used to confirm whether or not an out-of-order message is in order. A synchronization (sync) identification field is used to determine the validity of the synchronized content. A status field is used to identify the presence status of the master node of the cluster. The value of the home node (owner) field is the home node's internet protocol (Internet Protocol, IP) address. An error code (error code) field carries information.
In one possible implementation, when the arbitration message is specifically a preemptive request message, for example, an op field, a cluster ID field, a sequence field, a verify field, and an owner field may be included. The value of the op field is preempt, which indicates that the operation type is preempt. The cluster ID field carries a first cluster identity. The owner field carries the IP address of the first node, indicating the first node's election master node. The value of the sequence field identifies the request message. The value of the verify field is used to verify if it is an out-of-order message. The value of the sequence field may be a predefined string of letters, numbers, etc. The value of the verify field may be a predefined string of letters, numbers, etc.
S402: the first network device determines a master node of the first cluster.
The first network device can acquire a first message and process the first message to determine a master node of the first cluster.
The first network device is connected with cluster nodes in a first cluster to which the first node belongs, and can interact with the cluster nodes to realize arbitration and main selection. Therefore, no extra shared storage space is required to be arranged in the cluster, the cost of third party arbitration of the distributed cluster system is greatly reduced, and the availability of the distributed cluster system is improved. In addition, arbitration and election are realized based on the first network equipment, compared with majority dispatch algorithm election, negotiation and election among cluster nodes are not needed, and election duration is short.
The embodiments of the present application provide two possible implementation manners of determining the master node of the first cluster, which are only used to illustrate the technical solution of the present application, and not limit the manner of determining the master node of the first cluster.
First kind: in one possible manner of determining the master node of the first cluster, the first network device first determines whether the master node of the cluster is present, and determines the master node of the first cluster according to the presence status of the master node of the first cluster.
The method specifically comprises the following two modes:
mode one: 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.
When the first network device determines that the master node of the first cluster does not exist, the first node sending the preemption request message may be determined to be the master node of the first cluster. The embodiment of the application does not limit the main selection rule of the main node of the first cluster determined by the first network device. For example, the first network device may be based on a master selection rule that determines a previously requested node as a master node. The first preemption 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 selection rule. For another example, the first network device may determine the master node based on a priority of cluster nodes participating in the preemption. The first node is the highest priority node in the cluster nodes participating in preemption. Then the first network device determines the first node as the master node.
The absence of a master node may include the following two cases:
case one: in one implementation, a first network device may obtain first master node information. The first master node information is used to indicate that the master node of the first cluster does not exist. Wherein, the master node does not have the situation that the previous master node possibly fails or is disconnected and the like and the master node needs to be redetermined.
Specifically, the first master node information may include a first state identification. The first state identification is a state identification indicating that the master node is not present. The first status identifier may be, for example, "idle".
The first master node information may be generated by the first network device based on the behavior of the master nodes in the first cluster. The first master node information may be stored in an information table. The embodiment of the application does not limit the storage location of the first master node information. In the case where the first network device has a storage function, the first network device can store the first master node information in an information table in the local storage space. In the case where the first network device has access to other storage space, the first network device may store the first master node information in an information table of the other storage space. For example, the first network device can access a storage space provided at the other device. The first network device may store the first master node information in an information table of a storage space of the other device. When the first master node information needs to be acquired, the first network equipment accesses an information table in the storage space of other equipment, and the first master node information is acquired from the information table.
The first master node information may correspond to a first cluster identity. The first network device may store the correspondence between the first master node information and the first cluster identifier in an information table in a local storage space, or in an information table in another storage space. The first network device can query and obtain the first master node information based on the first cluster identifier in the first master request message and the corresponding relation between the first master node information and the first cluster identifier in the information table.
In the scenario corresponding to the first case, the first network device may update the first master node information correspondingly after determining that the first node is a master node of the first cluster. The updated first master node information is used to indicate that a master node of the first cluster exists. Specifically, the updated first master node information may include a second state identifier. The second state identification is a state identification indicating that the master node exists. The second status identification may be, for example, "in use". The updated first master node information may also include node information for the first node. The node information of the first node may be acquired by the first network device. The node information of the first node may be an IP address of the first node.
And a second case: in another implementation, the first network device determines that the master node of the first cluster does not exist when the second master node information is not acquired by the first network device. The second master node information is used to indicate a presence status of a master node of the first cluster. The presence state includes both a presence and an absence state. The first network device may not obtain the second master node information, for example, it may be that the cluster has not yet started to elect the master node, or the first network device may not obtain the information related to the master node.
Specifically, the second master node information may be stored in an information table. The first network device can query information tables in the local storage space, or information tables in other storage spaces. If the second master node information cannot be obtained through inquiry, the first network device cannot judge whether the master node of the first cluster exists or not. In order for the first cluster to function properly, the first network device determines that the primary node of the first cluster is not present and needs to determine the primary node.
In the scene corresponding to the second case, the first network device determines the master node of the first cluster according to the rule of choice. Similarly, the first network device can determine the first node as a master node of the first cluster based on the master selection rule. Correspondingly, the first network device generates second master node information. The generated second master node information indicates that a master node of the first cluster exists and may include a second state identification. The first network device writes the second master node information into the information table.
As an example, in connection with the above-mentioned preemption request message, a possible implementation manner in which the first network device determines that the master node of the first cluster does not exist and determines that the first node is the master node of the first cluster is described below.
The first network device obtains a preemption request message. The preemptive operation is determined to be performed for preempt based on the value of the op field. The first network device obtains the value pkt. And comparing the pkt.verify with the switch0.verify stored by the first network device.
If pkt.verify is greater than switch0.verify, then it is determined that the preemptive request message is not an out-of-order message. The first network device obtains a first cluster identifier in a cluster ID field in the preemptive main request message.
In one case, the first network device queries the information table for corresponding first master node information based on the first cluster identity. The first master node information includes a first status identification, i.e. "idle". The first network device determines the first node as a 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 state identification, i.e. "inuse", and includes the IP address of the first node. The IP address of the first node is obtained from the preemptive request message.
In another case, the first network device does not query the information table for the second master node information corresponding to the first cluster identifier. The first network device determines that a master node of the first cluster does not exist, and determines the first node as the master node of the first cluster. Correspondingly, the first network device writes second master node information corresponding to the first cluster identifier in the information table. The second master node information includes a second state identification, i.e., inuse, and includes the IP address of the first node.
In addition, the first network device also updates switch0.verify to pkt.
If pkt.verify is less than or equal to switch0.verify, determining that the preemptive request message is an out-of-order message. For the case that the preemptive request message is an out-of-order message, the first network device may generate a corresponding response message. The response message carries an error code field. The error code field carries information of check code errors.
Mode two: in response to determining that the master node of the first cluster exists, the first network device determines the master node of the first cluster.
The first network device is capable of determining a master node of the first cluster when the master node of the first cluster is present. In the presence of a master node of the cluster, the first node fails to compete for the master node.
In one possible implementation, the first network device may obtain the third master node information. The third master node information is used to indicate that a master node of the first cluster exists. Specifically, the third master node information may indicate that the presence status of the master node of the first cluster is present. For example, the third master node information includes a second state identification. Alternatively still, the third master node information may include node information of a master node of the first cluster. The first network device is capable of determining a master node of the first cluster based on node information of the master node of the first cluster.
The third master node information may be generated by the first network device based on the behavior of the master nodes in the cluster. The third master node information may be stored in an information table. Similarly, in the case where the first network device has a storage function, the first network device can store the third master node information in an information table in the local storage space. In case the first network device has access to the other storage space, the first network device may store the third master node information in an information table of the other storage space. For example, the first network device can access a storage space provided at the other device. The first network device may store the third master node information in an information table of the storage space of the other device. When the third master node information needs to be acquired, the first network device accesses an information table in the storage space of other devices, and acquires the third master node information from the information table.
The third master node information may correspond to the first cluster identity. The first network device may store the correspondence between the third master node information and the first cluster identifier in an information table in a local storage space or in an information table in a storage space of other devices. The first network device can query and obtain the third master node information based on the first cluster identifier in the master request message and the corresponding relation between the third master node information and the cluster identifier in the information table.
As an example, the presence of a master node of the first cluster, and a possible implementation of the master node of the first cluster by the first network device, is described below in connection with the above-mentioned preemptive request message.
The format and verification method of the preemptive request message are similar to those of the above examples, and are not described herein.
And if the verification is passed, the first network equipment queries in the information table based on the first cluster identification to obtain corresponding third master node information. The third master node information includes a second state identification, i.e. "inuse". The third master node information also includes the IP address of the master node. The first network device can determine that a master node of the first cluster exists based on the third master node information and can determine the master node of the first cluster based on the IP address of the master node.
Second kind: in another possible way of determining the master node of the first cluster, the first network device determines whether the first node is a first candidate master node. If the first node is a first candidate master node, the first network device determines the first node as the master node of the first cluster after receiving the master request message of the first node.
Specifically, in response to determining that the first node is a first candidate master node for the first cluster, the first network device determines the first node as a master node for the first cluster.
Wherein the first candidate master node of the first cluster is predetermined by the first network device. The first candidate master node of the first cluster is a cluster node capable of competing for serving as a master node when the master node fails or fails to connect. The first candidate master node of the first cluster is associated with the master node of the first cluster. For example, the first candidate master node of the first cluster may be a cluster node capable of providing services to the outside, other than the master node of the first cluster. When the master node of the first cluster is changed, the corresponding first candidate master node of the first cluster is changed.
In one possible implementation, the first network device may obtain node information of a first candidate master node of the first cluster and store the node information in the first node information set. The first node information set includes node information of the first candidate master node. The node information of the first candidate master node may be an IP address. The first network device obtains a first node preemption request message including node information of the first node. The first network device can acquire the node information of the first node based on the first node preemption request message, and further judge whether the first node information set includes the node information of the first node. If so, the first node can be determined to be a first candidate master node, and then the first node is taken as the master node of the first cluster.
In the embodiment of the present application, the first network device may obtain node information of the first candidate master node through the master node. When the first cluster initially determines the master node, the cluster nodes in the first cluster may negotiate to determine the master node, or the first network device may determine the master node. As an example, the first network device may obtain node information of the cluster nodes of the first cluster when the first cluster initially determines the master node. The first network device determines a master node among cluster nodes participating in the master selection based on the acquired node information and the master selection rule. The choice rule may be, for example, to determine the master node based on the priority of the cluster nodes. For another example, the master node may be determined according to the acquired node information of the cluster node. After determining the master node of the first cluster, the master node interacts with other cluster nodes in the first cluster to acquire node information of the other cluster nodes. And the master node sends the acquired node information of other cluster nodes to the first network equipment. Specifically, the master node may send node information of the cluster node capable of providing the service to the outside to the first network device. The first network device takes the cluster node corresponding to the obtained node information as a first candidate master node, and generates a first node information set.
In case the first network device has a storage function, the first network device is able to store the first set of node information in a local storage space. In the case where the first network device has access to other storage space, the first network device may store the first set of node information in the other storage space. For example, the first network device can access a storage space provided at the other device. The first network device may store the first set of node information in a storage space of the other device. When the first node information set needs to be queried, the first network equipment accesses the storage space of other equipment, and queries whether the first node information set comprises the node information of the first node.
The first set of node information may correspond to a first cluster identity. The first network device may store the correspondence between the first set of node information and the first cluster identity in a local storage space, or in other storage spaces. The first network device can obtain the first node information set based on the first cluster identifier in the preemptive request message and the corresponding relation between the first node information set and the first cluster identifier, so as to determine whether the first node information set includes node information of the first node.
Further, after the first network device determines that the first node is a master node of the first cluster, the candidate master nodes of the first cluster need to be changed correspondingly. The first network device may delete the first set of node information. The first network device may further obtain node information of a second candidate master node of the first cluster, and generate a second node information set. The first node, that is, the main node of the first cluster, may acquire node information of other cluster nodes in the cluster, and send the node information of the other cluster nodes to the first network device. The first network device takes the cluster node with the acquired node information as a second candidate master node, and generates a second node information set based on the node information of the second candidate master node.
As an example, in connection with the above-mentioned preemption request message, a possible implementation manner in which the first network device determines that the first node is the first candidate master node and uses the first node as the master node of the first cluster is described below.
The format and verification method of the preemptive request message are similar to those of the above examples, and are not described herein.
After verification, the first network device queries in the storage space to obtain a corresponding first node information set based on a first cluster identifier carried by a cluster id field in the preemptive request message. The first network device determines in the first set of node information whether an IP address of the first node is included. The IP address of the first node is obtained from the "wner" field in the preemptive request message.
When a cluster includes a plurality of network devices, synchronization information is required between the plurality of network devices. The embodiment of the application does not limit the manner of triggering the synchronization information between the network devices, and for example, the information stored by the network devices changes, and for example, the synchronization time is reached.
The embodiment of the application provides a possible specific implementation mode for synchronizing data between network devices.
In an embodiment of the present application, the first cluster includes a first network device and a second network device. The second network device is a standby device for the first network device. The first network device and the second network device are both connected with a cluster node of the first cluster. The second network device also has cluster arbitration capabilities and is able to access the storage space. As shown in connection with fig. 3, the first network device may be network device 306 and the second network device may be network device 307 and network device 308.
After the first network device determines the first node as the master node of the first cluster, the first network device needs to synchronize the related information of the master node of the first cluster as the first node with the second network device.
The first network device generates a synchronization message. The synchronization message includes node information of a master node of the first cluster. Specifically, after the first node is determined to be the master node of the first cluster, the synchronization message generated by the first network device includes node information of the first node. The node information of the first node may be, for example, an IP address of the first node.
The first network device sends a synchronization message to the second network device. After receiving the synchronization message, the second network device can backup the node information of the main node of the first cluster in the synchronization message, so as to realize data synchronization with the first network device. Wherein the second network device may be plural. The plurality may mean at least two.
It should be noted that, in some scenarios, a portion of the second network device is not directly connected to the first network device. In this scenario, the synchronization message may be forwarded through other second network devices. Taking network devices 306-308 of fig. 3 as an example, a first network device, i.e., network device 306, is connected to a second network device, i.e., network device 307. The second network device, i.e. network device 307, is connected to another second network device, i.e. network device 308. Network device 306 generates and transmits a synchronization message to network device 307. Network device 307 in turn forwards the synchronization message to network device 308.
Taking the arbitration message of table 1 as an example, the embodiment of the present application provides a synchronization message.
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. Wherein the value of the op field is sync, indicating that the operation type is synchronous. The cluster ID field carries a first cluster identity. The owner field carries the IP address of the first node, indicating the node information of the master node. The syncid field is used to verify whether the query synchronization message is valid. The value of the sync ID field is increased each time the first network device generates a synchronization message. The verify field is used for verifying whether the synchronous message is an out-of-order message, and the first network device sends the synchronous message to the second network device.
The second network device determines that a synchronization operation is required for the sync based on the value of the op field. The second network device first obtains a value pkt.sync ID of a sync ID field in the synchronization message. The pkt.sync ID is compared to the stored switch1.Sync ID of the second network device. If pkt.sync ID is greater than the switch1.sync ID, then determining that the content carried by the synchronization message is valid for the second network device. The second network device obtains information carried in the cluster ID field, the sync ID field, the status field and the owner field, and stores the information in a storage space corresponding to the second network device. And if the second network equipment stores the information carried by the fields, the second network equipment correspondingly updates the stored information. And if the second network device is not the last device in the forwarding path of the synchronous message, continuing to forward the synchronous message to other second network devices.
If pkt.sync ID is less than or equal to switch1.sync ID, it indicates that the content carried by the synchronization packet is invalid for the second network device, that is, the second network device has synchronized the content carried by the synchronization packet. If the second network device is not the last device in the forwarding path of the synchronization message, continuing to forward the synchronization message to other second network devices.
If the second network device is the last device in the forwarding path of the synchronization message, a synchronization success message may be generated and sent to the first network device. The first network device can determine that the second network device in the forwarding path of the synchronous message is successful in synchronization based on the acquired synchronous success message.
In one possible implementation, when the first network device does not acquire the synchronization success message within the preset time, the synchronization message is repeatedly sent until the first network device receives the synchronization success message.
In connection with fig. 3, network device 308 is the last network device in the forwarding path of the synchronization message. The network device 308 receives the synchronization message and synchronizes the content carried by the synchronization message, thereby generating a synchronization success message. Network device 308 sends a synchronization success message to network device 306.
As an example, still taking the arbitration packet of table 1 as an example, the embodiment of the present application provides a synchronization success packet.
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. Wherein the value of the op field is sync-ack, indicating that the operation is successful in synchronization. The cluster ID field carries a first cluster identity. The content carried by the sync ID field is consistent with the content carried by the sync ID field in the synchronization message.
The second network device sends a synchronization success message to the first network device. The first network device can determine that the message is a synchronization success message based on the value of the op field in the synchronization success message being sync-ack. And the first network device can determine that the synchronization is successful is the node information of the master node of the first cluster corresponding to the first cluster identifier based on the cluster ID field. The first network device can determine the content of the synchronization message for which the specific synchronization was successful based on the sync ID field.
After the first network device determines the master node of the first cluster, a preemptive response message is further required to be sent to the first node, so that the first node obtains a main selection result.
When the cluster only comprises the first network device, the first network device can send a second preemptive response message to the first node.
When the cluster is provided with a plurality of network devices, including a first network device and a second network device, the second network device can send a first preemptive response message to the first node, and the first network device can also send a second preemptive response message to the first node. The first preemptive response message and the second preemptive response message comprise a main selection result of the first node. If the first network device determines the first node as the master node of the first cluster, or the master node of the first cluster exists and the master node is the first node, the master selection result is that the master selection is successful. If the master node of the first cluster exists and the master node is not the first node, the result of the master selection is a master selection failure.
In one possible implementation, when the first network device determines that the master node of the first cluster exists, or the master node of the first cluster is the first node, the information stored by the first network device is not updated, and synchronization with the second network device is not required. The first network device generates a second preemptive response message and sends the second preemptive response message to the first node. Whereas for the case where the first network device determines the first node as the master node of the first cluster, the information stored in the first network device is updated and needs to be synchronized with the second network device. In this case, the first network device may send the second preemptive response message to the first node, or the second network device may send the first preemptive response message to the first node. When the second network device sends a first preemptive response message to the first node, the synchronous message sent by the first network device comprises node information of the first node. The second network device can determine a primary selection result of the first node based on the node information of the primary node of the first cluster and the node information of the first node in the synchronization message. The second network device that sends the first preemptive response message may be the last second network device in the forwarding path of the synchronization message.
Taking the architecture of the distributed cluster system 300 in fig. 3 as an example, the cluster node 301 is a first node, the network device 306 is a first network device, and the network device 307 and the network device 308 are second network devices. The forwarding path of the synchronization message includes network device 306, network device 307, and network device 308. Network device 308 is the last network device in the forwarding path.
When the network device 306 determines that the master node of the first cluster exists and is not the cluster node 301, a preemptive response message including a result of the election of the master failed is generated and the preemptive response message is sent to the cluster node 301. When the network device 306 determines that the master node of the first cluster exists and is the cluster node 301, a preemptive response message including a result of the successful election of the master is generated, and the preemptive response message is sent to the cluster node 301. When the network device 306 determines the cluster node 301 as the master node of the first cluster, a synchronization message is generated and sent to the network device 307. In one possible implementation, network device 306 generates a preemptive response message that includes a result of the successful election of the owner and sends the preemptive response message to cluster node 301. In another possible implementation, after the network device 308 acquires the synchronization message through the network device 307, based on the node information of the first node in the synchronization message, the network device generates a preemptive response message including a result of successful election of the preemption master, and sends the preemptive response message to the cluster node 301.
As an example, still taking the arbitration packet of table 1 as an example, the embodiment of the present application provides a preemptive response packet.
In one possible implementation, the preemptive response 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, an owner field, and an error code field.
Wherein the value of the op field is preempt, which indicates that the operation type is preempt. The cluster ID field carries a first cluster identity. The content carried by the sequence field may be consistent with the content carried in the preemptive request message, which indicates that the preemptive response message corresponds to the preemptive request message. The sync ID field is used to verify whether the preemptive response message is valid. The verify field is used to verify whether the preemptive response message is an out-of-order message. The status field carries a second status identifier 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 result of the choice.
The first network device can be used to query the master node in addition to the arbitration function described above.
Specifically, querying a master node of a cluster with a first network device may include the following three steps:
Step one: the first network device obtains a query request message of the second node.
It should be noted that the first network device is capable of connecting cluster nodes in a plurality of clusters. The first network device is directly or indirectly connected to the cluster node of the second cluster. The second node is a cluster node of the second cluster. The second cluster may be a different cluster from the first cluster, or may be the first cluster. When the second cluster is the first cluster, the second node may be a cluster node different from the first node, or may be the first node.
The first network device may directly obtain the query request message sent by the second node, or may obtain the query request message through other devices, for example, the second network device.
The query request message includes a second cluster identity. The second cluster identity corresponds to a second cluster. The first network device can determine node information of a master node needing to query the second cluster based on the second cluster identifier in the query request message.
As an example, still taking the arbitration packet of table 1 as an example, the embodiment of the present application provides a query request packet.
In one possible implementation, the query request message may include, for example, an op field, a cluster ID field, and a sequence field.
Where the value of the op field is read, indicating that the operation type is a query. The cluster ID field carries a second cluster identity.
The first network device may query the storage space for node information of the master node of the second cluster, and generate a corresponding query result.
Specifically, if the first network device does not query to obtain node information of the master node of the second cluster, the query result may be a query failure. If the first network device queries that the master node of the second cluster is not determined, the query result may include a status identifier indicating that the master node of the second cluster does not exist. For example, a first status identification. If the first network device queries the master node of the second cluster, the query result may include a status identifier indicating that the master node of the second cluster exists, for example, the second status identifier, and/or node information of the master node of the second cluster. The node information of the master node of the second cluster may be an IP address of the master node of the second cluster.
The first network device may store node information of the master node of the second cluster and/or presence status information of the master node of the second cluster in the storage space. Specifically, the first network device may obtain node information of the master node of the second cluster in advance, and/or presence state information of the master node of the second cluster, and store the obtained node information in a storage space of the local or other devices.
Step two: the first network device generates a query response message.
The first network device generates a query response message based on the query result.
The query response message includes the query result.
As an example, still taking the arbitration packet of table 1 as an example, the embodiment of the present application provides an arbitration packet with a specific operation type being a query. In this example, the query result includes a status identification indicating that the master node of the second cluster exists and node information of the master node of the second cluster.
In one possible implementation, when the arbitration message is specifically a query response message, the query response message may include, for example, an op field, a cluster ID field, a sequence field, a verify field, a status field, an owner field, and an error code field.
Where the value of the op field is read, indicating that the operation type is a query. The cluster ID field carries a second cluster identity. The content carried by the sequence field may be consistent with the content carried by the sequence field in the query request message, indicating that the message is a query response message. The syncid field is used to verify whether the query response message is valid. The verify field is used for verifying whether the query response message is an out-of-order message, and the status field carries a second status identifier, which indicates 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 flag indicating that the query was successful. Wherein the successful identification may be, for example, "successful".
Step three: the first network device sends a query response message to the second node.
The first network device sends the generated query response message to the second node. The second node obtains the query response message. The second node can determine whether the master node of the second cluster exists according to the query result carried in the query response message. Thus, the second node is convenient to apply for preempting or interact with the master node.
Fig. 5 shows a schematic diagram of a possible architecture of the network device involved in the above embodiment, and the network device 500 may implement the function of the first network device in the example shown in fig. 4. Referring to fig. 5, the network device 500 includes: a first acquisition unit 501 and a first processing unit 502.
These units may perform the corresponding functions of the first network device in the method examples described above. A first obtaining unit 501, configured to support the network device 500 to execute S401 in fig. 4; a first processing unit 502, configured to support the network device 500 to execute S402 in fig. 4; and/or other processes performed by the first network device in the techniques described herein. For example, the first obtaining unit 501 is configured to perform various obtaining operations performed by the first network device in the foregoing method embodiment; the first processing unit 502 is configured to perform operations of various processes of the first network device in the foregoing method embodiment. For example, a first obtaining unit 501 is configured to obtain a preemptive request packet of a first node; a first processing unit 502 is configured to determine a master node of the first cluster. Reference is made to the detailed description of the corresponding steps in the embodiment shown in fig. 4, and details are not repeated here.
It should be noted that, in the embodiment of the present application, the division of the units is schematic, which is merely a logic function division, and other division manners may be implemented in actual practice. Each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. For example, in the above embodiment, the acquisition unit and the processing unit may be the same unit or different units. The integrated units may be implemented in hardware or in software functional units.
Referring to fig. 6, an embodiment of the invention provides a system 600 for cluster arbitration, where the system 600 is used to implement the cluster arbitration method in the foregoing method embodiment. The system 600 includes a network device 601 and a first node 602. The network device 601 may implement the functionality of the first network device in the embodiment shown in fig. 4. Reference is made to the detailed description of the corresponding steps in the embodiment shown in fig. 4, and details are not repeated here.
Fig. 7 is a schematic structural diagram of an apparatus 700 according to an embodiment of the present application. The network device 500 in fig. 5 may be implemented by the device shown in fig. 7. Referring to fig. 7, the device 700 includes at least one processor 701, a communication bus 702, and at least one network interface 704, and optionally the device 700 may also include memory 703.
The processor 701 may be a general purpose central processing unit (central processing unit, CPU), application Specific Integrated Circuit (ASIC) or one or more integrated circuits (integrated circuit, IC) for controlling the execution of the programs of the present application. The processor may be configured to process the packet to implement the method for cluster arbitration provided in the embodiments of the present application.
For example, when the first network device in fig. 4 is implemented by using the device shown in fig. 7, the processor may be configured to obtain the preemption request packet of the first node, and determine the master node of the first cluster, where for implementation of a specific function, reference may be made to a processing portion corresponding to the first network device in an embodiment of the method.
A communication bus 702 is used to transfer information between the processor 701, network interface 704, and memory 703.
The Memory 703 may be, but is not limited to, a read-only Memory (ROM) or other type of static storage device that can store static information and instructions, the Memory 703 may also be a random access Memory (random access Memory, RAM) or other type of dynamic storage device that can store information and instructions, a read-only optical disk (compact disc read-only Memory, CD-ROM) or other optical disk storage, optical disk storage (including compact disk, laser disk, optical disk, digital versatile disk, blu-ray disk, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer. The memory 703 may be separate and may be coupled to the processor 701 via a communication bus 702. Memory 703 may also be integrated with processor 701.
Optionally, the memory 703 is used for storing program codes or instructions for executing the aspects of the present application, and is controlled by the processor 701 for execution. The processor 701 is configured to execute program code or instructions stored in the memory 703. One or more software modules may be included in the program code. Alternatively, the processor 701 may also store program code or instructions for performing the aspects of the present application, in which case the processor 701 does not need to read the program code or instructions into the memory 703.
The network interface 704 may be a device such as a transceiver for communicating with other devices or communication networks, which may be an ethernet, a Radio Access Network (RAN), or a wireless local area network (wireless local area networks, WLAN), etc. In the embodiment of the present application, the network interface 704 may be configured to receive a packet sent by another node in the segment routing network, or may send a packet to another node in the segment routing network. The network interface 704 may be an ethernet interface, a Fast Ethernet (FE) interface, a Gigabit Ethernet (GE) interface, or the like.
In a particular implementation, the device 700 may include multiple processors, such as the processor 701 and the processor 405 shown in fig. 7, as one embodiment. Each of these processors may be a single-core (single-CPU) processor or may be a multi-core (multi-CPU) processor. A processor herein may refer to one or more devices, circuits, and/or processing cores for processing data (e.g., computer program instructions).
Fig. 8 is a schematic structural diagram of an apparatus 800 according to an embodiment of the present application. The first network device of fig. 4 may be implemented by the device shown in fig. 8. Referring to the schematic device architecture shown in fig. 8, a device 800 includes a master control board and one or more interface boards. The main control board is in communication connection with the interface board. The main control board, also called a main processing unit (main processing unit, MPU) or routing processing card (route processor card), comprises a CPU and a memory, and is responsible for controlling and managing the various components in the device 800, including routing computation, device management and maintenance functions. The interface board is also called a line processing unit (line processing unit, LPU) or line card (line card) for receiving and transmitting messages. In some embodiments, communication is via a bus between the master control board and the interface board or between the interface board and the interface board. In some embodiments, the interface boards communicate via a switch fabric, in which case the device 800 also includes a switch fabric communicatively coupled to the master board and the interface boards, the switch fabric configured to forward data between the interface boards, which may also be referred to as a switch fabric unit (switch fabric unit, SFU). The interface board includes a CPU, memory, forwarding engine, and Interface Card (IC), where the interface card may include one or more network interfaces. The network interface may be an Ethernet interface, an FE interface, a GE interface, or the like. The CPU is in communication connection with the memory, the forwarding engine and the interface card respectively. The memory is used for storing a forwarding table. The forwarding engine is configured to forward the received message based on a forwarding table stored in the memory, and if the destination address of the received message is the IP address of the device 800, send the message to the CPU of the main control board or the interface board for processing; if the destination address of the received message is not the IP address of the device 800, the forwarding table is looked up according to the destination, and if the next hop and the egress interface corresponding to the destination address are found from the forwarding table, the message is forwarded to the egress interface corresponding to the destination address. The forwarding engine may be a network processor (network processor, NP). The interface card is also called a sub-card, can be installed on the interface board, and is responsible for converting the photoelectric signal into a data frame, and forwarding the data frame to a forwarding engine for processing or an interface board CPU after performing validity check. In some embodiments, the CPU may also perform the functions of a forwarding engine, such as soft forwarding based on a general purpose CPU, so that no forwarding engine is needed in the interface board. In some embodiments, the forwarding engine may be implemented by an ASIC or field programmable gate array (field programmable gate array, FPGA). In some embodiments, the memory storing the forwarding table may also be integrated into the forwarding engine as part of the forwarding engine.
The embodiment of the application also provides a chip system, which comprises: and a processor coupled to the memory, the memory for storing programs or instructions that, when executed by the processor, cause the system-on-a-chip to implement the method performed by the first network device in the embodiment of fig. 4.
Alternatively, the processor in the system-on-chip may be one or more. The processor may be implemented in hardware or in software. When implemented in hardware, the processor may be a logic circuit, an integrated circuit, or the like. When implemented in software, the processor may be a general purpose processor, implemented by reading software code stored in a memory.
Alternatively, the memory in the system-on-chip may be one or more. The memory may be integral with the processor or separate from the processor, and is not limited in this application. For example, the memory may be a non-transitory processor, such as a ROM, which may be integrated on the same chip as the processor, or may be separately provided on different chips, and the type of memory and the manner of providing the memory and the processor are not specifically limited in this application.
The system-on-chip may be, for example, an FPGA, an ASIC, a system-on-chip (SoC), a CPU, an NP, a digital signal processing circuit (digital signal processor, DSP), a microcontroller (micro controller unit, MCU), a programmable controller (programmable logic device, PLD) or other integrated chips.
It should be understood that the steps in the above-described method embodiments may be accomplished by integrated logic circuitry in hardware in a processor or instructions in the form of software. The steps of a method disclosed in connection with the embodiments of the present application may be embodied directly in a hardware processor or in a combination of hardware and software modules in a processor.
Embodiments of the present application also provide a computer-readable storage medium comprising instructions that, when run on a computer, cause the computer to perform the method of the previous embodiments.
The terms first, second, third, fourth and the like in the description and in the claims of the present application and in the above-described figures, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments described herein may be implemented in other sequences than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
In the present application, "at least one" means one or more, and "a plurality" means two or more. "at least one of" or the like means any combination of these items, including any combination of single item(s) or plural items(s). For example, at least one (one) of a, b, or c may represent: a, b, c, a-b, a-c, b-c, or a-b-c, wherein a, b, c may be single or plural. "A and/or B" is considered herein to include A alone, B alone, and A+B.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, which are not repeated herein.
In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods may be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative, and the division of the units, for example, is merely a logic module division, and there may be additional divisions when actually implemented, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be acquired according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each module unit in each embodiment of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units described above may be implemented either in hardware or in software module units.
The integrated units, if implemented in the form of software module units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be embodied in essence or a part contributing to the prior art or all or part of the technical solution in the form of a software product stored in a storage medium, including several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Those skilled in the art will appreciate that in one or more of the examples described above, the functions described in the present invention may be implemented in hardware, software, firmware, or any combination thereof. When implemented in software, these functions may be stored on or transmitted over as one or more instructions or code on a computer-readable medium. Computer-readable media includes both computer storage media and communication media including any medium that facilitates transfer of a computer program from one place to another. A storage media may be any available media that can be accessed by a general purpose or special purpose computer.
The above embodiments are further described in detail for the purpose, technical solution and advantageous effects of the present invention, and it should be understood that the above description is only an embodiment of the present invention.
The above embodiments are merely for illustrating the technical solution of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.

Claims (34)

1. A method of cluster arbitration, the method comprising:
the method comprises the steps that first network equipment obtains a first node preemptive request message, wherein the first node is a cluster node participating in election of a master node in a first cluster, the first node preemptive request message comprises a first cluster identifier, and the first cluster identifier is used for identifying the first cluster;
the first network device determines a master node of the first cluster.
2. The method of claim 1, wherein the first network device determining a master node of the first cluster comprises:
in response to determining that the primary node of the first cluster does not exist, the first network device determines the first node as the primary node of the first cluster.
3. The method of claim 2, wherein the determining that the master node of the first cluster is absent comprises:
determining that a master node of the first cluster does not exist based on first master node information, wherein the first master node information is used for indicating that the master node of the first cluster does not exist.
4. A method according to claim 3, characterized in that the method further comprises:
the first network device updates the first master node information, and the updated first master node information is used for indicating that the master node of the first cluster exists.
5. The method of claim 2, wherein the determining that the master node of the first cluster is not present comprises:
and in response to not acquiring the second master node information, determining that the master node of the first cluster does not exist, wherein the second master node information is used for indicating the existence state of the master node of the first cluster.
6. The method of claim 1, wherein the first network device determining a master node of the first cluster comprises:
the first network device determines a master node of the first cluster based on third master node information, the third master node information being used to indicate that a master node of the first cluster exists.
7. The method of claim 1, wherein the first network device determining a master node of the first cluster comprises:
in response to determining that the first node is a first candidate master node for the first cluster, the first network device determines the first node as a master node for the first cluster.
8. The method of claim 7, wherein the preemption request message includes node information for the first node, and wherein the determining that the first node is a first candidate master node for the first cluster comprises:
Determining that a first set of node information includes node information of the first node, the first set of node information including node information of a first candidate master node of the first cluster.
9. The method according to claim 7 or 8, characterized in that the method further comprises:
the first network device deletes the first set of node information.
10. The method according to any one of claims 7-9, further comprising:
the first network device obtains node information of a second candidate master node of the first cluster to obtain a second node information set, wherein the second node information set comprises node information of the second candidate master node of the first cluster.
11. The method according to any one of claims 1-10, further comprising:
the first network equipment generates a synchronous message, wherein the synchronous message comprises node information of a main node of the first cluster;
the first network device sends the synchronization message to a second network device, where the synchronization message is used to instruct the second network device to backup node information of a master node of the first cluster, and the second network device is a standby network device of the first network device.
12. The method of claim 11, wherein the method further comprises:
the first network device obtains a synchronization success message sent by the second network device, where the synchronization success message is used to indicate that the second network device is successful in backup.
13. The method according to claim 11 or 12, wherein the synchronization message further includes node information of the first node, and the synchronization message is further configured to instruct the second network device to send a first preemptive response message to the first node based on the node information of the first node, where the first preemptive response message includes a result of selecting a master of the first node.
14. The method according to any one of claims 1-13, further comprising:
the first network equipment generates a second preemptive response message, wherein the second preemptive response message comprises a main selection result of the first node;
and the first network equipment sends the second preemptive response message to the first node.
15. The method according to any one of claims 1-14, further comprising:
the first network equipment acquires a query request message of a second node, wherein the query request message comprises a second cluster identifier, the second cluster identifier is used for identifying a second cluster, and the second node is a cluster node of the second cluster;
The first network equipment generates a query response message, wherein the query response message comprises a query result, and the query result is used for enabling the second node to determine the existence state of the master node of the second cluster according to the query result;
and the first network equipment sends the query response message to the second node.
16. A network device, the network device comprising:
the first acquisition unit is used for acquiring a preemptive request message of a first node, wherein the first node is a cluster node participating in election of a master node in a first cluster, the preemptive request message comprises a first cluster identifier, and the first cluster identifier is used for identifying the first cluster;
and the first processing unit is used for determining the master node of the first cluster.
17. The network device of claim 16, wherein the first processing unit is configured to determine the first node as a master node of the first cluster in response to determining that the master node of the first cluster is not present.
18. The network device according to claim 17, wherein the first processing unit is configured to determine that a master node of the first cluster is absent based on first master node information, the first master node information being configured to indicate that the master node of the first cluster is absent.
19. The network device of claim 18, wherein the network device further comprises:
the second processing unit is used for updating the first master node information, and the updated first master node information is used for indicating the existence of the master node of the first cluster.
20. The network device of claim 17, wherein the first processing unit is configured to determine that a master node of the first cluster is absent in response to not obtaining second master node information, the second master node information being configured to indicate a presence status of a master node of the first cluster.
21. The network device according to claim 16, wherein the first processing unit is configured to determine a master node of the first cluster based on third master node information, the third master node information being configured to indicate that a master node of the first cluster is present.
22. The network device of claim 16, wherein the first processing unit is configured to determine the first node as a master node of the first cluster in response to determining that the first node is a first candidate master node of the first cluster.
23. The network device according to claim 22, wherein the preemptive request message comprises node information of the first node, and wherein the first processing unit is specifically configured to determine that a first set of node information comprises node information of the first node, and wherein the first set of node information comprises node information of a first candidate master node of the first cluster.
24. The network device according to claim 22 or 23, characterized in that the network device further comprises:
and the third processing unit is used for deleting the first node information set.
25. The network device of any of claims 22-24, wherein the network device further comprises:
the second obtaining unit is configured to obtain node information of a second candidate master node of the first cluster, and obtain a second node information set, where the second node information set includes node information of the second candidate master node of the first cluster.
26. The network device of any of claims 16-25, wherein the network device further comprises:
the third processing unit is used for generating a synchronous message, and the synchronous message comprises node information of a main node of the first cluster;
the first sending unit is configured to send the synchronization packet to a second network device, where the synchronization packet is used to instruct the second network device to backup node information of a primary node of the first cluster, and the second network device is a standby network device of the first network device.
27. The network device of claim 26, wherein the network device further comprises:
The third obtaining unit is configured to obtain, by using the first network device, a synchronization success packet sent by the second network device, where the synchronization success packet is used to indicate that the backup of the second network device is successful.
28. The network device according to claim 26 or 27, wherein the synchronization message further includes node information of the first node, and the synchronization message is further configured to instruct the second network device to send a first preemptive response message to the first node based on the node information of the first node, where the first preemptive response message includes a result of selecting a master of the first node.
29. The network device of any of claims 16-28, wherein the network device further comprises:
the fourth processing unit is used for generating a second preemptive response message, and the second preemptive response message comprises a main selection result of the first node;
and the second sending unit is used for sending the second preemptive response message to the first node.
30. The network device of any one of claims 16-29, wherein the network device further comprises:
a fourth obtaining unit, configured to obtain a query request packet of a second node, where the query request packet includes a second cluster identifier, where the second cluster identifier is used to identify a second cluster, and the second node is a cluster node of the second cluster;
A fifth processing unit, configured to generate a query response packet, where the query response packet includes a query result, where the query result is used to enable the second node to determine a presence state of a master node of the second cluster according to the query result;
and the third sending unit is used for sending the query response message to the second node.
31. A network device comprising a processor chip and a memory, the memory being for storing instructions or program code, the processor chip being for invoking from memory and executing the instructions or program code to perform the method of any of claims 1-15.
32. A network system comprising a network device and a first node, the network device being configured to perform the method of any of claims 1-15.
33. A computer readable storage medium comprising instructions, a program or code which, when executed on a computer, causes the computer to perform the method of any of claims 1-15.
34. A chip comprising a memory for storing instructions or program code and a processor for calling and executing the instructions or program code from the memory to perform the method of any of claims 1-15.
CN202111633349.5A 2021-12-28 2021-12-28 Cluster arbitration method, network equipment and system Pending CN116367202A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202111633349.5A CN116367202A (en) 2021-12-28 2021-12-28 Cluster arbitration method, network equipment and system
PCT/CN2022/133885 WO2023124663A1 (en) 2021-12-28 2022-11-24 Cluster quorum implementation method, network device, and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111633349.5A CN116367202A (en) 2021-12-28 2021-12-28 Cluster arbitration method, network equipment and system

Publications (1)

Publication Number Publication Date
CN116367202A true CN116367202A (en) 2023-06-30

Family

ID=86940455

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111633349.5A Pending CN116367202A (en) 2021-12-28 2021-12-28 Cluster arbitration method, network equipment and system

Country Status (2)

Country Link
CN (1) CN116367202A (en)
WO (1) WO2023124663A1 (en)

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100411401C (en) * 2002-12-31 2008-08-13 联想(北京)有限公司 Method for network equipment self adaption load equalization
US7548945B2 (en) * 2005-04-13 2009-06-16 Nokia Corporation System, network device, method, and computer program product for active load balancing using clustered nodes as authoritative domain name servers
CN106331046A (en) * 2015-07-02 2017-01-11 中兴通讯股份有限公司 Cluster main node voting method and device
CN106878382B (en) * 2016-12-29 2020-02-14 北京华为数字技术有限公司 Method and device for dynamically changing cluster scale in distributed arbitration cluster
CN111355600B (en) * 2018-12-21 2023-05-02 杭州海康威视数字技术股份有限公司 Main node determining method and device

Also Published As

Publication number Publication date
WO2023124663A1 (en) 2023-07-06

Similar Documents

Publication Publication Date Title
CN109729111B (en) Method, apparatus and computer program product for managing distributed systems
CN103460203B (en) cluster unique identifier
US7225356B2 (en) System for managing operational failure occurrences in processing devices
US7672252B2 (en) Method and system for resolving switch number conflicts in a stackable switch system
EP3316555B1 (en) Mac address synchronization method, device and system
CN109344014B (en) Main/standby switching method and device and communication equipment
CN108173691B (en) Cross-device aggregation method and device
EP2731313A1 (en) Distributed cluster processing system and message processing method thereof
EP3787232A1 (en) Network configuration method, device, and system
CN111259072A (en) Data synchronization method and device, electronic equipment and computer readable storage medium
EP3200416A1 (en) Sas system, traversal method and device thereof
US10530634B1 (en) Two-channel-based high-availability
CN111585835B (en) Control method and device for out-of-band management system and storage medium
CN110708275B (en) Protocol message processing method and device
JP2012209625A (en) System and method for reducing wiring complexity in cluster system
US11115266B2 (en) Priority based selection of time services
CN114124803B (en) Device management method and device, electronic device and storage medium
CN114401324B (en) Message forwarding method, network equipment and system
CN116367202A (en) Cluster arbitration method, network equipment and system
CN108574587B (en) Capacity updating method and device for distributed equipment
WO2022083122A1 (en) Fault tolerance method and apparatus of network device system, computer device, and storage medium
CN111064622B (en) Network device, synchronization apparatus, and information transmission method
CN110572290B (en) Master device determination method, master device determination device, electronic device, storage medium, and network system
CN110995502B (en) Network configuration management method, device, switching equipment and readable storage medium
CN111211927A (en) Resource synchronization method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination