Data writing method, device and electronic equipment

By splitting data blocks in the management server of the distributed block storage system and polling multiple target logical storage devices, the problem of bandwidth reduction when processing large data writing is solved by a single Volume Segment, which improves the system's parallel writing efficiency.

CN113608699BActive Publication Date: 2025-03-07BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110907176.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-09
Publication Date
2025-03-07
Estimated Expiration
2041-08-09

AI Technical Summary

Technical Problem

In distributed block storage systems, the client's continuous big data write is usually responsible for the Segment of a single Volume, resulting in a reduced system bandwidth and the ability of the distributed system cannot fully utilize the parallel capabilities.

Method used

By pre-creating the correspondence between the virtual disk and the logical storage device in the management server, after receiving the data write request from the client, the data to be stored is divided into multiple data blocks, and multiple target logical storage devices are determined based on the virtual disk identification, and the data blocks are written to multiple target storage spaces by polling and writing.

Benefits of technology

Through multiple target logical storage devices, the system bandwidth and efficiency of data writing are improved and the advantages of distributed systems are fully utilized.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113608699B_ABST
    Figure CN113608699B_ABST
Patent Text Reader

Abstract

The present application provides a data writing method, device and electronic device, wherein the method is applied to a management server of a distributed block storage system, and a correspondence between a virtual disk and a logical storage device is pre-created in the management server; wherein one virtual disk corresponds to multiple logical storage devices; the storage space corresponding to each logical storage device is distributed in at least one storage node of the system; the method comprises: receiving a data writing request from a client; wherein the data writing request carries a virtual disk identifier and data to be stored; dividing the data to be stored into multiple data blocks; determining multiple target logical storage devices corresponding to the virtual disk identifier according to the correspondence; and polling and writing multiple data blocks into the storage spaces corresponding to the multiple target logical storage devices. The present application can improve the system bandwidth when writing data and improve the efficiency of data writing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of software technology, and in particular to a data writing method, device and electronic device. Background Art

[0002] The distributed block storage system includes multiple data storage nodes, and data can be stored in multiple data storage nodes in a dispersed manner. It adopts an extensible system structure and uses multiple storage servers to share the storage load, which not only improves the reliability, availability and access efficiency of the system, but also is easy to expand. In the prior art, when a user performs a write operation based on a distributed block storage system, it is necessary to discover and log in to an available virtual disk LUN (Logical Unit Number, which can be regarded as a virtual disk) through the client. One LUN corresponds to a logical storage device Volume, and one Volume corresponds to multiple address segments. When the LUN receives a large amount of data written continuously by the client, the large data write will be handled by only one address segment in a Volume, that is, the underlying storage space VolBLock, resulting in the system bandwidth becoming a single VolBlock processing bandwidth, which limits the system's parallel capability, that is, the data write efficiency is low, and the advantages of the distributed system cannot be brought into play. Summary of the invention

[0003] The purpose of the present application is to provide a data writing method, device and electronic device, which can increase the system bandwidth during data writing and improve the data writing efficiency.

[0004] In a first aspect, an embodiment of the present application provides a data writing method, which is applied to a management server of a distributed block storage system, wherein a correspondence between a virtual disk and a logical storage device is pre-created in the management server; wherein one virtual disk corresponds to multiple logical storage devices; and the storage space corresponding to each logical storage device is distributed in at least one storage node of the system; the method comprises: receiving a data writing request from a client; wherein the data writing request carries a virtual disk identifier and data to be stored; dividing the data to be stored into multiple data blocks; determining multiple target logical storage devices corresponding to the virtual disk identifier according to the correspondence; and polling and writing multiple data blocks into the storage spaces corresponding to the multiple target logical storage devices respectively.

[0005] Furthermore, the management server is configured with data segmentation parameters; the data segmentation parameters include: data block size or number of data blocks; the step of segmenting the data to be stored into multiple data blocks includes: segmenting the data to be stored according to the data segmentation parameters to obtain multiple data blocks.

[0006] Furthermore, the above-mentioned step of polling and writing multiple data blocks into storage spaces corresponding to multiple target logical storage devices respectively includes: taking each data block as the current data block, executing the following steps: obtaining the data block identifier corresponding to the current data block and the number of target logical storage devices; determining the current logical storage device from multiple target logical storage devices based on the data block identifier and the number of target logical storage devices; and writing the current data block into the storage space corresponding to the current logical storage device.

[0007] Furthermore, the above-mentioned data block identifier is a data block segmentation sequence number; and the step of determining the current logical storage device from multiple target logical storage devices based on the data block identifier and the number of target logical storage devices includes: calculating the remainder obtained by dividing the data block segmentation sequence number corresponding to the current data block by the number of target logical storage devices; using the remainder as the sequence number, and using the target logical storage device corresponding to the sequence number among the multiple target logical storage devices as the current logical storage device.

[0008] Furthermore, the above-mentioned current logical storage device corresponds to multiple address segments, each address segment corresponds to multiple storage spaces distributed on different storage nodes; the step of writing the current data block into the storage space corresponding to the current logical storage device includes: obtaining a storage offset parameter corresponding to the current data block; determining the current address segment from the multiple address segments corresponding to the current logical storage device according to the storage offset parameter; and writing the current data block into the storage space corresponding to the current address segment.

[0009] Furthermore, the above step of obtaining the storage offset parameter corresponding to the current data block includes: obtaining the initial storage offset corresponding to the data to be stored; and determining the storage offset parameter corresponding to the current data block based on the initial storage offset, the sum of the data block sizes before the current data block, and the data block size corresponding to the current data block.

[0010] Furthermore, each of the above-mentioned address segments has the same corresponding size; the step of determining the current address segment from the multiple address segments corresponding to the current logical storage device according to the storage offset parameter includes: obtaining the quotient of the storage offset parameter divided by the address segment size; taking the quotient as a sequence number, and taking the address segment corresponding to the sequence number in the multiple address segments as the current address segment.

[0011] Furthermore, the above-mentioned current address segment corresponds to a first storage space and a second storage space; the second storage space is distributed in the form of multiple copies on different storage nodes in the system; the step of writing the current data block into the storage space corresponding to the current address segment includes: writing the current data block into the first storage space; and playing back the current data block to the second storage space through the first storage space.

[0012] Furthermore, the creation process of the above virtual disk is as follows: obtain the identifiers corresponding to multiple pre-created logical storage devices respectively; add the identifiers corresponding to multiple logical storage devices respectively to the device list corresponding to the same virtual disk identifier; generate a virtual disk based on the device list and TGT export block device driver.

[0013] Furthermore, before the above step of receiving the client's data write request, the method also includes: receiving a disk login request from the client; the disk login request carries a client identifier; performing user identity authentication based on the client identifier; after successful authentication, returning a prompt message of successful login to the client.

[0014] In the second aspect, an embodiment of the present application also provides a data writing device, which is applied to a management server of a distributed block storage system, and a correspondence between a virtual disk and a logical storage device is pre-created in the management server; wherein, one virtual disk corresponds to multiple logical storage devices; the storage space corresponding to each logical storage device is distributed in at least one storage node of the system; the device includes: a request receiving module, used to receive a data write request from a client; wherein the data write request carries a virtual disk identifier and data to be stored; a data segmentation module, used to segment the data to be stored into multiple data blocks; a target device determination module, used to determine multiple target logical storage devices corresponding to the virtual disk identifier according to the correspondence; a data writing module, used to poll and write multiple data blocks into the storage spaces corresponding to the multiple target logical storage devices respectively.

[0015] In a third aspect, an embodiment of the present application further provides an electronic device, including a processor and a memory, wherein the memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the method described in the first aspect above.

[0016] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the method described in the first aspect above.

[0017] In the data writing method, device and electronic device provided in the embodiments of the present application, the method is applied to a management server of a distributed block storage system, and a correspondence between a virtual disk and a logical storage device is pre-created in the management server; wherein, one virtual disk corresponds to multiple logical storage devices; after the management server receives a data writing request from a client, the data to be stored carried in the request is first divided into multiple data blocks, and multiple target logical storage devices are determined according to the virtual disk identifier carried in the request and the above correspondence, and then the multiple data blocks are polled and written into the storage spaces corresponding to the multiple target logical storage devices respectively. Since the storage space corresponding to each logical storage device is distributed in at least one storage node of the system, multiple data blocks of the data to be stored are written in parallel through multiple target logical storage devices, which can improve the system bandwidth when writing data and improve the data writing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the specific implementation methods of the present application or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0019] Figure 1 A flowchart of a data writing method provided in an embodiment of the present application;

[0020] Figure 2 A schematic diagram of data writing provided in an embodiment of the present application;

[0021] Figure 3 A flowchart of another data writing method provided in an embodiment of the present application;

[0022] Figure 4 A schematic diagram of an address space corresponding to a Volume provided in an embodiment of the present application;

[0023] Figure 5 A structural block diagram of a data writing device provided in an embodiment of the present application;

[0024] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0025] The technical solution of the present application will be described clearly and completely below in conjunction with the embodiments. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.

[0026] Currently, when users perform write operations based on distributed block storage systems, they need to discover and log in to available virtual disk LUNs through the client. In the prior art, one LUN corresponds to one logical storage device Volume, and one Volume corresponds to multiple address segments. When the LUN receives a large amount of continuous data writes from the client, the large data write will be handled by only one Segment in a Volume, that is, the underlying VolBLock, causing the system bandwidth to become the processing bandwidth of a single VolBlock, limiting the system's parallel capability, that is, the data write efficiency is low, and the advantages of the distributed system cannot be brought into play.

[0027] Based on this, the embodiments of the present application provide a data writing method, device and electronic device, which can increase the system bandwidth when writing data and improve the data writing efficiency.

[0028] To facilitate understanding of this embodiment, a data writing method disclosed in an embodiment of the present application is first introduced in detail.

[0029] Figure 1 A flowchart of a data writing method provided in an embodiment of the present application, the method is applied to a management server of a distributed block storage system, and a correspondence between a virtual disk LUN and a logical storage device Volume is pre-created in the management server; wherein one virtual disk LUN corresponds to multiple logical storage devices Volume; and the storage space corresponding to each logical storage device Volume is distributed in at least one storage node of the system. The above data writing method specifically includes the following steps:

[0030] Step S102, receiving a data write request from a client; wherein the data write request carries a virtual disk identifier and data to be stored.

[0031] When a user writes data through a client, a data write request is needed to be initiated for a virtual disk, indicating that the user wants to write the data to be stored into the virtual disk. The data write request carries the identifier of the virtual disk and the data to be stored that the user wants to write.

[0032] Step S104, dividing the data to be stored into multiple data blocks.

[0033] After obtaining the data to be stored, the data to be stored can be split according to the configuration information in the server to obtain multiple small data blocks. For example, the data can be split according to the data splitting parameters in the configuration information, where the data splitting parameters can be the size of each data block or the number of data blocks to be split.

[0034] Step S106: determining multiple target logical storage devices corresponding to the virtual disk identifier according to the corresponding relationship.

[0035] Since the data write request carries the virtual disk identifier, multiple target logical storage devices corresponding to the identifier can be determined from the above correspondence according to the identifier.

[0036] It should be noted that there is no necessary order for executing step S104 and step S106, and they can be executed interchangeably or simultaneously.

[0037] Step S108: Write the multiple data blocks into storage spaces corresponding to the multiple target logical storage devices in a round-robin manner.

[0038] See also Figure 2 As shown, the correspondence between LUN and Volume is 1:6. In this case, the user data, i.e., the data to be stored, is first divided into data_entry (e.g., 2MB) units. There are 4 data blocks after the division, which are polled and written into multiple volumes corresponding to the LUN, that is, written into the first 4 volumes corresponding to the LUN. For example, there are 24 data blocks after the division, and there are 8 target logical storage devices. Then the polling writing method can be: first write the first 8 data blocks into the storage space corresponding to the 8 target logical storage devices, then write the middle 8 data blocks into the storage space corresponding to the 8 target logical storage devices, and finally write the last 8 data blocks into the storage space corresponding to the 8 target logical storage devices. When writing to the 8 target logical storage devices, the 8 data blocks are written in parallel, so the data writing bandwidth and data writing efficiency can be improved.

[0039] The data writing method provided in the embodiment of the present application is applied to the management server of the distributed block storage system, and a correspondence relationship between a virtual disk and a logical storage device is pre-created in the management server; wherein, one virtual disk corresponds to multiple logical storage devices; after the management server receives a data writing request from the client, the data to be stored carried in the request is first divided into multiple data blocks, and multiple target logical storage devices are determined according to the virtual disk identifier carried in the request and the above correspondence relationship, and then the multiple data blocks are polled and written into the storage spaces corresponding to the multiple target logical storage devices respectively. Since the storage space corresponding to each logical storage device is distributed in at least one storage node of the system, the multiple data blocks of the data to be stored are written in parallel through multiple target logical storage devices, which can improve the system bandwidth when writing data and improve the data writing efficiency.

[0040] The present application embodiment also provides another data writing method, which is implemented on the basis of the above embodiment; this embodiment focuses on describing the data segmentation process and the data writing process. Figure 3 The data writing method in this embodiment includes the following steps:

[0041] Step S302, receiving a data write request from a client; wherein the data write request carries a virtual disk identifier and data to be stored.

[0042] The method provided in the embodiment of the present application can be applied to scenarios where a large amount of data needs to be written, for example, in security scenarios, hundreds or thousands of cameras will continuously write a large amount of data to this distributed block storage system. In other words, the data to be stored is usually a large number of bytes.

[0043] Step S304, dividing the data to be stored according to the data division parameters to obtain multiple data blocks.

[0044] The management server is pre-configured with data segmentation parameters; the data segmentation parameters include: data block size or data block number; if the data block size is set, the data can be segmented into multiple data blocks with the data block size as a unit; if the data block number is set, the data to be stored can be evenly segmented according to the number of data blocks. In a preferred embodiment, the data segmentation parameter is the data block size, such as 2MB, that is, the data to be stored is evenly segmented according to the size of 2MB, for example, it can be segmented into data block 1, data block 2, data block 3..., and each data block size is 2MB.

[0045] Step S306: determining multiple target logical storage devices corresponding to the virtual disk identifier according to the corresponding relationship.

[0046] For example, when the virtual disk is created, a corresponding relationship between it and 8 logical storage devices is created, so the target logical storage devices determined according to the virtual disk identifier are 8. The process of polling and writing the above multiple data blocks to the target logical storage devices is as follows:

[0047] Step S308, taking each data block as the current data block, the following steps are performed: obtaining the data block identifier and the number of target logical storage devices corresponding to the current data block; determining the current logical storage device from multiple target logical storage devices based on the data block identifier and the number of target logical storage devices; and writing the current data block into the storage space corresponding to the current logical storage device.

[0048] The above-mentioned data block identifier is a data block segmentation sequence number; the step of determining the current logical storage device from multiple target logical storage devices based on the data block identifier and the number of target logical storage devices includes: calculating the remainder obtained by dividing the data block segmentation sequence number corresponding to the current data block by the number of target logical storage devices; using the remainder as the sequence number, and using the target logical storage device corresponding to the sequence number among the multiple target logical storage devices as the current logical storage device.

[0049] For example, the number of target logical storage devices is 8, and the segmentation sequence number corresponding to the current data block is 1, that is, the first data block. Then, the remainder of 1 divided by 8 is 1, that is, the first target logical storage device is used as the current logical storage device corresponding to the current data block for data writing. For another example, the segmentation sequence number corresponding to the current data block is 10, that is, the tenth data block. Then, the remainder of 10 divided by 8 is 2, that is, the second target logical storage device is used as the current logical storage device corresponding to the current data block for data writing, and so on.

[0050] See also Figure 4 The schematic diagram of the address space corresponding to a Volume provided in the embodiment of the present application is shown as follows. Figure 4 It can be seen that the current logical storage device Volume corresponds to multiple address segments, and each address segment corresponds to multiple storage spaces distributed on different storage nodes, such as the blocks in the figure; Volume is only a logical concept, and the LogBlock and VolBlock in the figure are what actually store data. The Blocks contained in a Volume may be distributed on any storage node. The above step of writing the current data block to the storage space corresponding to the current logical storage device can be implemented in the following way:

[0051] (1) Obtain the storage offset parameter corresponding to the current data block.

[0052] Specifically, first obtain the initial storage offset corresponding to the data to be stored; then determine the storage offset parameter corresponding to the current data block according to the initial storage offset, the sum of the data block sizes before the current data block, and the data block size corresponding to the current data block.

[0053] For example, the initial storage offset corresponding to the data to be stored is offset. Taking the data block size of 2MB as an example, the storage offset parameter corresponding to the split data block is: offset+2MB*(i-1). Among them, i represents the data block sequence number, that is, the storage offset parameter corresponding to the first data block is offset, the storage offset parameter corresponding to the second data block is offset+2MB, the storage offset parameter corresponding to the third data block is offset+2MB*2, and so on.

[0054] (2) According to the storage offset parameter, a current address segment is determined from a plurality of address segments corresponding to the current logical storage device.

[0055] Each of the above address segments has the same size, which is a system setting value of 8GB. The above step of determining the current address segment from the multiple address segments corresponding to the current logical storage device according to the storage offset parameter can be implemented by the following steps:

[0056] The quotient of the storage offset parameter divided by the address segment size is calculated; the quotient is used as a sequence number, and an address segment corresponding to the sequence number among the multiple address segments is used as the current address segment.

[0057] For example, if the storage offset parameter corresponding to the current data block is 8GB+2MB, then 8GB+2MB is divided by the address segment size 8GB, and the quotient is 1, so the first address segment is used as the current address segment. For another example, if the storage offset parameter corresponding to the current data block is 16GB+4MB, then 16GB+4MB is divided by the address segment size 8GB, and the quotient is 2, so the second address segment is used as the current address segment.

[0058] (3) Write the current data block into the storage space corresponding to the current address segment.

[0059] See also Figure 4 , the above-mentioned current address segment corresponds to a first storage space LogBlock and a second storage space ValBlock; the second storage space ValBlock is distributed in different storage nodes in the system in the form of multiple copies (such as three copies); the step of writing the current data block to the storage space corresponding to the current address segment can be implemented in the following ways: writing the current data block to the first storage space; and replaying the current data block to the second storage space through the first storage space.

[0060] In a preferred implementation, the Volume address space is divided into multiple segments, each segment is 8GB in size, each segment corresponds to a VolBlock and multiple LogBlocks, VolBlock stores disk basic data and supports random writes, LogBlock stores WAL data and writes sequentially, and LogBlock data is deleted after being replayed to VolBlock. Each VolBlock exists in the form of three copies, each copy exists on a different storage node. When writing, write the primary copy first, then synchronize to the two slave copies, and it is considered successful only after three successful writes.

[0061] It should be noted that the user's data to be stored is only written to LogBlock. When each LogBlock is filled with 1GB or the user finds that the current LogBlock cannot be written, the EBS SDK will create a new LogBlock.

[0062] The following is a detailed description of the virtual disk creation process:

[0063] Obtain identifiers corresponding to multiple pre-created logical storage devices respectively; add the identifiers corresponding to the multiple logical storage devices respectively to a device list corresponding to the same virtual disk identifier; and generate a virtual disk based on the device list and TGT export block device driver.

[0064] When creating a LUN, the system administrator has specified which volumes the LUN contains (the default is 1:8), that is, the correspondence between the LUN and the 8 volumes is determined, and then the block device driver is exported through TGT to generate a virtual disk LUN. The LUN is visible to the user, and the user can select a LUN for data write operations.

[0065] In actual applications, the virtual disk created above is usually created according to user needs. In this case, usage permissions are set for the virtual disk LUN, and not everyone can use it. Therefore, in the data writing method provided in the embodiment of the present application, before the step of receiving the data writing request from the client, the following steps may also be included:

[0066] Receive a disk login request from a client; the disk login request carries a client identifier; perform user identity authentication based on the client identifier; after successful authentication, return a prompt message indicating successful login to the client.

[0067] The client identifier can be an IP address used by the user, or verification information such as an account number and password. Only after the user identity authentication is successful can the user use the virtual disk to perform data write operations.

[0068] The data writing method provided in the embodiment of the present application performs parallel data writing on multiple data blocks to be stored in multiple target logical storage devices, so that the data can be simultaneously written into the storage space corresponding to multiple address segments, such as multiple VolBlocks corresponding to multiple segments corresponding to multiple Volumes, thereby improving the system bandwidth when writing data and improving the data writing efficiency.

[0069] Based on the above method embodiment, the embodiment of the present application also provides a data writing device, which is applied to a management server of a distributed block storage system, and a corresponding relationship between a virtual disk and a logical storage device is pre-created in the management server; wherein one virtual disk corresponds to multiple logical storage devices; and the storage space corresponding to each logical storage device is distributed in at least one storage node of the system; see Figure 5 As shown, the device comprises:

[0070] A request receiving module 52 is used to receive a data writing request from a client; wherein the data writing request carries a virtual disk identifier and data to be stored; a data segmentation module 54 is used to segment the data to be stored into multiple data blocks; a target device determination module 56 is used to determine multiple target logical storage devices corresponding to the virtual disk identifier based on a corresponding relationship; a data writing module 58 is used to poll and write multiple data blocks into storage spaces corresponding to multiple target logical storage devices respectively.

[0071] The data writing device provided in the embodiment of the present application is applied to the management server of the distributed block storage system, and a correspondence between virtual disks and logical storage devices is pre-created in the management server; wherein, one virtual disk corresponds to multiple logical storage devices; when the management server writes data to be stored, multiple data blocks of the data to be stored can be written in parallel through multiple target logical storage devices, which can improve the system bandwidth when writing data and improve the data writing efficiency.

[0072] The management server is configured with data segmentation parameters, which include data block size or data block number. The data segmentation module 54 is further used to segment the data to be stored according to the data segmentation parameters to obtain multiple data blocks.

[0073] The above-mentioned data writing module 58 is also used to take each data block as the current data block, and execute the following steps: obtain the data block identifier and the number of target logical storage devices corresponding to the current data block; determine the current logical storage device from multiple target logical storage devices based on the data block identifier and the number of target logical storage devices; write the current data block into the storage space corresponding to the current logical storage device.

[0074] The data block identifier is a data block segmentation sequence number; the data writing module 58 is also used to calculate the remainder obtained by dividing the data block segmentation sequence number corresponding to the current data block by the number of target logical storage devices; using the remainder as the sequence number, the target logical storage device corresponding to the sequence number in multiple target logical storage devices is used as the current logical storage device.

[0075] The above-mentioned current logical storage device corresponds to multiple address segments, each address segment corresponds to multiple storage spaces distributed on different storage nodes; the above-mentioned data writing module 58 is also used to obtain the storage offset parameter corresponding to the current data block; according to the storage offset parameter, the current address segment is determined from the multiple address segments corresponding to the current logical storage device; and the current data block is written into the storage space corresponding to the current address segment.

[0076] The data writing module 58 is also used to obtain the initial storage offset corresponding to the data to be stored; and determine the storage offset parameter corresponding to the current data block according to the initial storage offset, the sum of the data block sizes before the current data block, and the data block size corresponding to the current data block.

[0077] Each of the above-mentioned address segments has the same corresponding size; the above-mentioned data writing module 58 is also used to obtain the quotient of the storage offset parameter divided by the address segment size; using the quotient as the sequence number, the address segment corresponding to the sequence number in the multiple address segments is used as the current address segment.

[0078] The above-mentioned current address segment corresponds to a first storage space and a second storage space; the second storage space is distributed in the form of multiple copies on different storage nodes in the system; the above-mentioned data writing module 58 is also used to write the current data block into the first storage space; and replay the current data block to the second storage space through the first storage space.

[0079] The above-mentioned device also includes a virtual disk creation module, which is used to obtain the identifiers corresponding to multiple pre-created logical storage devices; add the identifiers corresponding to multiple logical storage devices to the device list corresponding to the same virtual disk identifier; and generate a virtual disk based on the device list and TGT export block device driver.

[0080] The above device also includes: a verification module, which is used to receive a disk login request from a client; the disk login request carries a client identifier; performs user identity authentication according to the client identifier; after successful authentication, returns a prompt message of successful login to the client.

[0081] The data writing device provided in the embodiment of the present application has the same implementation principle and technical effects as those of the aforementioned method embodiment. For the sake of brief description, for parts not mentioned in the embodiment of the data writing device, reference may be made to the corresponding contents in the aforementioned method embodiment.

[0082] The present application also provides an electronic device, such as Figure 6 As shown, it is a schematic diagram of the structure of the electronic device, wherein the electronic device includes a processor 61 and a memory 60, the memory 60 stores computer executable instructions that can be executed by the processor 61, and the processor 61 executes the computer executable instructions to implement the above method.

[0083] exist Figure 6 In the illustrated embodiment, the electronic device further includes a bus 62 and a communication interface 63 , wherein the processor 61 , the communication interface 63 and the memory 60 are connected via the bus 62 .

[0084] Among them, the memory 60 may include a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 63 (which can be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. can be used. The bus 62 can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The bus 62 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0085] The processor 61 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 61. The above processor 61 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to execute, or the hardware and software modules in the decoding processor can be executed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor 61 reads the information in the memory and completes the steps of the method of the above embodiment in combination with its hardware.

[0086] An embodiment of the present application also provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the above method. The specific implementation can be found in the aforementioned method embodiment, which will not be repeated here.

[0087] The computer program product of the data writing method, device and electronic device provided in the embodiments of the present application includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the previous method embodiments. The specific implementation can be found in the method embodiments, which will not be repeated here.

[0088] Unless otherwise specifically stated, the relative steps, numerical expressions and values ​​of the components and steps set forth in these embodiments do not limit the scope of the present application.

[0089] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0090] In the description of the present application, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present application and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present application. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.

[0091] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present application, which are used to illustrate the technical solutions of the present application, rather than to limit them. The protection scope of the present application is not limited thereto. Although the present application is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present application, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims

1. A data writing method, characterized in that: The method is applied to a management server of a distributed block storage system, wherein a correspondence between a virtual disk and a logical storage device is pre-created in the management server; wherein one virtual disk corresponds to a plurality of logical storage devices; and a storage space corresponding to each logical storage device is distributed in at least one storage node of the system; the method comprises: Receive a data write request from a client; wherein the data write request carries a virtual disk identifier and data to be stored; Dividing the data to be stored into multiple data blocks; Determine, according to the corresponding relationship, a plurality of target logical storage devices corresponding to the virtual disk identifier; Taking each of the data blocks as the current data block, the following steps are performed: obtaining a data block identifier corresponding to the current data block and the number of the target logical storage devices; the data block identifier is a data block segmentation sequence number; calculating the remainder obtained by dividing the data block segmentation sequence number corresponding to the current data block by the number of the target logical storage devices; taking the remainder as a sequence number, taking a target logical storage device corresponding to the sequence number among the multiple target logical storage devices as the current logical storage device; and writing the current data block into a storage space corresponding to the current logical storage device.

2. The method according to claim 1, characterized in that The management server is configured with data segmentation parameters; The data segmentation parameters include: data block size or data block number; The step of dividing the data to be stored into a plurality of data blocks comprises: The data to be stored is divided according to the data division parameters to obtain a plurality of the data blocks.

3. The method according to claim 1, characterized in that The current logical storage device corresponds to a plurality of address segments, and each address segment corresponds to a plurality of storage spaces distributed on different storage nodes; The step of writing the current data block into the storage space corresponding to the current logical storage device includes: Obtaining a storage offset parameter corresponding to the current data block; Determining a current address segment from a plurality of address segments corresponding to the current logical storage device according to the storage offset parameter; The current data block is written into the storage space corresponding to the current address segment.

4. The method according to claim 3, characterized in that The step of obtaining a storage offset parameter corresponding to the current data block includes: Obtaining an initial storage offset corresponding to the data to be stored; A storage offset parameter corresponding to the current data block is determined according to the initial storage offset, the sum of the sizes of the data blocks before the current data block, and the data block size corresponding to the current data block.

5. The method according to claim 4, characterized in that The corresponding sizes of each of the address segments are the same; The step of determining the current address segment from a plurality of address segments corresponding to the current logical storage device according to the storage offset parameter comprises: Obtaining a quotient of the storage offset parameter divided by the address segment size; The quotient is used as a sequence number, and an address segment corresponding to the sequence number among the multiple address segments is used as a current address segment.

6. The method according to claim 3, characterized in that The current address segment corresponds to a first storage space and a second storage space; the second storage space is distributed in different storage nodes in the system in the form of multiple copies; The step of writing the current data block into a storage space corresponding to the current address segment comprises: Writing the current data block into the first storage space; The current data block is played back to the second storage space through the first storage space.

7. The method according to claim 1, characterized in that The process of creating the virtual disk is as follows: Obtain identifiers corresponding to multiple pre-created logical storage devices respectively; Adding the identifiers corresponding to the plurality of logical storage devices to the device list corresponding to the same virtual disk identifier; A block device driver is exported based on the device list and the TGT to generate a virtual disk.

8. The method according to claim 1, characterized in that: Before the step of receiving a data writing request from a client, the method further includes: receiving a disk login request from the client; the disk login request carries a client identifier; Performing user identity authentication according to the client identifier; After successful authentication, a prompt message indicating successful login is returned to the client.

9. A data writing device, characterized in that: The device is applied to a management server of a distributed block storage system, wherein a correspondence between a virtual disk and a logical storage device is pre-created in the management server; wherein one virtual disk corresponds to a plurality of logical storage devices; and a storage space corresponding to each logical storage device is distributed in at least one storage node of the system; the device comprises: A request receiving module, used for receiving a data writing request from a client; wherein the data writing request carries a virtual disk identifier and data to be stored; A data segmentation module, used for segmenting the data to be stored into a plurality of data blocks; A target device determination module, used to determine a plurality of target logical storage devices corresponding to the virtual disk identifier according to the corresponding relationship; The data writing module is used to take each of the data blocks as the current data block, and execute the following steps: obtaining a data block identifier corresponding to the current data block and the number of the target logical storage devices; the data block identifier is a data block segmentation sequence number; calculating the remainder obtained by dividing the data block segmentation sequence number corresponding to the current data block by the number of the target logical storage devices; taking the remainder as the sequence number, taking the target logical storage device corresponding to the sequence number among the multiple target logical storage devices as the current logical storage device; and writing the current data block into the storage space corresponding to the current logical storage device.

10. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the method according to any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Data writing method and device

    CN111913664A