WO2020237849A1 - 网络块设备快照读写方法、装置、设备及存储介质 - Google Patents
网络块设备快照读写方法、装置、设备及存储介质 Download PDFInfo
- Publication number
- WO2020237849A1 WO2020237849A1 PCT/CN2019/101713 CN2019101713W WO2020237849A1 WO 2020237849 A1 WO2020237849 A1 WO 2020237849A1 CN 2019101713 W CN2019101713 W CN 2019101713W WO 2020237849 A1 WO2020237849 A1 WO 2020237849A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- snapshot
- read
- write
- request
- network block
- Prior art date
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/11—File system administration, e.g. details of archiving or snapshots
- G06F16/128—Details of file system snapshots on the file-level, e.g. snapshot creation, administration, deletion
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/17—Details of further file system functions
- G06F16/172—Caching, prefetching or hoarding of files
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/18—File system types
- G06F16/182—Distributed file systems
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/1097—Protocols 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]
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Definitions
- This application relates to the field of computer technology, and in particular to a method, device, device, and storage medium for reading and writing snapshots of network block devices.
- Ceph distributed system includes Ceph clients and Ceph clusters.
- Ceph clients include network block devices (network block device), the network block device is referred to as nbd device, and the nbd device is a block device widely used by the Linux system of the Ceph client.
- the Ceph client can select a created nbd device locally, and use the preset nbd
- the protocol connects the rbd device of the Ceph cluster.
- the rbd device can be understood as a storage device in the Ceph cluster.
- the read and write on the Ceph client nbd device needs to be converted to Ceph
- the read and write of the rbd device in the cluster after the read and write of the rbd device in the Ceph cluster is completed, the read and write content of the rbd device is obtained and returned to the Ceph client nbd device to complete the read and write to the Ceph client nbd device.
- the snapshot file system or the snapshot database system is in the Ceph cluster It is a read-only attribute, and it is difficult to meet the needs of creating a writable snapshot file system for nbd devices or a writable snapshot database system.
- the main purpose of this application is to provide a method, device, device, and storage medium for reading and writing snapshots of network block devices, which aims to solve the problem of creating a writable snapshot file system of nbd devices or a writable snapshot database system in the prior art.
- this application provides a network block device snapshot read and write method.
- the network block device snapshot read and write method is applied to a Ceph client in a Ceph distributed system.
- the Ceph distributed system also includes a Ceph cluster.
- the network block device snapshot read-write method includes:
- the Ceph client When the Ceph client detects a read and write snapshot request for the snapshot database of the network block device, it sends the read and write snapshot request to the Ceph cluster based on the rbd-nbd process corresponding to the network block device to obtain all The snapshot data fed back by the Ceph cluster in response to the read-write snapshot request;
- the type of the read-write snapshot request is a write request type, perform a write operation in the rbd-nbd process according to the write type to obtain write data;
- the write data and the snapshot data are fed back to the network block device to start the snapshot database in the network block device.
- performing a write operation in the rbd-nbd process according to the write type to obtain write data includes:
- the type of the read-write snapshot request is the type of the write request, determining whether the cache in the rbd-nbd process is empty;
- the cache in the rbd-nbd process is not empty, acquire the first key value carried in the write request, where the first key value includes write position and write length information;
- the first key value is less than or equal to the second key value, a new cache entry is added to the cache, and the requested content of the write request is stored in the new cache entry.
- step of judging whether the cache in the rbd-nbd process is empty includes:
- the request content of the write request is stored in the initial entry in the rbd-nbd process.
- step of comparing the first key value with the second key value in the cached entry in the cache includes:
- the request content of the write request corresponding to the first key value and the request content corresponding to the second key are merged and stored.
- the method includes:
- the snapshot data fed back by the Ceph cluster in response to the read-write snapshot request is fed back to the network block device to start the snapshot database in the network block device.
- the step of feeding back the snapshot data fed back by the Ceph cluster for the read-write snapshot request to the network block device includes:
- the type of the read-write snapshot request is a read type, determining whether the cache in the rbd-nbd process is empty;
- the snapshot data and the read data fed back by the Ceph cluster for the read-write snapshot request are fed back to the network block device.
- This application also provides a network block device snapshot reading and writing device, the network block device snapshot reading and writing device is applied to a Ceph client in a Ceph distributed system, the Ceph distributed system also includes a Ceph cluster, and the network block
- the device snapshot reading and writing device includes:
- the detection module is used to send the read and write snapshot request to the Ceph based on the rbd-nbd process corresponding to the network block device when the Ceph client detects a read and write snapshot request to the snapshot database of the network block device Cluster to obtain the snapshot data fed back by the Ceph cluster in response to the read-write snapshot request;
- An obtaining module used to obtain the type of the read-write snapshot request
- a write module configured to perform a write operation in the rbd-nbd process according to the write type when the type of the read-write snapshot request is a write request type to obtain write data;
- the feedback module is used to feed back the write data and the snapshot data to the network block device to start the snapshot database in the network block device.
- the writing module includes:
- the first determining unit is configured to determine whether the cache in the rbd-nbd process is empty if the type of the read-write snapshot request is the type of the write request;
- the first obtaining unit is configured to obtain a first key value carried in the write request if the cache in the rbd-nbd process is not empty, wherein the first key value includes a write position and a write length information;
- a comparison unit configured to compare the first key value with the second key value in the cached entry in the cache
- the adding unit is configured to add a new cache entry in the cache if the first key value is less than or equal to the second key value, and store the requested content of the write request in the new cache entry.
- the writing module includes:
- a creation unit configured to create an initial entry in the cache if the cache in the rbd-nbd process is empty;
- the first storage unit is configured to store the request content of the write request in the initial entry in the rbd-nbd process.
- the writing module further includes:
- the second storage unit is configured to merge and merge the request content of the write request corresponding to the first key value and the request content corresponding to the second key if the first key value is greater than the second key value storage.
- the apparatus for reading and writing a snapshot of a network block device further includes:
- the startup module is used to feed back the snapshot data fed back by the Ceph cluster in response to the read-write snapshot request to the network block device if the type of the read-write snapshot request is a read type, so as to start the network block device Snapshot database in.
- the startup module includes:
- the second determining unit is configured to determine whether the cache in the rbd-nbd process is empty if the type of the read-write snapshot request is a read type
- the second obtaining unit is configured to obtain the target read key value carried in the read request if the cache in the rbd-nbd process is not empty, and obtain the target read key value from the cache according to the target read key value. Read data of the read request;
- the feedback unit is configured to feed back the snapshot data and the read data fed back by the Ceph cluster for the read-write snapshot request to the network block device.
- this application also provides a network block device snapshot read-write device
- the network block device snapshot read-write device includes: a memory, a processor, a communication bus, and a network block device stored on the memory Readable instructions for snapshot read and write methods
- the communication bus is used to realize the communication connection between the processor and the memory
- the processor is configured to execute the readable instructions of the network block device snapshot read and write method to implement the following steps:
- the Ceph client When the Ceph client detects a read and write snapshot request for the snapshot database of the network block device, it sends the read and write snapshot request to the Ceph cluster based on the rbd-nbd process corresponding to the network block device to obtain all The snapshot data fed back by the Ceph cluster in response to the read-write snapshot request;
- the type of the read-write snapshot request is a write request type, perform a write operation in the rbd-nbd process according to the write type to obtain write data;
- the write data and the snapshot data are fed back to the network block device to start the snapshot database in the network block device.
- the present application also provides a storage medium that stores one or more readable instructions, and the one or more readable instructions can be executed by one or more processors to Used for:
- the Ceph client When the Ceph client detects a read and write snapshot request for the snapshot database of the network block device, it sends the read and write snapshot request to the Ceph cluster based on the rbd-nbd process corresponding to the network block device to obtain all The snapshot data fed back by the Ceph cluster in response to the read-write snapshot request;
- the type of the read-write snapshot request is a write request type, perform a write operation in the rbd-nbd process according to the write type to obtain write data;
- the write data and the snapshot data are fed back to the network block device to start the snapshot database in the network block device.
- This application sends the read and write snapshot request to the Ceph cluster based on the rbd-nbd process corresponding to the network block device when the Ceph client detects the read and write snapshot request to the snapshot database of the network block device,
- the corresponding snapshot data is obtained from the Ceph cluster, and then the type of the read-write snapshot request is obtained. If the type of the read-write snapshot request is the write type, the write The write content in the request is designed to be carried out and cached in the rbd-nbd process, so that the nbd device can detect the snapshot data and the write data corresponding to the write request, so that the nbd device can be processed based on the snapshot data and the write data corresponding to the write request.
- a writable snapshot file system or a writable snapshot database system, thus solves the technical problem of creating a writable snapshot file system of an nbd device or a writable snapshot database system in the prior art.
- FIG. 1 is a schematic flowchart of a first embodiment of a method for reading and writing a snapshot of a network block device according to the application;
- FIG. 2 is a schematic flowchart of a second embodiment of a method for reading and writing a snapshot of a network block device according to the application;
- FIG. 3 is a schematic diagram of the device structure of the hardware operating environment involved in the method of the embodiment of the present application.
- This application provides a method for reading and writing a snapshot of a network block device.
- the method for reading and writing a snapshot of the network block device is applied to a Ceph distributed system
- the Ceph distributed system also includes a Ceph cluster
- the network block device snapshot read-write method includes:
- Step S10 when the Ceph client detects a read and write snapshot request to the snapshot database of the network block device, it sends the read and write snapshot request to the Ceph cluster based on the rbd-nbd process corresponding to the network block device, To obtain the snapshot data fed back by the Ceph cluster in response to the read-write snapshot request;
- Step S20 acquiring the type of the read-write snapshot request
- Step S30 if the type of the read-write snapshot request is a write request type, perform a write operation in the rbd-nbd process according to the write type to obtain write data;
- Step S40 feeding back the write data and the snapshot data to the network block device to activate the snapshot database in the network block device.
- Step S10 when the Ceph client detects a read and write snapshot request to the snapshot database of the network block device, it sends the read and write snapshot request to the Ceph cluster based on the rbd-nbd process corresponding to the network block device, To obtain the snapshot data fed back by the Ceph cluster in response to the read-write snapshot request;
- the Ceph distributed system includes a Ceph client, and the Ceph distributed system also includes a Ceph cluster.
- the data content in the Ceph cluster is mapped to the Ceph client.
- the network driver is mapped to the local, that is, the Ceph client.
- the rbd-nbd process needs to be artificially triggered by the Ceph client first Among them, the two ends of the rbd-nbd process connection are the Ceph client and the Ceph cluster respectively.
- Triggering the rbd-nbd process manually is to manually select the Ceph cluster and the local disk on the Ceph client by the user. After the selection is completed, the rbd-nbd process is created by clicking and other operations. After the rbd-nbd process is determined to be created, the nbd device is created in the local disk of the Ceph client based on the rbd-nbd process. After the nbd device is created , The user can read or write the data of the Ceph cluster to the local nbd device to complete the reading and writing of the local nbd device. In other words, the read and write on the Ceph client nbd device needs to be converted.
- the read and write content of the rbd device is obtained and returned to the Ceph client nbd device to complete the read and write to the Ceph client nbd device .
- the Ceph cluster can be regarded as a network neighbor device. If you want to read the data content of the network neighbor device locally, you need to first determine the network neighbor device address and local disk by the user. After the device address and the local disk, the rbd-nbd process is then triggered. According to the rbd-nbd process, the nbd device is created in the local disk, and based on the rbd-nbd process, the corresponding content is obtained from the network neighbor, and the corresponding The content is stored in the nbd device to determine the completion of the reading and writing of the nbd device.
- the Ceph client detects a read-write snapshot request to the snapshot database of the network block device
- the read-write snapshot request is sent based on the rbd-nbd process corresponding to the network block device
- the driver corresponding to the network block device will obtain the read-write snapshot request, Then forward the read-write snapshot request to the socket structure in the Ceph client.
- the socket structure connects the rbd-nbd process and the nbd device.
- the rbd-nbd process obtains the read-write snapshot request from the socket structure, and then reads and writes The snapshot request is sent to the Ceph cluster. After receiving the read-write snapshot request, the Ceph cluster will return the snapshot data based on the read request in the read-write snapshot request. It should be noted that in this embodiment, one end of the rbd-nbd process It is the snapshot volume of the rbd device of the Ceph cluster, that is, because one end of the rbd-nbd process is the snapshot volume of the rbd device of the Ceph cluster, the technical problem in this application will exist.
- Ceph cluster After the Ceph cluster receives the read-write snapshot request, it will return the snapshot data based on the read request in the read-write snapshot request.
- the process includes: Ceph cluster parses the read request content of the read-write snapshot request, and returns the snapshot data according to the read request content It should be noted that the Ceph cluster returns the snapshot data based on the content of the read request, which belongs to the prior art and does not make a specific description.
- Step S20 acquiring the type of the read-write snapshot request
- the type of the read-write snapshot request is determined.
- the purpose of determining the type of the read-write snapshot request is to determine whether a write operation is required.
- the type of the read-write snapshot request is a write type, a write operation is required.
- Step S30 if the type of the read-write snapshot request is a write request type, perform a write operation in the rbd-nbd process according to the write type to obtain write data;
- the write operation is designed in the rbd-nbd process to complete the read-write snapshot request Write request, that is, in this embodiment, as long as it is determined that the type of the read-write snapshot request is a write request type, a temporary cache is opened in the local rbd-nbd process to perform a write operation to obtain write data.
- performing a write operation in the rbd-nbd process according to the write type to obtain write data includes:
- Step S31 if the type of the read-write snapshot request is the type of the write request, determine whether the cache in the rbd-nbd process is empty;
- the cache in the rbd-nbd process may have previously written data. For example, after a previous write operation to the nbd device, it is found that there is an error in the content of the write operation, and a new write operation is required. At this time, The previously written data of the erroneous write operation exists in the rbd-nbd process, and it is necessary to determine whether the cache in the rbd-nbd process is empty when the re-write operation is correspondingly performed.
- Step S32 if the cache in the rbd-nbd process is not empty, obtain a first key value carried in the write request, where the first key value includes write position and write length information;
- the first key value and the write content carried in the write request are acquired, where the first key value It includes writing position and writing length information, and the writing content also includes data to be written.
- Step S33 comparing the first key value with the second key value in the cached entry in the cache
- the first key value is compared with the second key value in the cached entry in the cache, and the write position in the first key value is compared with the second key value.
- the writing position in the key value is compared. If the writing position in the first key value is different from the writing position or the writing length in the second key value, then no subsequent writing content comparison is performed. If the first key value is compared
- the write position in is the same as the write position or the write length in the second key value, then the write content in the write request is compared with the write content in the corresponding second key value.
- Step S34 If the first key value is less than or equal to the second key value, a new cache entry is added to the cache, and the requested content of the write request is stored in the new cache entry.
- the first key value is less than or equal to the second key value, and if the first key value is less than or equal to the second key value Key value, a new cache entry is added to the cache, and the requested content of the write request is stored in the new cache entry.
- step of judging whether the cache in the rbd-nbd process is empty includes:
- Step S35 if the cache in the rbd-nbd process is empty, an initial entry will be created in the cache;
- Step S36 Store the request content of the write request in the initial entry in the rbd-nbd process.
- Step S40 feeding back the write data and the snapshot data to the network block device to activate the snapshot database in the network block device.
- the network block device After obtaining the write data and the snapshot data, the write data and the snapshot data are fed back to the network block device, the network block device detects the write data and the snapshot data corresponding to the write request, and performs the The snapshot data in the network block device is started, that is, when the write data corresponding to the write request is detected in the nbd device, the snapshot database can be started.
- This application sends the read and write snapshot request to the Ceph cluster based on the rbd-nbd process corresponding to the network block device when the Ceph client detects the read and write snapshot request to the snapshot database of the network block device,
- the corresponding snapshot data is obtained from the Ceph cluster, and then the type of the read-write snapshot request is obtained. If the type of the read-write snapshot request is the write type, the write The write content in the request is designed to be carried out and cached in the rbd-nbd process, so that the nbd device can detect the snapshot data and the write data corresponding to the write request, so that the nbd device can be processed based on the snapshot data and the write data corresponding to the write request.
- a writable snapshot file system or a writable snapshot database system, thus solves the technical problem of creating a writable snapshot file system of an nbd device or a writable snapshot database system in the prior art.
- the present application provides another embodiment of a method for reading and writing a snapshot of a network block device.
- the first key value is compared with the second key value in the cached entry in the cache. After the steps include:
- Step S37 If the first key value is greater than the second key value, the request content of the write request corresponding to the first key value and the request content corresponding to the second key are combined and stored.
- Merged storage refers to writing and storing different parts of the writing content corresponding to the first key value and the writing content corresponding to the second key value, and removing the wrong content in the writing content corresponding to the second key value. The same part of the writing content corresponding to the key value and the writing content corresponding to the second key value is not processed.
- the request content of the write request corresponding to the first key value and the request content corresponding to the second key are combined and stored. Determine the correctness of the write operation.
- this application provides another embodiment of a method for reading and writing a snapshot of a network block device.
- the step of obtaining the type of the read and write snapshot request includes:
- Step A1 If the type of the read-write snapshot request is the read type, the snapshot data fed back by the Ceph cluster for the read-write snapshot request is fed back to the network block device to start the network block device Snapshot the database.
- the snapshot data fed back by the Ceph cluster for the read-write snapshot request is fed back to the network block device to start the network block
- the snapshot database in the device, that is, for the read request, the snapshot data can be returned directly.
- the step of feeding back the snapshot data fed back by the Ceph cluster for the read-write snapshot request to the network block device includes:
- Step B1 if the type of the read-write snapshot request is a read type, it is determined whether the cache in the rbd-nbd process is empty;
- the purpose of determining whether the cache in the rbd-nbd process is empty is to: Determine whether the nbd device corresponding to the degree request has corresponding read data in the rbd-nbd process before.
- Step B2 If the cache in the rbd-nbd process is not empty, obtain the target read key value carried in the read request, and obtain the read request of the read request from the cache according to the target read key value. data;
- the cache in the rbd-nbd process is not empty, the corresponding read data is obtained. Specifically, the target read key value carried in the read request is obtained from the cache according to the target read key value. Read the requested read data,
- Step B3 feeding back the snapshot data and the read data fed back by the Ceph cluster for the read-write snapshot request to the network block device.
- the snapshot data fed back by the Ceph cluster for the read-write snapshot request and the read data are fed back to the network block device.
- the method further includes:
- the snapshot data fed back by the Ceph cluster for the read-write snapshot request can be fed back to the network block device.
- the type of the read-write snapshot request is the read type, it is determined whether the cache in the rbd-nbd process is empty; if the cache in the rbd-nbd process is not empty, then obtain The target read key value carried in the read request, the read data of the read request is obtained from the cache according to the target read key value; the snapshot data fed back by the Ceph cluster for the read and write snapshot request is compared with The read data is fed back to the network block device, and a read request to nbd is implemented in this embodiment.
- FIG. 3 is a schematic diagram of the device structure of the hardware operating environment involved in the solution of the embodiment of the present application.
- the snapshot reading and writing device of the network block device in the embodiment of this application can be a PC, a smart phone, a tablet computer, an e-book reader, MP3 (Moving Picture Experts Group Audio Layer III, moving picture experts compress standard audio layer 3) player, MP4 (Moving Picture Experts) Group Audio Layer IV, dynamic image experts compress standard audio layer 3) Players, portable computers and other terminal equipment.
- the network block device snapshot read-write device may include a processor 1001, such as a CPU, a memory 1005, and a communication bus 1002.
- the communication bus 1002 is used to implement connection and communication between the processor 1001 and the memory 1005.
- the memory 1005 can be a high-speed RAM memory or a stable memory (non-volatile memory), such as disk storage.
- the memory 1005 may also be a storage device independent of the foregoing processor 1001.
- the network block device snapshot read-write device may also include a target user interface, network interface, camera, RF (Radio Frequency (radio frequency) circuits, sensors, audio circuits, WiFi modules, etc.
- the target user interface may include a display screen (Display) and an input unit such as a keyboard (Keyboard), and the optional target user interface may also include a standard wired interface and a wireless interface.
- the optional network interface can include standard wired interface and wireless interface (such as WI-FI interface).
- network block device snapshot read-write device structure shown in FIG. 3 does not constitute a limitation on the network block device snapshot read-write device, and may include more or less components than shown in the figure, or a combination Certain components, or different component arrangements.
- the memory 1005 as a computer storage medium may include an operating system, a network communication module, and readable instructions for a network block device snapshot reading and writing method.
- the operating system is a readable instruction for managing and controlling the hardware and software resources of the network block device snapshot reading and writing device, and supports the operation of the network block device snapshot reading and writing method readable instructions and other software and/or readable instructions.
- the network communication module is used to implement communication between various components in the memory 1005, and to communicate with other hardware and software in the network block device snapshot read-write device.
- the processor 1001 is configured to execute the readable instructions of the network block device snapshot reading and writing method stored in the memory 1005 to implement the network block device snapshot reading described above. Write method steps.
- the specific implementation of the network block device snapshot read-write device of this application is basically the same as the foregoing embodiments of the network block device snapshot read-write method, and will not be repeated here.
- This application also provides a network block device snapshot reading and writing device, the network block device snapshot reading and writing device is applied to a Ceph client in a Ceph distributed system, the Ceph distributed system also includes a Ceph cluster, and the network block
- the device snapshot reading and writing device includes:
- the detection module is used to send the read and write snapshot request to the Ceph based on the rbd-nbd process corresponding to the network block device when the Ceph client detects a read and write snapshot request to the snapshot database of the network block device Cluster to obtain the snapshot data fed back by the Ceph cluster in response to the read-write snapshot request;
- An obtaining module used to obtain the type of the read-write snapshot request
- a write module configured to perform a write operation in the rbd-nbd process according to the write type when the type of the read-write snapshot request is a write request type to obtain write data;
- the feedback module is used to feed back the write data and the snapshot data to the network block device to start the snapshot database in the network block device.
- the specific implementation of the network block device snapshot reading and writing apparatus of the present application is basically the same as the foregoing embodiments of the network block device snapshot reading and writing method, and will not be repeated here.
- the present application provides a storage medium, the storage medium may be a non-volatile readable storage medium, the storage medium stores one or more readable instructions, the one or more readable instructions may also be One or more processors are executed to implement the steps of the network block device snapshot reading and writing method described above.
- the specific implementation of the storage medium of the present application is basically the same as the foregoing embodiments of the network block device snapshot reading and writing method, and will not be repeated here.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
本申请公开了一种网络块设备快照读写方法、装置、设备及存储介质,所述方法包括:在Ceph客户端检测到对网络块设备的快照数据库的读写快照请求时,基于网络块设备对应的rbd-nbd进程,将读写快照请求发送给Ceph集群,以获取Ceph集群针对读写快照请求反馈的快照数据;获取读写快照请求的类型;若读写快照请求的类型为写请求类型时,根据写类型在rbd-nbd进程中进行写操作,以得到写数据;将写数据以及快照数据反馈给所述网络块设备,以启动所述网络块设备中的快照数据库,本申请基于分布式系统旨在解决现有技术中,难以满足创建nbd设备的可写快照文件系统,或者可写快照数据库系统的技术问题。
Description
本申请要求于2019年05月31日提交中国专利局、申请号为201910480680.4、发明名称为“网络块设备快照读写方法、装置、设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在申请中。
技术领域
本申请涉及计算机技术领域,尤其涉及一种网络块设备快照读写方法、装置、设备及存储介质。
背景技术
Ceph分布式系统中,包括Ceph客户端以及Ceph集群,其中,Ceph客户端中包括网络块设备(network block
device),该网络块设备简称nbd设备,且该nbd设备是Ceph客户端的linux系统广发使用的一种块设备,其中,Ceph客户端可以在本地选取一个创建好的nbd设备,通过预设的nbd协议连接Ceph集群的rbd设备,具体地,rbd设备可以理解为Ceph集群中的一个存储设备,需要说明的是,Ceph分布式系统中,在Ceph客户端nbd设备上的读写需要转换为对Ceph集群中rbd设备的读写,在Ceph集群中rbd设备的读写完成后,获取rbd设备的读写内容,返回给Ceph客户端nbd设备,以完成对Ceph客户端nbd设备的读写。
Ceph分布式系统中,如果通过nbd设备连接rbd设备中的快照存储卷imageA,以实现在nbd设备上创建快照文件系统,或者部署快照数据库系统时,这个快照文件系统或者快照数据库系统在Ceph集群中是只读属性的,难以满足创建nbd设备的可写快照文件系统,或者可写快照数据库系统的需求。
发明内容
本申请的主要目的在于提供一种网络块设备快照读写方法、装置、设备及存储介质,旨在解决现有技术中,难以满足创建nbd设备的可写快照文件系统,或者可写快照数据库系统的技术问题。
为实现上述目的,本申请提供一种网络块设备快照读写方法所述网络块设备快照读写方法应用于Ceph分布式系统中的Ceph客户端,所述Ceph分布式系统还包括Ceph集群,所述网络块设备快照读写方法包括:
在Ceph客户端检测到对网络块设备的快照数据库的读写快照请求时,基于所述网络块设备对应的rbd-nbd进程,将所述读写快照请求发送给所述Ceph集群,以获取所述Ceph集群针对所述读写快照请求反馈的快照数据;
获取所述读写快照请求的类型;
若所述读写快照请求的类型为写请求类型时,根据所述写类型在所述rbd-nbd进程中进行写操作,以得到写数据;
将所述写数据以及所述快照数据反馈给所述网络块设备,以启动所述网络块设备中的快照数据库。
可选地,所述若所述读写快照请求的类型为写类型时,根据所述写类型在所述rbd-nbd进程中进行写操作,以得到写数据步骤包括:
若所述读写快照请求的类型为写请求的类型时,判断所述rbd-nbd进程中的缓存是否为空;
若所述rbd-nbd进程中的缓存不为空,则获取所述写请求中携带的第一键值,其中,所述第一键值中包括写位置以及写长度信息;
将所述第一键值与所述缓存中已缓存条目中的第二键值进行比对;
若所述第一键值小于等于第二键值,则在所述缓存中增加新的缓存条目,将所述写请求的请求内容存储在所述新的缓存条目中。
可选地,所述判断所述rbd-nbd进程中的缓存是否为空步骤之后包括:
若所述rbd-nbd进程中的缓存为空时,将在所述缓存中创建初始条目;
将所述写请求的请求内容存储在rbd-nbd进程中的初始条目中。
可选地,所述将所述第一键值与所述缓存中已缓存条目中的第二键值进行比对步骤之后包括:
若所述第一键值大于所述第二键值,则将所述第一键值对应的写请求的请求内容与所述第二键对应的请求内容进行合并并存储。
可选地,所述获取所述读写快照请求的类型步骤之后包括:
若所述读写快照请求的类型为读类型时,将所述Ceph集群针对所述读写快照请求反馈的快照数据反馈给所述网络块设备,以启动所述网络块设备中的快照数据库。
可选地,,所述若所述读写快照请求的类型为读类型时,将所述Ceph集群针对所述读写快照请求反馈的快照数据反馈给所述网络块设备步骤包括:
若所述读写快照请求的类型为读类型时,判断所述rbd-nbd进程中的缓存是否为空;
若所述rbd-nbd进程中的缓存不为空,则获取所述读请求中携带的目标读键值,根据所述目标读键值从所述缓存中获取所述读请求的读数据;
将所述Ceph集群针对所述读写快照请求反馈的快照数据与所述读数据反馈给所述网络块设备。
本申请还提供一种网络块设备快照读写装置,所述网络块设备快照读写装置应用于Ceph分布式系统中的Ceph客户端,所述Ceph分布式系统还包括Ceph集群,所述网络块设备快照读写装置包括:
检测模块,用于在Ceph客户端检测到对网络块设备的快照数据库的读写快照请求时,基于所述网络块设备对应的rbd-nbd进程,将所述读写快照请求发送给所述Ceph集群,以获取所述Ceph集群针对所述读写快照请求反馈的快照数据;
获取模块,用于获取所述读写快照请求的类型;
写模块,用于若所述读写快照请求的类型为写请求类型时,根据所述写类型在所述rbd-nbd进程中进行写操作,以得到写数据;
反馈模块,用于将所述写数据以及所述快照数据反馈给所述网络块设备,以启动所述网络块设备中的快照数据库。
可选地,所述写模块包括:
第一判断单元,用于若所述读写快照请求的类型为写请求的类型时,判断所述rbd-nbd进程中的缓存是否为空;
第一获取单元,用于若所述rbd-nbd进程中的缓存不为空,则获取所述写请求中携带的第一键值,其中,所述第一键值中包括写位置以及写长度信息;
比对单元,用于将所述第一键值与所述缓存中已缓存条目中的第二键值进行比对;
增加单元,用于若所述第一键值小于等于第二键值,则在所述缓存中增加新的缓存条目,将所述写请求的请求内容存储在所述新的缓存条目中。
可选地,所述所述写模块包括:
创建单元,用于若所述rbd-nbd进程中的缓存为空时,将在所述缓存中创建初始条目;
第一存储单元,用于将所述写请求的请求内容存储在rbd-nbd进程中的初始条目中。
可选地,所述所述写模块还包括:
第二存储单元,用于若所述第一键值大于所述第二键值,则将所述第一键值对应的写请求的请求内容与所述第二键对应的请求内容进行合并并存储。
可选地,所述网络块设备快照读写装置还包括:
启动模块,用于若所述读写快照请求的类型为读类型时,将所述Ceph集群针对所述读写快照请求反馈的快照数据反馈给所述网络块设备,以启动所述网络块设备中的快照数据库。
可选地,所述启动模块包括:
第二判断单元,用于若所述读写快照请求的类型为读类型时,判断所述rbd-nbd进程中的缓存是否为空;
第二获取单元,用于若所述rbd-nbd进程中的缓存不为空,则获取所述读请求中携带的目标读键值,根据所述目标读键值从所述缓存中获取所述读请求的读数据;
反馈单元,用于将所述Ceph集群针对所述读写快照请求反馈的快照数据与所述读数据反馈给所述网络块设备。
此外,为实现上述目的,本申请还提供一种网络块设备快照读写设备,所述网络块设备快照读写设备包括:存储器、处理器,通信总线以及存储在所述存储器上的网络块设备快照读写方法可读指令,
所述通信总线用于实现处理器与存储器间的通信连接;
所述处理器用于执行所述网络块设备快照读写方法可读指令,以实现以下步骤:
在Ceph客户端检测到对网络块设备的快照数据库的读写快照请求时,基于所述网络块设备对应的rbd-nbd进程,将所述读写快照请求发送给所述Ceph集群,以获取所述Ceph集群针对所述读写快照请求反馈的快照数据;
获取所述读写快照请求的类型;
若所述读写快照请求的类型为写请求类型时,根据所述写类型在所述rbd-nbd进程中进行写操作,以得到写数据;
将所述写数据以及所述快照数据反馈给所述网络块设备,以启动所述网络块设备中的快照数据库。
此外,为实现上述目的,本申请还提供一种存储介质,所述存储介质存储有一个或者一个以上可读指令,所述一个或者一个以上可读指令可被一个或者一个以上的处理器执行以用于:
在Ceph客户端检测到对网络块设备的快照数据库的读写快照请求时,基于所述网络块设备对应的rbd-nbd进程,将所述读写快照请求发送给所述Ceph集群,以获取所述Ceph集群针对所述读写快照请求反馈的快照数据;
获取所述读写快照请求的类型;
若所述读写快照请求的类型为写请求类型时,根据所述写类型在所述rbd-nbd进程中进行写操作,以得到写数据;
将所述写数据以及所述快照数据反馈给所述网络块设备,以启动所述网络块设备中的快照数据库。
本申请通过在Ceph客户端检测到对网络块设备的快照数据库的读写快照请求时,基于所述网络块设备对应的rbd-nbd进程,将所述读写快照请求发送给所述Ceph集群,以获取所述Ceph集群针对所述读写快照请求反馈的快照数据;获取所述读写快照请求的类型;若所述读写快照请求的类型为写请求类型时,根据所述写类型在所述rbd-nbd进程中进行写操作,以得到写数据;将所述写数据以及所述快照数据反馈给所述网络块设备,以启动所述网络块设备中的快照数据库。在本申请中,在检测到网络块设备的读写快照请求时,从Ceph集群获取对应的快照数据,然后获取读写快照请求的类型,若读写快照请求的类型是写类型时,针对写请求中的写内容,设计在rbd-nbd进程中进行并缓存,以便nbd设备检测到该快照数据以及写请求对应的写数据,以便基于该快照数据以及写请求对应的写数据,进行nbd设备的可写快照文件系统,或者可写快照数据库系统的创建,因而解决了现有技术中难以满足创建nbd设备的可写快照文件系统,或者可写快照数据库系统的技术问题。
附图说明
图1为本申请网络块设备快照读写方法第一实施例的流程示意图;
图2为本申请网络块设备快照读写方法第二实施例的流程示意图;
图3是本申请实施例方法涉及的硬件运行环境的设备结构示意图。
本申请目的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
具体实施方式
应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
本申请提供一种网络块设备快照读写方法,在本申请网络块设备快照读写方法的第一实施例中,参照图1,所述网络块设备快照读写方法应用于Ceph分布式系统中的Ceph客户端,所述Ceph分布式系统还包括Ceph集群,所述网络块设备快照读写方法包括:
步骤S10,在Ceph客户端检测到对网络块设备的快照数据库的读写快照请求时,基于所述网络块设备对应的rbd-nbd进程,将所述读写快照请求发送给所述Ceph集群,以获取所述Ceph集群针对所述读写快照请求反馈的快照数据;
步骤S20,获取所述读写快照请求的类型;
步骤S30,若所述读写快照请求的类型为写请求类型时,根据所述写类型在所述rbd-nbd进程中进行写操作,以得到写数据;
步骤S40,将所述写数据以及所述快照数据反馈给所述网络块设备,以启动所述网络块设备中的快照数据库。
具体步骤如下:
步骤S10,在Ceph客户端检测到对网络块设备的快照数据库的读写快照请求时,基于所述网络块设备对应的rbd-nbd进程,将所述读写快照请求发送给所述Ceph集群,以获取所述Ceph集群针对所述读写快照请求反馈的快照数据;
需要说明的是,在本实施例中,Ceph分布式系统包括Ceph客户端,所述Ceph分布式系统还包括Ceph集群,在本实施例中,实现在Ceph客户端将Ceph集群中数据内容通过映射网络驱动映射到本地也即Ceph客户端,实现在Ceph客户端将Ceph集群中数据内容通过映射网络驱动映射到本地(Ceph客户端),则需要先由Ceph客户端通过人为方式触发rbd-nbd进程,其中,该rbd-nbd进程连接的两端分别为Ceph客户端以及Ceph集群,人为方式触发rbd-nbd进程即是由用户手动的在Ceph客户端进行Ceph集群的选取,以及本地磁盘的选取,在选取完成后,通过点击等操作即创建了rbd-nbd进程,在确定创建了rbd-nbd进程后,基于该rbd-nbd进程在Ceph客户端本地磁盘中创建nbd设备,在创建该nbd设备后,用户可以实现将Ceph集群的数据读取或者写至本地的nbd设备中,以完成对本地的nbd设备的读写,换种方式,也即实现在Ceph客户端nbd设备上的读写需要转换为对Ceph集群中rbd设备的读写,在Ceph集群中rbd设备的读写完成后,获取rbd设备的读写内容,返回给Ceph客户端nbd设备,以完成对Ceph客户端nbd设备的读写。
为了便于理解,可以将Ceph集群当作网上邻居设备,若要在本地实现将网上邻居设备中的数据内容读取至本地,则需要首先由用户确定网上邻居设备地址以及本地磁盘,在确定网上邻居设备地址以及本地磁盘后,然后触发rbd-nbd进程,根据该rbd-nbd进程,在本地磁盘中创建nbd设备,并基于该rbd-nbd进程,从网上邻居中获取对应的内容,将该对应的内容存储在nbd设备中,以确定完成该nbd设备的读写。
在创建完成网络块设备后,若在Ceph客户端检测到对网络块设备的快照数据库的读写快照请求时,基于所述网络块设备对应的rbd-nbd进程,将所述读写快照请求发送给所述Ceph集群,以获取所述Ceph集群针对所述读写快照请求反馈的快照数据,具体地,在检测到读写快照请求时,网络块设备对应的驱动会获取该读写快照请求,然后把该读写快照请求转发给Ceph客户端中的socket结构,该socket结构连接的是rbd-nbd进程与nbd设备,rbd-nbd进程从socket结构中获取该读写快照请求,然后把读写快照请求发送给Ceph集群,Ceph集群在得到该读写快照请求后,会基于该读写快照请求中的读请求返回快照数据,需要说明的是,在本实施例中,rbd-nbd进程的一端是Ceph集群的rbd设备的快照卷,也即由于该rbd-nbd进程的一端是Ceph集群的rbd设备的快照卷,才会存在本申请中的技术问题。
Ceph集群在得到该读写快照请求后,会基于该读写快照请求中的读请求返回快照数据过程包括:Ceph集群解析读写快照请求的读请求内容,根据该读请求内容进行快照数据的返回,需要说明的是,Ceph集群基于读请求内容进行快照数据的返回进行返回属于现有技术,并不做具体的说明。
步骤S20,获取所述读写快照请求的类型;
在得到快照数据后,再进行读写快照请求的类型的确定,确定读写快照请求的类型的目的在于确定是否需要进行写操作。
如果读写快照请求的类型是读类型,则不需要进行写操作;
如果读写快照请求的类型是写类型,则需要进行写操作。
步骤S30,若所述读写快照请求的类型为写请求类型时,根据所述写类型在所述rbd-nbd进程中进行写操作,以得到写数据;
需要说明的是,若所述读写快照请求的类型为写请求类型时,则需要进行写操作,在本实施例中,设计在rbd-nbd进程中进行写操作,以完成读写快照请求的写请求,也即在本实施例中,只要确定所述读写快照请求的类型为写请求类型,则在本地的rbd-nbd进程中开辟临时的缓存进行写操作,以得到写数据。
具体地,参照图2,所述若所述读写快照请求的类型为写类型时,根据所述写类型在所述rbd-nbd进程中进行写操作,以得到写数据步骤包括:
步骤S31,若所述读写快照请求的类型为写请求的类型时,判断所述rbd-nbd进程中的缓存是否为空;
在本实施例中,rbd-nbd进程中的缓存可能存在在先写数据,例如,之前对nbd设备进行写操作后,发现该写操作的内容存在错误,需要进行重新的写操作,此时,存在错误的写操作的在先写数据存在于rbd-nbd进程中,重新的写操作对应进行时需要判断所述rbd-nbd进程中的缓存是否为空。
步骤S32,若所述rbd-nbd进程中的缓存不为空,则获取所述写请求中携带的第一键值,其中,所述第一键值中包括写位置以及写长度信息;
若所述rbd-nbd进程中的缓存不为空,则存在对应的在先写数据,此时,获取所述写请求中携带的第一键值与写内容,其中,所述第一键值中包括写位置以及写长度信息,写内容还包括待写数据,其中,第一键值中包括写位置以及写长度信息,也即,KEY=offset+len。
步骤S33,将所述第一键值与所述缓存中已缓存条目中的第二键值进行比对;
在得到第一键值后,将所述将所述第一键值与所述缓存中已缓存条目中的第二键值进行比对,将第一键值中的写位置与所述第二键值中的写位置进行比对,若第一键值中的写位置与所述第二键值中的写位置或者写长度不同,则不进行后续写内容的比较,若将第一键值中的写位置与所述第二键值中的写位置或者写长度相同,则将写请求中的写内容与所述第二键值对应中的写内容进行比对。
步骤S34,若所述第一键值小于等于第二键值,则在所述缓存中增加新的缓存条目,将所述写请求的请求内容存储在所述新的缓存条目中。
若第一键值中的写位置与所述第二键值中的写位置或者写长度不同,则所述第一键值小于等于第二键值,若所述第一键值小于等于第二键值,则在所述缓存中增加新的缓存条目,将所述写请求的请求内容存储在所述新的缓存条目中。
所述判断所述rbd-nbd进程中的缓存是否为空步骤之后包括:
步骤S35,若所述rbd-nbd进程中的缓存为空时,将在所述缓存中创建初始条目;
步骤S36,将所述写请求的请求内容存储在rbd-nbd进程中的初始条目中。
在本实施例中,若所述rbd-nbd进程中的缓存为空时,将在所述缓存中创建初始条目,将所述写请求的请求内容存储在rbd-nbd进程中的初始条目中,以在本地完成写操作,以得到写数据。
步骤S40,将所述写数据以及所述快照数据反馈给所述网络块设备,以启动所述网络块设备中的快照数据库。
在得到写数据以及所述快照数据后,将写数据以及所述快照数据反馈给所述网络块设备,该网络块设备检测到该基于写请求对应的写数据以及所述快照数据,进行所述网络块设备中的快照数据的启动,也即在nbd设备中检测到了写请求对应的写数据,即可进行快照数据库的启动。
本申请通过在Ceph客户端检测到对网络块设备的快照数据库的读写快照请求时,基于所述网络块设备对应的rbd-nbd进程,将所述读写快照请求发送给所述Ceph集群,以获取所述Ceph集群针对所述读写快照请求反馈的快照数据;获取所述读写快照请求的类型;若所述读写快照请求的类型为写请求类型时,根据所述写类型在所述rbd-nbd进程中进行写操作,以得到写数据;将所述写数据以及所述快照数据反馈给所述网络块设备,以启动所述网络块设备中的快照数据库。在本申请中,在检测到网络块设备的读写快照请求时,从Ceph集群获取对应的快照数据,然后获取读写快照请求的类型,若读写快照请求的类型是写类型时,针对写请求中的写内容,设计在rbd-nbd进程中进行并缓存,以便nbd设备检测到该快照数据以及写请求对应的写数据,以便基于该快照数据以及写请求对应的写数据,进行nbd设备的可写快照文件系统,或者可写快照数据库系统的创建,因而解决了现有技术中难以满足创建nbd设备的可写快照文件系统,或者可写快照数据库系统的技术问题。
进一步地,本申请提供网络块设备快照读写方法的另一实施例,在该实施例中,所述将所述第一键值与所述缓存中已缓存条目中的第二键值进行比对步骤之后包括:
步骤S37,若所述第一键值大于所述第二键值,则将所述第一键值对应的写请求的请求内容与所述第二键对应的请求内容进行合并存储。
在本实施例中,若所述第一键值大于所述第二键值,则将所述第一键值对应的写请求的请求内容与所述第二键对应的请求内容进行合并存储,合并存储指的是将第一键值对应的写内容与第二键值对应的写内容中的不同部分进行写存储保存,第二键值对应的写内容中的错误内容进行移除,第一键值对应的写内容与第二键值对应的写内容中的相同部分不做处理。
在本实施例中,若所述第一键值大于所述第二键值,则将所述第一键值对应的写请求的请求内容与所述第二键对应的请求内容进行合并存储,确定写操作的正确性。
进一步地,本申请提供网络块设备快照读写方法的另一实施例,在该实施例中,所述获取所述读写快照请求的类型步骤之后包括:
步骤A1,若所述读写快照请求的类型为读类型时,将所述Ceph集群针对所述读写快照请求反馈的快照数据反馈给所述网络块设备,以启动所述网络块设备中的快照数据库。
在本实施例中,若所述读写快照请求的类型为读类型时,将所述Ceph集群针对所述读写快照请求反馈的快照数据反馈给所述网络块设备,以启动所述网络块设备中的快照数据库,也即对于读请求,直接进行快照数据的返回即可。
所述若所述读写快照请求的类型为读类型时,将所述Ceph集群针对所述读写快照请求反馈的快照数据反馈给所述网络块设备步骤包括:
步骤B1,若所述读写快照请求的类型为读类型时,判断所述rbd-nbd进程中的缓存是否为空;
在本实施例中,若所述读写快照请求的类型为读类型时,判断所述rbd-nbd进程中的缓存是否为空,判断该rbd-nbd进程中的缓存是否为空的目的在于,判断该度请求对应的nbd设备是否之前在rbd-nbd进程中存在对应的读数据。
步骤B2,若所述rbd-nbd进程中的缓存不为空,则获取所述读请求中携带的目标读键值,根据所述目标读键值从所述缓存中获取所述读请求的读数据;
若所述rbd-nbd进程中的缓存不为空,则获取对应的读数据,具体地,所述读请求中携带的目标读键值,根据所述目标读键值从所述缓存中获取所述读请求的读数据,
步骤B3,将所述Ceph集群针对所述读写快照请求反馈的快照数据与所述读数据反馈给所述网络块设备。
在得到读数据后,将所述Ceph集群针对所述读写快照请求反馈的快照数据与所述读数据反馈给所述网络块设备。
其中,所述若所述读写快照请求的类型为读类型时,判断所述rbd-nbd进程中的缓存是否为空步骤之后还包括:
若所述rbd-nbd进程中的缓存为空,则将所述Ceph集群针对所述读写快照请求反馈的快照数据反馈给所述网络块设备即可。
在本实施例中,若所述读写快照请求的类型为读类型时,判断所述rbd-nbd进程中的缓存是否为空;若所述rbd-nbd进程中的缓存不为空,则获取所述读请求中携带的目标读键值,根据所述目标读键值从所述缓存中获取所述读请求的读数据;将所述Ceph集群针对所述读写快照请求反馈的快照数据与所述读数据反馈给所述网络块设备,本实施例中实现对nbd的读请求。
参照图3,图3是本申请实施例方案涉及的硬件运行环境的设备结构示意图。
本申请实施例网络块设备快照读写设备可以是PC,也可以是智能手机、平板电脑、电子书阅读器、MP3(Moving Picture
Experts Group Audio Layer III,动态影像专家压缩标准音频层面3)播放器、MP4(Moving Picture Experts
Group Audio Layer IV,动态影像专家压缩标准音频层面3)播放器、便携计算机等终端设备。
如图3所示,该网络块设备快照读写设备可以包括:处理器1001,例如CPU,存储器1005,通信总线1002。其中,通信总线1002用于实现处理器1001和存储器1005之间的连接通信。存储器1005可以是高速RAM存储器,也可以是稳定的存储器(non-volatile
memory),例如磁盘存储器。存储器1005可选的还可以是独立于前述处理器1001的存储设备。
可选地,该网络块设备快照读写设备还可以包括目标用户接口、网络接口、摄像头、RF(Radio
Frequency,射频)电路,传感器、音频电路、WiFi模块等等。目标用户接口可以包括显示屏(Display)、输入单元比如键盘(Keyboard),可选目标用户接口还可以包括标准的有线接口、无线接口。网络接口可选的可以包括标准的有线接口、无线接口(如WI-FI接口)。
本领域技术人员可以理解,图3中示出的网络块设备快照读写设备结构并不构成对网络块设备快照读写设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。
如图3所示,作为一种计算机存储介质的存储器1005中可以包括操作系统、网络通信模块以及网络块设备快照读写方法可读指令。操作系统是管理和控制网络块设备快照读写设备硬件和软件资源的可读指令,支持网络块设备快照读写方法可读指令以及其它软件和/或可读指令的运行。网络通信模块用于实现存储器1005内部各组件之间的通信,以及与网络块设备快照读写设备中其它硬件和软件之间通信。
在图3所示的网络块设备快照读写设备中,处理器1001用于执行存储器1005中存储的网络块设备快照读写方法可读指令,实现上述任一项所述的网络块设备快照读写方法的步骤。
本申请网络块设备快照读写设备具体实施方式与上述网络块设备快照读写方法各实施例基本相同,在此不再赘述。
本申请还提供一种网络块设备快照读写装置,所述网络块设备快照读写装置应用于Ceph分布式系统中的Ceph客户端,所述Ceph分布式系统还包括Ceph集群,所述网络块设备快照读写装置包括:
检测模块,用于在Ceph客户端检测到对网络块设备的快照数据库的读写快照请求时,基于所述网络块设备对应的rbd-nbd进程,将所述读写快照请求发送给所述Ceph集群,以获取所述Ceph集群针对所述读写快照请求反馈的快照数据;
获取模块,用于获取所述读写快照请求的类型;
写模块,用于若所述读写快照请求的类型为写请求类型时,根据所述写类型在所述rbd-nbd进程中进行写操作,以得到写数据;
反馈模块,用于将所述写数据以及所述快照数据反馈给所述网络块设备,以启动所述网络块设备中的快照数据库。
本申请网络块设备快照读写装置具体实施方式与上述网络块设备快照读写方法各实施例基本相同,在此不再赘述。
本申请提供了一种存储介质,所述存储介质可以为非易失性可读存储介质,所述存储介质存储有一个或者一个以上可读指令,所述一个或者一个以上可读指令还可被一个或者一个以上的处理器执行以用于实现上述任一项所述的网络块设备快照读写方法的步骤。
本申请存储介质具体实施方式与上述网络块设备快照读写方法各实施例基本相同,在此不再赘述。
以上仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利处理范围内。
Claims (20)
- 一种网络块设备快照读写方法,其特征在于,所述网络块设备快照读写方法应用于Ceph分布式系统中的Ceph客户端,所述Ceph分布式系统还包括Ceph集群,所述网络块设备快照读写方法包括:在Ceph客户端检测到对网络块设备的快照数据库的读写快照请求时,基于所述网络块设备对应的rbd-nbd进程,将所述读写快照请求发送给所述Ceph集群,以获取所述Ceph集群针对所述读写快照请求反馈的快照数据;获取所述读写快照请求的类型;若所述读写快照请求的类型为写请求类型时,根据所述写类型在所述rbd-nbd进程中进行写操作,以得到写数据;将所述写数据以及所述快照数据反馈给所述网络块设备,以启动所述网络块设备中的快照数据库。
- 如权利要求1所述的网络块设备快照读写方法,其特征在于,所述若所述读写快照请求的类型为写类型时,根据所述写类型在所述rbd-nbd进程中进行写操作,以得到写数据步骤包括:若所述读写快照请求的类型为写请求的类型时,判断所述rbd-nbd进程中的缓存是否为空;若所述rbd-nbd进程中的缓存不为空,则获取所述写请求中携带的第一键值,其中,所述第一键值中包括写位置以及写长度信息;将所述第一键值与所述缓存中已缓存条目中的第二键值进行比对;若所述第一键值小于等于第二键值,则在所述缓存中增加新的缓存条目,将所述写请求的请求内容存储在所述新的缓存条目中。
- 如权利要求2所述的网络块设备快照读写方法,其特征在于,所述获取所述读写快照请求的类型步骤之后包括:若所述读写快照请求的类型为读类型时,将所述Ceph集群针对所述读写快照请求反馈的快照数据反馈给所述网络块设备,以启动所述网络块设备中的快照数据库。
- 如权利要求2所述的网络块设备快照读写方法,其特征在于,所述若所述读写快照请求的类型为读类型时,将所述Ceph集群针对所述读写快照请求反馈的快照数据反馈给所述网络块设备步骤包括:若所述读写快照请求的类型为读类型时,判断所述rbd-nbd进程中的缓存是否为空;若所述rbd-nbd进程中的缓存不为空,则获取所述读请求中携带的目标读键值,根据所述目标读键值从所述缓存中获取所述读请求的读数据;将所述Ceph集群针对所述读写快照请求反馈的快照数据与所述读数据反馈给所述网络块设备。
- 如权利要求2所述的网络块设备快照读写方法,其特征在于,所述判断所述rbd-nbd进程中的缓存是否为空步骤之后包括:若所述rbd-nbd进程中的缓存为空时,将在所述缓存中创建初始条目;将所述写请求的请求内容存储在rbd-nbd进程中的初始条目中。
- 如权利要求5所述的网络块设备快照读写方法,其特征在于,所述获取所述读写快照请求的类型步骤之后包括:若所述读写快照请求的类型为读类型时,将所述Ceph集群针对所述读写快照请求反馈的快照数据反馈给所述网络块设备,以启动所述网络块设备中的快照数据库。
- 如权利要求5所述的网络块设备快照读写方法,其特征在于,所述若所述读写快照请求的类型为读类型时,将所述Ceph集群针对所述读写快照请求反馈的快照数据反馈给所述网络块设备步骤包括:若所述读写快照请求的类型为读类型时,判断所述rbd-nbd进程中的缓存是否为空;若所述rbd-nbd进程中的缓存不为空,则获取所述读请求中携带的目标读键值,根据所述目标读键值从所述缓存中获取所述读请求的读数据;将所述Ceph集群针对所述读写快照请求反馈的快照数据与所述读数据反馈给所述网络块设备。
- 如权利要求2所述的网络块设备快照读写方法,其特征在于,所述将所述第一键值与所述缓存中已缓存条目中的第二键值进行比对步骤之后包括:若所述第一键值大于所述第二键值,则将所述第一键值对应的写请求的请求内容与所述第二键对应的请求内容进行合并存储。
- 如权利要求8所述的网络块设备快照读写方法,其特征在于,所述将所述第一键值与所述缓存中已缓存条目中的第二键值进行比对步骤之后包括:若所述第一键值大于所述第二键值,则将所述第一键值对应的写请求的请求内容与所述第二键对应的请求内容进行合并存储。
- 如权利要求8所述的网络块设备快照读写方法,其特征在于,所述获取所述读写快照请求的类型步骤之后包括:若所述读写快照请求的类型为读类型时,将所述Ceph集群针对所述读写快照请求反馈的快照数据反馈给所述网络块设备,以启动所述网络块设备中的快照数据库。
- 如权利要求8所述的网络块设备快照读写方法,其特征在于,所述若所述读写快照请求的类型为读类型时,将所述Ceph集群针对所述读写快照请求反馈的快照数据反馈给所述网络块设备步骤包括:若所述读写快照请求的类型为读类型时,判断所述rbd-nbd进程中的缓存是否为空;若所述rbd-nbd进程中的缓存不为空,则获取所述读请求中携带的目标读键值,根据所述目标读键值从所述缓存中获取所述读请求的读数据;将所述Ceph集群针对所述读写快照请求反馈的快照数据与所述读数据反馈给所述网络块设备。
- 如权利要求1所述的网络块设备快照读写方法,其特征在于,所述获取所述读写快照请求的类型步骤之后包括:若所述读写快照请求的类型为读类型时,将所述Ceph集群针对所述读写快照请求反馈的快照数据反馈给所述网络块设备,以启动所述网络块设备中的快照数据库。
- 如权利要求12所述的网络块设备快照读写方法,其特征在于,所述若所述读写快照请求的类型为读类型时,将所述Ceph集群针对所述读写快照请求反馈的快照数据反馈给所述网络块设备步骤包括:若所述读写快照请求的类型为读类型时,判断所述rbd-nbd进程中的缓存是否为空;若所述rbd-nbd进程中的缓存不为空,则获取所述读请求中携带的目标读键值,根据所述目标读键值从所述缓存中获取所述读请求的读数据;将所述Ceph集群针对所述读写快照请求反馈的快照数据与所述读数据反馈给所述网络块设备。
- 如权利要求1所述的网络块设备快照读写方法,其特征在于,所述若所述读写快照请求的类型为读类型时,将所述Ceph集群针对所述读写快照请求反馈的快照数据反馈给所述网络块设备步骤包括:若所述读写快照请求的类型为读类型时,判断所述rbd-nbd进程中的缓存是否为空;若所述rbd-nbd进程中的缓存不为空,则获取所述读请求中携带的目标读键值,根据所述目标读键值从所述缓存中获取所述读请求的读数据;将所述Ceph集群针对所述读写快照请求反馈的快照数据与所述读数据反馈给所述网络块设备。
- 一种网络块设备快照读写装置,其特征在于,所述网络块设备快照读写装置应用于Ceph分布式系统中的Ceph客户端,所述Ceph分布式系统还包括Ceph集群,所述网络块设备快照读写装置包括:检测模块,用于在Ceph客户端检测到对网络块设备的快照数据库的读写快照请求时,基于所述网络块设备对应的rbd-nbd进程,将所述读写快照请求发送给所述Ceph集群,以获取所述Ceph集群针对所述读写快照请求反馈的快照数据;获取模块,用于获取所述读写快照请求的类型;写模块,用于若所述读写快照请求的类型为写请求类型时,根据所述写类型在所述rbd-nbd进程中进行写操作,以得到写数据;反馈模块,用于将所述写数据以及所述快照数据反馈给所述网络块设备,以启动所述网络块设备中的快照数据库。
- 如权利要求15所述的网络块设备快照读写装置,其特征在于,所述写模块包括:第一判断单元,用于若所述读写快照请求的类型为写请求的类型时,判断所述rbd-nbd进程中的缓存是否为空;第一获取单元,用于若所述rbd-nbd进程中的缓存不为空,则获取所述写请求中携带的第一键值,其中,所述第一键值中包括写位置以及写长度信息;比对单元,用于将所述第一键值与所述缓存中已缓存条目中的第二键值进行比对;增加单元,用于若所述第一键值小于等于第二键值,则在所述缓存中增加新的缓存条目,将所述写请求的请求内容存储在所述新的缓存条目中。
- 一种网络块设备快照读写设备,其特征在于,所述网络块设备快照读写设备包括:存储器、处理器,通信总线以及存储在所述存储器上的网络块设备快照读写方法可读指令,所述通信总线用于实现处理器与存储器间的通信连接;所述处理器用于执行所述网络块设备快照读写方法可读指令,以实现如权利要求1所述的网络块设备快照读写方法的步骤。
- 一种网络块设备快照读写设备,其特征在于,所述网络块设备快照读写设备包括:存储器、处理器,通信总线以及存储在所述存储器上的网络块设备快照读写方法可读指令,所述通信总线用于实现处理器与存储器间的通信连接;所述处理器用于执行所述网络块设备快照读写方法可读指令,以实现如权利要求2所述的网络块设备快照读写方法的步骤。
- 一种存储介质,其特征在于,所述存储介质上存储有网络块设备快照读写方法可读指令,所述网络块设备快照读写方法可读指令被处理器执行时实现如权利要求1所述的网络块设备快照读写方法的步骤。
- 一种存储介质,其特征在于,所述存储介质上存储有网络块设备快照读写方法可读指令,所述网络块设备快照读写方法可读指令被处理器执行时实现如权利要求2所述的网络块设备快照读写方法的步骤。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910480680.4 | 2019-05-31 | ||
CN201910480680.4A CN110321321B (zh) | 2019-05-31 | 2019-05-31 | 网络块设备快照读写方法、装置、设备及存储介质 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2020237849A1 true WO2020237849A1 (zh) | 2020-12-03 |
Family
ID=68119584
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2019/101713 WO2020237849A1 (zh) | 2019-05-31 | 2019-08-21 | 网络块设备快照读写方法、装置、设备及存储介质 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN110321321B (zh) |
WO (1) | WO2020237849A1 (zh) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113779083A (zh) * | 2021-01-29 | 2021-12-10 | 北京京东拓先科技有限公司 | 数据处理方法、装置、服务器以及存储介质 |
CN114040346A (zh) * | 2021-09-22 | 2022-02-11 | 福建省新天地信勘测有限公司 | 一种基于5g网络的档案数字化信息管理系统 |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111143183A (zh) * | 2019-12-27 | 2020-05-12 | 紫光云(南京)数字技术有限公司 | 一种基于librbd库测试rbd上传速度的方法 |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20110313973A1 (en) * | 2010-06-19 | 2011-12-22 | Srivas Mandayam C | Map-Reduce Ready Distributed File System |
CN107291883A (zh) * | 2017-06-20 | 2017-10-24 | 郑州云海信息技术有限公司 | 一种分布式存储系统的快照方法及装置 |
CN109033328A (zh) * | 2018-07-19 | 2018-12-18 | 郑州云海信息技术有限公司 | 一种访问请求处理方法、装置、设备及可读存储介质 |
CN109814946A (zh) * | 2018-12-29 | 2019-05-28 | 创新科存储技术(深圳)有限公司 | 一种在XenServer中实现分布式存储的方法和装置 |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7617292B2 (en) * | 2001-06-05 | 2009-11-10 | Silicon Graphics International | Multi-class heterogeneous clients in a clustered filesystem |
US7774568B2 (en) * | 2007-08-13 | 2010-08-10 | Novell, Inc. | Clustered snapshots in networks |
CN108460045B (zh) * | 2017-02-21 | 2022-11-18 | 中兴通讯股份有限公司 | 一种快照的处理方法及分布式块存储系统 |
-
2019
- 2019-05-31 CN CN201910480680.4A patent/CN110321321B/zh active Active
- 2019-08-21 WO PCT/CN2019/101713 patent/WO2020237849A1/zh active Application Filing
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20110313973A1 (en) * | 2010-06-19 | 2011-12-22 | Srivas Mandayam C | Map-Reduce Ready Distributed File System |
CN107291883A (zh) * | 2017-06-20 | 2017-10-24 | 郑州云海信息技术有限公司 | 一种分布式存储系统的快照方法及装置 |
CN109033328A (zh) * | 2018-07-19 | 2018-12-18 | 郑州云海信息技术有限公司 | 一种访问请求处理方法、装置、设备及可读存储介质 |
CN109814946A (zh) * | 2018-12-29 | 2019-05-28 | 创新科存储技术(深圳)有限公司 | 一种在XenServer中实现分布式存储的方法和装置 |
Non-Patent Citations (1)
Title |
---|
WANG, PENGJIE ET AL.: "Non-official translation: A Continuous Data Protection Method for Ceph Distributed Block Storage", NETWORK SECURITY TECHNOLOGY & APPLICATION, 15 February 2017 (2017-02-15), DOI: 20200106095737A * |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113779083A (zh) * | 2021-01-29 | 2021-12-10 | 北京京东拓先科技有限公司 | 数据处理方法、装置、服务器以及存储介质 |
CN114040346A (zh) * | 2021-09-22 | 2022-02-11 | 福建省新天地信勘测有限公司 | 一种基于5g网络的档案数字化信息管理系统 |
CN114040346B (zh) * | 2021-09-22 | 2024-02-06 | 福建省新天地信勘测有限公司 | 一种基于5g网络的档案数字化信息管理系统与管理方法 |
Also Published As
Publication number | Publication date |
---|---|
CN110321321B (zh) | 2023-06-23 |
CN110321321A (zh) | 2019-10-11 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2018103315A1 (zh) | 监控数据的处理方法、装置、服务器及存储设备 | |
WO2020125251A1 (zh) | 基于联邦学习的模型参数训练方法、装置、设备及介质 | |
WO2018076865A1 (zh) | 数据分享方法、装置、存储介质及电子设备 | |
WO2020237849A1 (zh) | 网络块设备快照读写方法、装置、设备及存储介质 | |
WO2020237859A1 (zh) | 基于nbd设备的数据迁移方法、装置、设备及存储介质 | |
WO2018233352A1 (zh) | 数据传输方法、装置、终端以及计算机可读存储介质 | |
WO2012055298A1 (zh) | 客户端的离线工作方法和离线工作客户端 | |
WO2014189275A1 (en) | Apparatus and method of recognizing external device in a communication system | |
WO2021072881A1 (zh) | 基于对象存储的请求处理方法、装置、设备及存储介质 | |
WO2018120681A1 (zh) | 数据同步方法、装置、系统、数据处理服务器和存储介质 | |
WO2021051492A1 (zh) | 数据库服务节点切换方法、装置、设备及计算机存储介质 | |
WO2019137217A1 (zh) | 应用程序中的页面跳转方法、终端及存储介质 | |
WO2018201774A1 (zh) | 数据审批方法、装置、设备和计算机可读存储介质 | |
WO2016101441A1 (zh) | 一种进行文件同步的方法及系统 | |
WO2021027134A1 (zh) | 数据存储方法、装置、设备和计算机存储介质 | |
WO2020087981A1 (zh) | 风控审核模型生成方法、装置、设备及可读存储介质 | |
WO2020103275A1 (zh) | 扣款控制方法、装置、设备及可读存储介质 | |
WO2016183721A1 (zh) | 一种终端设备刷机方法、装置和设备 | |
WO2018120680A1 (zh) | 虚拟磁盘备份系统、方法、装置、服务主机和存储介质 | |
WO2017148142A1 (zh) | 桌面图标文件夹的名称切换方法、装置及电子设备 | |
WO2020062640A1 (zh) | 终端应用动态文案的语言切换方法、服务器及存储介质 | |
WO2020062554A1 (zh) | 存储器的数据读取方法、显示装置及计算机可读存储介质 | |
WO2015180434A1 (zh) | 一种数据库集群管理数据的方法、节点及系统 | |
WO2020107591A1 (zh) | 重复投保限制方法、装置、设备及可读存储介质 | |
WO2012022215A1 (zh) | 一种互联网中互动信息的交互方法、装置及系统 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 19931185 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 19931185 Country of ref document: EP Kind code of ref document: A1 |