WO2022116661A1 - 一种集群仲裁方法、装置、电子设备及可读存储介质 - Google Patents

一种集群仲裁方法、装置、电子设备及可读存储介质 Download PDF

Info

Publication number
WO2022116661A1
WO2022116661A1 PCT/CN2021/121209 CN2021121209W WO2022116661A1 WO 2022116661 A1 WO2022116661 A1 WO 2022116661A1 CN 2021121209 W CN2021121209 W CN 2021121209W WO 2022116661 A1 WO2022116661 A1 WO 2022116661A1
Authority
WO
WIPO (PCT)
Prior art keywords
arbitration
nodes
power supply
network topology
cluster
Prior art date
Application number
PCT/CN2021/121209
Other languages
English (en)
French (fr)
Inventor
李辉
赵鹏
Original Assignee
苏州浪潮智能科技有限公司
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 苏州浪潮智能科技有限公司 filed Critical 苏州浪潮智能科技有限公司
Priority to US18/034,554 priority Critical patent/US11902095B2/en
Publication of WO2022116661A1 publication Critical patent/WO2022116661A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0893Assignment of logical groups to network elements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/0654Management of faults, events, alarms or notifications using network fault recovery
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/12Discovery or management of network topologies
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/14Network analysis or design
    • H04L41/142Network analysis or design using statistical or mathematical methods
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0805Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
    • H04L43/0817Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability by checking functioning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1415Saving, restoring, recovering or retrying at system level
    • G06F11/142Reconfiguring to eliminate the error
    • G06F11/1425Reconfiguring to eliminate the error by reconfiguration of node membership
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/16Error detection or correction of the data by redundancy in hardware
    • G06F11/18Error detection or correction of the data by redundancy in hardware using passive fault-masking of the redundant circuits
    • G06F11/187Voting techniques
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/16Threshold monitoring
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • the present application relates to the field of cluster technology, and in particular, to a cluster arbitration method, a cluster arbitration device, an electronic device, and a computer-readable storage medium.
  • cluster nodes When a distributed cluster is working, cluster nodes may fail, or network communication between cluster nodes may be interrupted, which may result in loss or splitting of the cluster topology. If a topology loss occurs, the cluster will shut down if the remaining in the topology does not take over the cluster function; if a topology split occurs, and each part after the split tries to take over the cluster, since the parts cannot communicate with each other, the state consistency will be reduced. will be destroyed.
  • the related technology adopts the method of majority arbitration, that is, the network topology is confirmed when the above two faults occur in the cluster. If the connected branch of the topology contains more than half of the nodes, then the branch where it is located will take over the cluster. Nodes in other branches at the same time exit the cluster.
  • related technologies have great limitations. In many cases that can continue to provide services as a cluster, the service cannot be provided only because the number of surviving nodes does not exceed half, resulting in poor cluster survival.
  • the purpose of the present application is to provide a cluster arbitration method, a cluster arbitration device, an electronic device and a computer-readable storage medium, so that the network topology can continue to work under the condition of including any number of nodes, and the survival of the cluster is improved. sex.
  • the present application provides a cluster arbitration method, including:
  • obtaining the number of first nodes and power supply conditions by using the historical election set includes:
  • the power supply condition is determined as the maximum single power supply node number; the maximum single power supply node number is greater than half of the first node number.
  • generating an arbitration parameter by using the first number of nodes according to the power supply situation includes:
  • the power supply condition is the single power supply, generating an arbitration threshold by using the first number of nodes according to the parity of the first number of nodes;
  • the power supply condition is the maximum number of single power supply nodes, generating the arbitration threshold by using the maximum single power supply node number and the first number of nodes according to the arbitration disk situation of the historical election set;
  • the arbitration parameter is generated using the arbitration threshold.
  • generating an arbitration threshold by using the first number of nodes according to the parity of the number of first nodes includes:
  • arbitration disk exists in the historical election set, divide the number of the first nodes by two to obtain the arbitration threshold;
  • the arbitration threshold is obtained by dividing the number of the first nodes by two and then adding one.
  • generating the arbitration threshold by using the maximum number of single power supply nodes and the first number of nodes according to the arbitration disk situation of the historical election set including:
  • the arbitration threshold is obtained by subtracting the maximum number of single power supply nodes from the first node number
  • the arbitration threshold is obtained by subtracting the maximum single power supply node number from the first node number and adding one.
  • the judging whether the current network topology satisfies the arbitration parameter includes:
  • the historical election set is a target election set;
  • the target election set is a power supply with more than one power supply and an arbitration disk. an election set, or an election set with one of the power supplies, an even number of the first authorized nodes, and a quorum disk;
  • the current arbitration disk situation of the current network topology is used to determine whether the arbitration parameter is satisfied.
  • determining whether the arbitration parameter is satisfied by using the current arbitration disk situation of the current network topology includes:
  • the current network topology identifies the arbitration disk, execute the arbitration disk contention, and determine that the arbitration parameter is satisfied after the contention is successful;
  • arbitration node If the arbitration node does not exist, it is determined that the arbitration parameter is not satisfied.
  • the application also provides a cluster arbitration device, including:
  • an acquisition module used to acquire a historical election set, and use the historical election set to obtain the number of first nodes and the power supply;
  • a generating module configured to generate an arbitration parameter by using the first number of nodes according to the power supply condition
  • a judgment module configured to obtain the current network topology, and judge whether the current network topology satisfies the arbitration parameter
  • a service module configured to provide a cluster service if the current network topology satisfies the arbitration parameter.
  • the application also provides an electronic device, including a memory and a processor, wherein:
  • the memory for storing computer programs
  • the processor is configured to execute the computer program to implement the above cluster arbitration method.
  • the present application also provides a computer-readable storage medium for storing a computer program, wherein when the computer program is executed by a processor, the above-mentioned cluster arbitration method is implemented.
  • the cluster arbitration method provided in this application obtains a historical election set, and uses the historical election set to obtain the number of first nodes and power supply; according to the power supply situation, uses the number of first nodes to generate arbitration parameters; obtains the current network topology, and judges the current network topology Whether the quorum parameter is met; if the quorum parameter is met, the cluster service is provided.
  • the method will obtain the number of first nodes and the power supply corresponding to the historical election set before the split or loss, and use them to determine whether it can continue to provide services as a cluster.
  • arbitration is generated by the number of the first nodes, and can limit the number of nodes in the network topology after the failure based on the number of the original nodes, so as to ensure that if the network topology split occurs, there is only one new network Topology can provide services as a cluster to prevent data inconsistency caused by two clusters providing services at the same time.
  • the nodes in the network topology can serve as a new cluster to provide external services.
  • the arbitration parameter After obtaining the arbitration parameter, it is judged whether the current network topology satisfies the arbitration parameter. If the current network topology satisfies the arbitration parameter, the cluster service can be provided to the outside, so that the cluster continues to work. This method does not require that the nodes in the new network topology must be the majority in the original cluster after a failure. On the basis of ensuring data consistency, the network topology can continue to work even if it contains any number of nodes, which improves the Cluster survival.
  • the present application also provides a cluster arbitration device, an electronic device and a computer-readable storage medium, which also have the above beneficial effects.
  • FIG. 1 is a flowchart of a cluster arbitration method provided by an embodiment of the present application
  • FIG. 2 is a schematic structural diagram of a cluster arbitration apparatus according to an embodiment of the present application.
  • FIG. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
  • FIG. 1 is a flowchart of a cluster arbitration method provided by an embodiment of the present application.
  • the method includes:
  • S101 Obtain a historical election set, and use the historical election set to obtain the number of first nodes and the power supply situation.
  • all or part of the steps of the cluster arbitration method provided in this embodiment may be performed by using a node specified in the current network topology, and the node may be any node in the current network topology, such as the node with the smallest number. , or can be the node with the largest number, or can be the node with the smallest network address.
  • the network topology is split or lost, that is, the network communication between some nodes in the original cluster and other nodes is disconnected, resulting in topology classification; or when some nodes are shut down or powered off due to failure.
  • Each node can broadcast its own number or broadcast IP address in the current network topology. After obtaining the numbers or IP addresses of all nodes, determine whether it is the designated node, such as the node with the smallest number. If so, perform all or some of the steps in the cluster arbitration method.
  • the historical election set is the set of authorized nodes in the cluster when the cluster serves as the cluster before the network failure occurs.
  • An authorized node is a node whose cluster status is sufficiently new, and it can participate in cluster voting or provide services, such as voting as a quorum for whether the cluster continues to provide services to the outside world, or can vote for other nodes.
  • the number of authorized nodes is not limited. A node whose state is not new enough cannot be used as an authorized node and cannot vote. It needs to update the cluster state before it can become an authorized node.
  • the historical election set can be stored on each node in the cluster, or on each authorized node. By obtaining the historical election set, the cluster topology before the failure can be determined, and then the corresponding arbitration parameters can be generated based on this, and the arbitration parameters can be used to determine whether the cluster can continue to provide services.
  • the number of first nodes is the number of first authorized nodes in the historical election set, and its specific size is not limited.
  • the power supply situation is the power supply situation of each first authorized node in the historical election set.
  • the first authorization node may all be powered by one power source, or may be powered by multiple power sources. Based on this, this embodiment provides a specific method for obtaining the number of first nodes and power supply conditions. The steps of obtaining the number and power conditions of the first nodes by using the historical election set may include:
  • Step 11 Count the first authorized nodes in the historical election set to obtain the number of the first nodes.
  • Step 12 Acquire power supply information corresponding to each first authorization node, and determine whether all the first authorization nodes are powered by one power supply.
  • Step 13 If all the first authorized nodes are powered by one power supply, determine the power supply condition as a single power supply.
  • Step 14 If all the first authorized nodes are not powered by one power supply, determine the power supply situation as the maximum number of single power supply nodes.
  • the first authorized node in the historical election set there is only the first authorized node in the historical election set, so to count the first authorized node in the historical election set is to count the number of nodes in the historical election set. While counting the number of first nodes, power supply information corresponding to each first authorization node can also be obtained.
  • the power supply information is used to indicate the identity of the power supply that supplies power to the first authorization node, which may specifically be a power supply ID, a power supply name, or the like.
  • each power source information to determine whether all the first authorized nodes are powered by one power source, that is, it is judged whether all nodes in the historical election set are powered by one power source.
  • the power supply is determined to be a single power supply; if all nodes in the historical election set are not powered by one power supply, it means that the nodes in the historical election set are powered by two or more power supplies respectively.
  • the maximum number of single power supply nodes is the maximum number of nodes powered by the same power supply. Since the historical election set is powered by more than two power supplies, there must be a maximum number of nodes powered by each power supply, and the maximum value is the maximum single power supply. number of nodes.
  • each first authorization node is powered by only one power supply, and the maximum number of single power supply nodes in this embodiment is greater than half of the number of first nodes. This embodiment does not discuss the case where the maximum number of single power supply nodes is not greater than half of the first number of nodes.
  • S102 Generate an arbitration parameter by using the first number of nodes according to the power supply situation.
  • the arbitration parameter may be generated by using the first number of nodes according to the power supply situation.
  • the specific content of the arbitration parameter is not limited, and can be set according to actual needs. Since the topology loss can be caused by node power down, it is understandable that the impact of the topology loss is different under different power supply conditions.
  • the arbitration parameters generated according to the power supply situation and the number of the first nodes can not only select one of the two network topologies as a new cluster and provide services after a topology split, but also prevent nodes in the two network topologies from forming clusters to provide services , in order to ensure the singleness of the data and improve the survivability of the cluster; after the topology loss occurs, the current network topology can continue to provide services without being limited by the number of nodes, which improves the survivability of the cluster.
  • the number of the first authorized nodes in the cluster is an even number, and after the topology split occurs, the authorized nodes in the two new network topologies obtained by the split are half of the original ones.
  • the related technology cannot provide services to the outside world.
  • most of the first authorized nodes in the cluster are powered by the same power supply. If the power supply is suddenly cut off, the related technology determines that the remaining nodes in the cluster do not account for the majority, so the service cannot be continued.
  • the present application considers the power supply situation when generating the arbitration parameters, and the generated arbitration parameters can take into account the topology loss caused by the power failure, and can accurately arbitrate when the above or similar situations occur, thereby improving the cluster survival.
  • the arbitration parameter may include an arbitration threshold, and the arbitration threshold is used to limit the number of nodes in the topology for arbitration.
  • the step of using the first number of nodes to generate the arbitration parameter may include:
  • Step 21 If the power supply condition is a single power supply, the arbitration threshold is generated by using the first number of nodes according to the parity of the first number of nodes.
  • Step 22 If the power supply condition is the maximum number of single power supply nodes, the arbitration threshold is generated by using the maximum single power supply node number and the first number of nodes according to the arbitration disk situation in the historical election set.
  • Step 23 Use the arbitration threshold to generate arbitration parameters.
  • the topology loss may not be considered, because if the topology loss occurs, since all the first authorized nodes are powered by one power supply, the entire cluster cannot work. Therefore, when arbitration is required, a topology split must have occurred.
  • the number of nodes in the new topology obtained after topology splitting is related to the number of first nodes. When the number of first nodes is an odd number, the number of nodes in the two topologies obtained after splitting must not be equal; when the number of first nodes is an even number , the number of topological nodes obtained after the two splits may be equal. Therefore, when generating the arbitration threshold, it needs to be generated according to the parity of the first number of nodes.
  • the fault can include topology splitting and topology loss.
  • arbitration it can be judged whether there is an arbitration disk according to the arbitration disk situation in the historical election set, and the largest single power supply node can be used. number and the first number of nodes to generate the quorum threshold.
  • the arbitration disk is the storage address of the core data of the cluster, which may be a hard disk. When there is an arbitration disk, arbitration can be performed by competing for the arbitration disk. After obtaining the arbitration threshold, use it to generate arbitration parameters, and the specific generation process is not limited.
  • the arbitration parameters can also include other arbitration rules according to the actual situation, so as to prevent the problem of data inconsistency caused by successful arbitration between the two topologies.
  • the step of using the first number of nodes to generate an arbitration threshold may include:
  • Step 31 If the number of the first nodes is an odd number, add one to the number of the first nodes and divide by two to obtain the arbitration threshold.
  • the arbitration threshold can be obtained by adding one to the number of the first nodes and dividing by two.
  • the arbitration threshold can be represented by N Q (Node), where:
  • Ne is the number of first nodes.
  • Step 32 If the number of the first nodes is an even number, determine whether there is an arbitration disk in the historical election set.
  • the number of the first nodes is an even number, it means that the number of nodes in the two network topologies after the split may be the same. At this time, it is necessary to judge whether there is an arbitration disk in the historical election set, and then determine whether the new network topology can pass the arbitration disk contention. Arbitration by way of grab.
  • Step 33 If there is an arbitration disk, divide the number of the first nodes by two to obtain the arbitration threshold.
  • the arbitration threshold can be obtained by dividing the first number of nodes by two, that is, the success can be achieved.
  • the network topology of the quorum needs to have at least half the number of nodes in the original cluster.
  • the arbitration threshold can be represented by N Q (Disk), where:
  • Step 34 If there is no arbitration disk, divide the number of the first nodes by two and add one to obtain the arbitration threshold.
  • the arbitration threshold can be represented by N Q (Node), where:
  • the step of generating the arbitration threshold by using the maximum number of single power supply nodes and the first number of nodes may include:
  • Step 41 If there is an arbitration disk in the historical election set, subtract the maximum number of single power supply nodes from the first node number to obtain the arbitration threshold.
  • the network topology participating in the arbitration only needs to be no less than the difference between the number of first nodes minus the maximum number of single power supply nodes. To avoid topology loss, even if the power supply corresponding to the maximum number of single power supply nodes is dropped, the remaining nodes can also provide services as a cluster. If a topology split occurs, even if the two network topologies after the split have the same number of nodes, the arbitration disk contention can also be performed based on the arbitration threshold to complete the arbitration. At this time, the arbitration threshold can be represented by N Q (Disk), where:
  • N Q (Disk) N e -N p .
  • N p is the maximum number of single power supply nodes.
  • Step 42 If there is no arbitration disk in the historical election set, subtract the maximum number of single power supply nodes from the first node number and add one to obtain the arbitration threshold.
  • the arbitration threshold can be represented by N Q (Node), where:
  • N Q (Node) N e -N p +1.
  • S103 Acquire the current network topology, and determine whether the current network topology satisfies the arbitration parameter.
  • the current network topology is obtained, and it is judged whether the current network topology satisfies the arbitration parameters.
  • the current network topology is the network topology where the specified node is located, which may specifically be any one of two network topologies obtained after topology splitting, or may be a network topology composed of remaining nodes after topology loss.
  • the number of the second authorized nodes in the current network topology, the situation of the arbitration disk, etc. can be determined, so as to subsequently judge whether the current network topology satisfies the arbitration parameters.
  • This embodiment does not limit the specific judgment method for judging whether the current network topology satisfies the arbitration parameter, and the specific judgment method is related to the content of the arbitration parameter.
  • step S104 is entered. If the current network topology does not satisfy the arbitration parameter, step S105 may be entered.
  • the step of judging whether the current network topology satisfies the arbitration parameter may include:
  • Step 51 Determine whether the number of second authorized nodes corresponding to the current network topology is less than the arbitration threshold.
  • Step 52 If the number of the second authorized nodes corresponding to the current network topology is less than the arbitration threshold, it is determined that the arbitration parameter is not satisfied.
  • the second authorized node book corresponding to the current network topology is smaller than the arbitration threshold, it means that a topology split has occurred, and the current network topology obtained from the split is a network topology with fewer nodes, so it cannot be used as a new cluster to provide external services. It is determined that it does not satisfy the quorum parameter.
  • Step 53 If the number of the second authorized nodes corresponding to the current network topology is not less than the arbitration threshold, determine whether the historical election set is the target election set.
  • the target election set in this embodiment is an election set with more than one power supply and an arbitration disk, or an election set with one power supply, an even number of first authorized nodes, and an arbitration disk.
  • the historical election set is the target election set
  • the corresponding arbitration thresholds are all represented by N Q (Node), and all have an arbitration disk, so it may be necessary to use the arbitration disk for arbitration.
  • Step 54 If the historical election set is not the target election set, it is determined that the arbitration parameter is satisfied.
  • the historical election set is not the target election set, it means that the arbitration cannot be performed through the arbitration disk, and the arbitration disk does not need to be arbitrated.
  • the number of second authorized nodes in the current network topology that is, the number of second authorized nodes is greater than the arbitration threshold. It means that the current network topology includes more authorized nodes, so it is determined that the arbitration parameter is satisfied.
  • Step 55 If the historical election set is the target election set, determine whether the number of second authorized nodes is equal to the arbitration threshold.
  • the historical election set is the target election set, it means that arbitration may need to be performed by competing for the arbitration disk. Therefore, it is further judged whether the number of the second authorized nodes is large enough that there is no need to compete for the arbitration disk. Arbitration. Therefore, judging whether the number of second authorized nodes is less than the arbitration threshold plus one is equivalent to judging whether the number of second authorized nodes is equal to the arbitration threshold because the number of second authorized nodes is not less than the arbitration threshold.
  • Step 56 If the number of the second authorized nodes is not equal to the arbitration threshold, it is determined that the arbitration parameter is satisfied.
  • the number of second authorized nodes is not equal to the arbitration threshold, it means that the number of second authorized nodes is greater than the arbitration threshold, and it can be determined that the current network topology has enough second authorized nodes, so there is no need to compete for the arbitration disk, and it can be directly determined that the number of second authorized nodes is satisfied.
  • Arbitration parameters
  • Step 57 If the number of the second authorized nodes is equal to the arbitration threshold, it is judged whether the arbitration parameter is satisfied by using the current arbitration disk situation of the current network topology.
  • the number of second authorized nodes is equal to the arbitration threshold, it means that the current network topology has the same number of second authorized nodes as another network topology, and it is necessary to determine whether the arbitration parameter is satisfied by way of contention on the arbitration disk.
  • step 57 may include:
  • Step 61 If the current network topology identifies the arbitration disk, execute the arbitration disk contention, and determine that the arbitration parameters are satisfied after the contention is successful.
  • Step 62 If no arbitration disk is identified in the current network topology, it is determined whether there is an arbitration node.
  • Step 63 If there is an arbitration node, it is determined that the arbitration parameter is satisfied.
  • Step 64 If there is no arbitration node, it is determined that the arbitration parameter is not satisfied.
  • the arbitration disk contention operation can be performed, that is, it competes with another network topology for the write permission of the arbitration disk. After the contention is successful, the current network topology can be determined. Arbitration parameters are satisfied. If the current network topology cannot identify the arbitration disk, the arbitration may be performed in a manner similar to competing for the arbitration disk. Specifically, it can be determined whether there is an arbitration node in the current network topology. The arbitration node is specifically the node with the smallest ID among the first authorization nodes not in the leaving state. If all the first authorization nodes are in the leaving state, the arbitration node is the node with the smallest ID among all the first authorization nodes.
  • the going-off state means that the first authorized node is going to be offline under control, for example, after the next round of calculation, so as to receive maintenance.
  • the master node of the cluster is generally the authorization node with the smallest ID, if the master node is the leaving node, it needs to re-arbitrate after the master node goes offline. Therefore, the arbitration node is specifically the first authorization node that is not in the leaving state. The node with the smallest ID. If all the first authorized nodes are in the leaving state, the arbitration node is determined as the node with the smallest ID among all the first authorized nodes in a conventional manner. Therefore, when there is an arbitration node in the current network topology, that is, there is a node that can serve as the cluster master node, it is determined that the current network topology satisfies the arbitration parameter.
  • S104 Provide a cluster service.
  • the current network topology satisfies the arbitration parameter, it means that the current network topology can serve as a new cluster to provide external services. Therefore, after determining that the current network topology satisfies the arbitration parameter, the current network topology is used to provide the cluster service.
  • the specific method of providing cluster services is not limited. For example, operations such as initialization are required, and services are provided externally as a new cluster after initialization.
  • the current network topology does not meet the arbitration parameters, it means that the current network topology cannot provide services as a new cluster, and a topology split occurs at this time, and another split network topology can provide services as a new cluster.
  • the specific content of the preset operation is not limited, for example, each node in the current network topology can be controlled to go offline, or to exit the original cluster.
  • the cluster arbitration method By applying the cluster arbitration method provided by the embodiment of the present application, after a split or loss occurs in the network topology of the cluster, the number of first nodes and the power supply situation corresponding to the historical election set before the split or loss will be obtained, and use them to determine whether A quorum that can continue to serve as a cluster.
  • the arbitration parameter is generated by the number of the first nodes, and can limit the number of nodes in the network topology after the failure based on the number of the original nodes, so as to ensure that if the network topology split occurs, there is only one new network Topology can provide services as a cluster to prevent data inconsistency caused by two clusters providing services at the same time.
  • the nodes in the network topology can serve as a new cluster to provide external services.
  • the arbitration parameter After obtaining the arbitration parameter, it is judged whether the current network topology satisfies the arbitration parameter. If the current network topology satisfies the arbitration parameter, the cluster service can be provided to the outside, so that the cluster continues to work. This method does not require that the nodes in the new network topology must be the majority in the original cluster after a failure. On the basis of ensuring data consistency, the network topology can continue to work even if it contains any number of nodes, which improves the Cluster survival.
  • the following describes the cluster arbitration apparatus provided by the embodiments of the present application.
  • the cluster arbitration apparatus described below and the cluster arbitration method described above may refer to each other correspondingly.
  • FIG. 2 is a schematic structural diagram of a cluster arbitration apparatus provided by an embodiment of the present application, including:
  • an acquisition module 110 configured to acquire a historical election set, and use the historical election set to obtain the number of first nodes and power supply conditions;
  • a generating module 120 configured to generate an arbitration parameter by using the first number of nodes according to the power supply situation
  • the judgment module 130 is used for obtaining the current network topology, and judging whether the current network topology satisfies the arbitration parameter;
  • the service module 140 is configured to provide a cluster service if the current network topology satisfies the arbitration parameter.
  • the obtaining module 110 includes:
  • the statistical unit is used to perform statistics on the first authorized nodes in the historical election set to obtain the number of the first nodes
  • a power supply determination unit configured to obtain power supply information corresponding to each first authorization node, and determine whether all the first authorization nodes are powered by one power supply;
  • a single power supply unit configured to determine the power supply situation as a single power supply if all the first authorized nodes are powered by one power supply;
  • the unit for determining the maximum number of single power supply nodes is used to determine the power supply situation as the maximum number of single power supply nodes if all the first authorized nodes are not powered by one power supply; the maximum number of single power supply nodes is greater than half of the number of first nodes.
  • the generating module 120 includes:
  • a first arbitration threshold generating unit configured to generate an arbitration threshold by using the first number of nodes according to the parity of the first number of nodes if the power supply is a single power supply;
  • the second arbitration threshold generating unit is configured to generate an arbitration threshold by using the maximum single power supply node number and the first node number according to the arbitration disk situation in the historical election set if the power supply condition is the maximum single power supply node number;
  • the arbitration parameter generating unit is used for generating the arbitration parameter by using the arbitration threshold.
  • the first arbitration threshold generating unit includes:
  • a first calculation subunit used for adding one to the first node and dividing it by two if the number of the first nodes is an odd number to obtain an arbitration threshold
  • the judgment subunit is used to judge whether there is an arbitration disk in the historical election set if the number of the first nodes is an even number;
  • the second calculation subunit is used to divide the number of the first nodes by two if there is an arbitration disk in the historical election set to obtain the arbitration threshold;
  • the third calculation subunit is used to divide the number of the first nodes by two and add one to obtain the arbitration threshold if there is no arbitration disk in the historical election set.
  • the second arbitration threshold generating unit includes:
  • the fourth calculation subunit is used to obtain the arbitration threshold by subtracting the maximum number of single power supply nodes from the first node number if there is an arbitration disk in the historical election set;
  • the fifth calculation subunit is used for obtaining the arbitration threshold by subtracting the maximum number of single power supply nodes from the first node number and adding one if there is no arbitration disk in the historical election set.
  • the judgment module 130 includes:
  • a first judging unit for judging whether the number of second authorized nodes corresponding to the current network topology is less than the arbitration threshold
  • a first determining unit configured to determine that the arbitration parameter is not satisfied if the number of the second authorized nodes corresponding to the current network topology is less than the arbitration threshold
  • the target election set judgment unit is used to judge whether the historical election set is a target election set if the number of second authorized nodes corresponding to the current network topology is not less than the arbitration threshold; the target election set is an election set with more than one power supply and an arbitration disk , or an election set with one power supply, an even number of first authorized nodes, and a quorum disk;
  • the second determination unit is used for determining that the arbitration parameter is satisfied if the historical election set is not the target election set;
  • a second judgment unit configured to judge whether the number of the second authorized nodes is equal to the arbitration threshold if the historical election set is the target election set;
  • a third determining unit configured to determine that the arbitration parameter is satisfied if the number of the second authorized nodes is not equal to the arbitration threshold
  • the arbitration disk judging unit is configured to judge whether the arbitration parameter is satisfied by using the current arbitration disk situation of the current network topology if the number of the second authorized nodes is equal to the arbitration threshold.
  • the arbitration disk judgment unit includes:
  • the contention subunit is used to execute the contention for the arbitration disc if the current network topology identifies the arbitration disc, and determine that the arbitration parameter is satisfied after the contention is successful;
  • the arbitration node judgment subunit is used to judge whether there is an arbitration node if the current network topology does not identify the arbitration disk;
  • Satisfaction determination subunit used to determine that the arbitration parameter is satisfied if there is an arbitration node
  • the non-satisfaction determination subunit is used to determine that the arbitration parameter is not satisfied if there is no arbitration node.
  • the electronic device provided by the embodiment of the present application is introduced below, and the electronic device described below and the cluster arbitration method described above may refer to each other correspondingly.
  • the electronic device 100 may include a processor 101 and a memory 102 , and may further include one or more of a multimedia component 103 , an information input/information output (I/O) interface 104 and a communication component 105 .
  • a multimedia component 103 may be included in the electronic device 100 .
  • I/O information input/information output
  • the processor 101 is used to control the overall operation of the electronic device 100 to complete all or part of the steps in the above-mentioned cluster arbitration method;
  • the memory 102 is used to store various types of data to support the operation of the electronic device 100. These data For example, instructions for any application or method to operate on the electronic device 100 may be included, as well as application-related data.
  • the memory 102 may be implemented by any type of volatile or non-volatile memory device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (Electrically Erasable Programmable Read-Only Memory) Erasable Programmable Read-Only Memory, EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (Read- One or more of Only Memory, ROM), magnetic memory, flash memory, magnetic disk or optical disk.
  • SRAM Static Random Access Memory
  • EEPROM Electrically Erasable Programmable Read-Only Memory
  • EPROM Erasable Programmable Read-Only Memory
  • PROM Programmable Read-Only Memory
  • Read- One or more of Only Memory ROM
  • magnetic memory flash memory
  • flash memory magnetic disk or optical disk.
  • Multimedia components 103 may include screen and audio components.
  • the screen can be, for example, a touch screen, and the audio component is used for outputting and/or inputting audio signals.
  • the audio component may include a microphone for receiving external audio signals.
  • the received audio signal may be further stored in the memory 102 or transmitted through the communication component 105 .
  • the audio assembly also includes at least one speaker for outputting audio signals.
  • the I/O interface 104 provides an interface between the processor 101 and other interface modules, and the above-mentioned other interface modules may be a keyboard, a mouse, a button, and the like. These buttons can be virtual buttons or physical buttons.
  • the communication component 105 is used for wired or wireless communication between the electronic device 100 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC for short), 2G, 3G or 4G, or one or a combination of them, so the corresponding communication component 105 may include: Wi-Fi parts, Bluetooth parts, NFC parts.
  • the electronic device 100 may be implemented by one or more Application Specific Integrated Circuit (ASIC for short), Digital Signal Processor (DSP for short), Digital Signal Processing Device (DSPD for short), Programmable Logic Device (PLD for short), Field Programmable Gate Array (FPGA for short), controller, microcontroller, microprocessor or other electronic components are implemented for implementing the above embodiments The given cluster quorum method.
  • ASIC Application Specific Integrated Circuit
  • DSP Digital Signal Processor
  • DSPD Digital Signal Processing Device
  • PLD Programmable Logic Device
  • FPGA Field Programmable Gate Array
  • the following describes the computer-readable storage medium provided by the embodiments of the present application.
  • the computer-readable storage medium described below and the cluster arbitration method described above may refer to each other correspondingly.
  • the present application further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the foregoing cluster arbitration method are implemented.
  • the computer-readable storage medium may include: a USB flash drive, a removable hard disk, a read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), a magnetic disk or an optical disk, etc. that can store program codes medium.
  • a software module can be placed in random access memory (RAM), internal memory, read only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other in the technical field. in any other known form of storage medium.
  • RAM random access memory
  • ROM read only memory
  • electrically programmable ROM electrically erasable programmable ROM
  • registers hard disk, removable disk, CD-ROM, or any other in the technical field. in any other known form of storage medium.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Environmental & Geological Engineering (AREA)
  • Physics & Mathematics (AREA)
  • Algebra (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Mathematical Physics (AREA)
  • Probability & Statistics with Applications (AREA)
  • Pure & Applied Mathematics (AREA)
  • Hardware Redundancy (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本申请公开了一种集群仲裁方法、装置、电子设备及计算机可读存储介质,该方法包括:获取历史选举集,并利用历史选举集得到第一节点数量和电源情况;根据电源情况,利用第一节点数量生成仲裁参数;获取当前网络拓扑,并判断当前网络拓扑是否满足仲裁参数;若满足仲裁参数,则提供集群服务;该方法并不要求故障后新的网络拓扑中的节点必须为原本集群中的多数,在保证了数据一致性的基础上,使网络拓扑在包含任意数量节点的情况下均可继续工作,改善了集群的存续性。

Description

一种集群仲裁方法、装置、电子设备及可读存储介质
本申请要求在2020年12月02日提交中国专利局、申请号为202011391793.6、发明名称为“一种集群仲裁方法、装置、电子设备及可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及集群技术领域,特别涉及一种集群仲裁方法、集群仲裁装置、电子设备及计算机可读存储介质。
背景技术
分布式集群在工作中,集群节点可能会发生故障,或者集群节点间的网络通信可能会发生中断,这样会导致集群拓扑出现损失或者分裂。若发生了拓扑损失,留存在拓扑中的如果不接管集群功能,集群就会停机;若发生了拓扑分裂,且分裂后的各个部分都尝试接管集群,由于部分间相互不能通信,状态一致性就会被破坏。为了解决上述问题,相关技术采用多数仲裁的方式,即在集群发生上述两种故障时进行网络拓扑确认,如果所在的拓扑连通分支包含了半数以上的节点,那么它所在的分支就将接管集群,同时处于其他分支的节点退出集群。但是相关技术的局限性较大,在很多可以继续作为集群向外提供服务的情况下,仅由于存活的节点数量没有超过半数而无法提供服务,导致集群的存续性较差。
因此,相关技术存在的集群存续性较差的问题,是本领域技术人员需要解决的技术问题。
发明内容
有鉴于此,本申请的目的在于提供一种集群仲裁方法、集群仲裁装置、电子设备及计算机可读存储介质,使网络拓扑在包含任意数量节点的情况下均可继续工作,改善了集群的存续性。
为解决上述技术问题,本申请提供了一种集群仲裁方法,包括:
获取历史选举集,并利用所述历史选举集得到第一节点数量和电源情况;
根据所述电源情况,利用所述第一节点数量生成仲裁参数;
获取当前网络拓扑,并判断所述当前网络拓扑是否满足所述仲裁参数;
若所述当前网络拓扑满足所述仲裁参数,则提供集群服务。
可选地,所述利用所述历史选举集得到第一节点数量和电源情况,包括:
对所述历史选举集中的第一授权节点进行统计,得到所述第一节点数量;
获取各个所述第一授权节点对应的电源信息,判断所有的所述第一授权节点是否由一个电源供电;
若所有的所述第一授权节点由一个所述电源供电,则将所述电源情况确定为单一供电;
若所有的所述第一授权节点不由一个所述电源供电,则将所述电源情况确定为最大单一供电节点数;所述最大单一供电节点数大于所述第一节点数量的半数。
可选地,所述根据所述电源情况,利用所述第一节点数量生成仲裁参数,包括:
若所述电源情况为所述单一供电,则根据所述第一节点数量的奇偶情况,利用所述第一节点数量生成仲裁阈值;
若所述电源情况为所述最大单一供电节点数,则根据所述历史选举集的仲裁盘情况,利用所述最大单一供电节点数和所述第一节点数量生成所述仲裁阈值;
利用所述仲裁阈值生成所述仲裁参数。
可选地,所述根据所述第一节点数量的奇偶情况,利用所述第一节点数量生成仲裁阈值,包括:
若所述第一节点数量为奇数,则将所述第一节点数量加一后除以二,得到所述仲裁阈值;
若所述第一节点数量为偶数,则判断所述历史选举集中是否存在仲裁盘;
若所述历史选举集中存在所述仲裁盘,则将所述第一节点数量除以二,得到所述仲裁阈值;
若所述历史选举集中不存在所述仲裁盘,则将所述第一节点数量除以二后加一,得到所述仲裁阈值。
可选地,所述根据所述历史选举集的仲裁盘情况,利用所述最大单一供电节点数和所述第一节点数量生成所述仲裁阈值,包括:
若所述历史选举集中存在仲裁盘,则利用所述第一节点数量减去所述最大单一供电节点数,得到所述仲裁阈值;
若所述历史选举集中不存在所述仲裁盘,则利用所述第一节点数量减去所述最大单一供电节点数后加一,得到所述仲裁阈值。
可选地,所述判断所述当前网络拓扑是否满足所述仲裁参数,包括:
判断所述当前网络拓扑对应的第二授权节点数是否小于所述仲裁阈值;
若所述当前网络拓扑对应的第二授权节点数小于所述仲裁阈值,则确定不满足所述仲裁参数;
若所述当前网络拓扑对应的第二授权节点数不小于所述仲裁阈值,则判断所述历史选举集是否为目标选举集;所述目标选举集为具有大于一个所述电源且具有仲裁盘的选举集,或者为具有一个所述电源、所述第一授权节点数为偶数且具有仲裁盘的选举集;
若所述历史选举集不为所述目标选举集,则确定满足所述仲裁参数;
若所述历史选举集为所述目标选举集,则判断所述第二授权节点数是否等于所述仲裁阈值;
若所述第二授权节点数不等于所述仲裁阈值,则确定满足所述仲裁参数;
若所述第二授权节点数等于所述仲裁阈值,则利用所述当前网络拓扑的当前仲裁盘情况判断是否满足所述仲裁参数。
可选地,所述利用所述当前网络拓扑的当前仲裁盘情况判断是否满足所述仲裁参数,包括:
若所述当前网络拓扑识别到所述仲裁盘,则执行仲裁盘争抢,并在争抢成功后确定满足所述仲裁参数;
若所述当前网络拓扑未识别到所述仲裁盘,则判断是否存在仲裁节点;
若存在所述仲裁节点,则确定满足所述仲裁参数;
若不存在所述仲裁节点,则确定不满足所述仲裁参数。
本申请还提供了一种集群仲裁装置,包括:
获取模块,用于获取历史选举集,并利用所述历史选举集得到第一节点数量和电源情况;
生成模块,用于根据所述电源情况,利用所述第一节点数量生成仲裁参数;
判断模块,用于获取当前网络拓扑,并判断所述当前网络拓扑是否满足所述仲裁参数;
服务模块,用于若所述当前网络拓扑满足所述仲裁参数,则提供集群服务。
本申请还提供了一种电子设备,包括存储器和处理器,其中:
所述存储器,用于保存计算机程序;
所述处理器,用于执行所述计算机程序,以实现上述的集群仲裁方法。
本申请还提供了一种计算机可读存储介质,用于保存计算机程序,其中,所述计算机程序被处理器执行时实现上述的集群仲裁方法。
本申请提供的集群仲裁方法,获取历史选举集,并利用历史选举集得到第一节点数量和电源情况;根据电源情况,利用第一节点数量生成仲裁参数;获取当前网络拓扑,并判断当前网络拓扑是否满足仲裁参数;若满足仲裁参数,则提供集群服务。
可见,该方法在集群的网络拓扑发生一次分裂或损失的故障后,会获取分裂或损失前的历史选举集对应的第一节点数量和电源情况,并利用其进行是否能够继续作为集群提供服务的仲裁。具体的,仲裁参数利用第一节点数量生成,可以基于原有节点的数量,对故障后的网络拓扑中的节点数量做出限制,保证若发生网络拓扑分裂,则有且仅有一个新的网络拓扑能够作为集群对外提供服务,防止出现两个集群同时对外提供服务引起的数据不一致问题。同时,还可以保证在发生拓扑损失后仅有一个网络拓扑时,确保该网络拓扑中的节点能够作为新的集群对外提供服务。在得到仲裁参数后判断当前网络拓扑是否满足该仲裁参数,若当前网络拓扑满足该仲裁参数,则可以向外提供集群服务,使集群继续工作。该方法并不要求故障后新的网络拓扑中的节点必须为原本集群中的多数,在保证了数据一致性的基础上,使网络拓扑在包含任意数量节点的情况下均可继续工作,改善了集群的存续性。
此外,本申请还提供了一种集群仲裁装置、电子设备及计算机可读存储介质,同样具有上述有益效果。
附图说明
为了更清楚地说明本申请实施例或相关技术中的技术方案,下面将对实施例或相关技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据提供的附图获得其他的附图。
图1为本申请实施例提供的一种集群仲裁方法流程图;
图2为本申请实施例提供的一种集群仲裁装置的结构示意图;
图3为本申请实施例提供的一种电子设备的结构示意图。
具体实施方式
为使本申请实施例的目的、技术方案和优点更加清楚,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
请参考图1,图1为本申请实施例提供的一种集群仲裁方法流程图。该方法包括:
S101:获取历史选举集,并利用历史选举集得到第一节点数量和电源情况。
需要说明的是,本实施例提供的集群仲裁方法的全部或部分步骤可以利用当前网络拓扑中指定的节点执行,该节点可以为当前网路拓扑中的任意一个节点,例如可以为编号最小的节点,或者可以为编号最大的节点,或者可以为网络地址最小的节点。具体的,在发生网络拓扑分裂或损失时,即在原有集群中的部分节点与另外的节点之间的网络通讯断开,造成拓扑分类;或者在部分节点关机或故障掉电时。各个节点可以在当前网络拓扑中广播自身 编号,或者广播IP地址。在获取到所有节点的编号或IP地址后,判断自身是否为被指定的节点,例如编号最小的节点。若是,则执行集群仲裁方法中的全部或部分步骤。
历史选举集为集群发生网络故障前作为集群提供服务时,集群中的授权节点组成的集合。授权节点为集群状态足够新的节点,其可以参与集群投票或提供服务,例如进行是否作为集群继续向外提供服务的仲裁的投票,或者可以为其他投票,授权节点的数量不做限定。状态不够新的节点无法作为授权节点,也无法进行投票,需要更新集群状态后才能成为授权节点。历史选举集可以在集群中的各个节点上存储,或者在各个授权节点上存储。通过获取历史选举集,可以确定故障发生前的集群拓扑,进而以此为基准生成对应的仲裁参数,并利用仲裁参数进行是否可以作为集群继续提供服务的仲裁。
第一节点数量为历史选举集中第一授权节点的数量,其具体大小不做限定。电源情况为历史选举集中各个第一授权节点的供电情况。需要说明的是,第一授权节点可以全部由一个电源供电,也可以由多个电源供电。基于此,本实施例提供的一种具体的第一节点数量和电源情况获取方法。利用历史选举集得到第一节点数量和电源情况的步骤可以包括:
步骤11:对历史选举集中的第一授权节点进行统计,得到第一节点数量。
步骤12:获取各个第一授权节点对应的电源信息,判断所有的第一授权节点是否由一个电源供电。
步骤13:若所有的第一授权节点由一个电源供电,则将电源情况确定为单一供电。
步骤14:若所有的第一授权节点不由一个电源供电,则将电源情况确定为最大单一供电节点数。
需要说明的是,历史选举集中仅具有第一授权节点,因此对历史选举集中的第一授权节点进行统计,就是统计历史选举集中的节点数量。在统计第一节点数量的同时,还可以获取各个第一授权节点对应的电源信息,电源信息用于表示对第一授权节点供电的电源的身份,其具体可以为电源ID、电源名称等。利用各个电源信息判断所有的第一授权节点是否由一个电源供电,即判断历史选举集中的所有节点是否均由一个电源供电。若历史选举集中的所有节点由一个电源供电,则将电源情况确定为单一供电;若历史选举集中 的所有节点不由一个电源供电,即说明历史选举集中的节点由两个以上的电源分别供电,此时将电源情况确定为最大单一供电节点数。最大单一供电节点数即为同一个电源供电的最大节点数,由于历史选举集中由两个以上的电源分别供电,因此各个电源供电的节点数量必然存在最大值,则该最大值即为最大单一供电节点数。需要说明的是,本实施例中每个第一授权节点仅由一个电源供电,且本实施例中的最大单一供电节点数大于第一节点数量的半数。对于最大单一供电节点数不大于第一节点数量的半数的情况本实施例不做讨论。
S102:根据电源情况,利用第一节点数量生成仲裁参数。
在得到电源情况和第一节点数量后,可以根据电源情况,利用第一节点数量生成仲裁参数。仲裁参数的具体内容不做限定,其可以根据实际需要进行设置。由于拓扑损失可以由节点掉电引起,因此可以理解的是,在不同的供电情况下,发生拓扑损失后的影响不同。根据电源情况和第一节点数量生成的仲裁参数不仅可以在发生拓扑分裂后从两个网络拓扑中选择一个作为新的集群并向外提供服务,防止两个网络拓扑中的节点均组成集群提供服务,以便保证数据的单一性的同时提高集群的存续性;还可以在发生拓扑损失后,使当前网络拓扑不受到节点数量的限制而继续提供服务,提高了集群的存续性。
例如,在一种情况中,集群中第一授权节点的数量为偶数,在发生拓扑分裂后,分裂得到的两个新的网络拓扑中的授权节点均为原有的一半。在这种情况下,相关技术无法向外提供服务。在另一种情况中,集群中大部分的第一授权节点由同一个电源供电,若该电源突然断电,相关技术判断集群中剩余的节点不占多数,因此无法继续服务。本申请在生成仲裁参数时考虑电源情况,生成的仲裁参数可以考虑电源掉电造成拓扑损失的情况,在发生上述情况或与上述类似的情况时能够进行准确地仲裁,提高集群的存续性。
在一种可行的实施方式中,为了保证在任一情况下均可以仲裁成功,仲裁参数可以包括仲裁阈值,利用仲裁阈值对进行仲裁的拓扑结构中的节点数量进行限制。具体的,根据电源情况,利用第一节点数量生成仲裁参数的步骤,可以包括:
步骤21:若电源情况为单一供电,则根据第一节点数量的奇偶情况,利用第一节点数量生成仲裁阈值。
步骤22:若电源情况为最大单一供电节点数,则根据历史选举集的仲裁盘情况,利用最大单一供电节点数和第一节点数量生成仲裁阈值。
步骤23:利用仲裁阈值生成仲裁参数。
若电源情况为单一供电,则可以不考虑拓扑损失的情况,因为若发生了拓扑损失,由于所有第一授权节点均由一个电源供电,则整个集群都无法工作。因此在需要进行仲裁时,必然是发生了拓扑分裂。拓扑分裂后得到的新的拓扑中的节点数量与第一节点数量相关,在第一节点数量为奇数时,两个分裂后得到的拓扑的节点数量必然不可能相等;在第一节点数量为偶数时,两个分裂后得到的拓扑节点数量则可能相等。因此在生成仲裁阈值时,需要根据第一节点数量的奇偶情况生成。若电源情况为最大单一供电节点数,则故障可以包括拓扑分裂和拓扑损失两种,在进行仲裁时,可以根据历史选举集中的仲裁盘情况,即判断是否存在仲裁盘,并利用最大单一供电节点数和第一节点数量生成仲裁阈值。仲裁盘即为集群核心数据的存储地址,其具体可以为一块硬盘。当存在仲裁盘时可以通过争抢仲裁盘的方式进行仲裁。在得到仲裁阈值后,利用其生成仲裁参数,具体生成过程不作限制。仲裁参数中除了包括仲裁阈值外,还可以根据实际情况包括其他仲裁规则,以便防止出现两个拓扑均仲裁成功导致数据不一致的问题。
具体的,在一种可行的实施方式中,根据所述第一节点数量的奇偶情况,利用所述第一节点数量生成仲裁阈值的步骤可以包括:
步骤31:若第一节点数量为奇数,则将第一节点数量加一后除以二,得到仲裁阈值。
具体的,若第一节点数量为奇数,则在发生故障后必然存在一个网络拓扑具有更多的节点,因此将第一节点数量加一后除以二,即可得到仲裁阈值,在这种情况下,仲裁阈值可以用N Q(Node)表示,其中:
Figure PCTCN2021121209-appb-000001
其中N e为第一节点数量。通过选择节点数量更多的网络拓扑作为新的集群,可以保证只有一个网络拓扑能够仲裁成功,同时保证集群的运行能力。
步骤32:若第一节点数量为偶数,则判断历史选举集中是否存在仲裁盘。
若第一节点数量为偶数,则说明可能出现分裂后两个网络拓扑中节点数量相同的情况,此时需要判断历史选举集中是否存在仲裁盘,进而判断新出现的网络拓扑是否可以通过仲裁盘争抢的方式进行仲裁。
步骤33:若存在仲裁盘,则将第一节点数量除以二,得到仲裁阈值。
若存在仲裁盘,则说明在两个新的网络拓扑中节点数量相同的情况下,可以通过争抢仲裁盘的方式进行仲裁,因此可以将第一节点数量除以二得到仲裁阈值,即可以成功仲裁的网络拓扑至少需要有原有集群的一半数量的节点。此时,仲裁阈值可以用N Q(Disk)表示,其中:
Figure PCTCN2021121209-appb-000002
步骤34:若不存在仲裁盘,则将第一节点数量除以二后加一,得到仲裁阈值。
若不存在仲裁盘,则说明无法通过争抢仲裁盘的方式进行仲裁,此时则只能通过节点数量进行仲裁,因此成功仲裁的节点需要有超过第一节点数量半数以上的节点,因此将第一节点数量除以二后加一得到仲裁阈值,仲裁阈值可以用N Q(Node)表示,其中:
Figure PCTCN2021121209-appb-000003
具体的,在一种可行的实施方式中,根据历史选举集的仲裁盘情况,利用最大单一供电节点数和第一节点数量生成仲裁阈值的步骤可以包括:
步骤41:若历史选举集中存在仲裁盘,则利用第一节点数量减去最大单一供电节点数,得到仲裁阈值。
当历史选举集中存在仲裁盘时,说明可以通过争抢仲裁盘的方式完成仲裁,因此参与仲裁的网络拓扑只要不小于第一节点数量减去最大单一供电节点数的差值即可,即若发生了拓扑损失,即使是最大单一供电节点数对应的电源掉线,则剩下的节点同样可以作为集群提供服务。若发生了拓扑分裂,即使分裂后的两个网络拓扑具有相同的节点数,则同样可以基于该仲裁阈值进行仲裁盘争抢,进而完成仲裁。此时,仲裁阈值可以用N Q(Disk)表示,其中:
N Q(Disk)=N e-N p
其中,N p为最大单一供电节点数。
步骤42:若历史选举集中不存在仲裁盘,则利用第一节点数量减去最大单一供电节点数后加一,得到仲裁阈值。
若历史选举集中不存在仲裁盘,则说明无法通过争抢仲裁盘的方式进行仲裁,因此需要在利用第一节点数量减去最大单一供电节点数后加一,得到仲裁阈值。此时,仲裁阈值可以用N Q(Node)表示,其中:
N Q(Node)=N e-N p+1。
S103:获取当前网络拓扑,并判断当前网络拓扑是否满足仲裁参数。
在确定仲裁参数后,获取当前网络拓扑,并判断当前网络拓扑是否满足仲裁参数。当前网络拓扑即为指定的节点所处的网络拓扑中,其具体可以为拓扑分裂后得到的两个网络拓扑中的任意一个,或者可以为拓扑损失后剩余的节点组成的网络拓扑。在获取当前网络拓扑后,可以确定当前网络拓扑中第二授权节点的数量、仲裁盘情况等,以便后续判断当前网络拓扑是否满足仲裁参数。本实施例并不限定判断当前网络拓扑是否满足仲裁参数的具体判断方式,该具体判断方式与仲裁参数的内容相关,例如当仲裁参数中存在仲裁阈值时,则可以判断当前网络拓扑中的第二授权节点的数量是否小于仲裁阈值。若当前网络拓扑满足仲裁参数,则说明当前网络拓扑中的第二授权节点可以组合起来作为新的集群对外提供服务,因此进入S104步骤。若当前网络拓扑不满足仲裁参数,则可以进入S105步骤。
具体的,基于S102步骤中的说明,判断当前网络拓扑是否满足仲裁参数的步骤可以包括:
步骤51:判断当前网络拓扑对应的第二授权节点数是否小于仲裁阈值。
步骤52:若当前网络拓扑对应的第二授权节点数小于仲裁阈值,则确定不满足仲裁参数。
若当前网络拓扑对应的第二授权节点书小于仲裁阈值,则说明当前发生了拓扑分裂,且分裂得到的当前网络拓扑为节点更少的一个网络拓扑,因此其不能作为新的集群对外提供服务,确定其不满足仲裁参数。
步骤53:若当前网络拓扑对应的第二授权节点数不小于仲裁阈值,则判断历史选举集是否为目标选举集。
需要说明的是,本实施例中的目标选举集为,具有大于一个电源且具有仲裁盘的选举集,或者为具有一个电源、第一授权节点数为偶数且具有仲裁 盘的选举集。在历史选举集为目标选举集时,其对应的仲裁阈值均由N Q(Node)表示,且均具有仲裁盘,因此可能需要利用仲裁盘进行仲裁。
步骤54:若历史选举集不为目标选举集,则确定满足仲裁参数。
若历史选举集不为目标选举集,则说明无法通过仲裁盘进行仲裁,也不需要通过仲裁盘进行仲裁,当前网络拓扑中的第二授权节点的数量,即第二授权节点数大于仲裁阈值,说明当前网络拓扑中包括更多的授权节点,因此确定满足仲裁参数。
步骤55:若历史选举集为目标选举集,则判断第二授权节点数是否等于仲裁阈值。
具体的,若历史选举集为目标选举集,则说明可能需要通过争抢仲裁盘的方式进行仲裁,因此进一步判断第二授权节点的数量是否足够多,以至于不需要通过争抢仲裁盘的方式进行仲裁。故判断第二授权节点数是否小于仲裁阈值加一,由于第二授权节点数不小于仲裁阈值,因此相当于判断第二授权节点数是否等于仲裁阈值。
步骤56:若第二授权节点数不等于仲裁阈值,则确定满足仲裁参数。
若第二授权节点数不等于仲裁阈值,则说明第二授权节点数大于仲裁阈值,可以确定当前网络拓扑具有足够多的第二授权节点,因此可以不需要进行仲裁盘争抢,直接确定其满足仲裁参数。
步骤57:若第二授权节点数等于仲裁阈值,则利用当前网络拓扑的当前仲裁盘情况判断是否满足仲裁参数。
若第二授权节点数等于仲裁阈值,则说明当前网络拓扑与另一个网络拓扑具有相同的第二授权节点数,需要通过仲裁盘争抢的方式判断是否满足仲裁参数。
具体的,在一种实施方式中,步骤57可以包括:
步骤61:若当前网络拓扑识别到仲裁盘,则执行仲裁盘争抢,并在争抢成功后确定满足仲裁参数。
步骤62:若当前网络拓扑未识别到仲裁盘,则判断是否存在仲裁节点。
步骤63:若存在仲裁节点,则确定满足仲裁参数。
步骤64:若不存在仲裁节点,则确定不满足仲裁参数。
在本实施例中,若当前网络拓扑识别到仲裁盘,则可以执行仲裁盘争抢操作,即与另外一个网络拓扑争抢仲裁盘的写入权限,在争抢成功后,可以确定当前网络拓扑满足仲裁参数。若当前网络拓扑无法识别到仲裁盘,则可以利用类似于争抢仲裁盘的方式进行仲裁。具体的,可以判断当前网络拓扑中是否存在仲裁节点。仲裁节点具体为非将离状态的第一授权节点中ID最小的节点,若所有的第一授权节点均处于将离状态,则仲裁节点为所有第一授权节点中ID最小的节点。具体的,将离状态是指该第一授权节点将要受控下线,例如在下一轮计算过后下限,以便接收维护。由于集群的主节点一般也为ID最小的授权节点,因此若主节点为将离节点,则在主节点下线后需要重新进行仲裁,因此将仲裁节点具体为非将离状态的第一授权节点中ID最小的节点。若所有的第一授权节点均处于将离状态,则按照常规方式,将仲裁节点确定为所有第一授权节点中ID最小的节点。因此当在当前网络拓扑中存在仲裁节点,即存在可以作为集群主节点的节点时,确定当前网络拓扑满足仲裁参数。
S104:提供集群服务。
若当前网络拓扑满足仲裁参数,则说明当前网络拓扑可以作为新的集群对外提供服务,因此在确定当前网络拓扑满足仲裁参数后利用当前网络拓扑提供集群服务。具体提供集群服务的方式不做限定,例如需要进行初始化等操作,在初始化后作为新的集群对外提供服务。
S105:预设操作。
若当前网络拓扑不满足仲裁参数,则说明当前网络拓扑无法作为新的集群对外提供服务,且此时发生了拓扑分裂,分裂的另外一个网络拓扑可以作为新的集群对外提供服务,此时可以执行预设操作,预设操作的具体内容不做限定,例如可以控制当前网络拓扑中的各个节点下线,或者退出原本的集群。
应用本申请实施例提供的集群仲裁方法,在集群的网络拓扑发生一次分裂或损失的故障后,会获取分裂或损失前的历史选举集对应的第一节点数量和电源情况,并利用其进行是否能够继续作为集群提供服务的仲裁。具体的,仲裁参数利用第一节点数量生成,可以基于原有节点的数量,对故障后的网络拓扑中的节点数量做出限制,保证若发生网络拓扑分裂,则有且仅有一个 新的网络拓扑能够作为集群对外提供服务,防止出现两个集群同时对外提供服务引起的数据不一致问题。同时,还可以保证在发生拓扑损失后仅有一个网络拓扑时,确保该网络拓扑中的节点能够作为新的集群对外提供服务。在得到仲裁参数后判断当前网络拓扑是否满足该仲裁参数,若当前网络拓扑满足该仲裁参数,则可以向外提供集群服务,使集群继续工作。该方法并不要求故障后新的网络拓扑中的节点必须为原本集群中的多数,在保证了数据一致性的基础上,使网络拓扑在包含任意数量节点的情况下均可继续工作,改善了集群的存续性。
下面对本申请实施例提供的集群仲裁装置进行介绍,下文描述的集群仲裁装置与上文描述的集群仲裁方法可相互对应参照。
请参考图2,图2为本申请实施例提供的一种集群仲裁装置的结构示意图,包括:
获取模块110,用于获取历史选举集,并利用历史选举集得到第一节点数量和电源情况;
生成模块120,用于根据电源情况,利用第一节点数量生成仲裁参数;
判断模块130,用于获取当前网络拓扑,并判断当前网络拓扑是否满足仲裁参数;
服务模块140,用于若当前网络拓扑满足仲裁参数,则提供集群服务。
可选地,获取模块110,包括:
统计单元,用于对历史选举集中的第一授权节点进行统计,得到第一节点数量;
供电判断单元,用于获取各个第一授权节点对应的电源信息,判断所有的第一授权节点是否由一个电源供电;
单一供电单元,用于若所有的第一授权节点由一个电源供电,则将电源情况确定为单一供电;
最大单一供电节点数确定单元,用于若所有的第一授权节点不由一个电源供电,则将电源情况确定为最大单一供电节点数;最大单一供电节点数大于第一节点数量的半数。
可选地,生成模块120,包括:
第一仲裁阈值生成单元,用于若电源情况为单一供电,则根据第一节点数量的奇偶情况,利用第一节点数量生成仲裁阈值;
第二仲裁阈值生成单元,用于若电源情况为最大单一供电节点数,则根据历史选举集的仲裁盘情况,利用最大单一供电节点数和第一节点数量生成仲裁阈值;
仲裁参数生成单元,用于利用仲裁阈值生成仲裁参数。
可选地,第一仲裁阈值生成单元,包括:
第一计算子单元,用于若第一节点数量为奇数,则将第一节点数量加一后除以二,得到仲裁阈值;
判断子单元,用于若第一节点数量为偶数,则判断历史选举集中是否存在仲裁盘;
第二计算子单元,用于若历史选举集中存在仲裁盘,则将第一节点数量除以二,得到仲裁阈值;
第三计算子单元,用于若历史选举集中不存在仲裁盘,则将第一节点数量除以二后加一,得到仲裁阈值。
可选地,第二仲裁阈值生成单元,包括:
第四计算子单元,用于若历史选举集中存在仲裁盘,则利用第一节点数量减去最大单一供电节点数,得到仲裁阈值;
第五计算子单元,用于若历史选举集中不存在仲裁盘,则利用第一节点数量减去最大单一供电节点数后加一,得到仲裁阈值。
可选地,判断模块130,包括:
第一判断单元,用于判断当前网络拓扑对应的第二授权节点数是否小于仲裁阈值;
第一确定单元,用于若当前网络拓扑对应的第二授权节点数小于仲裁阈值,则确定不满足仲裁参数;
目标选举集判断单元,用于若当前网络拓扑对应的第二授权节点数不小于仲裁阈值,则判断历史选举集是否为目标选举集;目标选举集为具有大于一个电源且具有仲裁盘的选举集,或者为具有一个电源、第一授权节点数为偶数且具有仲裁盘的选举集;
第二确定单元,用于若历史选举集不为目标选举集,则确定满足仲裁参数;
第二判断单元,用于若历史选举集为目标选举集,则判断第二授权节点数是否等于仲裁阈值;
第三确定单元,用于若第二授权节点数不等于仲裁阈值,则确定满足仲裁参数;
仲裁盘判断单元,用于若第二授权节点数等于仲裁阈值,则利用当前网络拓扑的当前仲裁盘情况判断是否满足仲裁参数。
可选地,仲裁盘判断单元,包括:
争抢子单元,用于若当前网络拓扑识别到仲裁盘,则执行仲裁盘争抢,并在争抢成功后确定满足仲裁参数;
仲裁节点判断子单元,用于若当前网络拓扑未识别到仲裁盘,则判断是否存在仲裁节点;
满足确定子单元,用于若存在仲裁节点,则确定满足仲裁参数;
不满足确定子单元,用于若不存在仲裁节点,则确定不满足仲裁参数。
下面对本申请实施例提供的电子设备进行介绍,下文描述的电子设备与上文描述的集群仲裁方法可相互对应参照。
请参考图3,图3为本申请实施例提供的一种电子设备的结构示意图。其中电子设备100可以包括处理器101和存储器102,还可以进一步包括多媒体组件103、信息输入/信息输出(I/O)接口104以及通信组件105中的一种或多种。
其中,处理器101用于控制电子设备100的整体操作,以完成上述的集群仲裁方法中的全部或部分步骤;存储器102用于存储各种类型的数据以支持在电子设备100的操作,这些数据例如可以包括用于在该电子设备100上操作的任何应用程序或方法的指令,以及应用程序相关的数据。该存储器102可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,例如静态随机存取存储器(Static Random Access Memory,SRAM)、电可擦除可编程只读存储器(Electrically Erasable Programmable Read-Only Memory,EEPROM)、可擦除可编程只读存储器(Erasable Programmable Read-Only Memory,EPROM)、可编程只读存储器(Programmable Read-Only Memory,PROM)、 只读存储器(Read-Only Memory,ROM)、磁存储器、快闪存储器、磁盘或光盘中的一种或多种。
多媒体组件103可以包括屏幕和音频组件。其中屏幕例如可以是触摸屏,音频组件用于输出和/或输入音频信号。例如,音频组件可以包括一个麦克风,麦克风用于接收外部音频信号。所接收的音频信号可以被进一步存储在存储器102或通过通信组件105发送。音频组件还包括至少一个扬声器,用于输出音频信号。I/O接口104为处理器101和其他接口模块之间提供接口,上述其他接口模块可以是键盘,鼠标,按钮等。这些按钮可以是虚拟按钮或者实体按钮。通信组件105用于电子设备100与其他设备之间进行有线或无线通信。无线通信,例如Wi-Fi,蓝牙,近场通信(Near Field Communication,简称NFC),2G、3G或4G,或它们中的一种或几种的组合,因此相应的该通信组件105可以包括:Wi-Fi部件,蓝牙部件,NFC部件。
电子设备100可以被一个或多个应用专用集成电路(Application Specific Integrated Circuit,简称ASIC)、数字信号处理器(Digital Signal Processor,简称DSP)、数字信号处理设备(Digital Signal Processing Device,简称DSPD)、可编程逻辑器件(Programmable Logic Device,简称PLD)、现场可编程门阵列(Field Programmable Gate Array,简称FPGA)、控制器、微控制器、微处理器或其他电子元件实现,用于执行上述实施例给出的集群仲裁方法。
下面对本申请实施例提供的计算机可读存储介质进行介绍,下文描述的计算机可读存储介质与上文描述的集群仲裁方法可相互对应参照。
本申请还提供一种计算机可读存储介质,计算机可读存储介质上存储有计算机程序,计算机程序被处理器执行时实现上述的集群仲裁方法的步骤。
该计算机可读存储介质可以包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
本说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其它实施例的不同之处,各个实施例之间相同或相似部分互相参见即可。 对于实施例公开的装置而言,由于其与实施例公开的方法相对应,所以描述的比较简单,相关之处参见方法部分说明即可。
本领域技术人员还可以进一步意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件的方式来执行,取决于技术方案的特定应用和设计约束条件。本领域技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应该认为超出本申请的范围。
结合本文中所公开的实施例描述的方法或算法的步骤可以直接用硬件、处理器执行的软件模块,或者二者的结合来实施。软件模块可以置于随机存储器(RAM)、内存、只读存储器(ROM)、电可编程ROM、电可擦除可编程ROM、寄存器、硬盘、可移动磁盘、CD-ROM、或技术领域内所公知的任意其它形式的存储介质中。
最后,还需要说明的是,在本文中,诸如第一和第二等之类的关系属于仅仅用来将一个实体或者操作与另一个实体或者操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语包括、包含或者其他任何变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。
本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。

Claims (10)

  1. 一种集群仲裁方法,其特征在于,包括:
    获取历史选举集,并利用所述历史选举集得到第一节点数量和电源情况;
    根据所述电源情况,利用所述第一节点数量生成仲裁参数;
    获取当前网络拓扑,并判断所述当前网络拓扑是否满足所述仲裁参数;
    若所述当前网络拓扑满足所述仲裁参数,则提供集群服务。
  2. 根据权利要求1所述的集群仲裁方法,其特征在于,所述利用所述历史选举集得到第一节点数量和电源情况,包括:
    对所述历史选举集中的第一授权节点进行统计,得到所述第一节点数量;
    获取各个所述第一授权节点对应的电源信息,判断所有的所述第一授权节点是否由一个电源供电;
    若所有的所述第一授权节点由一个所述电源供电,则将所述电源情况确定为单一供电;
    若所有的所述第一授权节点不由一个所述电源供电,则将所述电源情况确定为最大单一供电节点数;所述最大单一供电节点数大于所述第一节点数量的半数。
  3. 根据权利要求2所述的集群仲裁方法,其特征在于,所述根据所述电源情况,利用所述第一节点数量生成仲裁参数,包括:
    若所述电源情况为所述单一供电,则根据所述第一节点数量的奇偶情况,利用所述第一节点数量生成仲裁阈值;
    若所述电源情况为所述最大单一供电节点数,则根据所述历史选举集的仲裁盘情况,利用所述最大单一供电节点数和所述第一节点数量生成所述仲裁阈值;
    利用所述仲裁阈值生成所述仲裁参数。
  4. 根据权利要求3所述的集群仲裁方法,其特征在于,所述根据所述第一节点数量的奇偶情况,利用所述第一节点数量生成仲裁阈值,包括:
    若所述第一节点数量为奇数,则将所述第一节点数量加一后除以二,得到所述仲裁阈值;
    若所述第一节点数量为偶数,则判断所述历史选举集中是否存在仲裁盘;
    若所述历史选举集中存在所述仲裁盘,则将所述第一节点数量除以二,得到所述仲裁阈值;
    若所述历史选举集中不存在所述仲裁盘,则将所述第一节点数量除以二后加一,得到所述仲裁阈值。
  5. 根据权利要求3所述的集群仲裁方法,其特征在于,所述根据所述历史选举集的仲裁盘情况,利用所述最大单一供电节点数和所述第一节点数量生成所述仲裁阈值,包括:
    若所述历史选举集中存在仲裁盘,则利用所述第一节点数量减去所述最大单一供电节点数,得到所述仲裁阈值;
    若所述历史选举集中不存在所述仲裁盘,则利用所述第一节点数量减去所述最大单一供电节点数后加一,得到所述仲裁阈值。
  6. 根据权利要求3至5任一项所述的集群仲裁方法,其特征在于,所述判断所述当前网络拓扑是否满足所述仲裁参数,包括:
    判断所述当前网络拓扑对应的第二授权节点数是否小于所述仲裁阈值;
    若所述当前网络拓扑对应的第二授权节点数小于所述仲裁阈值,则确定不满足所述仲裁参数;
    若所述当前网络拓扑对应的第二授权节点数不小于所述仲裁阈值,则判断所述历史选举集是否为目标选举集;所述目标选举集为具有大于一个所述电源且具有仲裁盘的选举集,或者为具有一个所述电源、所述第一授权节点数为偶数且具有仲裁盘的选举集;
    若所述历史选举集不为所述目标选举集,则确定满足所述仲裁参数;
    若所述历史选举集为所述目标选举集,则判断所述第二授权节点数是否等于所述仲裁阈值;
    若所述第二授权节点数不等于所述仲裁阈值,则确定满足所述仲裁参数;
    若所述第二授权节点数等于所述仲裁阈值,则利用所述当前网络拓扑的当前仲裁盘情况判断是否满足所述仲裁参数。
  7. 根据权利要求6所述的集群仲裁方法,其特征在于,所述利用所述当前网络拓扑的当前仲裁盘情况判断是否满足所述仲裁参数,包括:
    若所述当前网络拓扑识别到所述仲裁盘,则执行仲裁盘争抢,并在争抢成功后确定满足所述仲裁参数;
    若所述当前网络拓扑未识别到所述仲裁盘,则判断是否存在仲裁节点;
    若存在所述仲裁节点,则确定满足所述仲裁参数;
    若不存在所述仲裁节点,则确定不满足所述仲裁参数。
  8. 一种集群仲裁装置,其特征在于,包括:
    获取模块,用于获取历史选举集,并利用所述历史选举集得到第一节点数量和电源情况;
    生成模块,用于根据所述电源情况,利用所述第一节点数量生成仲裁参数;
    判断模块,用于获取当前网络拓扑,并判断所述当前网络拓扑是否满足所述仲裁参数;
    服务模块,用于若所述当前网络拓扑满足所述仲裁参数,则提供集群服务。
  9. 一种电子设备,其特征在于,包括存储器和处理器,其中:
    所述存储器,用于保存计算机程序;
    所述处理器,用于执行所述计算机程序,以实现如权利要求1至7任一项所述的集群仲裁方法。
  10. 一种计算机可读存储介质,其特征在于,用于保存计算机程序,其中,所述计算机程序被处理器执行时实现如权利要求1至7任一项所述的集群仲裁方法。
PCT/CN2021/121209 2020-12-02 2021-09-28 一种集群仲裁方法、装置、电子设备及可读存储介质 WO2022116661A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US18/034,554 US11902095B2 (en) 2020-12-02 2021-09-28 Cluster quorum method and apparatus, electronic device, and readable storage medium

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011391793.6A CN112468596B (zh) 2020-12-02 2020-12-02 一种集群仲裁方法、装置、电子设备及可读存储介质
CN202011391793.6 2020-12-02

Publications (1)

Publication Number Publication Date
WO2022116661A1 true WO2022116661A1 (zh) 2022-06-09

Family

ID=74805294

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/121209 WO2022116661A1 (zh) 2020-12-02 2021-09-28 一种集群仲裁方法、装置、电子设备及可读存储介质

Country Status (3)

Country Link
US (1) US11902095B2 (zh)
CN (1) CN112468596B (zh)
WO (1) WO2022116661A1 (zh)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112468596B (zh) * 2020-12-02 2022-07-05 苏州浪潮智能科技有限公司 一种集群仲裁方法、装置、电子设备及可读存储介质
CN113489595B (zh) * 2021-06-28 2023-02-28 苏州浪潮智能科技有限公司 一种实现分离式mac和phy电磁兼容的系统、方法
CN114461141B (zh) * 2021-12-30 2023-08-18 苏州浪潮智能科技有限公司 一种etcd系统、节点仲裁方法及系统
CN114390052B (zh) * 2021-12-30 2023-10-10 武汉达梦数据技术有限公司 一种基于vrrp协议实现etcd双节点高可用方法和装置
CN115242704B (zh) * 2022-06-22 2023-08-11 中国电信股份有限公司 网络拓扑数据更新方法、装置和电子设备

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8024432B1 (en) * 2008-06-27 2011-09-20 Symantec Corporation Method and apparatus for partitioning a computer cluster through coordination point devices
CN102308559A (zh) * 2011-07-26 2012-01-04 华为技术有限公司 一种用于集群计算机系统的投票仲裁方法及装置
CN104378232A (zh) * 2014-11-10 2015-02-25 东软集团股份有限公司 主备集群组网模式下的脑裂发现、恢复方法及装置
WO2016107172A1 (zh) * 2014-12-31 2016-07-07 华为技术有限公司 一种集群脑裂后仲裁处理方法、仲裁存储装置以及系统
CN106789193A (zh) * 2016-12-06 2017-05-31 郑州云海信息技术有限公司 一种集群投票仲裁方法及系统
CN106953914A (zh) * 2017-03-20 2017-07-14 郑州云海信息技术有限公司 一种用于控制器集群的仲裁方法及系统
CN112468596A (zh) * 2020-12-02 2021-03-09 苏州浪潮智能科技有限公司 一种集群仲裁方法、装置、电子设备及可读存储介质

Family Cites Families (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE19704662A1 (de) * 1997-02-07 1998-08-13 Siemens Ag Verfahren zur Lastsymmetrierung mehrerer autark und unabhängig arbeitenden Stromversorgungsmodulen einer modularen Stromversorgungsanlage
US6502203B2 (en) * 1999-04-16 2002-12-31 Compaq Information Technologies Group, L.P. Method and apparatus for cluster system operation
US7478263B1 (en) * 2004-06-01 2009-01-13 Network Appliance, Inc. System and method for establishing bi-directional failover in a two node cluster
US8108715B1 (en) * 2010-07-02 2012-01-31 Symantec Corporation Systems and methods for resolving split-brain scenarios in computer clusters
CN102402395B (zh) * 2010-09-16 2014-07-16 中标软件有限公司 基于仲裁磁盘的高可用系统不间断运行方法
US8578204B1 (en) * 2010-12-29 2013-11-05 Emc Corporation Witness facility for distributed storage system
US9063787B2 (en) * 2011-01-28 2015-06-23 Oracle International Corporation System and method for using cluster level quorum to prevent split brain scenario in a data grid cluster
US9203900B2 (en) * 2011-09-23 2015-12-01 Netapp, Inc. Storage area network attached clustered storage system
US20230113718A1 (en) * 2017-04-26 2023-04-13 View, Inc. Self orchestrating network
CN109257195B (zh) * 2017-07-12 2021-01-15 华为技术有限公司 集群中节点的故障处理方法及设备
CN109729129B (zh) * 2017-10-31 2021-10-26 华为技术有限公司 存储集群系统的配置修改方法、存储集群及计算机系统
US11769592B1 (en) * 2018-10-07 2023-09-26 Cerner Innovation, Inc. Classifier apparatus with decision support tool
CN109491615A (zh) * 2018-11-13 2019-03-19 郑州云海信息技术有限公司 一种基于集群存储系统的仲裁系统
CN110597664A (zh) * 2019-09-17 2019-12-20 深信服科技股份有限公司 一种高可用集群资源部署方法、装置及相关组件
CN111694694A (zh) * 2020-05-22 2020-09-22 北京三快在线科技有限公司 数据库集群的处理方法、装置、存储介质和节点
CN111654402B (zh) * 2020-06-23 2023-08-01 中国平安财产保险股份有限公司 网络拓扑创建方法、装置、设备及存储介质
US20220300384A1 (en) * 2021-03-22 2022-09-22 EMC IP Holding Company LLC Enhanced fencing scheme for cluster systems without inherent hardware fencing
WO2023178100A1 (en) * 2022-03-15 2023-09-21 Stryker Corporation Methods and systems for extracting medical images

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8024432B1 (en) * 2008-06-27 2011-09-20 Symantec Corporation Method and apparatus for partitioning a computer cluster through coordination point devices
CN102308559A (zh) * 2011-07-26 2012-01-04 华为技术有限公司 一种用于集群计算机系统的投票仲裁方法及装置
CN104378232A (zh) * 2014-11-10 2015-02-25 东软集团股份有限公司 主备集群组网模式下的脑裂发现、恢复方法及装置
WO2016107172A1 (zh) * 2014-12-31 2016-07-07 华为技术有限公司 一种集群脑裂后仲裁处理方法、仲裁存储装置以及系统
CN106789193A (zh) * 2016-12-06 2017-05-31 郑州云海信息技术有限公司 一种集群投票仲裁方法及系统
CN106953914A (zh) * 2017-03-20 2017-07-14 郑州云海信息技术有限公司 一种用于控制器集群的仲裁方法及系统
CN112468596A (zh) * 2020-12-02 2021-03-09 苏州浪潮智能科技有限公司 一种集群仲裁方法、装置、电子设备及可读存储介质

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
ZHANG YU , LIN YUN: "Research on Quorum and Data Protection of Veritas Cluster Server Cluster Members", DIGITAL TECHNOLOGY & APPLICATION, 15 November 2011 (2011-11-15), pages 84 - 85, XP055937191, DOI: 10.19695/j.cnki.cn12-1369.2011.11.057 *

Also Published As

Publication number Publication date
US11902095B2 (en) 2024-02-13
US20230396501A1 (en) 2023-12-07
CN112468596A (zh) 2021-03-09
CN112468596B (zh) 2022-07-05

Similar Documents

Publication Publication Date Title
WO2022116661A1 (zh) 一种集群仲裁方法、装置、电子设备及可读存储介质
CN108122165B (zh) 一种区块链共识方法及系统
EP4071610A1 (en) Transaction processing method, apparatus, and device, and computer storage medium
US10020980B2 (en) Arbitration processing method after cluster brain split, quorum storage apparatus, and system
US11102084B2 (en) Fault rectification method, device, and system
US20100299447A1 (en) Data Replication
US20210320977A1 (en) Method and apparatus for implementing data consistency, server, and terminal
CN111314125A (zh) 用于容错通信的系统和方法
EP4006742A1 (en) Fork processing method and blockchain node
CN110855737B (zh) 一种一致性级别可控的自适应数据同步方法和系统
CN107666493B (zh) 一种数据库配置方法及其设备
US11544245B2 (en) Transaction processing method, apparatus, and device and computer storage medium
CN109495540A (zh) 一种数据处理的方法、装置、终端设备及存储介质
WO2017034898A1 (en) Global logical timestamp
CN115088235A (zh) 主节点选取方法、装置、电子设备以及存储介质
US8719622B2 (en) Recording and preventing crash in an appliance
CN113395165B (zh) 共识流程处理方法、装置、存储介质及计算机设备
CN106161086B (zh) 主控板重启的控制方法及装置
CN107040509B (zh) 一种报文发送方法及装置
KR20220013846A (ko) 블록체인 네트워크의 블록 합의 방법 및 장치
CN114500327B (zh) 一种服务器集群的检测方法、检测装置及计算设备
CN115190130A (zh) 基于区块链的数据处理方法、装置、电子设备及存储介质
US10564665B2 (en) Performing scalable, causally consistent reads using a logical wall clock
US20170161969A1 (en) System and method for model-based optimization of subcomponent sensor communications
US20230261893A1 (en) Quality issue management for online meetings

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21899695

Country of ref document: EP

Kind code of ref document: A1