[go: up one dir, main page]

CN116055494B - Resource sharing method and system for distributed block storage gateway - Google Patents

Resource sharing method and system for distributed block storage gateway

Info

Publication number
CN116055494B
CN116055494B CN202211515113.6A CN202211515113A CN116055494B CN 116055494 B CN116055494 B CN 116055494B CN 202211515113 A CN202211515113 A CN 202211515113A CN 116055494 B CN116055494 B CN 116055494B
Authority
CN
China
Prior art keywords
lock
master node
node
lock acquisition
slave node
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202211515113.6A
Other languages
Chinese (zh)
Other versions
CN116055494A (en
Inventor
颜嘉伟
林洁琬
黄鹄
肖露
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Telecom Cloud Technology Co Ltd
Original Assignee
China Telecom Cloud Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Telecom Cloud Technology Co Ltd filed Critical China Telecom Cloud Technology Co Ltd
Priority to CN202211515113.6A priority Critical patent/CN116055494B/en
Publication of CN116055494A publication Critical patent/CN116055494A/en
Application granted granted Critical
Publication of CN116055494B publication Critical patent/CN116055494B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/66Arrangements for connecting between networks having differing types of switching systems, e.g. gateways
    • 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]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application relates to a resource sharing method and a system of a distributed block storage gateway, wherein the method comprises the steps of selecting through Raft algorithm, so that a gateway access layer is divided into a master node and a plurality of slave nodes, and the master node is used for controlling the slave nodes to acquire and release storage resource PR locks. And receiving a PR lock release request, sending PR lock acquisition information to the master node through the slave node, and acquiring PR lock service conditions of corresponding storage resources. And searching the persistent reservation mechanism information table, sending the application result of the PR lock to the slave node according to the use condition of the PR lock, and updating the persistent reservation mechanism information table according to the application result. And according to the application result and by sending a PR lock acquisition request from the node, the PR lock acquisition request is used for triggering the client to acquire PR lock acquisition information and judging the reservation condition of the storage resource according to the PR lock acquisition information. The method can reduce the time of fault switching through a multipath technology and improve the reliability and the load balancing capability of the system.

Description

Resource sharing method and system of distributed block storage gateway
Technical Field
The application relates to the technical field of constructing shared block storage resources, in particular to a resource sharing method and system of a distributed block storage gateway.
Background
The persistent reservation mechanism (PERSISTENT RESERVE) of SCSI is proposed by the SCSI standard to support the scenario where multiple initiating nodes access devices, preventing other nodes from accessing specific storage resources. In addition, the mechanism also supports multiple paths from the originating node to the server. The shared cloud hard disk of the iSCSI type realized based on the method is a data block-level storage device supporting concurrent read-write operation of a plurality of cloud hosts. The mechanism effectively avoids the possibility of damaging disk data when a plurality of cloud hosts operate the disk simultaneously. With the development of network storage technology, internet small computer system interface (iSCSI) becomes a universal standard for block network storage resources, and has the advantages of high cost performance, strong universality and the like, so that the rapid development of Storage Area Networks (SANs) is promoted. For example, the IP-SAN is an SAN storage scheme based on IP, is easy to apply in local area networks and wide area networks, has good technical support, and realizes a remote block-level storage system in an IP network.
However, the concept of cloud storage is gradually expanded, which generally refers to a system for providing data storage and access to the outside by using functions such as distributed clusters, grid technology or distributed file systems, and integrating and cooperating with various different types of storage devices in a network. When a client accesses various cloud storage services, the characteristics of disaster recovery capability, high reliability, high availability and the like are pursued, which means that a distributed expandable system structure is needed, and a plurality of storage servers are utilized to balance service flow so as to improve the reliability and availability of the system. Shared block storage requires a persistent reservation mechanism using SCSI, so when existing block gateways implement shared storage resources, resources such as access nodes and underlying storage devices often need to be planned in advance onto a specific block gateway. However, the current way of constructing the shared block store makes a difference between different block gateways, so that different servers form a customized gateway configuration.
Therefore, the common mode of constructing the shared block storage depends on the storage resource planning of the top layer, and the cooperation of the persistent reservation mechanism is not performed among different block gateway servers, so that when a plurality of clients connect the shared disk resource, only one gateway server can be selected, otherwise, the PR locking mechanism is invalid, and the disk data is damaged. In addition, because the storage resources maintained on the storage gateway are inconsistent, when a fault occurs, the storage resources need to be recovered on another gateway, and the fault switching cannot be rapidly performed by utilizing the multipath technology, so that the availability and the reliability of the system are reduced to a certain extent, and the fault recovery time is prolonged.
Disclosure of Invention
Based on this, it is necessary to provide a resource sharing method and system for distributed block storage gateways, which can design a data collaboration flow between distributed block storage gateways based on a persistent reservation mechanism of SCSI standard, so that a shared disk can combine with a conventional multipath technology to achieve load balancing and higher reliability.
In a first aspect, the present application provides a resource sharing method of a distributed block storage gateway, applied to a server, where the method includes:
Electing through Raft algorithm, so that the gateway access layer is divided into a master node and a plurality of slave nodes, wherein the master node is used for controlling the slave nodes to acquire and release storage resource PR locks;
Receiving a PR lock release request, sending PR lock acquisition information to the master node through the slave node, and acquiring PR lock service conditions of corresponding storage resources;
the method comprises the steps of searching a persistent reservation mechanism information table, sending an application result of PR lock to the slave node according to the use condition of the PR lock, and updating the persistent reservation mechanism information table according to the application result;
And sending a PR lock acquisition request through the slave node according to the application result, wherein the PR lock acquisition request is used for triggering a client to acquire PR lock acquisition information and judging the reservation condition of storage resources according to the PR lock acquisition information.
In one embodiment, the method for sending the application result of the PR lock to the slave node by retrieving the persistent reservation mechanism information table and according to the use condition of the PR lock includes:
if no used client exists, sending a result of successful PR lock application to the slave node;
if the used client side is the same as the PR lock acquisition information, sending a result of success of PR lock application to the slave node;
and if the used client side is different from the PR lock acquisition information, sending a PR lock application failure result to the slave node.
In one embodiment, the receiving the PR lock release request and sending PR lock acquisition information to the master node through the slave node, then includes:
And when the sending duration of the PR lock acquisition information sent by the slave node to the master node exceeds a first threshold value, sending PR lock release information to the master node.
In one embodiment, the sending, by the slave node, a PR lock acquisition request according to the application result, and then includes:
And after the storage resource reservation is successful, receiving the first connection request, and constructing an I/O uplink and downlink channel of the storage resource layer with the client.
In a second aspect, the present application provides a resource sharing method of a distributed block storage gateway, applied to a client, the method comprising:
A PR lock release request is sent, and the PR lock release request is used for triggering a slave node of a server to send PR lock acquisition information to a master node and acquiring PR lock service conditions of corresponding storage resources;
Receiving a PR lock acquisition request and acquiring PR lock acquisition information, and judging the reservation condition of storage resources according to the PR lock acquisition information;
The master node and the slave node are obtained by electing the server side through Raft algorithm, the master node is used for controlling the slave node to acquire and release the PR lock of the storage resource, when the transmission duration of the PR lock acquisition information sent from the slave node to the master node in the server side exceeds a first threshold, the PR lock release information is sent to the master node, and the master node sends the application result of the PR lock to the slave node and updates the PR lock reservation mechanism information table by retrieving the persistent reservation mechanism information table according to the service condition of the PR lock.
In one embodiment, the receiving the PR lock acquisition request and acquiring PR lock acquisition information includes:
And after the storage resource reservation is successful, sending a first connection request, and constructing an I/O uplink and downlink channel of the storage resource layer with the server.
In a third aspect, the present application provides a resource sharing system of a distributed block storage gateway, applied to a server, where the system includes:
The first election module is used for carrying out election through Raft algorithm, so that the gateway access layer is divided into a master node and a plurality of slave nodes, and the master node is used for controlling the slave nodes to acquire and release storage resource PR locks;
The first processing module is used for receiving a PR lock release request, sending PR lock acquisition information to the master node through the slave node, and acquiring PR lock service conditions of corresponding storage resources;
The second processing module is used for updating the persistent reservation mechanism information table according to the application result by retrieving the persistent reservation mechanism information table and sending the application result of the PR lock to the slave node according to the use condition of the PR lock;
And the first sending module is used for sending a PR lock acquisition request through the slave node according to the application result, wherein the PR lock acquisition request is used for triggering a client to acquire PR lock acquisition information and judging the reservation condition of storage resources according to the PR lock acquisition information.
In a fourth aspect, the present application provides a resource sharing system of a distributed block storage gateway, applied to a client, the system comprising:
the second sending module is used for sending a PR lock release request, wherein the PR lock release request is used for triggering a slave node of the server to send PR lock acquisition information to a master node and acquiring PR lock service conditions of corresponding storage resources;
the first judging module is used for receiving a PR lock acquisition request and acquiring PR lock acquisition information, and judging the reservation condition of storage resources according to the PR lock acquisition information;
The master node and the slave node are obtained by electing the server side through Raft algorithm, the master node is used for controlling the slave node to acquire and release the PR lock of the storage resource, when the transmission duration of the PR lock acquisition information sent from the slave node to the master node in the server side exceeds a first threshold, the PR lock release information is sent to the master node, and the master node sends the application result of the PR lock to the slave node and updates the PR lock reservation mechanism information table by retrieving the persistent reservation mechanism information table according to the service condition of the PR lock.
In a fifth aspect, the present application provides a computer device comprising a memory storing a computer program and a processor implementing the following steps when executing the computer program:
Electing through Raft algorithm, so that the gateway access layer is divided into a master node and a plurality of slave nodes, wherein the master node is used for controlling the slave nodes to acquire and release storage resource PR locks;
Receiving a PR lock release request, sending PR lock acquisition information to the master node through the slave node, and acquiring PR lock service conditions of corresponding storage resources;
the method comprises the steps of searching a persistent reservation mechanism information table, sending an application result of PR lock to the slave node according to the use condition of the PR lock, and updating the persistent reservation mechanism information table according to the application result;
According to the application result and through the slave node sending PR lock acquisition request, the PR lock acquisition request is used for triggering a client to acquire PR lock acquisition information and judging the reservation condition of storage resources according to the PR lock acquisition information, or
A PR lock release request is sent, and the PR lock release request is used for triggering a slave node of a server to send PR lock acquisition information to a master node and acquiring PR lock service conditions of corresponding storage resources;
Receiving a PR lock acquisition request and acquiring PR lock acquisition information, and judging the reservation condition of storage resources according to the PR lock acquisition information;
The master node and the slave node are obtained by electing the server side through Raft algorithm, the master node is used for controlling the slave node to acquire and release the PR lock of the storage resource, when the transmission duration of the PR lock acquisition information sent from the slave node to the master node in the server side exceeds a first threshold, the PR lock release information is sent to the master node, and the master node sends the application result of the PR lock to the slave node and updates the persistence reservation mechanism information table by retrieving the persistence reservation mechanism information table according to the use condition of the PR lock.
In a sixth aspect, the present application provides a computer storage medium storing a computer program which when executed by a processor performs the steps of:
Electing through Raft algorithm, so that the gateway access layer is divided into a master node and a plurality of slave nodes, wherein the master node is used for controlling the slave nodes to acquire and release storage resource PR locks;
Receiving a PR lock release request, sending PR lock acquisition information to the master node through the slave node, and acquiring PR lock service conditions of corresponding storage resources;
the method comprises the steps of searching a persistent reservation mechanism information table, sending an application result of PR lock to the slave node according to the use condition of the PR lock, and updating the persistent reservation mechanism information table according to the application result;
According to the application result and through the slave node sending PR lock acquisition request, the PR lock acquisition request is used for triggering a client to acquire PR lock acquisition information and judging the reservation condition of storage resources according to the PR lock acquisition information, or
A PR lock release request is sent, and the PR lock release request is used for triggering a slave node of a server to send PR lock acquisition information to a master node and acquiring PR lock service conditions of corresponding storage resources;
Receiving a PR lock acquisition request and acquiring PR lock acquisition information, and judging the reservation condition of storage resources according to the PR lock acquisition information;
The master node and the slave node are obtained by electing the server side through Raft algorithm, the master node is used for controlling the slave node to acquire and release the PR lock of the storage resource, when the transmission duration of the PR lock acquisition information sent from the slave node to the master node in the server side exceeds a first threshold, the PR lock release information is sent to the master node, and the master node sends the application result of the PR lock to the slave node and updates the PR lock reservation mechanism information table by retrieving the persistent reservation mechanism information table according to the service condition of the PR lock.
In the resource sharing method and system of the distributed block storage gateway, in the initialization stage, the server side performs election through Raft algorithm, so that the gateway access layer is divided into a master node and a plurality of slave nodes, and the master node controls the slave nodes to acquire and release storage resource PR locks, and any control node possibly becomes a control gateway due to the consistency algorithm of Raft. After initialization, the server receives a PR lock release request, sends PR lock acquisition information and PR lock service conditions of corresponding storage resources to the slave node through the master node, and the master node sends an application result of the PR lock to the slave node according to the service conditions of the PR lock by retrieving the persistent reservation mechanism information table and updating the persistent reservation mechanism information table according to the application result. And finally, the slave node sends a PR lock acquisition request to the client according to the result of success or failure of PR lock application, the client acquires PR lock acquisition information after receiving the PR lock acquisition request, and the reservation condition of the storage resource is judged according to the PR lock acquisition information. The method designs a cooperative method of a gateway access layer based on a persistent reservation mechanism, so that PR locks cannot be disabled due to the fact that I/O channels are built on a plurality of block storage gateways, the block gateway access layer in a shared storage resource scene is unified, the same resource access logic is arranged on each gateway in a shared disk scene, the time of fault switching can be reduced through a multipath technology, the reliability and the load balancing capability of a system are improved, a client can access any distributed gateway without considering whether a SCSI persistent reservation mechanism is disabled, and a bottom storage cluster does not need to consider whether read-write requests from different gateway servers for the same storage resource can cause shared disk data damage.
Drawings
FIG. 1 is a flow chart of a method for resource sharing of a distributed block storage gateway according to one embodiment of the present application;
FIG. 2 is a flow chart of a method for resource sharing of a distributed block storage gateway according to an embodiment of the present application;
FIG. 3 is a flow chart of a method for resource sharing of a distributed block storage gateway according to an embodiment of the present application;
FIG. 4 is a flow chart of a method for resource sharing of a distributed block storage gateway according to an embodiment of the present application;
FIG. 5 is a schematic diagram of a system architecture of a resource sharing scheme of a distributed block storage gateway according to an embodiment of the present application;
fig. 6 is a flowchart of a persistent reservation mechanism implemented by the gateway access layer according to the present embodiment;
FIG. 7 is a schematic diagram of a resource sharing system of a distributed block storage gateway according to an embodiment of the present application;
FIG. 8 is a schematic diagram of a resource sharing system of a distributed block storage gateway according to an embodiment of the present application;
FIG. 9 is a schematic diagram of a resource sharing system of a distributed block storage gateway according to an embodiment of the present application;
FIG. 10 is a schematic diagram of a resource sharing system of a distributed block storage gateway according to an embodiment of the present application;
fig. 11 is an internal structural view of a computer device according to an embodiment of the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
As shown in fig. 1, in one embodiment, a resource sharing method of a distributed block storage gateway is applied to a server, and includes the following steps:
Step S110, electing through Raft algorithm, so that the gateway access layer is divided into a master node and a plurality of slave nodes, where the master node is used to control the slave nodes to acquire and release the storage resource PR lock.
Specifically, in the initialization process, the server side performs election through Raft algorithm to divide the gateway access layer into a master node and a plurality of slave nodes, wherein the master node is used for controlling the slave nodes to acquire and release the storage resource PR lock.
Step S120, a PR lock release request is received, PR lock acquisition information is sent to the master node through the slave node, and PR lock service conditions of corresponding storage resources are acquired.
Specifically, after initialization is finished, a slave node in the server receives a PR lock release request from the client and sends PR lock acquisition information and PR lock service conditions of corresponding storage resources to the master node.
Step S130, the persistent reservation mechanism information table is updated according to the application result by retrieving the persistent reservation mechanism information table and sending the application result of the PR lock to the slave node according to the use condition of the PR lock.
Specifically, a master node in the server side sends an application result of PR lock to a slave node according to the use condition of PR lock by retrieving the persistent reservation mechanism information table, and updates the persistent reservation mechanism information table according to the application result of PR lock.
Step S140, according to the application result and by sending a PR lock acquisition request from the node, the PR lock acquisition request is used for triggering the client to acquire PR lock acquisition information and judging the reservation condition of the storage resource according to the PR lock acquisition information.
Specifically, the server sends a PR lock acquisition request to the client according to the PR lock application result obtained in step S130, and the client acquires PR lock acquisition information after receiving the PR lock acquisition request and determines a reservation condition of the storage resource according to the PR lock acquisition information.
In the above method for sharing resources of the distributed block storage gateway, in the initialization stage, the server performs election through Raft algorithm, so that the gateway access layer is divided into a master node and a plurality of slave nodes, and the master node controls the slave nodes to acquire and release the storage resource PR lock, and any control node may become a control gateway due to Raft consistency algorithm. After initialization, the server receives a PR lock release request, sends PR lock acquisition information and PR lock service conditions of corresponding storage resources to the slave node through the master node, and the master node sends an application result of the PR lock to the slave node according to the service conditions of the PR lock by retrieving the persistent reservation mechanism information table and updating the persistent reservation mechanism information table according to the application result. And finally, the slave node sends a PR lock acquisition request to the client according to the result of success or failure of PR lock application, the client acquires PR lock acquisition information after receiving the PR lock acquisition request, and the reservation condition of the storage resource is judged according to the PR lock acquisition information. The method designs a cooperative method of a gateway access layer based on a persistent reservation mechanism, so that PR locks cannot be disabled due to the fact that I/O channels are built on a plurality of block storage gateways, the block gateway access layer in a shared storage resource scene is unified, the same resource access logic is arranged on each gateway in a shared disk scene, the time of fault switching can be reduced through a multipath technology, the reliability and the load balancing capability of a system are improved, a client can access any distributed gateway without considering whether a SCSI persistent reservation mechanism is disabled, and a bottom storage cluster does not need to consider whether read-write requests from different gateway servers for the same storage resource can cause shared disk data damage.
As shown in fig. 2, in one embodiment, a resource sharing method of a distributed block storage gateway is applied to a server, and includes the following steps:
In step S210, election is performed by using Raft algorithm, so that the gateway access layer is divided into a master node and a plurality of slave nodes, where the master node is used to control the slave nodes to acquire and release the storage resource PR lock.
Specifically, in the initialization process, the server side performs election through Raft algorithm to divide the gateway access layer into a master node and a plurality of slave nodes, wherein the master node is used for controlling the slave nodes to acquire and release the storage resource PR lock.
Step S220, a PR lock release request is received, PR lock acquisition information is sent to the master node through the slave node, and PR lock service conditions of corresponding storage resources are acquired.
Specifically, after initialization is finished, a slave node in the server receives a PR lock release request from the client and sends PR lock acquisition information and PR lock service conditions of corresponding storage resources to the master node.
Step S230, when the transmission duration of the PR lock acquisition information transmitted from the slave node to the master node exceeds the first threshold, transmitting PR lock release information to the master node.
Specifically, when the sending duration of sending PR lock acquisition information from the slave node to the master node in the server exceeds a set first threshold, the sending duration is overtime, and after the overtime, PR lock release information is sent to the master node.
Step S240, the persistent reservation mechanism information table is updated according to the application result by retrieving the persistent reservation mechanism information table and sending the application result of the PR lock to the slave node according to the use condition of the PR lock.
Specifically, a master node in the server side sends an application result of PR lock to a slave node according to the use condition of PR lock by retrieving the persistent reservation mechanism information table, and updates the persistent reservation mechanism information table according to the application result of PR lock. And if the used client is not the same as the PR lock acquisition information, sending the result of the PR lock application success to the slave node, and if the used client is different from the PR lock acquisition information, sending the result of the PR lock application failure to the slave node.
Step S250, according to the application result and by sending a PR lock acquisition request from the node, the PR lock acquisition request is used for triggering the client to acquire PR lock acquisition information and judging the reservation condition of the storage resource according to the PR lock acquisition information.
Specifically, the server sends a PR lock acquisition request to the client according to the PR lock application result obtained in step S130, and the client acquires PR lock acquisition information after receiving the PR lock acquisition request and determines a reservation condition of the storage resource according to the PR lock acquisition information.
Step S260, when the reservation of the storage resource is successful, the first connection request is received, and the I/O uplink and downlink channel of the storage resource layer is constructed with the client.
Specifically, when the result of the determination of the reservation condition of the storage resource in step S250 indicates that the reservation of the storage resource is successful, the server side receives the first connection request from the client side and constructs an I/O uplink/downlink channel of the storage resource layer with the client side.
In the above method for sharing resources of the distributed block storage gateway, in the initialization stage, the server performs election through Raft algorithm, so that the gateway access layer is divided into a master node and a plurality of slave nodes, and the master node controls the slave nodes to acquire and release the storage resource PR lock, and any control node may become a control gateway due to Raft consistency algorithm. After initialization, the server receives PR lock release requests, sends PR lock acquisition information and PR lock service conditions of corresponding storage resources to the slave node through the master node, and sends PR lock release information to the master node when the sending duration of the PR lock acquisition information sent to the master node by the slave node exceeds a first threshold. The master node sends the application result of the PR lock to the slave node according to the service condition of the PR lock by retrieving the persistent reservation mechanism information table, and updates the persistent reservation mechanism information table according to the application result. And finally, the slave node sends a PR lock acquisition request to the client according to the success or failure of PR lock application, the client acquires PR lock acquisition information after receiving the PR lock acquisition request, judges the reservation condition of storage resources according to the PR lock acquisition information, and finally sends a first connection request to the server after the storage resources are reserved successfully and constructs an I/O uplink and downlink channel of a storage resource layer with the server. The method designs a cooperative method of a gateway access layer based on a persistent reservation mechanism, so that PR locks cannot be disabled due to the fact that I/O channels are built on a plurality of block storage gateways, the block gateway access layer in a shared storage resource scene is unified, the same resource access logic is arranged on each gateway in a shared disk scene, the time of fault switching can be reduced through a multipath technology, the reliability and the load balancing capability of a system are improved, a client can access any distributed gateway without considering whether a SCSI persistent reservation mechanism is disabled, and a bottom storage cluster does not need to consider whether read-write requests from different gateway servers for the same storage resource can cause shared disk data damage.
As shown in fig. 3, in one embodiment, a resource sharing method of a distributed block storage gateway is applied to a client, and includes the following steps:
step S310, a PR lock release request is sent, and the PR lock release request is used for triggering a slave node of a server to send PR lock acquisition information to a master node and acquiring PR lock service conditions of corresponding storage resources.
Specifically, the client sends a PR lock release request to the server, and the server sends PR lock acquisition information and PR lock service conditions of corresponding storage resources to the master node through the slave node after receiving the PR lock release request.
It should be noted that, the master node and the slave node are obtained by electing through Raft algorithm for the server, the master node is used for controlling the slave node to acquire and release the storage resource PR lock, when the transmission duration of the slave node in the server for transmitting the PR lock acquisition information to the master node exceeds the first threshold, the master node transmits the PR lock release information to the master node, and the master node of the server transmits the PR lock application result to the slave node and updates the persistent reservation mechanism information table by retrieving the persistent reservation mechanism information table and according to the use condition of the PR lock.
Step S320, receiving PR lock acquisition request and acquiring PR lock acquisition information, and judging reservation condition of storage resources according to the PR lock acquisition information.
Specifically, the client receives a PR lock acquisition request from the server and acquires PR lock acquisition information, and the reservation condition of the storage resource is judged according to the acquired PR lock acquisition information.
In the above method for sharing resources of the distributed block storage gateway, in the initialization stage, the server performs election through Raft algorithm, so that the gateway access layer is divided into a master node and a plurality of slave nodes, and the master node controls the slave nodes to acquire and release the storage resource PR lock, and any control node may become a control gateway due to Raft consistency algorithm. After initialization, the server receives a PR lock release request, sends PR lock acquisition information and PR lock service conditions of corresponding storage resources to the slave node through the master node, and the master node sends an application result of the PR lock to the slave node according to the service conditions of the PR lock by retrieving the persistent reservation mechanism information table and updating the persistent reservation mechanism information table according to the application result. And finally, the slave node sends a PR lock acquisition request to the client according to the result of success or failure of PR lock application, the client acquires PR lock acquisition information after receiving the PR lock acquisition request, and the reservation condition of the storage resource is judged according to the PR lock acquisition information. The method designs a cooperative method of a gateway access layer based on a persistent reservation mechanism, so that PR locks cannot be disabled due to the fact that I/O channels are built on a plurality of block storage gateways, the block gateway access layer in a shared storage resource scene is unified, the same resource access logic is arranged on each gateway in a shared disk scene, the time of fault switching can be reduced through a multipath technology, the reliability and the load balancing capability of a system are improved, a client can access any distributed gateway without considering whether a SCSI persistent reservation mechanism is disabled, and a bottom storage cluster does not need to consider whether read-write requests from different gateway servers for the same storage resource can cause shared disk data damage.
As shown in fig. 4, in one embodiment, a resource sharing method of a distributed block storage gateway is applied to a client, and includes the following steps:
Step S410, a PR lock release request is sent, where the PR lock release request is used to trigger a slave node of a server to send PR lock acquisition information to a master node and acquire a PR lock usage condition of a corresponding storage resource.
Specifically, the client sends a PR lock release request to the server, and the server sends PR lock acquisition information and PR lock service conditions of corresponding storage resources to the master node through the slave node after receiving the PR lock release request.
It should be noted that, the master node and the slave node are obtained by electing through Raft algorithm for the server, the master node is used for controlling the slave node to acquire and release the storage resource PR lock, when the transmission duration of the slave node in the server for transmitting the PR lock acquisition information to the master node exceeds the first threshold, the master node transmits the PR lock release information to the master node, and the master node of the server transmits the PR lock application result to the slave node and updates the persistent reservation mechanism information table by retrieving the persistent reservation mechanism information table and according to the use condition of the PR lock.
Step S420, a PR lock acquisition request is received, PR lock acquisition information is acquired, and reservation conditions of storage resources are judged according to the PR lock acquisition information.
Specifically, the client receives a PR lock acquisition request from the server and acquires PR lock acquisition information, and the reservation condition of the storage resource is judged according to the acquired PR lock acquisition information.
Step S430, after the storage resource reservation is successful, a first connection request is sent, and an I/O uplink/downlink channel of the storage resource layer is constructed with the server.
Specifically, when the determination result of the reservation condition of the storage resource by the client in step S420 indicates that the reservation of the storage resource is successful, the client sends a first connection request to the server, and constructs an I/O uplink/downlink channel of the storage resource layer with the server.
In the above method for sharing resources of the distributed block storage gateway, in the initialization stage, the server performs election through Raft algorithm, so that the gateway access layer is divided into a master node and a plurality of slave nodes, and the master node controls the slave nodes to acquire and release the storage resource PR lock, and any control node may become a control gateway due to Raft consistency algorithm. After initialization, the server receives a PR lock release request, sends PR lock acquisition information and PR lock service conditions of corresponding storage resources to the slave node through the master node, and sends PR lock release information to the master node when the sending duration of the PR lock acquisition information sent to the master node by the slave node in the server exceeds a first threshold. The master node sends the application result of the PR lock to the slave node according to the service condition of the PR lock by retrieving the persistent reservation mechanism information table, and updates the persistent reservation mechanism information table according to the application result. And finally, the slave node sends a PR lock acquisition request to the client according to the success or failure of PR lock application, the client acquires PR lock acquisition information after receiving the PR lock acquisition request, judges the reservation condition of storage resources according to the PR lock acquisition information, and finally sends a first connection request to the server after the storage resources are reserved successfully and constructs an I/O uplink and downlink channel of a storage resource layer with the server. The method designs a cooperative method of a gateway access layer based on a persistent reservation mechanism, so that PR locks cannot be disabled due to the fact that I/O channels are built on a plurality of block storage gateways, the block gateway access layer in a shared storage resource scene is unified, the same resource access logic is arranged on each gateway in a shared disk scene, the time of fault switching can be reduced through a multipath technology, the reliability and the load balancing capability of a system are improved, a client can access any distributed gateway without considering whether a SCSI persistent reservation mechanism is disabled, and a bottom storage cluster does not need to consider whether read-write requests from different gateway servers for the same storage resource can cause shared disk data damage.
As shown in fig. 5 and fig. 6, in one embodiment, in a resource sharing scheme of a distributed block storage gateway, since the block storage gateway of a gateway access layer needs to be classified into master nodes and slave nodes, an etcd component is installed on the gateway to implement a Leader election function of Raft algorithm.
The server side firstly needs to collect the storage resource relation of all the block storage gateways of the summarized gateway access layer, and constructs the same resource access logic on each gateway, wherein the storage resource relation comprises a network port group of iSCSI, a client side defined name (IQN), a target defined name, authentication information and block resource association logic. And then deploying etcd components on all the block storage gateways, and after the node is started, carrying out election through Raft algorithm, so that an access layer is divided into a Master node (Master node) and a plurality of slave nodes (slave nodes), wherein the Master node (Master node) is used for controlling the slave nodes (slave nodes) to acquire and release storage resource PR locks. The Master node (Master node) actively reserves a memory space for maintenance of the persistent reservation mechanism of the underlying storage resources.
The client connects the gateway access layer as required and sends a connection request to the server to construct an I/O uplink/downlink channel of the storage resource layer, and before the shared disk client sends the I/O request, the client sends a PR lock (PERSISTENT RESERVE) release request (PR OUT request) to the server to the block storage gateway correspondingly connected with the gateway access layer. After receiving the PR lock release request (PR OUT request), the corresponding block storage gateway sends a message for acquiring the PR lock to the Master node (Master node).
After receiving the PR lock information from the slave node (slave node), the Master node (Master node) inquires the maintained persistent reservation mechanism information table and sends a PR lock application success or failure message to the slave node (slave node) according to the use condition of the corresponding storage resource PR lock, if no used client IQN (client-side defined name) exists, the application success is returned, if the used client IQN is the same as the acquired message, the high reliability and load balancing scene of multiple paths are judged, the application success is returned, and if the used client IQN is different from the acquired message, the application failure is returned. Meanwhile, the Master node (Master node) needs to update the current gateway and the candidate gateway list, namely a persistent reservation mechanism information table, as shown in table 1, wherein the persistent reservation mechanism information comprises a block resource number, acquisition time of PR lock, timeout time, client IQN, the current gateway and the candidate gateway list, and for the message of releasing PR lock, the current gateway of the information table is removed until one message for sending PR lock to acquire success is selected from the candidate gateway list when the current gateway is empty.
Table 1 persistent reservation mechanism information table
Block resource numbering Acquisition time Timeout time Client IQN Current gateway Candidate gateway list
1 t1 t2 IQN1 3,4 1,5
2 t3 t4 IQN3 1 7,6,2
3 ... t5 ... ... ...
4 ... ... ... ... ...
... ... ... ... ... ...
And the client judges the reservation condition of the storage resource according to the received PR lock acquisition message (PR IN message), and the reservation success can issue an I/O request through the constructed I/O channel.
It should be noted that, after the block storage gateway successfully acquires the PR lock, it needs to block the I/O channel and release the PR lock in time within the timeout period formulated by the Master node (Master node), and the client access gateway as required indicates that different usage scenarios may exist, that is, the same client uses a multipath technology to implement load balancing and high reliability by connecting storage resources through different storage gateways, and different clients connect to the same shared disk for resource usage through the storage gateway layer.
The resource sharing scheme of the distributed block storage gateway is compatible with the existing distributed storage system architecture, a Master node and a slave node (slave node) are selected through Raft algorithm in the management of the same storage resource of the access layer of the block storage gateway, and the acquisition and release of the storage resource PR lock are carried out. Clients can theoretically access any distributed gateway regardless of whether the SCSI persistent reservation mechanism would fail. The underlying storage clusters also do not need to consider whether read and write requests from different gateway servers to the same storage resource would cause data corruption of the shared disk. Therefore, the proposal designs a cooperative method of the gateway access layer based on a persistent reservation mechanism, so that PR locks cannot be disabled due to the construction of I/O channels on a plurality of block storage gateways, unifies the block gateway access layer under the shared storage resource scene, ensures that each gateway has the same resource access logic under the shared disk scene, reduces the fault switching time through a multipath technology, improves the reliability of the system and the capacity of load balancing, and ensures that the realization of the shared disk function of the block storage gateway access layer is transparent to an upper client and a lower distributed storage cluster.
As shown in fig. 7, in one embodiment, a resource sharing system of a distributed block storage gateway is applied to a server and includes a first election module 710, a first processing module 720, a second processing module 730, and a first sending module 740.
The first election module 710 is configured to perform election by using a Raft algorithm, so that the gateway access layer is divided into a master node and a plurality of slave nodes, where the master node is configured to control the slave nodes to acquire and release the storage resource PR lock.
The first processing module 720 is configured to receive a PR lock release request, send PR lock acquisition information to the master node by using the slave node, and acquire a PR lock usage condition of a corresponding storage resource.
The second processing module 730 updates the persistent reservation mechanism information table according to the application result by retrieving the persistent reservation mechanism information table and transmitting the application result of the PR lock to the slave node according to the use condition of the PR lock.
The first sending module 740 is configured to send a PR lock acquisition request according to an application result and through a slave node, where the PR lock acquisition request is used to trigger a client to acquire PR lock acquisition information and determine a reservation condition of a storage resource according to the PR lock acquisition information.
In the above resource sharing system of the distributed block storage gateway, in the initialization stage, the first election module performs election through Raft algorithm, so that the gateway access layer is divided into a master node and a plurality of slave nodes, and the master node controls the slave nodes to acquire and release the storage resource PR lock, and any control node may become the control gateway due to the consistency algorithm of Raft. After initialization, the first processing module receives PR lock release requests, sends PR lock acquisition information and PR lock service conditions of corresponding storage resources to the slave node through the master node, and the master node searches the persistent reservation mechanism information table through the second processing module, sends PR lock application results to the slave node according to the PR lock service conditions and updates the persistent reservation mechanism information table according to the application results. And finally, the slave node sends a PR lock acquisition request to the client through a first sending module according to the result of success or failure of PR lock application, the client acquires PR lock acquisition information after receiving the PR lock acquisition request, and the reservation condition of the storage resource is judged according to the PR lock acquisition information. The system designs a cooperative method of a gateway access layer based on a persistent reservation mechanism, so that PR locks cannot be disabled due to the fact that I/O channels are built on a plurality of block storage gateways, the block gateway access layer in a shared storage resource scene is unified, the same resource access logic is arranged on each gateway in a shared disk scene, the time of fault switching can be reduced through a multipath technology, the reliability and the load balancing capability of the system are improved, a client can access any distributed gateway without considering whether a SCSI persistent reservation mechanism is disabled, and a bottom storage cluster does not need to consider whether read-write requests from different gateway servers for the same storage resource can cause shared disk data damage.
As shown in fig. 8, in one embodiment, a resource sharing system of a distributed block storage gateway is applied to a server and includes a first election module 810, a first processing module 820, a first feedback module 830, a second processing module 840, a first sending module 850 and a first receiving module 860.
The first election module 810 is configured to perform election by using Raft algorithm, so that the gateway access layer is divided into a master node and a plurality of slave nodes, where the master node is configured to control the slave nodes to acquire and release the storage resource PR lock.
The first processing module 820 is configured to receive a PR lock release request, send PR lock acquisition information to a master node by using a slave node, and acquire a PR lock usage of a corresponding storage resource.
The first feedback module 830 is configured to send PR lock release information to the master node when a sending duration of sending PR lock acquisition information from the slave node to the master node exceeds a first threshold.
The second processing module 840 searches the persistent reservation mechanism information table and sends the application result of the PR lock to the slave node according to the use condition of the PR lock, updates the persistent reservation mechanism information table according to the application result, if there is no used client, sends the result of successful PR lock application to the slave node, if there is a used client and the same information as the PR lock acquisition information, sends the result of successful PR lock application to the slave node, and if there is a used client and the same information as the PR lock acquisition information, sends the result of failure PR lock application to the slave node.
The first sending module 850 is configured to send, according to the application result and by sending a PR lock acquisition request from the node, the PR lock acquisition request is configured to trigger the client to acquire PR lock acquisition information and determine a reservation condition of the storage resource according to the PR lock acquisition information.
The first receiving module 860 is configured to receive the first connection request after the storage resource reservation is successful, and construct an I/O uplink/downlink channel of the storage resource layer with the client.
In the above resource sharing system of the distributed block storage gateway, in the initialization stage, the first election module performs election through Raft algorithm, so that the gateway access layer is divided into a master node and a plurality of slave nodes, and the master node controls the slave nodes to acquire and release the storage resource PR lock, and any control node may become the control gateway due to the consistency algorithm of Raft. After initialization, the first processing module receives PR lock release requests, sends PR lock acquisition information and PR lock service conditions of corresponding storage resources to the slave node through the master node, and sends PR lock release information to the master node through the first feedback module when the sending duration of the PR lock acquisition information sent to the master node by the slave node exceeds a first threshold. The master node searches the persistent reservation mechanism information table through the second processing module, sends the application result of the PR lock to the slave node according to the use condition of the PR lock, and updates the persistent reservation mechanism information table according to the application result. And finally, the slave node sends a PR lock acquisition request to the client through a first sending module according to the result of success or failure of PR lock application, the client acquires PR lock acquisition information after receiving the PR lock acquisition request, judges the reservation condition of storage resources according to the PR lock acquisition information, and finally, the server receives a first connection request from the client through a first receiving module after the storage resources are reserved successfully and constructs an I/O uplink and downlink channel of the storage resource layer with the client. The system designs a cooperative method of a gateway access layer based on a persistent reservation mechanism, so that PR locks cannot be disabled due to the fact that I/O channels are built on a plurality of block storage gateways, the block gateway access layer in a shared storage resource scene is unified, the same resource access logic is arranged on each gateway in a shared disk scene, the time of fault switching can be reduced through a multipath technology, the reliability and the load balancing capability of the system are improved, a client can access any distributed gateway without considering whether a SCSI persistent reservation mechanism is disabled, and a bottom storage cluster does not need to consider whether read-write requests from different gateway servers for the same storage resource can cause shared disk data damage.
As shown in fig. 9, in one embodiment, a resource sharing system of a distributed block storage gateway is applied to a client, and includes a second sending module 910 and a first judging module 920.
The second sending module 910 is configured to send a PR lock release request, where the PR lock release request is used to trigger a slave node of the server to send PR lock acquisition information to the master node and acquire a PR lock service condition of a corresponding storage resource.
The first determining module 920 is configured to receive the PR lock acquisition request and acquire PR lock acquisition information, and determine a reservation condition of the storage resource according to the PR lock acquisition information.
It should be noted that, the master node and the slave node are obtained by electing through Raft algorithm for the server, the master node is used for controlling the slave node to acquire and release the storage resource PR lock, when the transmission duration of the slave node in the server for transmitting the PR lock acquisition information to the master node exceeds the first threshold, the master node transmits the PR lock release information to the master node, and the master node of the server transmits the PR lock application result to the slave node and updates the persistent reservation mechanism information table by retrieving the persistent reservation mechanism information table and according to the use condition of the PR lock.
In the above resource sharing system of the distributed block storage gateway, in the initialization stage, the server performs election through Raft algorithm, so that the gateway access layer is divided into a master node and a plurality of slave nodes, and the master node controls the slave nodes to acquire and release the storage resource PR lock, and any control node may become a control gateway due to Raft consistency algorithm. After initialization, the second sending module sends a PR lock release request to the server, the server sends PR lock acquisition information and PR lock service conditions of corresponding storage resources to the slave node through the master node, and the master node sends an application result of the PR lock to the slave node through retrieving the persistent reservation mechanism information table according to the service conditions of the PR lock and updates the persistent reservation mechanism information table according to the application result. And finally, a slave node in the server side sends a PR lock acquisition request to the client side according to the result of success or failure of PR lock application, and a first judging module of the client side acquires PR lock acquisition information after receiving the PR lock acquisition request and judges the reservation condition of the storage resource according to the PR lock acquisition information. The system designs a cooperative method of a gateway access layer based on a persistent reservation mechanism, so that PR locks cannot be disabled due to the fact that I/O channels are built on a plurality of block storage gateways, the block gateway access layer in a shared storage resource scene is unified, the same resource access logic is arranged on each gateway in a shared disk scene, the time of fault switching can be reduced through a multipath technology, the reliability and the load balancing capability of the system are improved, a client can access any distributed gateway without considering whether a SCSI persistent reservation mechanism is disabled, and a bottom storage cluster does not need to consider whether read-write requests from different gateway servers for the same storage resource can cause shared disk data damage.
As shown in fig. 10, in one embodiment, a resource sharing system of a distributed block storage gateway is applied to a client, and includes a second sending module 1010, a first judging module 1020, and a third sending module 1030.
The second sending module 1010 is configured to send a PR lock release request, where the PR lock release request is used to trigger a slave node of the server to send PR lock acquisition information to the master node and acquire a PR lock service condition of a corresponding storage resource.
The first determining module 1020 is configured to receive the PR lock acquisition request and acquire PR lock acquisition information, and determine a reservation condition of the storage resource according to the PR lock acquisition information.
It should be noted that, the master node and the slave node are obtained by electing through Raft algorithm for the server, the master node is used for controlling the slave node to acquire and release the storage resource PR lock, when the transmission duration of the slave node in the server for transmitting the PR lock acquisition information to the master node exceeds the first threshold, the master node transmits the PR lock release information to the master node, and the master node of the server transmits the PR lock application result to the slave node and updates the persistent reservation mechanism information table by retrieving the persistent reservation mechanism information table and according to the use condition of the PR lock.
The third sending module 1030 is configured to send the first connection request after the storage resource reservation is successful, and construct an I/O uplink/downlink channel of the storage resource layer with the server.
In the above resource sharing system of the distributed block storage gateway, in the initialization stage, the server performs election through Raft algorithm, so that the gateway access layer is divided into a master node and a plurality of slave nodes, and the master node controls the slave nodes to acquire and release the storage resource PR lock, and any control node may become a control gateway due to Raft consistency algorithm. After initialization, the second sending module sends a PR lock release request to the server, the server sends PR lock acquisition information and PR lock service conditions of corresponding storage resources to the slave node through the master node, and when the sending duration of the PR lock acquisition information sent to the master node by the slave node in the server exceeds a first threshold, the PR lock release information is sent to the master node. The master node sends the application result of the PR lock to the slave node according to the service condition of the PR lock by retrieving the persistent reservation mechanism information table, and updates the persistent reservation mechanism information table according to the application result. And finally, the slave node sends a PR lock acquisition request to the client according to the success or failure of PR lock application, a first judging module of the client acquires PR lock acquisition information after receiving the PR lock acquisition request, judges the reservation condition of storage resources according to the PR lock acquisition information, and finally, a third sending module sends a first connection request to the server after the storage resources are reserved successfully and constructs an I/O uplink and downlink channel of the storage resource layer with the server. The system designs a cooperative method of a gateway access layer based on a persistent reservation mechanism, so that PR locks cannot be disabled due to the fact that I/O channels are built on a plurality of block storage gateways, the block gateway access layer in a shared storage resource scene is unified, the same resource access logic is arranged on each gateway in a shared disk scene, the time of fault switching can be reduced through a multipath technology, the reliability and the load balancing capability of the system are improved, a client can access any distributed gateway without considering whether a SCSI persistent reservation mechanism is disabled, and a bottom storage cluster does not need to consider whether read-write requests from different gateway servers for the same storage resource can cause shared disk data damage.
In one embodiment, a computer device is provided, which may be a smart terminal, and the internal structure thereof may be as shown in fig. 11. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program, when executed by a processor, implements a method for resource sharing of a distributed block storage gateway.
It will be appreciated by those skilled in the art that the structure shown in FIG. 11 is merely a block diagram of some of the structures associated with the present inventive arrangements and is not limiting of the computer device to which the present inventive arrangements may be applied, and that a particular computer device may include more or fewer components than shown, or may combine some of the components, or have a different arrangement of components.
In one embodiment, a computer device includes a memory storing a computer program and a processor implementing the steps of the method embodiments described above when the computer program is executed by the processor.
In one embodiment, a computer storage medium stores a computer program which, when executed by a processor, performs the steps of the method embodiments described above.
In one embodiment, a computer program product or computer program is provided that includes computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps in the above-described method embodiments.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in embodiments provided herein may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (SYNCHLINK) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The foregoing examples illustrate only a few embodiments of the invention and are described in detail herein without thereby limiting the scope of the invention. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the invention, which are all within the scope of the invention. Accordingly, the scope of protection of the present invention is to be determined by the appended claims.

Claims (10)

1.一种分布式块存储网关的资源共享方法,其特征在于,应用于服务端,所述方法包括:1. A resource sharing method for a distributed block storage gateway, characterized in that it is applied to a server, and the method comprises: 通过Raft算法进行选举,使得网关接入层被划分为主节点和多个从节点,所述主节点用于控制所述从节点进行存储资源PR锁的获取和释放;The Raft algorithm is used to elect nodes so that the gateway access layer is divided into a master node and multiple slave nodes. The master node is used to control the slave nodes to obtain and release storage resource PR locks. 接收PR锁释放请求并通过所述从节点向所述主节点发送PR锁获取信息,并获取对应存储资源的PR锁使用情况;Receive a PR lock release request and send PR lock acquisition information to the master node through the slave node, and obtain PR lock usage of the corresponding storage resource; 通过检索持久性预留机制信息表并根据所述PR锁的使用情况向所述从节点发送PR锁的申请结果,根据所述申请结果更新所述持久性预留机制信息表;By retrieving the persistent reservation mechanism information table and sending the PR lock application result to the slave node according to the usage of the PR lock, updating the persistent reservation mechanism information table according to the application result; 根据所述申请结果并通过所述从节点发送PR锁获取请求,所述PR锁获取请求用于触发客户端获取PR锁获取信息并根据所述PR锁获取信息判断存储资源的预留情况。According to the application result, a PR lock acquisition request is sent through the slave node, where the PR lock acquisition request is used to trigger the client to obtain PR lock acquisition information and determine the reservation status of storage resources according to the PR lock acquisition information. 2.根据权利要求1所述的分布式块存储网关的资源共享方法,其特征在于,所述通过检索持久性预留机制信息表并根据所述PR锁的使用情况向所述从节点发送PR锁的申请结果,包括:2. The resource sharing method of a distributed block storage gateway according to claim 1, wherein the step of retrieving the persistent reservation mechanism information table and sending the PR lock application result to the slave node according to the usage of the PR lock comprises: 若没有已使用的客户端,则向所述从节点发送PR锁申请成功的结果;If there is no client in use, a successful PR lock application result is sent to the slave node; 若有已使用的客户端且与所述PR锁获取信息相同,则向所述从节点发送PR锁申请成功的结果;If there is a client that has been used and the information is the same as the PR lock acquisition information, a result indicating that the PR lock application is successful is sent to the slave node; 若有已使用的客户端且与所述PR锁获取信息不同,则向所述从节点发送PR锁申请失败的结果。If there is a client that has been used and the information is different from the PR lock acquisition information, a result indicating that the PR lock application failed is sent to the slave node. 3.根据权利要求1所述的分布式块存储网关的资源共享方法,其特征在于,所述接收PR锁释放请求并通过所述从节点向所述主节点发送PR锁获取信息,之后包括:3. The resource sharing method of a distributed block storage gateway according to claim 1, wherein the receiving of the PR lock release request and the sending of the PR lock acquisition information to the master node through the slave node further comprise: 当所述从节点向所述主节点发送所述PR锁获取信息的发送时长超过第一阈值时向所述主节点发送PR锁释放信息。When the duration of the slave node sending the PR lock acquisition information to the master node exceeds a first threshold, the slave node sends PR lock release information to the master node. 4.根据权利要求1所述的分布式块存储网关的资源共享方法,其特征在于,所述根据所述申请结果并通过所述从节点发送PR锁获取请求,之后包括:4. The resource sharing method of a distributed block storage gateway according to claim 1, wherein the step of sending a PR lock acquisition request through the slave node according to the application result further comprises: 当存储资源预留成功后接收第一连接请求,并与客户端构建存储资源层的I/O上下行通道。When the storage resource reservation is successful, the first connection request is received, and an I/O uplink and downlink channel of the storage resource layer is established with the client. 5.一种分布式块存储网关的资源共享方法,其特征在于,应用于客户端,所述方法包括:5. A resource sharing method for a distributed block storage gateway, characterized in that it is applied to a client and comprises: 发送PR锁释放请求,所述PR锁释放请求用于触发服务端的从节点向主节点发送PR锁获取信息并获取对应存储资源的PR锁使用情况;Send a PR lock release request, which is used to trigger the slave node of the server to send PR lock acquisition information to the master node and obtain the PR lock usage of the corresponding storage resource; 接收PR锁获取请求并获取PR锁获取信息,根据所述PR锁获取信息判断存储资源的预留情况;Receiving a PR lock acquisition request and obtaining PR lock acquisition information, and determining a reservation status of storage resources according to the PR lock acquisition information; 其中,所述主节点和从节点为所述服务端通过Raft算法进行选举获得,所述主节点用于控制所述从节点进行存储资源PR锁的获取和释放,当服务端中的从节点向主节点发送PR锁获取信息的发送时长超过第一阈值时,则向主节点发送PR锁释放信息,所述主节点通过检索持久性预留机制信息表并根据PR锁的使用情况向所述从节点发送PR锁的申请结果并更新所述持久性预留机制信息表。The master node and slave node are elected by the server through the Raft algorithm. The master node is used to control the slave node to acquire and release the storage resource PR lock. When the sending time of the PR lock acquisition information sent by the slave node in the server to the master node exceeds a first threshold, the master node sends PR lock release information to the master node. The master node retrieves the persistent reservation mechanism information table and sends the PR lock application result to the slave node according to the usage of the PR lock and updates the persistent reservation mechanism information table. 6.根据权利要求5所述的分布式块存储网关的资源共享方法,其特征在于,所述接收PR锁获取请求并获取PR锁获取信息,之后包括:6. The resource sharing method of a distributed block storage gateway according to claim 5, wherein the receiving a PR lock acquisition request and obtaining PR lock acquisition information further comprises: 当存储资源预留成功后发送第一连接请求,并与服务端构建存储资源层的I/O上下行通道。When the storage resource reservation is successful, the first connection request is sent, and the I/O uplink and downlink channels of the storage resource layer are established with the server. 7.一种分布式块存储网关的资源共享系统,其特征在于,应用于服务端,所述系统包括:7. A resource sharing system for a distributed block storage gateway, characterized in that it is applied to a server and comprises: 第一选举模块,用于通过Raft算法进行选举,使得网关接入层被划分为主节点和多个从节点,所述主节点用于控制所述从节点进行存储资源PR锁的获取和释放;A first election module is configured to perform elections using a Raft algorithm, so that the gateway access layer is divided into a master node and multiple slave nodes. The master node is configured to control the slave nodes to acquire and release storage resource PR locks. 第一处理模块,用于接收PR锁释放请求并通过所述从节点向所述主节点发送PR锁获取信息,并获取对应存储资源的PR锁使用情况;A first processing module is configured to receive a PR lock release request and send PR lock acquisition information to the master node through the slave node, and obtain PR lock usage of corresponding storage resources; 第二处理模块,用于通过检索持久性预留机制信息表并根据所述PR锁的使用情况向所述从节点发送PR锁的申请结果,根据所述申请结果更新所述持久性预留机制信息表;a second processing module, configured to retrieve a persistent reservation mechanism information table and send a PR lock application result to the slave node according to usage of the PR lock, and update the persistent reservation mechanism information table according to the application result; 第一发送模块,用于根据所述申请结果并通过所述从节点发送PR锁获取请求,所述PR锁获取请求用于触发客户端获取PR锁获取信息并根据所述PR锁获取信息判断存储资源的预留情况。The first sending module is configured to send a PR lock acquisition request through the slave node according to the application result, wherein the PR lock acquisition request is used to trigger the client to obtain PR lock acquisition information and determine the reservation status of storage resources according to the PR lock acquisition information. 8.一种分布式块存储网关的资源共享系统,其特征在于,应用于客户端,所述系统包括:8. A resource sharing system for a distributed block storage gateway, characterized in that it is applied to a client and comprises: 第二发送模块,用于发送PR锁释放请求,所述PR锁释放请求用于触发服务端的从节点向主节点发送PR锁获取信息并获取对应存储资源的PR锁使用情况;A second sending module is configured to send a PR lock release request, wherein the PR lock release request is used to trigger the slave node of the server to send PR lock acquisition information to the master node and obtain the PR lock usage of the corresponding storage resource; 第一判断模块,用于接收PR锁获取请求并获取PR锁获取信息,根据所述PR锁获取信息判断存储资源的预留情况;a first determination module, configured to receive a PR lock acquisition request and obtain PR lock acquisition information, and determine a reservation status of storage resources according to the PR lock acquisition information; 其中,所述主节点和从节点为所述服务端通过Raft算法进行选举获得,所述主节点用于控制所述从节点进行存储资源PR锁的获取和释放,当服务端中的从节点向主节点发送PR锁获取信息的发送时长超过第一阈值时,则向主节点发送PR锁释放信息,所述主节点通过检索持久性预留机制信息表并根据PR锁的使用情况向所述从节点发送PR锁的申请结果并更新所述持久性预留机制信息表。The master node and slave node are elected by the server through the Raft algorithm. The master node is used to control the slave node to acquire and release the storage resource PR lock. When the sending time of the PR lock acquisition information sent by the slave node in the server to the master node exceeds a first threshold, the master node sends PR lock release information to the master node. The master node retrieves the persistent reservation mechanism information table and sends the PR lock application result to the slave node according to the usage of the PR lock and updates the persistent reservation mechanism information table. 9.一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,其特征在于,所述处理器执行所述计算机程序时实现权利要求1至4或5至6中任一项所述的方法的步骤。9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein the processor implements the steps of the method according to any one of claims 1 to 4 or 5 to 6 when executing the computer program. 10.一种计算机存储介质,存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现权利要求1至4或5至6中任一项所述的方法的步骤。10. A computer storage medium storing a computer program, wherein when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 or 5 to 6 are implemented.
CN202211515113.6A 2022-11-30 2022-11-30 Resource sharing method and system for distributed block storage gateway Active CN116055494B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211515113.6A CN116055494B (en) 2022-11-30 2022-11-30 Resource sharing method and system for distributed block storage gateway

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211515113.6A CN116055494B (en) 2022-11-30 2022-11-30 Resource sharing method and system for distributed block storage gateway

Publications (2)

Publication Number Publication Date
CN116055494A CN116055494A (en) 2023-05-02
CN116055494B true CN116055494B (en) 2025-09-05

Family

ID=86132060

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211515113.6A Active CN116055494B (en) 2022-11-30 2022-11-30 Resource sharing method and system for distributed block storage gateway

Country Status (1)

Country Link
CN (1) CN116055494B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN120223699B (en) * 2025-05-27 2025-08-22 中兴通讯股份有限公司 Resource storage method and device, storage medium, electronic device and computer program product

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102984268A (en) * 2012-12-11 2013-03-20 中国人民解放军国防科学技术大学 Access method and device for SCSI sharing storage resource for high-availability cluster
CN107402821A (en) * 2017-07-03 2017-11-28 阿里巴巴集团控股有限公司 Access control method, device and the equipment of shared resource

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100432940C (en) * 2006-10-19 2008-11-12 华为技术有限公司 Shared resource lock allocation method in computer cluster system and computer and cluster system
US8510334B2 (en) * 2009-11-05 2013-08-13 Oracle International Corporation Lock manager on disk
US8977703B2 (en) * 2011-08-08 2015-03-10 Adobe Systems Incorporated Clustering without shared storage
US9959309B2 (en) * 2013-11-04 2018-05-01 Tenoware R&D Limited Distributed reservation systems and methods
EP3857859B1 (en) * 2018-11-16 2023-07-19 VMWare, Inc. Active-active architecture for distributed iscsi target in hyper-converged storage
CN112100190B (en) * 2020-09-21 2023-12-15 天津神舟通用数据技术有限公司 Distributed lock state synchronization method based on update sequence
CN114579321B (en) * 2022-02-14 2025-11-04 阿里巴巴(中国)有限公司 Implementation methods and devices for distributed locks

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102984268A (en) * 2012-12-11 2013-03-20 中国人民解放军国防科学技术大学 Access method and device for SCSI sharing storage resource for high-availability cluster
CN107402821A (en) * 2017-07-03 2017-11-28 阿里巴巴集团控股有限公司 Access control method, device and the equipment of shared resource

Also Published As

Publication number Publication date
CN116055494A (en) 2023-05-02

Similar Documents

Publication Publication Date Title
US11360854B2 (en) Storage cluster configuration change method, storage cluster, and computer system
US20120166611A1 (en) Distributed storage system including a plurality of proxy servers and method for managing objects
WO2016070375A1 (en) Distributed storage replication system and method
CN105208124A (en) Method and device for managing locks and method and device for determining lock management servers
CN115145715B (en) A distributed transaction processing method, system and related equipment
CN113190619B (en) Data read-write method, system, equipment and medium for distributed KV database
WO2016177130A1 (en) Method and device for selecting communication node
CN101751415A (en) Metadata service system metadata synchronized method and writing server updating method
WO2014177085A1 (en) Distributed multicopy data storage method and device
CN109739435B (en) File storage and updating method and device
US20100332532A1 (en) Distributed directory environment using clustered ldap servers
CN116055494B (en) Resource sharing method and system for distributed block storage gateway
CN112218342A (en) A method, device and system for realizing core network sub-slice disaster tolerance
CN112866408A (en) Service switching method, device, equipment and storage medium in cluster
CN106790610B (en) A cloud system message distribution method, device and system
CN113542373B (en) Route service discovery device and method for PAAS platform
CN114201117A (en) Cache data processing method and device, computer equipment and storage medium
CN107395406B (en) Online state data processing method, device and system of online system
CN111291063A (en) Master and backup copy election method, system, computer equipment and storage medium
CN111614725A (en) Service management method, device and equipment based on block chain development
CN113301086B (en) DNS data management system and method
CN112783982B (en) Data processing method, device, system, computer equipment and storage medium
CN113254226B (en) Asymmetric distributed lock system for asymmetric service scene and implementation method
CN113453340B (en) Service method, server cluster and LoRaWAN network system
CN114461141A (en) ETCD system, node arbitration method and system

Legal Events

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