Node scheduling method and access method of shared storage device and electronic device

By managing the token value and broadcasting the new token value by arbitration server, the split brain problem caused by misjudgment of the old master node is solved, and the system can quickly recover and data consistency when the master node fails.

CN119814801APending Publication Date: 2025-04-11CHINA UNITED NETWORK COMM GRP CO LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411999413.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-04-11

AI Technical Summary

Technical Problem

In the prior art, if the failure of the old master node is a misjudgment, it is prone to split brain problems, resulting in inconsistent data.

Method used

The token value is managed through the arbitration server. When the original master node fails, it changes the token value and broadcasts it to the connectivity slave node, runs out the new master node, and broadcasts the new token value to the shared storage device, ensuring that the new master node has the latest token value to access the shared storage device.

Benefits of technology

It effectively avoids split brain problems, ensuring that the system can quickly resume normal operation when the master node fails or switches, and avoids data inconsistencies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119814801A_ABST
    Figure CN119814801A_ABST
Patent Text Reader

Abstract

The invention provides a node scheduling method and an access method of shared storage equipment and electronic equipment. The method comprises the steps that if it is determined that an original main node in the node cluster breaks down, a currently managed token value is changed to obtain a new token value; broadcasting the new token value to connected slave nodes in the node cluster, so that a new master node is competed from the connected slave nodes, and the new master node obtains the new token value; wherein the communication slave node is an original slave node at least communicated with the arbitration server and the shared storage device; broadcasting the new token value to a shared storage device, so that the shared storage device obtains the new token value; wherein when the main node requests to access the shared storage device, and the token value carried in the request of the main node is consistent with the token value of the shared storage device, the main node is allowed to access the shared storage device. According to the method, data inconsistency caused by split brain can be avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a node scheduling method, an access method and an electronic device for a shared storage device. Background Art

[0002] A node cluster consists of multiple nodes that can work together to complete computing tasks with high availability and high computing efficiency. When multiple nodes work together, the nodes need to be managed and scheduled to maintain the normal operation of the node cluster.

[0003] Node clusters generally operate in a master-slave node architecture. The master node can perform tasks such as task allocation, and the slave node can perform tasks such as task execution. If the arbitration server detects that the host point is unavailable due to network partition or detects that the master node is abnormal, it is a misjudgment. Then after the new master node is generated, the new master node will access the shared storage device for reading and writing, and the old master node will also access the shared storage device for reading and writing, resulting in a double write problem, also known as the split-brain problem.

[0004] Therefore, the present application proposes a node scheduling method and an access method for a shared storage device to solve the above problems. Summary of the invention

[0005] The embodiment of the present application provides a node scheduling method, an access method and an electronic device for a shared storage device, which are used to solve the problem in the prior art that if the failure of the old master node is a misjudgment, a brain split may easily occur.

[0006] In a first aspect, the present application provides a node scheduling of a shared storage device for scheduling a node cluster, wherein the node cluster includes a master node and at least one slave node, and the method includes:

[0007] If it is determined that the original master node in the node cluster fails, the currently managed token value is changed to obtain a new token value;

[0008] The new token value is broadcasted to the connected slave nodes in the node cluster, so that a new master node is competed out from the connected slave nodes, and the new master node obtains the new token value; wherein the connected slave node is an original slave node connected to at least an arbitration server and a shared storage device; the connected slave node is connected to at least one other connected slave node;

[0009] The new token value is broadcast to the shared storage device so that the shared storage device obtains the new token value; wherein, when the master node requests access to the shared storage device and the token value carried in the request of the master node is consistent with the token value of the shared storage device, the master node is allowed to access the shared storage device.

[0010] Optionally, in the method as described above, the interconnected slave nodes are in a node sub-cluster, and the node sub-cluster includes at least two of the interconnected slave nodes;

[0011] If there are multiple node subclusters, correspondingly, broadcasting the new token value to the connected slave nodes in the node cluster so that a new master node is competed out among the connected slave nodes, including:

[0012] If there is a node subcluster with the largest number of connected slave nodes, the node subcluster with the largest number of connected slave nodes is used as the target subcluster;

[0013] The new token value is broadcasted to the target sub-cluster, so that a new master node is competed out from the connected slave nodes of the target sub-cluster.

[0014] Optionally, in the method described above, if there are multiple node subclusters with the largest number of connected slave nodes, then according to the sequence numbers of the connected slave nodes in the node subclusters, one node subcluster is selected as the target subcluster from the multiple node subclusters with the largest number of connected slave nodes;

[0015] The new token value is broadcasted to the target sub-cluster, so that a new master node is competed out from the connected slave nodes of the target sub-cluster.

[0016] Optionally, in the method described above, the failure of the original master node includes at least one of the following types: network partition and master node abnormality; wherein, when only the master node abnormality occurs, all the original slave nodes in the node cluster are one node sub-cluster; when only the network partition occurs, at least one original master node in the node cluster fails, and the node cluster is divided into at least one node sub-cluster.

[0017] Optionally, according to the method described above, the non-new master node in the target subcluster is migrated to a new slave node of the new master node.

[0018] Optionally, the method as described above further comprises:

[0019] broadcasting the new token value to the disconnected slave nodes connected to the arbitration server;

[0020] If the original slave node in the node cluster that is not connected to the arbitration server is restored to be connected, the new token value is broadcast to the original slave node that is restored to be connected.

[0021] In a second aspect, the present application provides a method for accessing a shared storage device, which is applied to a shared storage device, and the method includes:

[0022] Receive an access request from a master node, and if it is determined that a token value carried in the access request is consistent with a latest token value of the shared storage device, allow the master node to access the shared storage device;

[0023] If it is determined that the token value carried in the access request is inconsistent with the latest token value of the shared storage device, denying the master node access to the shared storage device;

[0024] When the arbitration server selects a new master node in the node cluster, the token value of the original master node in the node cluster remains unchanged, and the token values ​​of the new master node and the shared storage device are updated by the new token value broadcast by the arbitration server.

[0025] In a third aspect, the present application provides an electronic device, including: at least one processor and a memory;

[0026] The memory stores computer-executable instructions;

[0027] The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the method described above.

[0028] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of the method described above when executed by a processor.

[0029] In a fifth aspect, the present application provides a computer program product, including a computer program, which implements the method described above when executed by a processor.

[0030] In a sixth aspect, the present application provides a node scheduling device of a shared storage device, which is used to schedule a node cluster, wherein the node cluster includes a master node and at least one slave node, including:

[0031] A change module, used for changing the currently managed token value to obtain a new token value if it is determined that the original master node in the node cluster fails;

[0032] A first processing module is used to broadcast the new token value to the connected slave nodes in the node cluster, so that a new master node is competed out from the connected slave nodes, and the new master node obtains the new token value; wherein the connected slave node is an original slave node connected to at least an arbitration server and a shared storage device; and the connected slave node is connected to at least one other connected slave node;

[0033] The second processing module is used to broadcast the new token value to the shared storage device so that the shared storage device obtains the new token value; wherein, when the master node requests access to the shared storage device and the token value carried in the request of the master node is consistent with the token value of the shared storage device, the master node is allowed to access the shared storage device.

[0034] In a seventh aspect, the present application provides a device for accessing a shared storage device, which is applied to a shared storage device, comprising:

[0035] A receiving module, configured to receive an access request from a master node, and if it is determined that a token value carried in the access request is consistent with a latest token value of the shared storage device, then allowing the master node to access the shared storage device;

[0036] A determination module, configured to deny the master node access to the shared storage device if it is determined that the token value carried in the access request is inconsistent with the latest token value of the shared storage device;

[0037] When the arbitration server selects a new master node in the node cluster, the token value of the original master node in the node cluster remains unchanged, and the token values ​​of the new master node and the shared storage device are updated by the new token value broadcast by the arbitration server.

[0038] The present application provides a node scheduling method, access method and electronic device for a shared storage device, which are used to schedule a node cluster, wherein the node cluster includes a master node and at least one slave node, including: if it is determined that the original master node in the node cluster fails, the currently managed token value is changed to obtain a new token value; the new token value is broadcast to the connected slave nodes in the node cluster, so that a new master node is competed out from the connected slave nodes, and the new master node obtains the new token value; wherein the connected slave node is an original slave node connected to at least an arbitration server and a shared storage device; the connected slave node is connected to at least one other connected slave node; the new token value is broadcast to the shared storage device, so that the shared storage device obtains the new token value; wherein, when the master node requests to access the shared storage device, and the token value carried in the request of the master node is consistent with the token value of the shared storage device, the master node is allowed to access the shared storage device.

[0039] In the above method, the node cluster is scheduled by the arbitration server. When the original master node of the node cluster fails, the arbitration server will re-determine the master node. In order to allow only the new master node to access the shared storage device, the arbitration server is responsible for managing the token value. Each time the master node is re-determined, the token value is changed. The arbitration server broadcasts the new token value obtained after the change to the connected slave nodes that can participate in the election of the new master node, and broadcasts it to the shared storage device. Only one connected slave node will become the new master node, and the new master node has a new token value, and the original master node does not have a new token value. Therefore, regardless of whether a fault misjudgment occurs, only the new master node can access the shared storage device, and data inconsistency caused by brain split will not occur. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0041] Figure 1 A schematic diagram of a node cluster scenario provided in an embodiment of the present application;

[0042] Figure 2 A schematic diagram of a node scheduling method for a shared storage device provided in an embodiment of the present application Figure 1 ;

[0043] Figure 3 A schematic diagram of a node scheduling method for a shared storage device provided in an embodiment of the present application Figure 2 ;

[0044] Figure 4 A schematic diagram of a flow chart of a method for accessing a shared storage device provided in an embodiment of the present application;

[0045] Figure 5 A node scheduling device diagram of a shared storage device provided by an embodiment of the present invention;

[0046] Figure 6 An access device diagram of a shared storage device provided by an embodiment of the present invention;

[0047] Figure 7 A hardware schematic diagram of an electronic device provided by an embodiment of the present invention.

[0048] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0049] Here, exemplary embodiments will be described in detail, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. They are only examples of devices and methods consistent with some aspects of the present application that are described in detail.

[0050] Node clusters are generally operated in a master-slave node architecture. The master node can perform tasks such as task allocation, and the slave node can perform tasks such as task execution. At present, it is generally determined whether the master node is faulty, whether it is a real fault, or just a temporary fault caused by a hang or network interruption. If it is a temporary fault, it can be regarded as a misjudgment. A hang means that the program is stuck or stops responding.

[0051] If the arbitration server detects that the host node is unavailable due to network partition or detects that the master node is abnormal, it is a false positive. After the new master node is generated, the new master node will access the shared storage device for reading and writing, and the old master node will also access the shared storage device for reading and writing, resulting in a double write problem, also known as the split-brain problem.

[0052] In order to solve the split-brain problem, the existing technology registers a node ID for each node in the collaborative disk. However, this method supports limited protocols, and the shared storage devices on the cloud do not support this protocol. When the underlying cloud storage infrastructure needs to be upgraded, it will affect other businesses running on the cloud storage and will also bring additional development workload.

[0053] Therefore, the present application proposes a node scheduling method and an access method for a shared storage device that can avoid brain split and has a wider range of applicable scenarios.

[0054] The specific implementation process of a node scheduling method and an access method for a shared storage device proposed in the present application is described in detail below in conjunction with the accompanying drawings and specific embodiments.

[0055] Figure 1 A schematic diagram of a node cluster scenario provided in an embodiment of the present application. Figure 1 As shown, the system includes: a node cluster, an arbitration server and a shared storage device; wherein the node cluster includes a master node and at least one slave node, the arbitration server can be connected to each node in the node cluster; the nodes in the node cluster can be connected to each other; the shared storage device and each node can be connected; connectivity generally refers to the ability of two nodes to reach each other in a system or network, or is called a communication connection;

[0056] Nodes (db) have master and slave roles; each node is equipped with a service module (distributed storage service, dss) that directly reads and writes shared storage devices; the shared storage device is regarded as a volume (raw device), and the service module can directly read and write the volume as a whole file, and then access the device after calculating the offset corresponding to the specified file through metadata; the read and write performance is similar to that of raw devices, exceeding the local file system by 3%; each node is equipped with an agent, which is a component or service responsible for managing and monitoring the status and operation of the node; the agent can collect the operation information of the node so that the arbitration server can determine the node status based on the operation information;

[0057] The shared storage device has a volume group space allocation unit (AU), and the shared storage device corresponds to multiple volume group space allocation units; one of the volume group space allocation units is used to record a token value for the master node to access the shared storage device, and the token value is a variable value, for example, a globally unique increment value;

[0058] The arbitration server can manage the token value of the node and the token value of the shared storage device. In the process of managing the master and slave nodes, when it is determined that a new master node is needed, the token value is changed to obtain a new token value; the new token value is broadcast to the shared storage device, so that the token value recorded in the volume group space allocation unit of the shared storage device is changed to the new token value; the new token value is broadcast to the new master node, so that the new master node can access the shared storage device with the new token value. If the token values ​​of the shared storage device and the new master node are consistent, the shared storage device allows the new master node to access; if the old master node does not have a new token value and is inconsistent with the token value of the shared storage device, the shared storage device denies the old master node access.

[0059] Figure 2 A schematic diagram of a node scheduling method for a shared storage device provided in an embodiment of the present application Figure 1 .like Figure 2 As shown, for scheduling a node cluster, the node cluster includes a master node and at least one slave node, and the method includes:

[0060] S201. If it is determined that the original master node in the node cluster fails, the currently managed token value is changed to obtain a new token value.

[0061] The arbitration server can be used to detect whether a node in the node cluster fails. If the original master node fails, the collaboration of the node cluster will be affected. Therefore, the master node needs to be re-selected to allow the new master node to access the shared storage device.

[0062] When the arbitration server performs fault detection, it can obtain the operation information of the node and determine whether the node is faulty through the operation information; the operation information includes instance status information, network heartbeats between nodes, disk heartbeats between nodes and shared storage devices, etc.; instance status information is detailed data about the current operation status of each node or instance in the cluster, including whether there are faults or performance problems; network heartbeats between nodes refer to signals sent regularly between nodes through the network in a node cluster to confirm each other's reachability. If a node fails to receive a heartbeat signal from another node within a predetermined time, it may indicate that the node has failed; disk heartbeats between nodes and shared storage devices refer to regular signal exchanges between nodes and shared storage devices through storage devices, which are used to ensure that nodes can access shared storage devices and verify the validity of storage connections;

[0063] When the original master node instance is abnormal, or is not connected to other slave nodes, or is not connected to the shared storage device, it can be determined that the original master node has failed; if the original master node fails, the arbitration server will take over the work of the original master node according to the new master node;

[0064] The master node and the shared storage device are set to use a variable token value to verify whether the master node can access the shared storage device; an arbitration server is set to manage the token value, and when it is determined that a new master node is needed, the token value is changed to a new token value; for example, the token value is set to an incremental value, which is incremented each time a new master node is needed.

[0065] S202. Broadcast the new token value to the connected slave nodes in the node cluster, so that a new master node is competed among the connected slave nodes, and the new master node obtains the new token value; wherein the connected slave node is an original slave node connected to at least an arbitration server and a shared storage device; and the connected slave node is connected to at least one other connected slave node.

[0066] When the original master node fails, the nodes in the node cluster may also have connectivity problems; if a node has connectivity problems, it is generally not suitable for being a new master node; the connected slave node is selected from the original slave nodes in the node cluster, and the new master node needs to be generated from the connected slave node; the connected slave node is connected to the arbitration server, the shared storage device, and at least one other connected slave node, and at least two connected slave nodes are connected, so that the new master node can have a corresponding new slave node;

[0067] The new master node is obtained through competition among connected slave nodes. For example, after receiving the new token value, the connected slave node starts to seize the master node lock. The first connected slave node that seizes the master node lock is the new master node. The token value of the new master node is updated to the new token value. When the new master node sends an access request, it can carry the new token value.

[0068] S203. Broadcast the new token value to the shared storage device so that the shared storage device obtains the new token value; wherein, when the master node requests access to the shared storage device and the token value carried in the request of the master node is consistent with the token value of the shared storage device, the master node is allowed to access the shared storage device.

[0069] The new token value is broadcast to the volume group space allocation unit of the shared storage device, and the token value in the volume group space allocation unit is updated to the new token value; at this time, the original master node cannot update the token value, and when it carries the previous token value to access the shared storage device, the token value is inconsistent and access is not possible. The original master node cannot read and write the shared storage device; when the new master node accesses the shared storage device, it carries the new token value, the token value is consistent, and access is possible. The original master node can read and write the shared storage device.

[0070] In addition to the connected slave nodes in the node cluster, other original slave nodes may also be connected to the arbitration server:

[0071] For example, broadcasting the new token value to the disconnected slave nodes connected to the arbitration server;

[0072] If the original slave node in the node cluster that is not connected to the arbitration server is restored to be connected, the new token value is broadcast to the original slave node that is restored to be connected.

[0073] The arbitration server can broadcast the new token value to other original slave nodes connected to the arbitration server for easy management. For example, when other original slave nodes resume connectivity with the new master node and the shared storage device, they can be used as new slave nodes of the new master node.

[0074] If the original slave node is not connected to the arbitration server, it cannot receive the broadcast. It can receive the broadcast when the connection with the arbitration server is restored, which is convenient for management.

[0075] In the embodiment of the present application, the node cluster is scheduled by an arbitration server. When the original master node of the node cluster fails, the arbitration server will re-determine the master node. In order to allow only the new master node to access the shared storage device, the arbitration server is responsible for managing the token value. Each time the master node is re-determined, the token value is changed. The arbitration server broadcasts the new token value obtained after the change to the connected slave nodes that can participate in the election of the new master node, and broadcasts it to the shared storage device. Only one connected slave node will become the new master node, and the new master node has a new token value, and the original master node does not have a new token value. Therefore, regardless of whether a fault misjudgment occurs, only the new master node can access the shared storage device, and data inconsistency caused by brain split will not occur.

[0076] Figure 3A schematic diagram of a node scheduling method for a shared storage device provided in an embodiment of the present application Figure 2 .like Figure 3 As shown, the method includes:

[0077] S301: If there is a node sub-cluster with the largest number of connected slave nodes, the node sub-cluster with the largest number of connected slave nodes is used as a target sub-cluster.

[0078] The interconnected slave nodes are in a node sub-cluster, and the node sub-cluster includes at least two of the interconnected slave nodes.

[0079] The original master node fails. Possible reasons include:

[0080] For example, the failure of the original master node includes at least one of the following types: network partition and master node abnormality; when only the master node abnormality occurs, all the original slave nodes in the node cluster are one node sub-cluster; when only the network partition occurs, at least one original master node in the node cluster fails, and the node cluster is divided into at least one node sub-cluster.

[0081] Network partition means that some nodes of the cluster cannot communicate with other components due to network problems, such as nodes, shared storage devices and arbitration servers; master node abnormality means that the master node has management or service failures and other problems;

[0082] If only the master node is abnormal, then the original slave nodes in the node cluster are normal, and all the original slave nodes can be regarded as a node subcluster; if only the network partition occurs, then the original master node is abnormal, and the original slave nodes may be abnormal. At this time, the original slave nodes may not be connected. At this time, the original slave nodes that are connected to each other can be divided into a node subcluster, and at least one node subcluster may be obtained.

[0083] If there is only one node subcluster, then this node subcluster is the one with the largest number of connected slave nodes and can be used as the target subcluster; if there are multiple node subclusters and only one node subcluster has the largest number of connected slave nodes, then this node subcluster can be used as the target subcluster.

[0084] S302: Broadcast the new token value to the target sub-cluster, so that a new master node is competed out from the connected slave nodes of the target sub-cluster.

[0085] The new master node is selected from the target subcluster, and the other connected slave nodes in the target subcluster are new slave nodes of the new master node;

[0086] For example, the non-new master node in the target subcluster is migrated to become a new slave node of the new master node.

[0087] If there are multiple node subclusters with the largest number of connected slave nodes, select one as the target subcluster based on the preset conditions:

[0088] For example, if there are multiple node subclusters with the largest number of connected slave nodes, then according to the sequence numbers of the connected slave nodes in the node subclusters, one node subcluster is selected from the multiple node subclusters with the largest number of connected slave nodes as the target subcluster;

[0089] The new token value is broadcasted to the target sub-cluster, so that a new master node is competed out from the connected slave nodes of the target sub-cluster.

[0090] The preset conditions are as follows: the sequence numbers of all connected slave nodes are compared, and the node subcluster with the smallest sequence number of connected slave nodes is the target subcluster.

[0091] In an embodiment of the present application, by competing to elect a new master node among the connected slave nodes, the system can quickly resume normal operation when the master node fails, thereby reducing service interruption time; the node subcluster with the largest number of connected slave nodes is selected as the target subcluster to ensure that the new master node is selected from the largest possible set of nodes, thereby improving the stability and reliability of the new master node.

[0092] Figure 4 A schematic diagram of a flow chart of a method for accessing a shared storage device provided in an embodiment of the present application. Figure 4 As shown, applied to a shared storage device, the method includes:

[0093] S401. Receive an access request from a master node. If it is determined that a token value carried in the access request is consistent with a latest token value of the shared storage device, allow the master node to access the shared storage device.

[0094] When the master node in the node cluster reads and writes the shared storage device, it needs to initiate an access request. The access request carries the master node's own latest token value. If the token value is consistent with the latest token value of the shared storage device, then after verification, the shared storage device allows the master node to access it for read and write operations.

[0095] S402: If it is determined that the token value carried in the access request is inconsistent with the latest token value of the shared storage device, denying the master node access to the shared storage device;

[0096] When the arbitration server selects a new master node in the node cluster, the token value of the original master node in the node cluster remains unchanged, and the token values ​​of the new master node and the shared storage device are updated by the new token value broadcast by the arbitration server.

[0097] The process of the arbitration server selecting a new master node and updating the token value has been described in detail in the above embodiment and will not be repeated here;

[0098] If the latest token value of the master node is consistent with the latest token value of the shared storage device, the verification fails and the shared storage device denies the master node access.

[0099] The failure of the original master node does not necessarily mean that the shared storage device is disconnected. In other words, when a new master node is selected, the connection with the shared storage device is restored. If a new master node is generated and the original master node is disconnected from the arbitration server, the new master node will not be known to the original master node and will continue to send read and write requests to the shared storage device, but the shared storage device will deny access.

[0100] If the original master node fails, the original master node is not connected to the shared storage device, but is connected to the arbitration server; the original master node can receive the new token value, but it cannot access the shared storage device, and the master node lock will be canceled and it will no longer be the master node.

[0101] In an embodiment of the present application, a variable token value is used to verify whether the master node is the latest master node, and only the latest master node is allowed to access, read and write shared storage devices, thereby avoiding brain splits and data inconsistencies. Through the token value update and verification mechanism, the system can quickly identify and reject illegal access requests, ensuring that when the master node fails or switches, the system can quickly resume normal operation.

[0102] A preferred embodiment of the present application is:

[0103] 1. When the cluster status is normal, the primary and standby database nodes access the shared storage device through the DSS service. The shared storage device is logically divided into a volume group (volume). The current DSS token value is recorded on the super_au of the volume. At this time, the token value in the DSS request is consistent with the token value on super_au, and read and write operations can be accessed normally; super_au is the volume group space allocation unit used to record the token value.

[0104] 2. When a database node is partitioned or the master node is abnormal, the arbitration server selects a new available subcluster based on the information collected by the database node agent, advances the token value of dss, broadcasts it to all database node agents for refresh, and updates the token value of super_au in the shared storage device volume at the same time.

[0105] 3. After the data node agent receives the broadcast message of the token value update, it starts to grab the database master node lock from the arbitration server. The first database node that grabs the lock becomes the new master node, and other nodes automatically become slave nodes of the new master node.

[0106] 4. If a network partition occurs, the old master node does not know that the database cluster has selected a new master node and still writes data to the shared storage device through DSS. At this time, the token value of the old master node's DSS write request is less than the token value in the super_au of the shared storage device volume, so the write will be automatically rejected, which can effectively avoid the occurrence of brain split.

[0107] Figure 5 A node scheduling device diagram of a shared storage device provided by an embodiment of the present invention, such as Figure 5 As shown, it is used to schedule a node cluster, the node cluster includes a master node and at least one slave node, and the device includes: a change module 501, a first processing module 502 and a second processing module 503;

[0108] The changing module 501 is used to change the currently managed token value to obtain a new token value if it is determined that the original master node in the node cluster fails.

[0109] The first processing module 502 is used to broadcast the new token value to the connected slave nodes in the node cluster so that a new master node is competed among the connected slave nodes, and the new master node obtains the new token value; wherein the connected slave node is an original slave node connected to at least an arbitration server and a shared storage device; and the connected slave node is connected to at least one other connected slave node.

[0110] The first processing module 502 is further configured to include the interconnected slave nodes in a node sub-cluster, wherein the node sub-cluster includes at least two of the interconnected slave nodes;

[0111] If there are multiple node subclusters, correspondingly, broadcasting the new token value to the connected slave nodes in the node cluster so that a new master node is competed out among the connected slave nodes, including:

[0112] If there is a node subcluster with the largest number of connected slave nodes, the node subcluster with the largest number of connected slave nodes is used as the target subcluster;

[0113] The new token value is broadcasted to the target sub-cluster, so that a new master node is competed out from the connected slave nodes of the target sub-cluster.

[0114] The first processing module 502 is further configured to select a node subcluster from the plurality of node subclusters with the largest number of connected slave nodes as a target subcluster according to the sequence numbers of the connected slave nodes in the node subclusters if there are multiple node subclusters with the largest number of connected slave nodes;

[0115] The new token value is broadcasted to the target sub-cluster, so that a new master node is competed out from the connected slave nodes of the target sub-cluster.

[0116] The second processing module 503 is used to broadcast the new token value to the shared storage device so that the shared storage device obtains the new token value; wherein, when the master node requests access to the shared storage device and the token value carried in the request of the master node is consistent with the token value of the shared storage device, the master node is allowed to access the shared storage device.

[0117] Figure 6 An access device diagram of a shared storage device provided by an embodiment of the present invention, such as Figure 6 As shown, the device is applied to a shared storage device, and includes: a receiving module 601 and a determining module 602;

[0118] The receiving module 601 is used to receive an access request from a master node, and if it is determined that the token value carried in the access request is consistent with the latest token value of the shared storage device, the master node is allowed to access the shared storage device.

[0119] The determination module 602 is configured to deny the master node access to the shared storage device if it is determined that the token value carried in the access request is inconsistent with the latest token value of the shared storage device.

[0120] When the arbitration server selects a new master node in the node cluster, the token value of the original master node in the node cluster remains unchanged, and the token values ​​of the new master node and the shared storage device are updated by the new token value broadcast by the arbitration server.

[0121] The present application also provides an electronic device, comprising: at least one processor and a memory;

[0122] The memory stores computer-executable instructions;

[0123] The at least one processor executes the computer-implemented instructions stored in the memory, causing the at least one processor to perform a method.

[0124] Figure 7 Schematic diagram of the hardware of the electronic device provided by the embodiment of the present invention. Figure 7 As shown, the electronic device 70 provided in this embodiment includes: at least one processor 701 and a memory 702. The device 70 also includes a communication component 703. The processor 701, the memory 702 and the communication component 703 are connected via a bus 704.

[0125] In a specific implementation process, at least one processor 701 executes the computer-executable instructions stored in the memory 702, so that at least one processor 701 executes the above method.

[0126] The specific implementation process of the processor 701 can be found in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.

[0127] In the above Figure 7 In the illustrated embodiment, it should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the invention may be directly implemented as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.

[0128] The memory may include a high-speed memory (Random Access Memory, RAM), and may also include a non-volatile memory (Non-volatile Memory, NVM), such as at least one disk memory.

[0129] The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of the present application is not limited to only one bus or one type of bus.

[0130] The present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the method described above is implemented.

[0131] The computer-readable storage medium mentioned above can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as 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), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special purpose computer.

[0132] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (Application Specific Integrated Circuits, referred to as: ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.

[0133] The division of the units is only a logical function division, and there may be other divisions in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, which may be electrical, mechanical or other forms.

[0134] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0135] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.

[0136] Finally, it should be noted that those skilled in the art will readily conceive of other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. The present invention is intended to cover any variation, use or adaptation of the present invention, which follows the general principles of the present invention and includes common knowledge or conventional techniques in the art not disclosed by the present invention, is not limited to the precise structure described above and shown in the drawings, and may be modified and changed in various ways without departing from the scope thereof.

Claims

1. A node scheduling method for a shared storage device, characterized in that: For scheduling a node cluster, the node cluster includes a master node and at least one slave node, the method includes: If it is determined that the original master node in the node cluster fails, the currently managed token value is changed to obtain a new token value; The new token value is broadcasted to the connected slave nodes in the node cluster, so that a new master node is competed out from the connected slave nodes, and the new master node obtains the new token value; wherein the connected slave node is an original slave node connected to at least an arbitration server and a shared storage device; the connected slave node is connected to at least one other connected slave node; The new token value is broadcast to the shared storage device so that the shared storage device obtains the new token value; wherein, when the master node requests access to the shared storage device and the token value carried in the request of the master node is consistent with the token value of the shared storage device, the master node is allowed to access the shared storage device.

2. The node scheduling method of a shared storage device according to claim 1, characterized in that: The interconnected slave nodes are in a node sub-cluster, and the node sub-cluster includes at least two of the interconnected slave nodes; If there are multiple node subclusters, correspondingly, broadcasting the new token value to the connected slave nodes in the node cluster so that a new master node is competed out among the connected slave nodes, including: If there is a node subcluster with the largest number of connected slave nodes, the node subcluster with the largest number of connected slave nodes is used as the target subcluster; The new token value is broadcasted to the target sub-cluster, so that a new master node is competed out from the connected slave nodes of the target sub-cluster.

3. The node scheduling method of a shared storage device according to claim 2, characterized in that: If there are multiple node subclusters with the largest number of connected slave nodes, then according to the sequence numbers of the connected slave nodes in the node subclusters, one node subcluster is selected from the multiple node subclusters with the largest number of connected slave nodes as the target subcluster; The new token value is broadcasted to the target sub-cluster, so that a new master node is competed out from the connected slave nodes of the target sub-cluster.

4. The node scheduling method of a shared storage device according to claim 2, characterized in that: The failure of the original master node includes at least one of the following types: network partition and master node abnormality; when only the master node abnormality occurs, all the original slave nodes in the node cluster are one node sub-cluster; when only the network partition occurs, at least one original master node in the node cluster fails, and the node cluster is divided into at least one node sub-cluster.

5. The node scheduling method of a shared storage device according to claim 2 or 3, characterized in that: The non-new master node in the target subcluster is migrated to become a new slave node of the new master node.

6. The node scheduling method of a shared storage device according to claim 1, characterized in that: The method further comprises: broadcasting the new token value to the disconnected slave nodes connected to the arbitration server; If the original slave node in the node cluster that is not connected to the arbitration server is restored to be connected, the new token value is broadcast to the original slave node that is restored to be connected.

7. A method for accessing a shared storage device, characterized in that: Applied to a shared storage device, the method comprises: Receive an access request from a master node, and if it is determined that a token value carried in the access request is consistent with a latest token value of the shared storage device, allow the master node to access the shared storage device; If it is determined that the token value carried in the access request is inconsistent with the latest token value of the shared storage device, denying the master node access to the shared storage device; When the arbitration server selects a new master node in the node cluster, the token value of the original master node in the node cluster remains unchanged, and the token values ​​of the new master node and the shared storage device are updated by the new token value broadcast by the arbitration server.

8. An electronic device, characterized in that: include: at least one processor and memory; The memory stores computer-executable instructions; The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the method according to any one of claims 1 to 7.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer program product, characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 7 when being executed by a processor.