[go: up one dir, main page]

CN106648959B - Data storage method and storage system - Google Patents

Data storage method and storage system Download PDF

Info

Publication number
CN106648959B
CN106648959B CN201610811110.5A CN201610811110A CN106648959B CN 106648959 B CN106648959 B CN 106648959B CN 201610811110 A CN201610811110 A CN 201610811110A CN 106648959 B CN106648959 B CN 106648959B
Authority
CN
China
Prior art keywords
storage device
storage
resource
target
target log
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201610811110.5A
Other languages
Chinese (zh)
Other versions
CN106648959A (en
Inventor
叶小杰
倪敏芳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201610811110.5A priority Critical patent/CN106648959B/en
Publication of CN106648959A publication Critical patent/CN106648959A/en
Application granted granted Critical
Publication of CN106648959B publication Critical patent/CN106648959B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1456Hardware arrangements for backup
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Quality & Reliability (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本申请实施例提供了一种数据存储的方法和存储系统。该方法应用于包括第一存储设备和至少一个第二存储设备的存储系统,其中,该第二存储设备为该第一存储设备的镜像存储设备,该方法包括:第一存储设备接收写请求消息,该写请求消息携带目标数据;该第一存储设备根据该目标数据,生成目标日志,该目标日志包括该目标数据和用于标识该目标数据的标识信息;该第一存储设备向该第二存储设备发送该目标日志;该第二存储设备存储该目标日志,且该存储不需要配置内存索引。因此,本申请实施例的数据存储的方法和存储系统能够在第二存储设备不配置内存索引的情况下,直接存储目标日志,从而减少了第二存储设备对CPU的占用。

Figure 201610811110

Embodiments of the present application provide a data storage method and storage system. The method is applied to a storage system including a first storage device and at least one second storage device, wherein the second storage device is a mirrored storage device of the first storage device, and the method includes: the first storage device receives a write request message , the write request message carries target data; the first storage device generates a target log according to the target data, and the target log includes the target data and identification information for identifying the target data; the first storage device reports to the second The storage device sends the target log; the second storage device stores the target log, and the storage does not need to configure a memory index. Therefore, the data storage method and storage system of the embodiments of the present application can directly store the target log without configuring the memory index in the second storage device, thereby reducing the occupation of the CPU by the second storage device.

Figure 201610811110

Description

数据存储的方法和存储系统Data storage method and storage system

技术领域technical field

本申请涉及计算机存储领域,并且更具体地,涉及数据存储的方法和存储系统。The present application relates to the field of computer storage, and more particularly, to methods and storage systems for data storage.

背景技术Background technique

镜像是冗余的一种类型,一个磁盘上的数据在另一个磁盘上存在一个完全相同的副本即为镜像。在服务器上常用镜像操作是组建独立磁盘冗余阵列(Redundant Array OfIndependent Disks,RAID)1,RAID1是将一个两块硬盘所构成的RAID磁盘阵列,其容量仅等于一个硬盘的容量,因为另一块只是当作数据“镜像”。Mirroring is a type of redundancy. Data on one disk has an exact copy on another disk, which is mirroring. The common mirror operation on the server is to form a redundant array of independent disks (Redundant Array Of Independent Disks, RAID) 1. RAID 1 is a RAID disk array composed of two hard disks, and its capacity is only equal to the capacity of one hard disk, because the other is only as a data "mirror".

在分布式存储系统中,为了达到可靠性的要求,选择在节点间使用镜像机制。将本地数据,复制一份在镜像节点保存,在故障情况下,快速恢复业务。In a distributed storage system, in order to meet the requirements of reliability, a mirroring mechanism is chosen between nodes. A copy of the local data is stored on the mirror node, and services can be quickly restored in the event of a failure.

在现有技术中,待存储数据发送到镜像节点,镜像节点需要为待存储数据配置内存索引,内存索引用于方便读取该镜像节点存储的数据;之后镜像节点需要申请资源空间,并设置资源空间的存储地址与内存索引的映射关系;最后将待存储数据存储到存储地址对应的资源空间中。现有技术镜像节点存储待存储数据的上述操作对镜像节点的中央处理器(Central Processing Unit,CPU)的占用较高。In the prior art, the data to be stored is sent to the mirror node, and the mirror node needs to configure a memory index for the data to be stored, and the memory index is used to facilitate reading the data stored by the mirror node; then the mirror node needs to apply for resource space and set resources The mapping relationship between the storage address of the space and the memory index; finally, the data to be stored is stored in the resource space corresponding to the storage address. In the prior art, the above operation of storing the data to be stored by the mirror node takes a relatively high occupation of a central processing unit (Central Processing Unit, CPU) of the mirror node.

发明内容SUMMARY OF THE INVENTION

本申请实施例提供一种数据存储的方法和存储系统,能够减少镜像存储设备存储数据对CPU的占用。Embodiments of the present application provide a data storage method and a storage system, which can reduce the occupation of a CPU for storing data by a mirrored storage device.

第一方面,本申请实施例提供了一种数据存储的方法,该方法应用于包括第一存储设备和至少一个第二存储设备的存储系统,其中,该第二存储设备为该第一存储设备的镜像存储设备,该方法包括:第一存储设备接收写请求消息,该写请求消息携带目标数据;该第一存储设备根据该目标数据,生成目标日志,该目标日志包括该目标数据和用于标识该目标数据的标识信息;该第一存储设备向该第二存储设备发送该目标日志;该第二存储设备存储该目标日志,且该存储该目标日志不需要配置内存索引。In a first aspect, an embodiment of the present application provides a data storage method, and the method is applied to a storage system including a first storage device and at least one second storage device, wherein the second storage device is the first storage device The mirror storage device, the method includes: a first storage device receives a write request message, the write request message carries target data; the first storage device generates a target log according to the target data, and the target log includes the target data and Identification information for identifying the target data; the first storage device sends the target log to the second storage device; the second storage device stores the target log, and does not need to configure a memory index for storing the target log.

本申请实施例应用于包括第一存储设备和至少一个第二存储设备的存储系统中,且第二存储设备为一类第一存储设备的镜像存储设备。第一存储设备接收写请求消息,写请求消息中携带待写的数据(表示为目标数据),根据该目标数据,生成相应的目标日志,并向第二存储设备发送该目标日志将该目标日志直接存储到第二存储设备中,由于该目标日志包括用于表示该目标数据的标识信息,这样第二存储设备存储该目标日志时并不需要创建内存索引,相比现有技术中,第二存储设备需要配置内存索引而言,本申请可以直接存储该目标日志,从而节省了第二存储设备配置内存索引时对CPU的占用。The embodiments of the present application are applied to a storage system including a first storage device and at least one second storage device, and the second storage device is a mirror storage device of a type of first storage device. The first storage device receives the write request message, and the write request message carries the data to be written (represented as target data), generates a corresponding target log according to the target data, and sends the target log to the second storage device. It is directly stored in the second storage device, because the target log includes identification information used to represent the target data, so the second storage device does not need to create a memory index when storing the target log. Compared with the prior art, the second As far as the memory index needs to be configured on the storage device, the present application can directly store the target log, thereby saving the CPU occupation when the second storage device configures the memory index.

在一些可能的实现方式中,该方法还包括:该第二存储设备在完成存储该目标日志时,向该第一存储设备发送存储完成消息;该第一存储设备存储该目标日志;该第一存储设备在完成该目标日志的存储和接收到该存储完成消息之后,发送写请求响应消息。In some possible implementations, the method further includes: when the second storage device finishes storing the target log, sending a storage completion message to the first storage device; the first storage device stores the target log; the first storage device After completing the storage of the target log and receiving the storage completion message, the storage device sends a write request response message.

第一存储设备完成写入目标日志,且接收到第二存储设备发送的存储完成消息之后,向IO设备发送写请求响应消息,这样避免现有技术中需要等待将目标数据存储到内存索引对应的资源空间之后才能向IO设备返回写请求响应消息,从而减少了发出写请求到收到写请求响应消息的时延。After the first storage device completes writing the target log and receives the storage completion message sent by the second storage device, it sends a write request response message to the IO device, so as to avoid the need to wait for the target data to be stored in the memory index corresponding to the prior art. Only after the resource space can return the write request response message to the IO device, the delay from issuing the write request to receiving the write request response message is reduced.

在一些可能的实现方式中,该第二存储设备包括多个资源空间;其中,该第二存储设备存储该目标日志包括:该第二存储设备根据该标识信息,确定存储该目标日志的第一资源空间,该第一资源空间为该第二存储设备的多个资源空间中满足该目标日志的资源需求的任一资源空间;该第二存储设备将该目标日志存储到该第一资源空间中。In some possible implementations, the second storage device includes a plurality of resource spaces; wherein, storing the target log in the second storage device includes: the second storage device determines, according to the identification information, a first storage device for storing the target log Resource space, the first resource space is any resource space in the plurality of resource spaces of the second storage device that meets the resource requirements of the target log; the second storage device stores the target log in the first resource space .

第二存储设备根据该标识信息选择合适的资源空间(表示为第一资源空间),将该目标日志存储到第二存储设备的第一资源空间中。此外,第二存储设备可以根据标识信息识别目标数据,以目标日志的形式可以将目标数据按照顺序进行有规律的存储,这样第二存储设备可以不需要为目标数据配置内存索引,从而使得节省了第二存储设备的CPU占用。The second storage device selects an appropriate resource space (represented as a first resource space) according to the identification information, and stores the target log in the first resource space of the second storage device. In addition, the second storage device can identify the target data according to the identification information, and can regularly store the target data in order in the form of the target log, so that the second storage device does not need to configure a memory index for the target data, thereby saving CPU usage of the second storage device.

在一些可能的实现方式中,该第二存储设备包括多个资源空间;该方法还包括:该第一存储设备获取第二资源空间的存储地址和该第二资源空间的存储容量,该第二资源空间为该第二存储设备的多个资源空间中任一资源空间;该第一存储设备根据该第二资源空间的存储容量和该标识信息,确定该第二资源空间是否满足该目标日志的资源需求;该第一存储设备在该第二资源空间满足该目标日志的资源需求时,根据RDMA编码方式、该目标日志和该第二资源空间的存储地址,生成RDMA消息,该RDMA消息包括该第二资源空间的存储地址和该目标日志;其中,该第一存储设备向该第二存储设备发送该目标日志包括:该第一存储设备向该第二存储设备的第二资源空间发送该RDMA消息;其中,该第二存储设备存储该目标日志包括:该第二存储设备的第二资源空间根据该RDMA消息,存储该目标日志。In some possible implementations, the second storage device includes multiple resource spaces; the method further includes: acquiring, by the first storage device, a storage address of the second resource space and a storage capacity of the second resource space, the second The resource space is any resource space in a plurality of resource spaces of the second storage device; the first storage device determines whether the second resource space meets the requirements of the target log according to the storage capacity of the second resource space and the identification information. Resource requirements; when the second resource space meets the resource requirements of the target log, the first storage device generates an RDMA message according to the RDMA encoding method, the target log and the storage address of the second resource space, and the RDMA message includes the The storage address of the second resource space and the target log; wherein, sending the target log by the first storage device to the second storage device includes: the first storage device sending the RDMA to the second resource space of the second storage device message; wherein, storing the target log by the second storage device includes: storing the target log in a second resource space of the second storage device according to the RDMA message.

第二存储设备在将目标日志存储到第二资源空间之后,就可以向第一存储设备返回存储完成消息。本申请实施例相比第二存储设备接收目标日志,并需要为目标日志选择合适的资源空间,能够更进一步节省了第二存储设备的CPU的占用。After storing the target log in the second resource space, the second storage device may return a storage completion message to the first storage device. Compared with the second storage device receiving the target log and needing to select an appropriate resource space for the target log, the embodiment of the present application can further save the CPU occupation of the second storage device.

在一些可能的实现方式中,该第一存储设备获取第二资源空间的存储地址和该第二资源空间的存储容量包括:该第一存储设备向该第二存储设备发送资源请求消息,该资源请求消息用于请求存储该目标日志的该第二资源空间;该第一存储设备接收该第二存储设备根据该资源请求消息发送的资源请求响应消息,该资源请求响应消息携带该第二资源空间的存储地址和该第二资源空间的存储容量。In some possible implementations, the obtaining, by the first storage device, the storage address of the second resource space and the storage capacity of the second resource space includes: the first storage device sends a resource request message to the second storage device, the resource The request message is used to request the second resource space for storing the target log; the first storage device receives a resource request response message sent by the second storage device according to the resource request message, and the resource request response message carries the second resource space and the storage capacity of the second resource space.

第一存储设备可以向第二存储设备发送资源请求消息,第二存储设备在多个资源空间中选择任意一个资源空间(表示为第二资源空间),并向第一存储设备发送资源请求响应消息,且在资源请求响应消息中携带该第二资源空间的存储地址和该第二资源空间的剩余容量,从而使得第一存储设备能够为目标日志选择合适的资源空间。第一存储设备可以只获取一次第二存储设备的资源空间的地址和存储容量,直至该资源空间没有剩余资源,或者剩余资源不能够满足当前待写入数据的大小,然后才进行下一次获取第二存储设备的资源空间的地址和存储容量。The first storage device may send a resource request message to the second storage device, and the second storage device selects any one resource space (represented as a second resource space) among multiple resource spaces, and sends a resource request response message to the first storage device , and the resource request response message carries the storage address of the second resource space and the remaining capacity of the second resource space, so that the first storage device can select an appropriate resource space for the target log. The first storage device may acquire the address and storage capacity of the resource space of the second storage device only once, until the resource space has no remaining resources, or the remaining resources cannot meet the size of the current data to be written, and then perform the next acquisition. 2. The address and storage capacity of the resource space of the storage device.

在一些可能的实现方式中,该方法还包括:该第一存储设备为该目标数据配置内存索引;该第一存储设备根据该内存索引,确定存储该目标数据的该第一存储设备的资源空间,其中,该第一存储设备的资源空间的存储地址对应于该内存索引;该第一存储设备将该目标数据写入该第一存储设备的资源空间中。In some possible implementations, the method further includes: configuring, by the first storage device, a memory index for the target data; and determining, by the first storage device, a resource space of the first storage device storing the target data according to the memory index , wherein the storage address of the resource space of the first storage device corresponds to the memory index; the first storage device writes the target data into the resource space of the first storage device.

第一存储设备为目标数据配置内存索引,以及为目标数据申请存储资源(表示为第一存储设备的资源空间),且配置已经申请的存储资源的存储地址与内存索引的映射关系,该映射关系用于后续第一存储设备能够根据内存索引读取到对应的存储地址中存储的数据,最后将目标数据写入到存储地址对应的资源空间中。这样第一存储设备将目标数据存储到有内存索引对应的资源空间中,并不会延长影响返回写请求响应消息的时间。The first storage device configures a memory index for the target data, and applies for a storage resource (represented as the resource space of the first storage device) for the target data, and configures the mapping relationship between the storage address of the applied storage resource and the memory index, the mapping relationship It is used for the subsequent first storage device to be able to read the data stored in the corresponding storage address according to the memory index, and finally write the target data into the resource space corresponding to the storage address. In this way, the first storage device stores the target data in the resource space corresponding to the memory index, and does not prolong the time that affects the return of the write request response message.

第二方面,本申请实施例提供了一种存储系统,该存储系统可以实现上述方面所涉及方法中第一存储设备和第二存储设备所执行的功能,所述功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。所述硬件或软件包括一个或多个上述功能相应的单元或模块。In a second aspect, an embodiment of the present application provides a storage system, and the storage system can implement the functions performed by the first storage device and the second storage device in the methods involved in the above aspects. The functions can be implemented by hardware, or can be The corresponding software implementation is performed by hardware. The hardware or software includes one or more units or modules corresponding to the above functions.

第三方面,提供了一种存储系统,该存储系统的结构中包括存储器,该处理器被配置为支持上述方面所涉及方法中第一存储设备和第二存储设备所执行的功能。该通信接口用于支持该第一存储设备、第二存储设备与其它网元之间的通信。该存储器用于与处理器耦合,其保存该第一存储设备、该第二存储设备必要的程序指令和数据。In a third aspect, a storage system is provided, the structure of the storage system includes a memory, and the processor is configured to support the functions performed by the first storage device and the second storage device in the methods involved in the above aspects. The communication interface is used to support communication between the first storage device, the second storage device and other network elements. The memory is for coupling with the processor and holds necessary program instructions and data for the first storage device and the second storage device.

第四方面,提供了一种计算机存储介质,该计算机存储介质中存储有程序代码,该程序代码用于指示执行上述存储系统所用的计算机软件指令,其包含用于执行上述方面所设计的程序。In a fourth aspect, a computer storage medium is provided, and program codes are stored in the computer storage medium, and the program codes are used to instruct computer software instructions for executing the above storage system, and the program codes include the programs designed for executing the above aspects.

基于上述技术方案,第一存储设备通过接收携带目标数据的写请求消息,根据该写请求消息中的目标数据生成包括该目标数据和用于标识该目标数据的标识信息的目标日志,并向该第二存储设备发送该目标日志,第二存储设备存储该目标日志,且存储该目标日志不需要配置内存索引,这样第一存储设备生成包括标识目标数据的标识信息的目标日志,第二存储设备可以存储目标日志不需要配置内存索引,从而减少了对第二存储设备的CPU的占用。Based on the above technical solution, the first storage device generates a target log including the target data and identification information for identifying the target data according to the target data in the write request message by receiving the write request message carrying the target data, and sends the target log to the target data. The second storage device sends the target log, the second storage device stores the target log, and does not need to configure a memory index to store the target log, so the first storage device generates a target log including identification information that identifies the target data, and the second storage device The target log can be stored without configuring a memory index, thereby reducing the occupation of the CPU of the second storage device.

附图说明Description of drawings

为了更清楚地说明本申请实施例的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to illustrate the technical solutions of the embodiments of the present application more clearly, the following briefly introduces the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some of the drawings in the present application. In the embodiments, for those of ordinary skill in the art, other drawings can also be obtained according to these drawings without any creative effort.

图1是本申请实施例的存储系统的架构示意图;FIG. 1 is a schematic structural diagram of a storage system according to an embodiment of the present application;

图2是本申请实施例的存储节点和管理节点的结构示意图;FIG. 2 is a schematic structural diagram of a storage node and a management node according to an embodiment of the present application;

图3是本申请实施例Cache模块的工作流程图;FIG. 3 is a work flow diagram of a Cache module according to an embodiment of the present application;

图4a、图4b和图4c是本申请实施例的日志格式的示意图;Fig. 4a, Fig. 4b and Fig. 4c are schematic diagrams of log formats according to an embodiment of the present application;

图5是本申请实施例的资源空间的结构示意图;5 is a schematic structural diagram of a resource space according to an embodiment of the present application;

图6是现有技术数据存储的方法的示意性流程图;6 is a schematic flow chart of a method for prior art data storage;

图7是本申请一个实施例的数据存储的方法的示意性流程图;7 is a schematic flowchart of a method for data storage according to an embodiment of the present application;

图8是本申请另一个实施例的数据存储的方法的示意性流程图;8 is a schematic flowchart of a data storage method according to another embodiment of the present application;

图9是本申请实施例的存储系统的示意性框图;9 is a schematic block diagram of a storage system according to an embodiment of the present application;

图10是本申请实施例的存储系统的结构示意图。FIG. 10 is a schematic structural diagram of a storage system according to an embodiment of the present application.

具体实施方式Detailed ways

下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are some, but not all, embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.

图1示出了本申请实施例的存储系统的架构示意图。如图1所示,该存储系统包括节点和网络。其中,节点分为用户节点(可以有多个用户节点:用户节点200a、用户节点200b、用户节点200c和用户节点200d)、存储节点(可以有多个存储节点:存储节点100a、存储节点100b、存储节点100c和存储节点100d)和管理节点300。网络分为用于承载用户输入输出(Input/Output,IO)数据的前端网络400和用于承载业务数据的后端网络500。本申请实施例中的业务数据可以是指支持RDMA的镜像数据。FIG. 1 shows a schematic structural diagram of a storage system according to an embodiment of the present application. As shown in Figure 1, the storage system includes nodes and a network. The nodes are divided into user nodes (there may be multiple user nodes: user node 200a, user node 200b, user node 200c and user node 200d), storage nodes (there may be multiple storage nodes: storage node 100a, storage node 100b, Storage node 100c and storage node 100d) and management node 300. The network is divided into a front-end network 400 for carrying user input/output (Input/Output, IO) data and a back-end network 500 for carrying service data. The service data in this embodiment of the present application may refer to mirror data supporting RDMA.

用户节点用于在前端接收用户IO数据,通过前端网络转发给存储节点。存储节点用于存储用户业务数据,同时高速缓冲存储器(Cache)功能也在存储节点上。管理节点用于负责维护存储节点间的镜像关系。The user node is used to receive user IO data at the front end and forward it to the storage node through the front end network. The storage node is used to store user service data, and a cache memory (Cache) function is also on the storage node. The management node is responsible for maintaining the mirror relationship between storage nodes.

图2示出了存储节点和管理节点的结构示意图。其中,存储节点可以区分IO的主存储节点(以图1中的100a为例)和IO的镜像存储节点(以图1中的100b为例)。IO的主节点100a主要包括前端IO模块110a、后端磁盘模块120a和Cache模块130a。前端IO模块110a用于负责用户IO接收、IO流控以及IO错误处理。后端磁盘模块120a用于提供用户业务数据通过磁盘读写功能。Cache模块130a分为日志层131a、资源层132a和本地存储133a。管理节点300包括镜像管理模块310,镜像管理模块310用于在管理节点上负责维护节点间镜像关系,并通知Cache模块130。镜像存储节点100b的结构与主存储节点100a的结构相同,在此不再赘述。FIG. 2 shows a schematic structural diagram of a storage node and a management node. Among them, the storage node can distinguish the main storage node of IO (take 100a in FIG. 1 as an example) and the mirror storage node of IO (take 100b in FIG. 1 as an example). The IO master node 100a mainly includes a front-end IO module 110a, a back-end disk module 120a and a Cache module 130a. The front-end IO module 110a is used for user IO reception, IO flow control and IO error handling. The back-end disk module 120a is used to provide the read/write function of user service data through the disk. The Cache module 130a is divided into a log layer 131a, a resource layer 132a and a local storage 133a. The management node 300 includes a mirror management module 310, and the mirror management module 310 is used to maintain the mirror relationship between nodes on the management node, and notify the Cache module 130. The structure of the mirror storage node 100b is the same as that of the main storage node 100a, and details are not described herein again.

图3示出了Cache模块130a的内部工作流程。日志层131a接收前端IO模块110a发送的IO数据,并将IO数据转换为日志形式(例如,预写日志(Write-ahead logging,WAL log)格式的数据)发送给资源层132a;资源层132a负责资源(例如,非易失性的双列内存模块(Non-Volatile Dual In-line Memory Module,NVDIMM)资源)的空间分配,并将日志发送到镜像节点110b进行存储。主存储节点100a接收到存储完成消息,本地存储133a在本地存储日志。FIG. 3 shows the internal workflow of the Cache module 130a. The log layer 131a receives the IO data sent by the front-end IO module 110a, converts the IO data into log format (for example, data in a write-ahead logging (WAL log) format) and sends it to the resource layer 132a; the resource layer 132a is responsible for Space allocation of resources (eg, Non-Volatile Dual In-line Memory Module (NVDIMM) resources), and logs are sent to mirror node 110b for storage. The primary storage node 100a receives the storage complete message, and the local storage 133a stores the log locally.

为了方便理解本申请实施例,首先在此介绍本申请实施例之前引入以下几个要素。To facilitate understanding of the embodiments of the present application, the following elements are first introduced before the embodiments of the present application are introduced here.

远程直接数据存取(Remote Direct Memory Access,RDMA)通过网络将数据直接传入镜像节点的存储区,而不对操作系统造成任何影响,这样就可以减少镜像端的CPU的开销。具体RDMA实现是通过发送方和接收方针对目的缓存区的位置进行协商,与传统的TCP连接不同的是要对传统传输控制协议(Transmission Control Protocol,TCP)头部数据结构进行一些改动以支持RDMA协议,主要是增加一个表示目的地址的字段(即生成RDMA消息)。RDMA读写操作要求源端和目的端都知道目的缓存区的位置和大小,如果从主机的内存通过RDMA向另一个主机内存写一块数据,则必须提供目的缓存区的地址,并确保这个缓存区足够大来接收这块数据。Remote Direct Memory Access (RDMA) directly transfers data to the storage area of the mirror node through the network without any impact on the operating system, thus reducing the overhead of the CPU on the mirror side. The specific implementation of RDMA is through the negotiation between the sender and the receiver on the location of the destination buffer. Different from the traditional TCP connection, some changes must be made to the traditional Transmission Control Protocol (TCP) header data structure to support RDMA. protocol, mainly by adding a field representing the destination address (ie, generating an RDMA message). RDMA read and write operations require both the source and destination to know the location and size of the destination buffer. If a piece of data is written from the host's memory to another host's memory through RDMA, the address of the destination buffer must be provided and ensure that this buffer is Large enough to receive this piece of data.

WAL log日志格式分为三种类型:简单型日志、复合型日志和命令型日志。There are three types of WAL log log formats: simple log, compound log, and command log.

简单型日志只针对元数据(即是描述数据属性的信息,用来指示存储位置、历史数据、资源查找、文件记录等功能)的一个对象的日志,或数据的一个文件的日志。在一个写IO只包含一个Cache模块的数据时,通常使用简单型日志格式。简单型日志格式如图4a所示,包括魔术字部分、数据部分、日志头部分和日志尾部分。魔术字部分存储一组魔术字表示日志开始,日志头中存放元数据,日志尾中存放日志的循环冗余码校验(Cyclic RedundancyCheck,CRC)校验信息。The simple log is only for the log of an object of metadata (that is, the information describing the attributes of the data, used to indicate the storage location, historical data, resource search, file recording, etc.), or the log of a file of data. When a write IO only contains the data of one Cache module, the simple log format is usually used. The simple log format is shown in Figure 4a, including magic word part, data part, log header part and log tail part. The magic word part stores a group of magic words to indicate the start of the log, metadata is stored in the log header, and Cyclic Redundancy Check (CRC) check information of the log is stored in the log tail.

复合型日志格式如图4b所示,在一个写IO包含多个Cache模块的数据时,需要转换为多条简单日志,再对多条简单日志封装一个复合日志头,组合成一条复合型日志,来保证这多条log的一致性。这条复合型日志的数据部分存放着多条简单日志,具体日志个数及数据长度在日志头中保存。The composite log format is shown in Figure 4b. When a write IO contains data from multiple Cache modules, it needs to be converted into multiple simple logs, and then multiple simple logs are encapsulated with a composite log header to form a composite log. To ensure the consistency of these multiple logs. The data part of this composite log stores multiple simple logs, and the specific log number and data length are stored in the log header.

命令型日志格式如图4c所示,当一个写命令或者其他命令的IO下发数据,这部分IO携带的数据将不需要在Cache中保存,为了镜像节点能够感知到,也需要写入一条日志,描述实现数据的位置以及大小。其中,命令型日志头中描述失效范围信息。The command type log format is shown in Figure 4c. When a write command or IO of other commands sends data, the data carried by the IO does not need to be stored in the Cache. In order for the mirror node to perceive it, a log needs to be written. , describing the location and size of the implementation data. The failure range information is described in the command-type log header.

资源层的资源分配是指将镜像的空间分为多个段(Segment)(通常使用8M NVDIMM空间)来管理。每个Segment可以存放多条WAL log(如图5所示),WAL log采用连续存放方式,每条WAL log首尾相连。魔术字部分存储一组魔术字表示一个Segment的开始,日志头记录Segmnet状态是否可用以及Segment序号等描述信息。Resource allocation at the resource layer refers to dividing the mirrored space into multiple segments (usually using 8M NVDIMM space) to manage. Each segment can store multiple WAL logs (as shown in Figure 5). The WAL logs are stored continuously, and each WAL log is connected end to end. The magic word part stores a set of magic words to indicate the start of a segment, and the log header records whether the segment status is available and the segment serial number and other description information.

图6示出了现有技术数据存储的方法,具体流程如下所示:Fig. 6 shows the method for data storage in the prior art, and the specific process is as follows:

101、IO前端模块向本地缓存模块发送写请求消息,该写请求消息携带待写的目标数据。101. The IO front-end module sends a write request message to the local cache module, where the write request message carries the target data to be written.

102、本地缓存模块接收到该目标数据,并将该目标数据发送给镜像缓存模块以使镜像缓存模块存储该目标数据。102. The local cache module receives the target data, and sends the target data to the mirror cache module, so that the mirror cache module stores the target data.

103、镜像缓存模块接收该目标数据,并为该目标数据配置内存索引,该内存索引用于方便读取该目标数据,具体地,镜像缓存模块可以先在已有的索引表查询是否存在该目标数据对应的内存索引,若不存在,为该目标数据创建相应的内存索引;103. The mirror cache module receives the target data, and configures a memory index for the target data. The memory index is used to facilitate reading the target data. Specifically, the mirror cache module can first query an existing index table whether the target exists. The memory index corresponding to the data, if it does not exist, create a corresponding memory index for the target data;

104、镜像缓存模块根据内存索引为目标数据申请存储资源(即配置合适的用于存储目标数据的资源空间),且设置目标数据的内存索引与申请的资源空间的存储地址的映射关系,使得根据索引以及索引对应的存储地址能够读取存储空间中的数据。104. The mirror cache module applies for storage resources for the target data according to the memory index (that is, configures a suitable resource space for storing the target data), and sets the mapping relationship between the memory index of the target data and the storage address of the applied resource space, so that according to The index and the storage address corresponding to the index can read data in the storage space.

105、镜像存储模块将目标数据存储到申请的资源空间中。105. The image storage module stores the target data in the requested resource space.

106、镜像缓存模块完成目标数据的存储后,向本地缓存模块发送存储完成消息。106. After the mirror cache module completes the storage of the target data, it sends a storage completion message to the local cache module.

107、本地缓存模块接收到镜像缓存模块发送的存储完成消息后,可以开始在本地缓存中进行存储目标数据,首先为目标数据配置内存索引。具体流程与镜像节点存储数据的流程(如上述步骤103和步骤104)相同,在此不进行赘述。107. After the local cache module receives the storage completion message sent by the mirror cache module, it can start to store the target data in the local cache, and firstly configure a memory index for the target data. The specific process is the same as that of the mirror node storing data (such as the above-mentioned steps 103 and 104 ), and details are not described here.

108、本地缓存模块为目标数据申请存储资源。108. The local cache module applies for storage resources for the target data.

109、本地缓存模块将目标数据存储到申请的资源空间中。109. The local cache module stores the target data in the applied resource space.

110、本地缓存模块完成目标数据的存储后,向IO前端模块发送写请求响应消息。110. After the local cache module completes the storage of the target data, it sends a write request response message to the IO front-end module.

因此,现有技术中,镜像缓存模块存储镜像数据时需要经过为目标数据配置内存索引、申请存储资源(镜像缓存模块需要根据目标数据的大小、类型等各种属性找到合适的资源空间,并配置资源空间的存储地址与内存索引的映射关系)和并将目标数据存储到镜像缓存模块的这些步骤都需要CPU参与,从而使得镜像存储节点的CPU占用较高。Therefore, in the prior art, when the mirror cache module stores mirror data, it needs to configure a memory index for the target data and apply for storage resources (the mirror cache module needs to find a suitable resource space according to various attributes such as the size and type of the target data, and configure The mapping relationship between the storage address of the resource space and the memory index) and the steps of storing the target data in the mirror cache module all require the participation of the CPU, so that the CPU usage of the mirror storage node is relatively high.

本申请实施例应用于第一存储设备正常工作的情况下,第一存储设备存储数据以及第二存储设备存储数据的场景。The embodiments of the present application are applied to a scenario where the first storage device stores data and the second storage device stores data when the first storage device works normally.

应理解,本申请实施例的第一存储设备对应于上述图2的主存储节点100a,第二存储设备对应于上述图2的镜像存储节点100b;或者说本申请实施例的第一存储设备就是上述图2的主存储节点100a,第二存储设备就是上述图2的镜像存储节点100b;或者该第一存储设备和第二存储设备分别为具有上述Cache模块130a功能的设备和上述Cache模块130b功能的设备,本申请对此不进行限定。It should be understood that the first storage device in this embodiment of the present application corresponds to the primary storage node 100a in FIG. 2, and the second storage device corresponds to the mirror storage node 100b in FIG. 2. In other words, the first storage device in the embodiment of the present application is The primary storage node 100a and the second storage device in the above-mentioned FIG. 2 are the mirror storage node 100b in the above-mentioned FIG. 2; or the first storage device and the second storage device are respectively a device having the function of the Cache module 130a and the function of the Cache module 130b. equipment, which is not limited in this application.

图7示出了根据本申请一个实施例的数据存储的方法的示意性流程图。本申请实施例中的第一存储设备可以是图1中的存储节点100a、100b、100c和100d中的任意一个存储节点,第二存储设备可以是通过管理节点300确定的主存储节点的镜像存储节点。FIG. 7 shows a schematic flowchart of a method for data storage according to an embodiment of the present application. The first storage device in this embodiment of the present application may be any one of the storage nodes 100a, 100b, 100c, and 100d in FIG. 1 , and the second storage device may be the mirror storage of the primary storage node determined by the management node 300 node.

701、第一存储设备接收写请求消息,该写请求消息携带目标数据。701. The first storage device receives a write request message, where the write request message carries target data.

本申请实施例应用于包括第一存储设备和至少一个第二存储设备的存储系统中,且第二存储设备为一类第一存储设备的镜像存储设备。此外,第一存储设备也可以是第二存储设备的镜像存储设备,也就是说,第一存储设备和第二存储设备可以互为镜像存设备,本申请对此不进行限定。The embodiments of the present application are applied to a storage system including a first storage device and at least one second storage device, and the second storage device is a mirror storage device of a type of first storage device. In addition, the first storage device may also be a mirror storage device of the second storage device, that is, the first storage device and the second storage device may be mirror storage devices of each other, which is not limited in this application.

第一存储设备可以是图2中的Cache模块130a,Cache模块130a接收IO前端模块110a发送的写请求消息,但本申请并不限于此。第一存储设备接收写请求消息,写请求消息中携带待写的数据(表示为目标数据),该目标数据可以是需要同一个缓存处理的数据,也可以是需要多个缓存单元处理的数据;或者该目标数据不需要在缓存中保存。The first storage device may be the Cache module 130a in FIG. 2. The Cache module 130a receives the write request message sent by the IO front-end module 110a, but the present application is not limited thereto. The first storage device receives a write request message, and the write request message carries data to be written (represented as target data), and the target data may be data that needs to be processed by the same cache, or data that needs to be processed by multiple cache units; Or the target data does not need to be kept in the cache.

应注意,该第一存储设备可以包括多个内存区域、处理器、控制器、且控制器上运行着操作系统等,第二存储设备可以与第一存储设备相同,也可以不同,本申请对此不进行限定。It should be noted that the first storage device may include multiple memory areas, processors, controllers, and an operating system running on the controllers, etc. The second storage device may be the same as the first storage device, or may be different. This is not limited.

702、第一存储设备根据该目标数据,生成相应的目标日志。702. The first storage device generates a corresponding target log according to the target data.

该目标日志包括目标数据和用于标识目标数据的标识信息,该标识信息为指示目标数据属性的各种信息。例如,日志格式如图4a、图4b和图4c所示,以简单型日志为例,简单型日志中包括魔术字部分、数据部分和日志头部分和日志尾部分。存储设备能够根据魔术字部分识别日志的开始;而日志头中存储元数据,元数据用于指示数据存储位置、历史数据、资源查找、文件记录等功能;日志尾部分存放日志的CRC校验信息,保证了数据的可靠性。因此,本申请实施例中的目标日志中包括的标识信息可以是日志头、日志尾以及魔术字部分中存储的所有信息。The target log includes target data and identification information for identifying the target data, where the identification information is various information indicating attributes of the target data. For example, the log format is shown in Figure 4a, Figure 4b, and Figure 4c. Taking a simple log as an example, the simple log includes a magic word part, a data part, a log header part, and a log tail part. The storage device can identify the start of the log according to the magic word part; the metadata is stored in the log header, and the metadata is used to indicate data storage location, historical data, resource search, file recording and other functions; the log tail part stores the CRC check information of the log , to ensure the reliability of the data. Therefore, the identification information included in the target log in this embodiment of the present application may be all information stored in the log header, log tail, and magic word parts.

日志格式包括简单型日志、复合型日志和命令型日志。若目标数据需要一个缓存处理,则第一存储存储设备将该目标数据转换为简单型日志;若目标数据是需要多个缓存处理,则第一存储设备将目标数据转换为复合型日志。若目标数据不需要在缓存中保存,则第一存储设备将目标数据转换为命令型日志,以描述该数据失效,以及失效数据的位置和大小。这样第一存储设备能够根据目标数据需要一个缓存处理、多个缓存处理还是不需要缓存处理,为目标数据选择生成合适的目标日志。Log formats include simple log, compound log, and command log. If the target data requires one cache process, the first storage device converts the target data into a simple log; if the target data requires multiple cache processes, the first storage device converts the target data into a compound log. If the target data does not need to be stored in the cache, the first storage device converts the target data into a command-type log to describe the data failure and the location and size of the invalid data. In this way, the first storage device can select and generate an appropriate target log for the target data according to whether the target data needs one cache process, multiple cache processes, or no cache process.

应理解,本申请实施例中对“缓存”和“内存”不进行区分,也就是说,缓存和内存都能够实现本申请实施例对数据存储的需求,因此本申请对此不进行限定。It should be understood that the embodiments of the present application do not distinguish between "cache" and "memory", that is, both the cache and the memory can meet the data storage requirements of the embodiments of the present application, and therefore are not limited in the present application.

例如,目标数据为需要一个缓存处理的块存储数据,块存储数据主要包括卷标识(volume Identity,volume ID)、块起始地址(Logical block address,LBA)、块个数(lengh)、用户数据(buff)。由于目标数据需要一个缓存处理,因此,第一存储设备将该块存储数据转换为简单型日志,并将LBA转化为缓存管理单元的编号,比如LBA除以64k取整得到单元编号(chunk ID)、取余得到单元内的偏移(offset),把volume ID、chunk ID、offset写入日志头中,将buff写入日志数据部分,将用于保证数据的可靠性的循环冗余校验码(Cyclic Redundancy Check,CRC)写在日志尾。For example, the target data is block storage data that needs to be processed by a cache, and the block storage data mainly includes volume identity (volume Identity, volume ID), block start address (Logical block address, LBA), number of blocks (lengh), user data (buff). Since the target data needs to be processed by a cache, the first storage device converts the block storage data into a simple log, and converts the LBA into the number of the cache management unit, for example, dividing the LBA by 64k and rounding up to obtain the unit number (chunk ID) , Take the remainder to get the offset (offset) in the unit, write the volume ID, chunk ID, offset into the log header, write the buff into the log data part, and use the cyclic redundancy check code to ensure the reliability of the data (Cyclic Redundancy Check, CRC) is written at the end of the log.

应理解,本申请实施例中对“缓存”和“内存”不进行区分,也就是说,缓存和内存都能够实现本申请实施例对数据存储的需求。It should be understood that "cache" and "memory" are not distinguished in the embodiments of the present application, that is, both the cache and the memory can meet the data storage requirements of the embodiments of the present application.

703、第一存储设备向该第二存储设备发送该目标日志。703. The first storage device sends the target log to the second storage device.

第二存储设备接收到该第一存储设备发送的目标日志,并将目标日志存储到第二存储设备的内存中。The second storage device receives the target log sent by the first storage device, and stores the target log in the memory of the second storage device.

704、第二存储设备镜像存储该目标日志。704. The second storage device mirrors and stores the target log.

第二存储设备接收第一存储设备根据写请求消息中携带的目标数据生成的目标日志,并将该目标日志直接存储到第二存储设备中,由于该目标日志包括用于表示该目标数据的标识信息,这样第二存储设备存储该目标日志时并不需要创建内存索引,相比现有技术中,第二存储设备需要配置内存索引而言,本申请可以直接存储该目标日志,从而节省了第二存储设备配置内存索引时对CPU的占用。The second storage device receives the target log generated by the first storage device according to the target data carried in the write request message, and directly stores the target log in the second storage device, because the target log includes an identifier used to represent the target data In this way, the second storage device does not need to create a memory index when storing the target log. Compared with the prior art, in which the second storage device needs to configure a memory index, the present application can directly store the target log, thereby saving the Second, the CPU usage of the storage device when the memory index is configured.

可选地,作为一个实施例,第一存储设备接收到第二存储设备完成镜像存储目标日志的存储完成消息,保证第二存储设备已经成功完成写入目标日志之后,第一存储设备才开始在自己的缓存中写入目标日志,这样可以避免第二存储设备失败,浪费了第一存储设备的CPU占用。第一存储设备完成写入目标日志,且接收到第二存储设备发送的存储完成消息之后,向IO设备发送写请求响应消息,这样避免现有技术中需要等待将目标数据存储到内存索引对应的资源空间之后才能向IO设备返回写请求响应消息,从而减少了发出写请求到收到写请求响应消息的时延。Optionally, as an embodiment, the first storage device receives a storage completion message that the second storage device completes the mirrored storage of the target log, and ensures that the second storage device has successfully completed writing the target log before the first storage device starts to store the target log. The target log is written in its own cache, so that the failure of the second storage device can be avoided and the CPU usage of the first storage device is wasted. After the first storage device completes writing the target log and receives the storage completion message sent by the second storage device, it sends a write request response message to the IO device, so as to avoid the need to wait for the target data to be stored in the memory index corresponding to the prior art. Only after the resource space can return the write request response message to the IO device, the delay from issuing the write request to receiving the write request response message is reduced.

应理解,发送写请求消息和接收写请求响应消息的设备可以是IO设备也可以是其他设备,为描述方便以IO设备为例进行说明,但本申请并不限于此。It should be understood that the device sending the write request message and receiving the write request response message may be an IO device or other devices. For the convenience of description, an IO device is used as an example for description, but the present application is not limited thereto.

可选地,第一存储设备没有接收到存储完成消息之前,第一存储设备就开始写入该目标日志,在第一存储设备完成写入目标日志,且接收到第二存储设备发送的存储完成消息之后,向IO设备发送写请求响应消息,这样可以更进一步节省向IO设备返回写请求响应消息的时间。Optionally, before the first storage device receives the storage completion message, the first storage device starts writing the target log, after the first storage device completes writing the target log, and receives the storage completion message sent by the second storage device. After the message, a write request response message is sent to the IO device, which can further save the time for returning the write request response message to the IO device.

可选地,作为一个实施例,该第二存储设备包括多个资源空间;其中,该第二存储设备镜像存储该目标日志包括:该第二存储设备根据该标识信息,确定存储该目标日志的第一资源空间,该第一资源空间为该第二存储设备的多个资源空间中满足该目标日志的资源需求的任一资源空间;该第二存储设备将该目标日志镜像存储到该第一资源空间中。Optionally, as an embodiment, the second storage device includes a plurality of resource spaces; wherein, storing the target log in a mirror image of the second storage device includes: the second storage device, according to the identification information, determines the storage space of the target log. A first resource space, the first resource space is any resource space in the plurality of resource spaces of the second storage device that meets the resource requirements of the target log; the second storage device stores the target log image in the first storage device in the resource space.

具体而言,第二存储设备接收目标日志,该目标日志包括用于标识目标数据的标识信息,第二存储设备根据该标识信息选择合适的资源空间(表示为第一资源空间),将该目标日志存储到第二存储设备的第一资源空间中。此外,第二存储设备可以根据标识信息识别目标数据,以目标日志的形式可以将目标数据按照顺序进行有规律的存储,这样第二存储设备可以不需要为目标数据配置内存索引,从而使得节省了第二存储设备的CPU占用。Specifically, the second storage device receives a target log, the target log includes identification information for identifying target data, the second storage device selects an appropriate resource space (represented as a first resource space) according to the identification information, and the target The log is stored in the first resource space of the second storage device. In addition, the second storage device can identify the target data according to the identification information, and can regularly store the target data in order in the form of the target log, so that the second storage device does not need to configure a memory index for the target data, thereby saving CPU usage of the second storage device.

应理解,第一资源空间即为上述提到的以Segment为单位的资源空间,每个Segment可以存放多条日志。It should be understood that the first resource space is the resource space mentioned above in units of segments, and each segment can store multiple logs.

可选地,该第二存储设备包括多个资源空间;该方法还包括:该第一存储设备获取第二资源空间的存储地址和该第二资源空间的存储容量,该第二资源空间为该第二存储设备的多个资源空间中任一资源空间;该第一存储设备根据该第二资源空间的存储容量和该标识信息,确定该第二资源空间是否满足该目标日志的资源需求;该第一存储设备在该第二资源空间满足该目标日志的资源需求时,根据RDMA编码方式、该目标日志和该第二资源空间的存储地址,生成RDMA消息,该RDMA消息包括该第二资源空间的存储地址和该目标日志;其中,该第一存储设备向该第二存储设备发送该目标日志包括:该第一存储设备向该第二存储设备发送该RDMA消息;其中,该第二存储设备镜像存储该目标日志包括:该第二存储设备根据该RDMA消息,将该目标日志存储到该第二资源空间中。Optionally, the second storage device includes a plurality of resource spaces; the method further includes: the first storage device obtains the storage address of the second resource space and the storage capacity of the second resource space, and the second resource space is the Any resource space in a plurality of resource spaces of the second storage device; the first storage device determines whether the second resource space meets the resource requirements of the target log according to the storage capacity of the second resource space and the identification information; the When the second resource space meets the resource requirement of the target log, the first storage device generates an RDMA message according to the RDMA encoding method, the target log and the storage address of the second resource space, and the RDMA message includes the second resource space The storage address and the target log; wherein, sending the target log by the first storage device to the second storage device includes: the first storage device sending the RDMA message to the second storage device; wherein, the second storage device Mirroring the storing of the target log includes: the second storage device storing the target log in the second resource space according to the RDMA message.

具体而言,第二存储设备包括多个资源空间,第二存储设备可以随意发送任意一个资源空间的存储容量和存储地址。第一存储设备获取到第二存储设备中多个资源空间中任意一个资源空间(表示为第二资源空间)的存储地址和存储容量,并根据该第二资源空间的存储容量和目标日志的标识信息确定第二资源空间是否满足目标日志的资源需求,相应地,第二资源空间也是上述提到的Segment资源空间。由于目标日志的标识信息包括目标数据的资源大小(即存储目标日志所需的资源),因此第一存储设备可以通过比较标识信息中目标数据的资源大小与第二资源空间的存储容量确定第二资源空间是否能够满足目标日志的资源需求。Specifically, the second storage device includes multiple resource spaces, and the second storage device can freely send the storage capacity and storage address of any resource space. The first storage device obtains the storage address and storage capacity of any one of the multiple resource spaces in the second storage device (represented as the second resource space), and according to the storage capacity of the second resource space and the identifier of the target log The information determines whether the second resource space meets the resource requirements of the target log. Correspondingly, the second resource space is also the above-mentioned Segment resource space. Since the identification information of the target log includes the resource size of the target data (that is, the resources required for storing the target log), the first storage device can determine the second storage device by comparing the resource size of the target data in the identification information with the storage capacity of the second resource space. Whether the resource space can meet the resource requirements of the target log.

该第一存储设备在该第二资源空间满足该目标日志的资源需求时,根据RDMA编码方式、该目标日志和该第二资源空间的存储地址,生成RDMA消息,该RDMA消息包括该第二资源空间的存储地址和该目标日志,第一存储设备向第二存储设备发送该RDMA消息,第二存储设备的第二资源空间接收到RDMA消息后,解析得到目标日志,并将目标日志直接存储到第二资源空间中。第二存储设备在将目标日志镜像存储到第二资源空间之后,就可以向第一存储设备返回镜像存储完成消息。本申请实施例相比第二存储设备接收目标日志,并需要为目标日志选择合适的资源空间,能够更进一步节省了第二存储设备的CPU的占用。When the second resource space meets the resource requirement of the target log, the first storage device generates an RDMA message according to the RDMA encoding method, the target log and the storage address of the second resource space, and the RDMA message includes the second resource The storage address of the space and the target log, the first storage device sends the RDMA message to the second storage device, and after the second resource space of the second storage device receives the RDMA message, it parses to obtain the target log, and directly stores the target log in in the second resource space. After storing the target log image in the second resource space, the second storage device may return an image storage completion message to the first storage device. Compared with the second storage device receiving the target log and needing to select an appropriate resource space for the target log, the embodiment of the present application can further save the CPU occupation of the second storage device.

例如,如图2所示,第一存储设备通过RDMA技术,可以将目标日志从资源层132a直接发送到资源层132b。For example, as shown in FIG. 2, the first storage device can directly send the target log from the resource layer 132a to the resource layer 132b through the RDMA technology.

可选地,作为一个实施例,该第一存储设备获取第二资源空间的存储地址和该第二资源空间的存储容量包括:该第一存储设备向该第二存储设备发送资源请求消息,该资源请求消息用于请求存储该目标日志的该第二资源空间;该第一存储设备接收该第二存储设备根据该资源请求消息发送的资源请求响应消息,该资源请求响应消息携带该第二资源空间的存储地址和该第二资源空间的存储容量。Optionally, as an embodiment, the obtaining, by the first storage device, the storage address of the second resource space and the storage capacity of the second resource space includes: the first storage device sending a resource request message to the second storage device, the The resource request message is used to request the second resource space for storing the target log; the first storage device receives a resource request response message sent by the second storage device according to the resource request message, and the resource request response message carries the second resource The storage address of the space and the storage capacity of the second resource space.

具体而言,第一存储设备可以向第二存储设备发送资源请求,以获取第二存储设备的资源空间的存储地址以及该资源空间的剩余资源大小(即该资源空间中还能够写入多大的数据)。第一存储设备可以向第二存储设备发送资源请求消息,第二存储设备在多个资源空间中选择任意一个资源空间(表示为第二资源空间),并向第一存储设备发送资源请求响应消息,且在资源请求响应消息中携带该第二资源空间的存储地址和该第二资源空间的剩余容量,从而使得第一存储设备能够为目标日志选择合适的资源空间。Specifically, the first storage device may send a resource request to the second storage device to obtain the storage address of the resource space of the second storage device and the remaining resource size of the resource space (that is, how much can be written in the resource space). data). The first storage device may send a resource request message to the second storage device, and the second storage device selects any one resource space (represented as a second resource space) among multiple resource spaces, and sends a resource request response message to the first storage device , and the resource request response message carries the storage address of the second resource space and the remaining capacity of the second resource space, so that the first storage device can select an appropriate resource space for the target log.

应理解,本申请实施例中,第一存储设备可以只获取一次第二存储设备的资源空间的地址和存储容量,直至该资源空间没有剩余资源,或者剩余资源不能够满足当前待写入数据的大小,然后才进行下一次获取第二存储设备的资源空间的地址和存储容量。It should be understood that, in this embodiment of the present application, the first storage device may acquire the address and storage capacity of the resource space of the second storage device only once, until the resource space has no remaining resources, or the remaining resources cannot satisfy the current data to be written. size, and then perform the next acquisition of the address and storage capacity of the resource space of the second storage device.

可选地,作为一个实施例,该方法还包括:该第一存储设备为该目标数据配置内存索引;该第一存储设备根据该内存索引,确定存储该目标数据的该第一存储设备的资源空间,其中,该第一存储设备的资源空间的存储地址对应于该内存索引;该第一存储设备将该目标数据写入该第一存储设备的资源空间中。Optionally, as an embodiment, the method further includes: the first storage device configures a memory index for the target data; the first storage device determines, according to the memory index, a resource of the first storage device that stores the target data space, wherein the storage address of the resource space of the first storage device corresponds to the memory index; the first storage device writes the target data into the resource space of the first storage device.

第一存储设备在完成存储目标日志,以及接收到第二存储设备返回的存储完成消息后,向IO设备发送写请求响应消息。由于根据内存索引读取目标数据比较快,因此,在此之后,第一存储设备还可以为目标数据配置内存索引,该内存索引用于标识目标数据(例如,目标数据的大小、类型等),并根据该内存索引为目标数据申请存储资源(表示为第一存储设备的资源空间,该第一存储设备也可以包括多个存储空间),且配置已经申请的存储资源的存储地址与内存索引的映射关系,该映射关系用于后续第一存储设备能够根据内存索引读取到对应的存储地址中存储的数据,最后将目标数据写入到存储地址对应的资源空间中,这样第一存储设备将目标数据存储到有内存索引对应的资源空间中,并不会延长影响返回写请求响应消息的时间。The first storage device sends a write request response message to the IO device after completing the storage of the target log and receiving the storage completion message returned by the second storage device. Since it is faster to read the target data according to the memory index, after that, the first storage device may further configure a memory index for the target data, where the memory index is used to identify the target data (for example, the size and type of the target data, etc.), And apply for a storage resource (represented as the resource space of the first storage device, the first storage device may also include multiple storage spaces) for the target data according to the memory index, and configure the storage address of the applied storage resource and the memory index. The mapping relationship is used for the subsequent first storage device to be able to read the data stored in the corresponding storage address according to the memory index, and finally write the target data into the resource space corresponding to the storage address, so that the first storage device will The target data is stored in the resource space corresponding to the memory index, which will not prolong the time for returning the response message of the write request.

应理解,该目标数据可以是写请求中携带的目标数据,也可以是解析目标日志获得的目标数据,本申请对此不进行限定。It should be understood that the target data may be the target data carried in the write request or the target data obtained by parsing the target log, which is not limited in this application.

还应理解,第一存储设备也可以不存储目标日志,而是直接将目标数据写入内存索引对应的资源空间中;或者,第一存储设备写入目标日志后,再进行将目标数据写入内存索引对应的资源空间中之后,才发送写请求响应消息。本申请对此不进行限定。It should also be understood that the first storage device may not store the target log, but directly write the target data into the resource space corresponding to the memory index; or, after the first storage device writes the target log, the target data is written into The write request response message is sent only after the resource space corresponding to the memory index is stored. This application does not limit this.

第二存储设备存储目标日志用于在第一存储设备故障时,第二存储设备可以接管第一存储设备当前服务的数据存储,具体故障现象有如下几种:The second storage device stores the target log so that when the first storage device fails, the second storage device can take over the data storage currently served by the first storage device. The specific failure symptoms are as follows:

在第一存储设备故障时,第二存储设备检测到该故障后,第二存储设备接管数据存储。这时,第二存储设备需要进行目标日志回放,日志回放是指解析目标日志以获取有效的目标数据(即将目标数据逐条读出),为目标数据配置内存索引,并将目标数据存储到对应的资源空间中(即表示日志回放结束),该资源空间为内存索引对应的存储地址,该存储地址对应的资源空间;此后,第二存储设备才能够处理数据存储业务。When the first storage device fails, after the second storage device detects the failure, the second storage device takes over data storage. At this time, the second storage device needs to perform target log playback. Log playback refers to parsing the target log to obtain valid target data (that is, reading the target data one by one), configuring a memory index for the target data, and storing the target data in the corresponding In the resource space (that is, indicating the end of log playback), the resource space is the storage address corresponding to the memory index, and the resource space corresponding to the storage address; after that, the second storage device can process the data storage service.

在第一存储设备故障后快速恢复,第一存储设备可以直接重启回放日志,之后,第一存储设备才能够处理数据存储业务。After the first storage device fails to recover quickly, the first storage device can directly restart the playback log, and then the first storage device can process the data storage service.

在第一存储设备和第二存储设备都故障的情况下,重启后,第一存储设备可以与第二存储设备竞争主存储设备(即接管当前数据存储),竞争为主存储设备后,回放日志。此后,第二存储设备才能够处理数据存储业务,不会造成内存数据的丢失,提供了数据存储的可靠性。。When both the first storage device and the second storage device are faulty, after restarting, the first storage device can compete with the second storage device for the primary storage device (ie, take over the current data storage), and after competing with the primary storage device, the log can be played back. . After that, the second storage device can process the data storage service, without causing the loss of memory data, and improving the reliability of data storage. .

应理解,在本申请的各种实施例中,上述各过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。It should be understood that, in various embodiments of the present application, the size of the sequence numbers of the above-mentioned processes does not mean the sequence of execution, and the execution sequence of each process should be determined by its functions and internal logic, and should not be dealt with in the embodiments of the present application. implementation constitutes any limitation.

因此,本申请实施例的数据存储的方法,第一存储设备通过接收携带目标数据的写请求消息,根据该写请求消息中的目标数据生成包括该目标数据和用于标识该目标数据的标识信息的目标日志,并向该第二存储设备发送该目标日志,第二存储设备镜像存储该目标日志,且镜像存储该目标日志不需要配置内存索引,这样第一存储设备生成包括标识目标数据的标识信息的目标日志,第二存储设备可以存储目标日志不需要配置内存索引,从而减少了对第二存储设备的CPU的占用。Therefore, in the data storage method according to the embodiment of the present application, the first storage device generates, according to the target data in the write request message, the target data and the identification information for identifying the target data by receiving the write request message carrying the target data. The target log is sent to the second storage device, the second storage device mirrors the target log, and the mirrored storage of the target log does not need to configure a memory index, so the first storage device generates an identifier that includes identifying the target data. For the target log of information, the second storage device can store the target log without configuring a memory index, thereby reducing the occupation of the CPU of the second storage device.

图8示出了根据本申请一个实施例的数据存储的方法的交互流程图。本申请实施例中的各种术语的含义与前述各实施例相同。FIG. 8 shows an interaction flowchart of a method for data storage according to an embodiment of the present application. The meanings of various terms in the embodiments of the present application are the same as those in the foregoing embodiments.

应注意,这只是为了帮助本领域技术人员更好地理解本申请实施例,而非限制本申请实施例的范围。It should be noted that this is only to help those skilled in the art to better understand the embodiments of the present application, rather than limiting the scope of the embodiments of the present application.

801、第一存储设备接收写请求消息,该写请求消息携带目标数据。801. A first storage device receives a write request message, where the write request message carries target data.

802、第一存储设备根据目标数据生成相应的目标日志,目标日志包括目标数据和用于标识目标数据的标识信息。802. The first storage device generates a corresponding target log according to the target data, where the target log includes the target data and identification information for identifying the target data.

803、第一存储设备获取第二存储设备的资源空间(表示为第二资源空间)的存储地址和资源空间的存储容量。803. The first storage device acquires the storage address of the resource space (represented as the second resource space) and the storage capacity of the resource space of the second storage device.

804、第一存储设备根据第二资源空间的存储容量和标识信息,确定获取的第二资源空间的存储容量是否能够满足目标日志的资源需求。804. The first storage device determines, according to the storage capacity and identification information of the second resource space, whether the acquired storage capacity of the second resource space can meet the resource requirements of the target log.

805、第一存储设备在确定获取的第二资源空间的存储容量能够满足目标日志的资源需求,根据目标日志、RDMA编码方式、第二资源空间的存储地址生成RDMA消息。805. After determining that the acquired storage capacity of the second resource space can meet the resource requirements of the target log, the first storage device generates an RDMA message according to the target log, the RDMA encoding method, and the storage address of the second resource space.

806、第一存储设备向第二存储设备发送RDMA消息。806. The first storage device sends an RDMA message to the second storage device.

807、第二存储设备根据RDMA消息,将目标日志直接存储到存储地址对应的第二资源空间中。807. The second storage device directly stores the target log in the second resource space corresponding to the storage address according to the RDMA message.

可选地,第一存储设备可以直接向第二存储设备发送目标日志,由第二存储设备来确定能够存储目标日志的资源空间,这样可以不需要步骤803至807。Optionally, the first storage device may directly send the target log to the second storage device, and the second storage device determines a resource space capable of storing the target log, so steps 803 to 807 may not be required.

808、第二存储设备在完成目标日志的镜像存储后,向第一存储设备发送存储完成消息。808. After completing the mirror storage of the target log, the second storage device sends a storage completion message to the first storage device.

809、第一存储设备在本地存储目标日志。809. The first storage device locally stores the target log.

步骤808和步骤809可以没有先后关系,本申请对此不进行限定。Step 808 and step 809 may not have a sequential relationship, which is not limited in this application.

810、第一存储设备在本地完成存储目标日志,且接收到存储完成消息之后,向IO设备返回写请求响应消息。810. The first storage device completes the storage of the target log locally, and after receiving the storage completion message, returns a write request response message to the IO device.

811、第一存储设备在本地为目标数据配置对应的内存索引,该内存索引用于标识目标数据。811. The first storage device locally configures a corresponding memory index for the target data, where the memory index is used to identify the target data.

812、第一存储设备根据该内存索引,确定存储目标数据的第一存储设备的资源空间。812. The first storage device determines, according to the memory index, the resource space of the first storage device that stores the target data.

813、第一存储设备将目标数据存储到确定的第一存储设备的资源空间中。813. The first storage device stores the target data in the determined resource space of the first storage device.

应理解,上述相应信息的具体指示方式可参考前述各实施例,为了简洁,在此不再赘述。It should be understood that for the specific indication manner of the above-mentioned corresponding information, reference may be made to the foregoing embodiments, which are not repeated here for brevity.

因此,本申请实施例的数据存储的方法,第一存储设备通过接收携带目标数据的写请求消息,根据该写请求消息中的目标数据生成包括该目标数据和用于标识该目标数据的标识信息的目标日志,获取第二存储设备的第二资源空间,在第二资源空间满足目标日志的资源需求时,根据目标日志、RDMA编码方式和第二资源空间的存储地址生成RDMA消息,并向该第二存储设备发送该目标日志,第二存储设备根据RDMA消息将目标日志直接存储到第二资源空间中,且存储该目标日志不需要配置内存索引,这样第一存储设备生成包括标识目标数据的标识信息的目标日志,并通过发送RDMA消息直接将目标日志存储在满足资源需求的存储空间中,第二存储设备存储目标日志可以不需要配置内存索引,从而减少了对第二存储设备的CPU的占用。Therefore, in the data storage method according to the embodiment of the present application, the first storage device generates, according to the target data in the write request message, the target data and the identification information for identifying the target data by receiving the write request message carrying the target data. The target log, obtain the second resource space of the second storage device, when the second resource space meets the resource requirements of the target log, generate an RDMA message according to the target log, the RDMA encoding method and the storage address of the second resource space, and send the message to the target log. The second storage device sends the target log, the second storage device directly stores the target log in the second resource space according to the RDMA message, and does not need to configure a memory index to store the target log, so that the first storage device generates the target log including the identification target data. The target log of the identification information, and the target log is directly stored in the storage space that meets the resource requirements by sending an RDMA message, and the second storage device does not need to configure the memory index to store the target log, thereby reducing the CPU of the second storage device. occupied.

应理解,在本申请的各种实施例中,上述各过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。It should be understood that, in various embodiments of the present application, the size of the sequence numbers of the above-mentioned processes does not mean the sequence of execution, and the execution sequence of each process should be determined by its functions and internal logic, and should not be dealt with in the embodiments of the present application. implementation constitutes any limitation.

上文中详细描述了根据本申请实施例的数据存储的方法,下面将描述根据本申请实施例的存储设备。The data storage method according to the embodiment of the present application is described in detail above, and the storage device according to the embodiment of the present application will be described below.

图9示出了根据本申请实施例的存储系统900的示意性框图,该存储系统包括第一存储设备910和至少一个第二存储设备920,其中,该第二存储设备920为该第一存储设备910的镜像存储设备,该存储系统900用于执行图7所述的数据存储的方法,该存储系统900包括:FIG. 9 shows a schematic block diagram of a storage system 900 according to an embodiment of the present application, where the storage system includes a first storage device 910 and at least one second storage device 920, where the second storage device 920 is the first storage device A mirrored storage device of the device 910, the storage system 900 is configured to execute the data storage method described in FIG. 7, and the storage system 900 includes:

该第一存储设备910,用于接收写请求消息,该写请求消息携带目标数据,根据该目标数据生成目标日志,并向该第二存储设备920发送该目标日志,该目标日志包括该目标数据和用于标识该目标数据的标识信息;The first storage device 910 is configured to receive a write request message, where the write request message carries target data, generate a target log according to the target data, and send the target log to the second storage device 920, where the target log includes the target data and identification information used to identify the target data;

该第二存储设备920,用于存储该目标日志,且该存储该目标日志不需要配置内存索引。The second storage device 920 is configured to store the target log, and the storage of the target log does not require configuring a memory index.

因此,本申请实施例的存储系统,第一存储设备通过接收携带目标数据的写请求消息,根据该写请求消息中的目标数据生成包括该目标数据和用于标识该目标数据的标识信息的目标日志,并向该第二存储设备发送该目标日志,第二存储设备镜像存储该目标日志,且镜像存储该目标日志不需要配置内存索引,这样第一存储设备生成包括标识目标数据的标识信息的目标日志,第二存储设备可以存储目标日志不需要配置内存索引,从而减少了对第二存储设备的CPU的占用。Therefore, in the storage system of the embodiment of the present application, the first storage device generates a target including the target data and identification information for identifying the target data according to the target data in the write request message by receiving the write request message carrying the target data. log, and send the target log to the second storage device, the second storage device mirrors the target log, and the mirrored storage of the target log does not need to configure a memory index, so that the first storage device generates the identification information that includes the target data. For the target log, the second storage device can store the target log without configuring a memory index, thereby reducing the occupation of the CPU of the second storage device.

可选地,在本申请一个实施例中,该第二存储设备920还用于在完成存储该目标日志时,向该第一存储设备910发送存储完成消息;Optionally, in an embodiment of the present application, the second storage device 920 is further configured to send a storage completion message to the first storage device 910 when the target log is stored;

该第一存储设备910还用于存储该目标日志,并在完成该目标日志的存储和接收到该存储完成消息之后,发送写请求响应消息。The first storage device 910 is further configured to store the target log, and send a write request response message after completing the storage of the target log and receiving the storage completion message.

可选地,在本申请一个实施例中,该第二存储设备920包括多个资源空间;Optionally, in an embodiment of the present application, the second storage device 920 includes multiple resource spaces;

该第二存储设备920具体用于:The second storage device 920 is specifically used for:

根据该标识信息,确定存储该目标日志的第一资源空间,该第一资源空间为该第二存储设备920的多个资源空间中满足该目标日志的资源需求的任一资源空间;According to the identification information, determine the first resource space for storing the target log, where the first resource space is any resource space that satisfies the resource requirements of the target log in the plurality of resource spaces of the second storage device 920;

将该目标日志存储到该第一资源空间中。The target log is stored in the first resource space.

可选地,在本申请一个实施例中,该第二存储设备920包括多个资源空间;Optionally, in an embodiment of the present application, the second storage device 920 includes multiple resource spaces;

该第一存储设备910,还用于获取第二资源空间的存储地址和该第二资源空间的存储容量,根据该第二资源空间的存储容量和该标识信息确定该第二资源空间是否满足该目标日志的资源需求,并在该第二资源空间满足该目标日志的资源需求时根据远程直接数据存取RDMA编码方式、该目标日志和该第二资源空间的存储地址生成RDMA消息,以及向该第二存储设备920的第二资源空间发送该RDMA消息,该第二资源空间为该第二存储设备920的多个资源空间中任一资源空间,该RDMA消息包括该第二资源空间的存储地址和该目标日志;The first storage device 910 is further configured to obtain the storage address of the second resource space and the storage capacity of the second resource space, and determine whether the second resource space satisfies the requirements according to the storage capacity of the second resource space and the identification information. The resource requirement of the target log, and when the second resource space meets the resource requirement of the target log, an RDMA message is generated according to the remote direct data access RDMA encoding method, the target log and the storage address of the second resource space, and an RDMA message is sent to the target log. The second resource space of the second storage device 920 sends the RDMA message, the second resource space is any resource space among multiple resource spaces of the second storage device 920, and the RDMA message includes the storage address of the second resource space and the target log;

该第二存储设备920,还用于通过该第二资源空间根据该RDMA消息,存储该目标日志。The second storage device 920 is further configured to store the target log according to the RDMA message through the second resource space.

可选地,在本申请一个实施例中,该第一存储设备910,还用于向该第二存储设备920发送资源请求消息,并接收该第二存储设备920根据该资源请求消息发送的资源请求响应消息,该资源请求消息用于请求存储该目标日志的该第二资源空间,该资源请求响应消息携带该第二资源空间的存储地址和该第二资源空间的存储容量。Optionally, in an embodiment of the present application, the first storage device 910 is further configured to send a resource request message to the second storage device 920, and receive a resource sent by the second storage device 920 according to the resource request message A request response message, where the resource request message is used to request the second resource space for storing the target log, and the resource request response message carries the storage address of the second resource space and the storage capacity of the second resource space.

可选地,在本申请一个实施例中,该第一存储设备910,还用于为该目标数据配置内存索引,并根据该内存索引确定存储该目标数据的该第一存储设备的资源空间,以及将该目标数据写入该第一存储设备的资源空间中,其中,该第一存储设备的资源空间的存储地址对应于该内存索引。Optionally, in an embodiment of the present application, the first storage device 910 is further configured to configure a memory index for the target data, and determine the resource space of the first storage device that stores the target data according to the memory index, and writing the target data into the resource space of the first storage device, wherein the storage address of the resource space of the first storage device corresponds to the memory index.

因此,本申请实施例的存储系统,第一存储设备通过接收携带目标数据的写请求消息,根据该写请求消息中的目标数据生成包括该目标数据和用于标识该目标数据的标识信息的目标日志,并向该第二存储设备发送该目标日志,第二存储设备镜像存储该目标日志,且镜像存储该目标日志不需要配置内存索引,这样第一存储设备生成包括标识目标数据的标识信息的目标日志,第二存储设备可以存储目标日志不需要配置内存索引,从而减少了对第二存储设备的CPU的占用。Therefore, in the storage system of the embodiment of the present application, the first storage device generates a target including the target data and identification information for identifying the target data according to the target data in the write request message by receiving the write request message carrying the target data. log, and send the target log to the second storage device, the second storage device mirrors the target log, and the mirrored storage of the target log does not need to configure a memory index, so that the first storage device generates the identification information that includes the target data. For the target log, the second storage device can store the target log without configuring a memory index, thereby reducing the occupation of the CPU of the second storage device.

根据本申请实施例的存储系统900可对应于根据本申请实施例图7或图8的数据存储的方法的存储系统,并且存储系统900中的各个模块的上述和其它操作和/或功能分别为了实现前述各个方法的相应流程,为了简洁,在此不再赘述。The storage system 900 according to the embodiment of the present application may correspond to the storage system according to the data storage method of FIG. 7 or FIG. 8 according to the embodiment of the present application, and the above-mentioned and other operations and/or functions of each module in the storage system 900 are for the purpose of For the sake of brevity, the corresponding processes for implementing the foregoing methods are not repeated here.

图10示出了本申请的实施例提供的存储系统的结构,包括至少一个处理器1002(例如CPU),至少一个网络接口1005或者其他通信接口,至少一个存储器1006,和至少一个通信总线1003,用于实现这些装置之间的连接通信。处理器1002用于执行存储器1006中存储的可执行模块,例如计算机程序。存储器1006可能包含高速随机存取存储器(RandomAccess Memory,RAM),也可能还包括非不稳定的存储器(non-volatile memory),例如至少一个磁盘存储器。通过至少一个网络接口1005(可以是有线或者无线)实现与至少一个其他网元之间的通信连接。10 shows a structure of a storage system provided by an embodiment of the present application, including at least one processor 1002 (eg, CPU), at least one network interface 1005 or other communication interface, at least one memory 1006, and at least one communication bus 1003, Used to realize the connection communication between these devices. The processor 1002 is used to execute executable modules, such as computer programs, stored in the memory 1006 . The memory 1006 may include a high-speed random access memory (Random Access Memory, RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory. The communication connection with at least one other network element is realized through at least one network interface 1005 (which may be wired or wireless).

在一些实施方式中,存储器1006存储了程序10061,处理器1002执行程序10061,用于执行以下操作:In some embodiments, the memory 1006 stores a program 10061, and the processor 1002 executes the program 10061 for performing the following operations:

通过网络接口1005接收写请求消息,该写请求消息携带目标数据;Receive a write request message through the network interface 1005, the write request message carrying the target data;

根据该目标数据,生成目标日志,该目标日志包括该目标数据和用于标识该目标数据的标识信息;According to the target data, a target log is generated, and the target log includes the target data and identification information for identifying the target data;

通过网络接口1005向第二存储设备发送该目标日志;Send the target log to the second storage device through the network interface 1005;

存储所述目标日志,且所述存储所述目标日志不需要配置内存索引。The target log is stored, and the storage of the target log does not require configuring a memory index.

需要说明的是,该存储系统可以用于执行上述图7或图8所示的方法实施例中的各个步骤和/或流程。It should be noted that the storage system may be used to execute each step and/or process in the method embodiment shown in FIG. 7 or FIG. 8 above.

从本申请实施例提供的以上技术方案可以看出,第一存储设备通过接收携带目标数据的写请求消息,根据该写请求消息中的目标数据生成包括该目标数据和用于标识该目标数据的标识信息的目标日志,并向该第二存储设备发送该目标日志,第二存储设备镜像存储该目标日志,且镜像存储该目标日志不需要配置内存索引,这样第一存储设备生成包括标识目标数据的标识信息的目标日志,第二存储设备可以存储目标日志不需要配置内存索引,从而减少了对第二存储设备的CPU的占用。It can be seen from the above technical solutions provided by the embodiments of the present application that, by receiving the write request message carrying the target data, the first storage device generates, according to the target data in the write request message, a message including the target data and an identifier for identifying the target data. Identify the target log of the information, and send the target log to the second storage device. The second storage device mirrors and stores the target log, and the mirrored storage of the target log does not need to configure a memory index, so that the first storage device generates the target data including the identification target. The target log of the identification information, the second storage device can store the target log without configuring a memory index, thereby reducing the occupation of the CPU of the second storage device.

本申请实施例还提供一种计算机存储介质,该计算机存储介质可以存储用于指示上述任一种方法的程序指令。Embodiments of the present application further provide a computer storage medium, where the computer storage medium can store program instructions for instructing any of the foregoing methods.

可选地,该存储介质具体可以为存储器1106。Optionally, the storage medium may specifically be the memory 1106 .

应理解,本申请中的具体的例子只是为了帮助本领域技术人员更好地理解本申请实施例,而非限制本申请实施例的范围。It should be understood that the specific examples in the present application are only for helping those skilled in the art to better understand the embodiments of the present application, rather than limiting the scope of the embodiments of the present application.

应理解,本文中术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中字符“/”,一般表示前后关联对象是一种“或”的关系。It should be understood that the term "and/or" in this document is only an association relationship to describe associated objects, indicating that there can be three kinds of relationships, for example, A and/or B, which can mean that A exists alone, and A and B exist at the same time , there are three cases of B alone. In addition, the character "/" in this document generally indicates that the related objects are an "or" relationship.

应理解,在本申请的各种实施例中,上述各过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。It should be understood that, in various embodiments of the present application, the size of the sequence numbers of the above-mentioned processes does not mean the sequence of execution, and the execution sequence of each process should be determined by its functions and internal logic, and should not be dealt with in the embodiments of the present application. implementation constitutes any limitation.

本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Skilled artisans may implement the described functionality using different methods for each particular application, but such implementations should not be considered beyond the scope of this application.

所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described systems, devices and units may refer to the corresponding processes in the foregoing method embodiments, which will not be repeated here.

在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,该单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the apparatus embodiments described above are only illustrative. For example, the division of the unit is only a logical function division. In actual implementation, there may be other division methods, for example, multiple units or components may be combined or Integration into another system, or some features can be ignored, or not implemented. On the other hand, the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical, mechanical or other forms.

所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.

另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit. The above-mentioned integrated units may be implemented in the form of hardware, or may be implemented in the form of software functional units.

所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。The integrated unit, if implemented in the form of a software functional unit and sold or used as an independent product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be embodied in the form of a software product in essence, or the part that contributes to the prior art or the part of the technical solution. The computer software product is stored in a storage medium, including Several instructions are used to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, Read-Only Memory (ROM, Read-Only Memory), Random Access Memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program codes .

以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以该权利要求的保护范围为准。The above are only specific embodiments of the present application, but the protection scope of the present application is not limited to this. should be covered within the scope of protection of this application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. A method for storing data is applied to a storage system comprising a first storage device and at least one second storage device, wherein the second storage device is a mirror storage device of the first storage device, and the method comprises the following steps:
a first storage device receives a write request message, wherein the write request message carries target data;
the first storage device generates a target log according to the target data, wherein the target log comprises the target data and identification information for identifying the target data;
the first storage device sends the target log to the second storage device;
the second storage device stores the target log, and the target log is stored without configuring a memory index;
the method further comprises the following steps:
when the second storage device finishes storing the target log, sending a storage finishing message to the first storage device;
the first storage device stores the target log;
and the first storage equipment sends a write request response message after finishing the storage of the target log and receiving the storage finishing message.
2. The method of claim 1, wherein the second storage device comprises a plurality of resource spaces;
wherein the second storage device storing the target log comprises:
the second storage device determines a first resource space for storing the target log according to the identification information, wherein the first resource space is any one of a plurality of resource spaces of the second storage device which meets the resource requirement of the target log;
the second storage device stores the target log in the first resource space.
3. The method of claim 1, wherein the second storage device comprises a plurality of resource spaces;
the method further comprises the following steps:
the first storage device acquires a storage address of a second resource space and a storage capacity of the second resource space, wherein the second resource space is any one of a plurality of resource spaces of the second storage device;
the first storage device determines whether the second resource space meets the resource requirement of the target log according to the storage capacity of the second resource space and the identification information;
when the second resource space meets the resource requirement of the target log, the first storage device generates an RDMA message according to a remote direct data access (RDMA) coding mode, the target log and a storage address of the second resource space, wherein the RDMA message comprises the storage address of the second resource space and the target log;
wherein sending, by the first storage device, the target log to the second storage device comprises:
the first storage device sending the RDMA message to a second resource space of the second storage device;
wherein the second storage device storing the target log comprises:
a second resource space of the second storage device stores the target log according to the RDMA message.
4. The method of claim 3, wherein the first storage device obtaining the storage address of the second resource space and the storage capacity of the second resource space comprises:
the first storage device sends a resource request message to the second storage device, wherein the resource request message is used for requesting to store the second resource space of the target log;
and the first storage device receives a resource request response message sent by the second storage device according to the resource request message, wherein the resource request response message carries a storage address of the second resource space and a storage capacity of the second resource space.
5. The method according to any one of claims 1 to 4, further comprising:
the first storage device configures a memory index for the target data;
the first storage device determines a resource space of the first storage device for storing the target data according to the memory index, wherein a storage address of the resource space of the first storage device corresponds to the memory index;
the first storage device writes the target data into a resource space of the first storage device.
6. A storage system is characterized by comprising a first storage device and at least one second storage device, wherein the second storage device is a mirror image storage device of the first storage device;
the first storage device is configured to receive a write request message, where the write request message carries target data, generate a target log according to the target data, and send the target log to the second storage device, where the target log includes the target data and identification information used to identify the target data;
the second storage device is used for storing the target log, and the target log is stored without configuring a memory index;
the second storage device is further used for sending a storage completion message to the first storage device when the target log is stored;
the first storage device is further configured to store the target log, and send a write request response message after the storage of the target log is completed and the storage completion message is received.
7. The storage system of claim 6, wherein the second storage device comprises a plurality of resource spaces;
the second storage device is specifically configured to:
determining a first resource space for storing the target log according to the identification information, wherein the first resource space is any one of a plurality of resource spaces of the second storage device which meets the resource requirement of the target log;
storing the target log into the first resource space.
8. The storage system of claim 6, wherein the second storage device comprises a plurality of resource spaces;
the first storage device is further configured to obtain a storage address of a second resource space and a storage capacity of the second resource space, determine whether the second resource space meets the resource requirement of the target log according to the storage capacity of the second resource space and the identification information, generate an RDMA message according to an RDMA encoding manner, the target log and the storage address of the second resource space when the second resource space meets the resource requirement of the target log, and send the RDMA message to the second resource space of the second storage device, where the RDMA message is any one of the plurality of resource spaces of the second storage device, and the RDMA message includes the storage address of the second resource space and the target log;
the second storage device is further configured to store the target log according to the RDMA message through the second resource space.
9. The storage system according to claim 8, wherein the first storage device is further configured to send a resource request message to the second storage device, and receive a resource request response message sent by the second storage device according to the resource request message, where the resource request message is used to request to store the second resource space of the target log, and the resource request response message carries a storage address of the second resource space and a storage capacity of the second resource space.
10. The storage system according to any one of claims 6 to 9, wherein the first storage device is further configured to configure a memory index for the target data, determine a resource space of the first storage device storing the target data according to the memory index, and write the target data into the resource space of the first storage device, wherein a storage address of the resource space of the first storage device corresponds to the memory index.
CN201610811110.5A 2016-09-07 2016-09-07 Data storage method and storage system Active CN106648959B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610811110.5A CN106648959B (en) 2016-09-07 2016-09-07 Data storage method and storage system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610811110.5A CN106648959B (en) 2016-09-07 2016-09-07 Data storage method and storage system

Publications (2)

Publication Number Publication Date
CN106648959A CN106648959A (en) 2017-05-10
CN106648959B true CN106648959B (en) 2020-03-10

Family

ID=58851593

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610811110.5A Active CN106648959B (en) 2016-09-07 2016-09-07 Data storage method and storage system

Country Status (1)

Country Link
CN (1) CN106648959B (en)

Families Citing this family (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107329708A (en) * 2017-07-04 2017-11-07 郑州云海信息技术有限公司 A kind of distributed memory system realizes data cached method and system
CN108959465B (en) * 2018-06-19 2022-03-04 创新先进技术有限公司 Method and device for storing and reading service data and server
CN110737716B (en) * 2018-07-02 2022-09-23 华为技术有限公司 A method and device for writing data
CN110727632B (en) * 2018-07-16 2022-11-11 超聚变数字技术有限公司 Data processing method and device
CN112256657B (en) * 2019-07-22 2023-03-28 华为技术有限公司 Log mirroring method and system
CN111092817A (en) * 2019-12-23 2020-05-01 中国联合网络通信集团有限公司 A data transmission method and device
CN111274176B (en) * 2020-01-15 2022-04-22 联想(北京)有限公司 Information processing method, electronic equipment, system and storage medium
CN112099997B (en) * 2020-09-23 2024-06-11 维沃移动通信有限公司 File storage method and electronic device
CN112817967B (en) * 2020-12-30 2023-09-29 北京天融信网络安全技术有限公司 Flow data storage method and device, electronic equipment and storage medium
CN112632129B (en) * 2020-12-31 2023-11-21 联想未来通信科技(重庆)有限公司 Code stream data management method, device and storage medium
CN113760798B (en) * 2021-08-05 2025-02-18 阿里巴巴创新公司 RDMA device allocation method, computing device and storage medium
CN113608699B (en) * 2021-08-09 2025-03-07 北京金山云网络技术有限公司 Data writing method, device and electronic equipment
CN116610598A (en) * 2022-02-08 2023-08-18 华为技术有限公司 A data storage system, data storage method, device and related equipment
CN115202588B (en) * 2022-09-14 2022-12-27 本原数据(北京)信息技术有限公司 Data storage method and device and data recovery method and device

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100476747C (en) * 2006-04-12 2009-04-08 株式会社日立制作所 Storage system and data management method
CN101819543A (en) * 2010-02-01 2010-09-01 成都市华为赛门铁克科技有限公司 Snapshot data processing method, system and storage device
EP2042979A3 (en) * 2007-09-26 2012-01-25 Hitachi, Ltd. Power efficient data storage with data de-duplication
CN101727366B (en) * 2008-10-23 2013-01-02 株式会社日立制作所 Computer system for performing remote copy using journal
CN103645969A (en) * 2013-12-13 2014-03-19 华为技术有限公司 Data replication method and data storage system
CN104641650A (en) * 2012-07-16 2015-05-20 康佩伦特科技公司 Source Reference Replication in the Data Storage Subsystem

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7698520B2 (en) * 2006-03-10 2010-04-13 Seiko Epson Corporation Method for processing backup, devices for backup processing, and storage mediums for storing a program for operating a backup processing device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100476747C (en) * 2006-04-12 2009-04-08 株式会社日立制作所 Storage system and data management method
EP2042979A3 (en) * 2007-09-26 2012-01-25 Hitachi, Ltd. Power efficient data storage with data de-duplication
CN101727366B (en) * 2008-10-23 2013-01-02 株式会社日立制作所 Computer system for performing remote copy using journal
CN101819543A (en) * 2010-02-01 2010-09-01 成都市华为赛门铁克科技有限公司 Snapshot data processing method, system and storage device
CN104641650A (en) * 2012-07-16 2015-05-20 康佩伦特科技公司 Source Reference Replication in the Data Storage Subsystem
CN103645969A (en) * 2013-12-13 2014-03-19 华为技术有限公司 Data replication method and data storage system

Also Published As

Publication number Publication date
CN106648959A (en) 2017-05-10

Similar Documents

Publication Publication Date Title
CN106648959B (en) Data storage method and storage system
CN115270033A (en) A data access system, method, device and network card
CN103645969B (en) Data copy method and data-storage system
US12321635B2 (en) Method for accessing solid state disk and storage device
CN116107516B (en) Data writing method and device, solid state disk, electronic equipment and storage medium
CN113535068B (en) Data reading method and system
CN102014153A (en) Data storage system and method thereof
CN111949210A (en) Metadata storage method, system and storage medium in distributed storage system
JPWO2018154667A1 (en) Scale-out storage system
US12032849B2 (en) Distributed storage system and computer program product
US11775194B2 (en) Data storage method and apparatus in distributed storage system, and computer program product
CN116149575A (en) Method and system for writing to redundant disk array for server-less perception computing
US20250028463A1 (en) Storage system and management method for storage system
CN116893789B (en) Data management method, system, device, equipment and computer storage medium
CN115687170A (en) A data processing method, storage device and system
CN114490540B (en) Data storage method, medium, device and computing equipment
CN117453242A (en) Application updating method of virtual machine, computing equipment and computing system
US12366990B2 (en) Data storage method to shorten a data access path
CN118259823A (en) A distributed storage unit set and related data storage method
CN116594551A (en) Data storage method and device
CN114327248A (en) Storage nodes, storage devices and network chips
CN114489465A (en) Method, network device and computer system for data processing using network card
CN120010792B (en) Data writing method and system, storage medium, electronic device and computer program product
US12124336B2 (en) Data acquisition of snapshots
CN120296065B (en) Distributed storage management method, electronic device, storage medium and program product

Legal Events

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