[go: up one dir, main page]

CN115687250A - A storage method, device, system and computer storage medium - Google Patents

A storage method, device, system and computer storage medium Download PDF

Info

Publication number
CN115687250A
CN115687250A CN202110823074.5A CN202110823074A CN115687250A CN 115687250 A CN115687250 A CN 115687250A CN 202110823074 A CN202110823074 A CN 202110823074A CN 115687250 A CN115687250 A CN 115687250A
Authority
CN
China
Prior art keywords
file
index
storage
equipment
index number
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.)
Pending
Application number
CN202110823074.5A
Other languages
Chinese (zh)
Inventor
许家桐
谢昌龙
席金玉
王福成
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Mobile Communications Group Co Ltd
China Mobile Suzhou Software Technology Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Suzhou Software Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Mobile Communications Group Co Ltd, China Mobile Suzhou Software Technology Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN202110823074.5A priority Critical patent/CN115687250A/en
Publication of CN115687250A publication Critical patent/CN115687250A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本发明公开了一种存储方法,该方法应用于接入设备中,该方法包括:在接收到针对第一文件的存储请求的情况下,向第一文件分配标识码,利用第一文件的已有父目录和标识码,生成第一文件的索引号,将第一文件的名称与第一文件的索引号之间的关联关系进行存储,将第一文件和第一文件的索引号,发送至索引设备。本发明实施例还同时公开了一种设备、系统和计算机存储介质,提高了文件存储的可靠性,进而提高了文件存储的存储效率。

Figure 202110823074

The invention discloses a storage method, which is applied to an access device. The method includes: when receiving a storage request for a first file, assigning an identification code to the first file, using the existing There is a parent directory and an identification code, generate the index number of the first file, store the association between the name of the first file and the index number of the first file, and send the first file and the index number of the first file to Index device. The embodiment of the invention also discloses a device, a system and a computer storage medium at the same time, which improves the reliability of file storage and further improves the storage efficiency of file storage.

Figure 202110823074

Description

一种存储方法、设备、系统和计算机存储介质A storage method, device, system and computer storage medium

技术领域technical field

本发明涉及计算机的文件存储技术,尤其涉及一种存储方法、设备、系统和计算机存储介质。The invention relates to computer file storage technology, in particular to a storage method, device, system and computer storage medium.

背景技术Background technique

分布式文件系统(DFS,Distributed File System)可以用于数据的存储和管理。目前,常见的分布式文件系统通常在单机文件系统的基础上,通过额外增加模块来实现数据跨服务器的分布存储,并通过共享同一命名空间来进行数据的管理。A distributed file system (DFS, Distributed File System) can be used for data storage and management. At present, the common distributed file system is usually based on the stand-alone file system, and realizes the distributed storage of data across servers by adding additional modules, and manages the data by sharing the same namespace.

在各类单机文件系统中,动态文件系统(ZFS,Zettabyte File System)相对于其他单机文件系统,由于结合了文件系统和设备管理等,从而能够跨越数据的物理位置。Among various stand-alone file systems, compared with other stand-alone file systems, the dynamic file system (ZFS, Zettabyte File System) can span the physical location of data due to the combination of file system and device management.

然而,在分布式文件系统中,ZFS无法突破自身单机文件系统的局限性,在服务可用性方面仍然有许多不足。例如,在ZFS服务器宕机或故障时通常难以提供服务。However, in the distributed file system, ZFS cannot break through the limitations of its own stand-alone file system, and still has many shortcomings in terms of service availability. For example, it is often difficult to provide service when a ZFS server is down or fails.

发明内容Contents of the invention

有鉴于此,本发明提供一种存储方法、设备、系统和计算机存储介质,以解决现有技术中ZFS服务器宕机或故障时通常难以提供服务的技术问题。In view of this, the present invention provides a storage method, device, system and computer storage medium to solve the technical problem in the prior art that it is usually difficult to provide services when the ZFS server is down or faulty.

本发明的技术方案是这样实现的:Technical scheme of the present invention is realized like this:

第一方面,本发明实施例提供了一种存储方法,所述方法应用于接入设备中,包括:In the first aspect, an embodiment of the present invention provides a storage method, and the method is applied to an access device, including:

在接收到针对第一文件的存储请求的情况下,向所述第一文件分配标识码;assigning an identification code to the first file in case a storage request for the first file is received;

利用所述第一文件的已有父目录和所述标识码,生成所述第一文件的索引号;generating an index number of the first file by using the existing parent directory of the first file and the identification code;

将所述第一文件的名称与所述第一文件的索引号之间的关联关系进行存储;storing the association relationship between the name of the first file and the index number of the first file;

将所述第一文件和所述第一文件的索引号,发送至所述索引设备;sending the first file and the index number of the first file to the indexing device;

其中,所述索引设备用于在确定存储设备中用于存储所述第一文件的存储节点的标识后,将所述第一文件的索引号与所述第一文件的存储节点的标识之间的对应关系存储至所述索引设备的第一设备和第二设备中。Wherein, the indexing device is configured to, after determining the identifier of the storage node used to store the first file in the storage device, compare the index number of the first file with the identifier of the storage node of the first file The corresponding relationship is stored in the first device and the second device of the indexing device.

第二方面,本发明实施例提供了一种存储方法,所述方法应用于索引设备中,包括:In a second aspect, an embodiment of the present invention provides a storage method, and the method is applied to an index device, including:

接收来自接入设备所发送的第一文件和所述第一文件的索引号;其中,所述第一文件的索引号是由接入设备利用所述第一文件的已有父目录,和所述接入设备向所述第一文件分配的标识码生成;Receiving the first file and the index number of the first file sent by the access device; wherein, the index number of the first file is an existing parent directory of the first file used by the access device, and the generating an identification code assigned by the access device to the first file;

确定存储设备中,用于存储所述第一文件的存储节点的标识;determining an identifier of a storage node used to store the first file in the storage device;

将所述第一文件的索引号与所述第一文件的存储节点的标识之间的对应关系进行存储于所述索引设备的第一设备和第二设备中。The corresponding relationship between the index number of the first file and the identifier of the storage node of the first file is stored in the first device and the second device of the indexing device.

第三方面,本发明实施例提供了一种接入设备,包括:In a third aspect, an embodiment of the present invention provides an access device, including:

分配模块,用于在接收到针对第一文件的存储请求的情况下,向所述第一文件分配标识码;An allocation module, configured to allocate an identification code to the first file when a storage request for the first file is received;

生成模块,用于利用所述第一文件的已有父目录和所述标识码,生成所述第一文件的索引号;A generating module, configured to generate an index number of the first file by using the existing parent directory of the first file and the identification code;

第一存储模块,用于将所述第一文件的名称与所述第一文件的索引号之间的关联关系进行存储;A first storage module, configured to store the association relationship between the name of the first file and the index number of the first file;

发送模块,用于将所述第一文件和所述第一文件的索引号,发送至索引设备;a sending module, configured to send the first file and the index number of the first file to an indexing device;

其中,所述索引设备用于在确定存储设备中用于存储所述第一文件的存储节点的标识后,将所述第一文件的索引号与所述第一文件的存储节点的标识之间的对应关系存储至所述索引设备的第一设备和第二设备中。Wherein, the indexing device is configured to, after determining the identifier of the storage node used to store the first file in the storage device, compare the index number of the first file with the identifier of the storage node of the first file The corresponding relationship is stored in the first device and the second device of the indexing device.

第四方面,本发明实施例提供了一种索引设备,包括:In a fourth aspect, an embodiment of the present invention provides an indexing device, including:

接收模块,用于接收来自接入设备所发送的第一文件和所述第一文件的索引号;其中,所述第一文件的索引号是由接入设备利用所述第一文件的已有父目录,和所述接入设备向所述第一文件分配的标识码生成;The receiving module is configured to receive the first file and the index number of the first file sent from the access device; wherein, the index number of the first file is obtained by the access device using the existing generating a parent directory and an identification code assigned by the access device to the first file;

确定模块,用于确定存储设备中,用于存储所述第一文件的存储节点的标识;A determining module, configured to determine an identifier of a storage node used to store the first file in the storage device;

第二存储模块,用于将所述第一文件的索引号与所述第一文件的存储节点的标识之间的对应关系存储于所述索引设备的第一设备和第二设备中。The second storage module is configured to store the corresponding relationship between the index number of the first file and the identifier of the storage node of the first file in the first device and the second device of the indexing devices.

第五方面,本发明实施例还提供了一种接入设备,所述接入设备包括:处理器以及存储有所述处理器可执行指令的存储介质,所述存储介质通过通信总线依赖所述处理器执行操作,当所述指令被所述处理器执行时,执行上述一个或多个实施例所述存储方法。In the fifth aspect, the embodiment of the present invention also provides an access device, the access device includes: a processor and a storage medium storing instructions executable by the processor, and the storage medium relies on the The processor executes operations, and when the instructions are executed by the processor, the storage method described in one or more embodiments above is executed.

第六方面,本发明实施例还提供了一种索引设备,所述索引设备包括:处理器以及存储有所述处理器可执行指令的存储介质,所述存储介质通过通信总线依赖所述处理器执行操作,当所述指令被所述处理器执行时,执行上述一个或多个实施例所述存储方法。In a sixth aspect, an embodiment of the present invention also provides an indexing device, the indexing device includes: a processor and a storage medium storing instructions executable by the processor, and the storage medium relies on the processor through a communication bus The execution operation is to execute the storage method described in one or more embodiments above when the instruction is executed by the processor.

第七方面,本发明实施例提供了一种计算机存储介质,存储有可执行指令,当所述可执行指令被一个或多个处理器执行的时候,所述处理器执行上述一个或多个实施例所述存储方法。In a seventh aspect, an embodiment of the present invention provides a computer storage medium storing executable instructions, and when the executable instructions are executed by one or more processors, the processors perform one or more of the above implementations The storage method described in the example.

本发明所提供的一种存储方法、设备、系统和计算机存储介质,该方法包括:接入设备在接收到针对第一文件的存储请求的情况下,向第一文件分配标识码,利用第一文件的已有父目录和标识码,生成第一文件的索引号,将第一文件的名称与第一文件的索引号之间的关联关系进行存储,将第一文件和第一文件的索引号,发送至索引设备,其中,索引设备用于在确定存储设备中用于存储第一文件的存储节点的标识后,将第一文件的索引号与第一文件的存储节点的标识之间的对应关系存储至索引设备的第一设备和第二设备中;也就是说,在本发明中,接入设备在获取到存储请求为第一文件分配标识码时,通过第一文件的已有父目录与标识码生成第一文件的索引号,这样,在接入设备中就能够存储有每个文件的名称与文件的索引号之间的关联关系,有利于读取文件和修改文件,并且,将第一文件和第一文件的索引号发送至索引设备,那么,索引设备可以确定出用于存储第一文件的存储节点的标识,并将第一文件的索引号与第一文件的存储节点标识对应起来并存储至索引设备的第一设备和第二设备中,这样,当第一设备发生故障,第二设备还可以重新设置路由,保障文件的正常存储和读取,从而提高了文件存储的可靠性,进而提高了文件存储的存储效率。A storage method, device, system, and computer storage medium provided by the present invention, the method includes: when the access device receives a storage request for the first file, assigning an identification code to the first file, using the first The existing parent directory and identification code of the file, generate the index number of the first file, store the association relationship between the name of the first file and the index number of the first file, and store the first file and the index number of the first file , sent to the indexing device, where the indexing device is used to determine the correspondence between the index number of the first file and the storage node's identifier of the first file after determining the identifier of the storage node used to store the first file in the storage device The relationship is stored in the first device and the second device of the index device; that is, in the present invention, when the access device obtains the storage request and assigns an identification code to the first file, it passes the existing parent directory of the first file and the identification code to generate the index number of the first file, so that the association relationship between the name of each file and the index number of the file can be stored in the access device, which is conducive to reading the file and modifying the file, and will The first file and the index number of the first file are sent to the index device, then the index device can determine the identification of the storage node used to store the first file, and compare the index number of the first file with the storage node identification of the first file Correspond and store in the first device and the second device of the index device, so that when the first device fails, the second device can also reset the route to ensure the normal storage and reading of files, thereby improving the file storage efficiency. Reliability, thereby improving the storage efficiency of file storage.

附图说明Description of drawings

图1为本发明实施例中的一种可选的文件系统的结构示意图;FIG. 1 is a schematic structural diagram of an optional file system in an embodiment of the present invention;

图2为本发明实施例中的一种可选的存储方法的流程交互示意图;FIG. 2 is a schematic flow diagram of an optional storage method in an embodiment of the present invention;

图3为本发明实施例中的一种可选的文件系统的实例的结构示意图;FIG. 3 is a schematic structural diagram of an example of an optional file system in an embodiment of the present invention;

图4为本发明实施例中的一种可选的文件系统的实例的架构示意图;FIG. 4 is a schematic structural diagram of an example of an optional file system in an embodiment of the present invention;

图5为本发明实施例中的一种可选的目录示意图;FIG. 5 is a schematic diagram of an optional directory in the embodiment of the present invention;

图6为本发明实施例中的一种可选的Raft算法的流程示意图;FIG. 6 is a schematic flow diagram of an optional Raft algorithm in an embodiment of the present invention;

图7为本发明实施例中的一种可选的存储方法的流程示意图;FIG. 7 is a schematic flowchart of an optional storage method in an embodiment of the present invention;

图8为本发明实施例中的另一种可选的存储方法的流程示意图;FIG. 8 is a schematic flowchart of another optional storage method in an embodiment of the present invention;

图9为本发明实施例中的一种可选的接入设备的结构示意图;FIG. 9 is a schematic structural diagram of an optional access device in an embodiment of the present invention;

图10为本发明实施例中的一种可选的索引设备的结构示意图;FIG. 10 is a schematic structural diagram of an optional indexing device in an embodiment of the present invention;

图11为本发明实施例中的另一种可选的接入设备的结构示意图;FIG. 11 is a schematic structural diagram of another optional access device in an embodiment of the present invention;

图12为本发明实施例中的另一种可选的索引设备的结构示意图;FIG. 12 is a schematic structural diagram of another optional indexing device in the embodiment of the present invention;

图13为本发明实施例中的一种可选的文件系统的结构示意图。FIG. 13 is a schematic structural diagram of an optional file system in an embodiment of the present invention.

具体实施方式Detailed ways

下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention.

实施例一Embodiment one

本发明实施例提供一种存储方法,该存储方法应用于文件系统中,图1为本发明实施例中的一种可选的文件系统的结构示意图,如图1所示,该文件系统可以包括:接入设备11,索引设备12和存储设备13;其中,索引设备12包括两种类型的设备,分别为第一设备121和第二设备122;其中,An embodiment of the present invention provides a storage method, which is applied to a file system. FIG. 1 is a schematic structural diagram of an optional file system in an embodiment of the present invention. As shown in FIG. 1 , the file system may include : an access device 11, an index device 12 and a storage device 13; wherein, the index device 12 includes two types of devices, namely a first device 121 and a second device 122; wherein,

接入设备11与索引设备12具有通信连接,接入设备11可以为用户客户端,还可以为网关服务器,在文件系统中扮演客户端的角色;索引设备12的第一设备121和第二设备122均为计算服务器,第一设备121可以为ZFS服务器,第二设备122可以为Index服务器,Index服务器用于管理ZFS服务器的路由;存储设备13通常为存储服务器,用于存储文件。The access device 11 has a communication connection with the index device 12, and the access device 11 can be a user client or a gateway server, playing the role of a client in the file system; the first device 121 and the second device 122 of the index device 12 Both are computing servers, the first device 121 can be a ZFS server, the second device 122 can be an Index server, and the Index server is used to manage the routing of the ZFS server; the storage device 13 is usually a storage server, used to store files.

基于上述图1的文件系统,本发明实施例提供一种存储方法,图2为本发明实施例中的一种可选的存储的流程交互示意图,如图2所示,该存储方法可以包括:Based on the above-mentioned file system in FIG. 1, an embodiment of the present invention provides a storage method. FIG. 2 is a schematic diagram of an optional storage process interaction in the embodiment of the present invention. As shown in FIG. 2, the storage method may include:

S201:接入设备11在接收到针对第一文件的存储请求的情况下,向第一文件分配标识码;S201: When the access device 11 receives a storage request for the first file, allocate an identification code to the first file;

目前,主流的分布式文件系统,在大文件读写方面皆有良好表现,性能瓶颈通常限于海量小文件读写与索引访问,而小文件读写问题也可以归结为索引设计问题。主流分布式文件系统索引大致分为两个方向,其中,集中化索引扩展性存在瓶颈,而去中心化索引又在基本性能上有所不足。主流分布式文件系统通常只能推动上层应用层面或本身在协议接入层面做小文件聚合,来在部分模型下减轻瓶颈限制。At present, mainstream distributed file systems have good performance in reading and writing large files. The performance bottleneck is usually limited to reading and writing of massive small files and index access, and the problem of reading and writing small files can also be attributed to index design problems. Mainstream distributed file system indexes are roughly divided into two directions. Among them, there is a bottleneck in the scalability of the centralized index, and the basic performance of the decentralized index is insufficient. Mainstream distributed file systems usually can only promote small file aggregation at the upper application level or at the protocol access level to alleviate bottleneck restrictions in some models.

同时,这些分布式系统受传统一致性算法(例如,PAXOS算法或Multi-PAXOS算法)拖累,在实现PAXOS语义时无法同时设计高效系统,最终也无法证明设计出系统的实际安全性。在生产环境中各类主流分布式文件系统产生脑裂,丢失数据的情况屡见不鲜,而故障自修复以保证最终一致性更是一种常态。PAXOS算法原理本身是具有完整安全可证明性和可推导性的,但是其最大的缺陷就是难以理解与实际实现,用在分布式文件存储中常常需要大量额外开销,最终也无法准确地保证安全性而要再次来维护最终一致性。At the same time, these distributed systems are hindered by traditional consensus algorithms (for example, PAXOS algorithm or Multi-PAXOS algorithm), and it is impossible to simultaneously design an efficient system when implementing PAXOS semantics, and ultimately cannot prove the actual security of the designed system. In the production environment, various mainstream distributed file systems have split brains, and data loss is not uncommon, and fault self-repair to ensure final consistency is even more normal. The principle of the PAXOS algorithm itself has complete security provability and derivation, but its biggest flaw is that it is difficult to understand and implement in practice. It often requires a lot of extra overhead when used in distributed file storage, and ultimately cannot accurately guarantee security. And again to maintain the final consistency.

为了提高文件的存储效率,在本发明实施例中,接入设备11在接收到第一文件的存储请求之后,先为第一文件分配一个标识码,具体来说,接入设备11在接收到需要存储的第一文件时,可以按照预设的规则为第一文件生成一个标识码,例如,可以按照存储文件的序号来编码,还可以按照字母加数字来对需要存储的文件进行编号,这里,本发明实施例对此不作具体限定。In order to improve file storage efficiency, in the embodiment of the present invention, after receiving the storage request of the first file, the access device 11 first assigns an identification code to the first file. When the first file needs to be stored, an identification code can be generated for the first file according to the preset rules. For example, it can be coded according to the serial number of the stored file, or the files to be stored can be numbered according to letters and numbers. Here , which is not specifically limited in this embodiment of the present invention.

S202:接入设备11利用第一文件的已有父目录和标识码,生成第一文件的索引号;S202: The access device 11 generates an index number of the first file by using the existing parent directory and the identification code of the first file;

具体来说,接入设备11为第一文件分配好标识码之后,可以利用第一文件的父目录和第一文件的标识码生成第一文件的索引号,例如,为第一文件分配的标识码为345,第一文件的父目录为F盘,那么,第一文件的索引号可以为F/345,这样,便可以得到第一文件的索引号。Specifically, after the access device 11 assigns the identification code to the first file, it can use the parent directory of the first file and the identification code of the first file to generate the index number of the first file, for example, the identification code assigned to the first file code is 345, and the parent directory of the first file is disk F, then the index number of the first file can be F/345, and thus, the index number of the first file can be obtained.

S203:接入设备11将第一文件的名称与第一文件的索引号之间的关联关系进行存储;S203: The access device 11 stores the association relationship between the name of the first file and the index number of the first file;

在生成第一文件的索引号之后,可以将第一文件的名称与第一文件的索引号关联起来并存储,这样,可以保证在读取或者丢失文件时,通过文件的命名找到文件的索引号,有利于从存储设备中读取或者修改文件。After the index number of the first file is generated, the name of the first file can be associated with the index number of the first file and stored, so that when the file is read or lost, the index number of the file can be found by naming the file , which is beneficial for reading or modifying files from storage devices.

S204:接入设备11将第一文件的名称和第一文件的索引号,发送至索引设备;S204: The access device 11 sends the name of the first file and the index number of the first file to the indexing device;

其中,索引设备中通常包括多个第一设备和多个第二设备,并且,每个第二设备都管理有多个第一设备,那么,为了从索引设备的第一设备中确定出第一文件对应的设备,在一种可选的实施例中,上述方法还可以包括:Wherein, indexing devices generally include multiple first devices and multiple second devices, and each second device manages multiple first devices, then, in order to determine the first The device corresponding to the file, in an optional embodiment, the above method may also include:

接入设备11向第二设备122发送针对索引设备的路由信息的获取请求;The access device 11 sends an acquisition request for the routing information of the indexing device to the second device 122;

第二设备122将第二设备122所管理的第一设备的路由信息确定为索引设备的路由信息,并发送至接入设备11;The second device 122 determines the routing information of the first device managed by the second device 122 as the routing information of the indexing device, and sends it to the access device 11;

接入设备11将接收到的索引设备的路由信息,确定为确定出的索引设备的路由信息。The access device 11 determines the received routing information of the indexing device as the determined routing information of the indexing device.

接入设备11基于确定出的索引设备的路由信息,根据第一文件的已有父目录,从索引设备的第一设备中确定第一文件对应的设备;The access device 11 determines the device corresponding to the first file from the first device of the index device based on the determined routing information of the index device and according to the existing parent directory of the first file;

具体来说,接入设备11向第二设备122发送针对索引设备的路由信息的获取请求,这里,需要说明的是,这里的第二设备122表示索引设备中所有的第二设备,每个第二设备下均连接有至少两个第一设备,对其进行管理,那么,第二设备122在接收到获取请求之后,将每个第二设备下的第一设备的路由信息都作为索引设备的路由信息发送至接入设备11,这样,接入设备11将接收到索引设备的路由信息,确定为确定出的索引设备的路由信息。Specifically, the access device 11 sends to the second device 122 a request for obtaining the routing information of the indexing device. Here, it should be noted that the second device 122 here represents all the second devices in the indexing device, and each There are at least two first devices connected to each of the two devices, and they are managed. Then, after receiving the acquisition request, the second device 122 uses the routing information of the first device under each second device as the routing information of the index device. The routing information is sent to the access device 11, so that the access device 11 will receive the routing information of the indexing device and determine it as the determined routing information of the indexing device.

如此,通过发送获取请求的方式来确定索引设备的路由信息,使得确定出的索引设备的路由信息为有效的路由信息,以保证文件系统的正常读写。In this way, the routing information of the indexing device is determined by sending an acquisition request, so that the determined routing information of the indexing device is effective routing information, so as to ensure normal reading and writing of the file system.

在接入设备11中存储有确定出的索引设备的路由信息,由于索引设备的路由信息中存储有父目录对应的第一设备,那么,接入设备11可以从确定出的索引设备的路由信息中,确定出第一文件的父目录对应的第一设备,将第一文件的父目录对应的第一设备确定为第一文件对应的设备。The routing information of the determined index device is stored in the access device 11. Since the first device corresponding to the parent directory is stored in the routing information of the index device, the access device 11 can use the determined routing information of the index device In the process, the first device corresponding to the parent directory of the first file is determined, and the first device corresponding to the parent directory of the first file is determined as the device corresponding to the first file.

需要说明的是,接入设备11中存储的确定出的索引设备的路由信息可以是有效的路由信息,也可以是失效的路由信息,为了使得确定出的索引设备的路由信息为有效的路由信息,以保证存储设备的正常读写和修改,可以采取以下任意一种方式,例如,可以通过比较路由信息的版本号来确定是否为有效路由信息,在一种可选的实施例中,上述方法还可以包括:It should be noted that the determined routing information of the indexing device stored in the access device 11 may be valid routing information or invalid routing information. In order to make the determined routing information of the indexing device valid routing information , to ensure the normal reading and writing and modification of the storage device, any of the following methods can be adopted. For example, it can be determined whether it is valid routing information by comparing the version number of the routing information. In an optional embodiment, the above method Can also include:

当接收到的索引设备的路由信息的版本号与已存储的索引设备的路由信息的版本号相同时,接入设备11将已存储的索引设备的路由信息确定为确定出的索引设备的路由信息;When the version number of the received routing information of the indexing device is the same as the version number of the stored routing information of the indexing device, the access device 11 determines the stored routing information of the indexing device as the determined routing information of the indexing device ;

当接收到的索引设备的路由信息的版本号与已存储的索引设备的路由信息的版本号不同时,接入设备11将接收到的索引设备的路由信息确定为确定出的索引设备的路由信息。When the version number of the received routing information of the indexing device is different from the version number of the stored routing information of the indexing device, the access device 11 determines the received routing information of the indexing device as the determined routing information of the indexing device .

也就是说,接入设备11比较接收到索引设备的路由信息的版本号与已存储的索引设备的路由信息的版本号是否相同,当相同时,说明接入设备11中已存储的索引设备的路由信息为有效的路由信息,所以,接入设备11将已存储的索引设备的路由信息确定为确定出的索引设备的路由信息。That is to say, the access device 11 compares whether the version number of the routing information received from the indexing device is the same as the version number of the stored routing information of the indexing device. The routing information is valid routing information, so the access device 11 determines the stored routing information of the indexing device as the determined routing information of the indexing device.

当不相同时,说明接入设备11中已存储的索引设备的路由信息为失效的路由信息,所以,将接入设备接收到的索引设备的路由信息确定为确定出的索引设备的路由信息。If they are different, it means that the routing information of the indexing device stored in the access device 11 is invalid routing information, so the routing information of the indexing device received by the accessing device is determined as the determined routing information of the indexing device.

这样,便可以保证确定出的索引设备的路由信息为有效的路由信息,防止接入设备使用失效的路由信息所引起的问题。In this way, it can be ensured that the determined routing information of the indexing device is valid routing information, and problems caused by access devices using invalid routing information can be prevented.

在接入设备11在确定出第一文件的索引号,将第一文件和第一文件的索引号发送至索引设备,以使得索引设备用于在确定存储设备中用于存储第一文件的存储节点的标识后,将第一文件的索引号与述第一文件的存储节点的标识之间的对应关系存储至索引设备的第一设备和第二设备中。After the access device 11 determines the index number of the first file, the first file and the index number of the first file are sent to the indexing device, so that the indexing device is used to store the first file in the determined storage device After the identification of the node, the corresponding relationship between the index number of the first file and the identification of the storage node of the first file is stored in the first device and the second device of the indexing device.

其中,需要说明的是,上述S203和S204之间既可以先执行S203,也可以先执行S204,还可以同时执行S203和S204,这里,本申请实施例对此做具体限定。Wherein, it should be noted that, between the above S203 and S204, S203 may be executed first, S204 may be executed first, or S203 and S204 may be executed simultaneously, which is specifically limited in this embodiment of the present application.

S205:索引设备12确定存储设备中,用于存储第一文件的存储节点的标识;S205: The indexing device 12 determines an identifier of a storage node used to store the first file in the storage device;

其中,上述存储节点可以包括主节点和备份节点。Wherein, the above-mentioned storage nodes may include a master node and a backup node.

这里,具体来说,索引设备12的第一设备在获取到第一文件和第一文件的索引号之后,从存储设备空闲的存储节点中,用于存储第一文件的存储节点的标识;其中,该存储节点可以包括主节点和备份节点,这里,需要说明的是,通常,主节点为一个,备份节点可以为2个或者3个,这里,本发明实施例对此不作具体限定。Here, specifically, after the first device of the indexing device 12 obtains the first file and the index number of the first file, it uses the identifier of the storage node for storing the first file from the storage nodes that are free in the storage device; wherein , the storage node may include a master node and a backup node. Here, it should be noted that, generally, there is one master node, and there may be 2 or 3 backup nodes. Here, this embodiment of the present invention does not specifically limit this.

S206:索引设备12将第一文件的索引号与第一文件的存储节点的标识之间的对应关系存储于索引设备12的第一设备和第二设备中;S206: The indexing device 12 stores the corresponding relationship between the index number of the first file and the identifier of the storage node of the first file in the first device and the second device of the indexing device 12;

具体来说,索引设备第一设备,即为从索引设备的第一设备中确定出的第一文件随影的设备,需要将第一文件的索引号与第一文件的主节点的标识和备份节点的标识之间的对应关系进行存储,这样,当用户需要读取已存储的文件时,可以通过对应关系来读取文件。Specifically, the first device of the index device, that is, the device that follows the first file determined from the first device of the index device, needs to combine the index number of the first file with the identification and backup of the primary node of the first file The corresponding relationship between the identifiers of the nodes is stored, so that when the user needs to read the stored file, the file can be read through the corresponding relationship.

并且,第一设备还需要将上述对应关系发送至管理第一设备的第二设备,使得第二设备存储有该对应关系,这样,防止当某个第一设备故障时无法读写文件的情况发生,保证了文件系统的可靠性。In addition, the first device also needs to send the above correspondence to the second device that manages the first device, so that the second device stores the correspondence, so as to prevent the failure to read and write files when a certain first device fails , ensuring the reliability of the file system.

为了提高文件系统中读写文件的一致性,在一种可选的实施例中,上述方法还包括:In order to improve the consistency of reading and writing files in the file system, in an optional embodiment, the above method further includes:

当第一文件对应的设备接收到存储设备13针对第一文件的写入成功的回复消息时,第一文件对应的设备向接入设备11发送针对第一文件的写入成功的响应消息;When the device corresponding to the first file receives a reply message that the storage device 13 writes successfully to the first file, the device corresponding to the first file sends a response message to the access device 11 that the write to the first file is successful;

接入设备11接收针对第一文件的写入成功的响应消息时,生成提示信息;其中,提示信息用于提示用户第一文件存储成功。When the access device 11 receives the response message that the writing of the first file is successful, it generates prompt information; wherein, the prompt information is used to prompt the user that the first file is successfully stored.

也就是说,第一文件对应的设备在存储第一文件至存储设备13成功的情况下,存储设备13会向第一文件对应的设备发送针对第一文件的写入成功的回复消息,第一文件对应的设备接收到回复消息之后,发送写入成功的响应消息至接入设备11,使得接入设备11得知第一文件存储成功,接入设备11在获知存储成功之后,还会生成提示信息来提示用户第一文件存储成功。That is to say, when the device corresponding to the first file successfully stores the first file to the storage device 13, the storage device 13 will send a reply message of writing success for the first file to the device corresponding to the first file, and the first After the device corresponding to the file receives the reply message, it sends a write success response message to the access device 11, so that the access device 11 knows that the first file is stored successfully, and the access device 11 also generates a prompt after knowing that the storage is successful. information to prompt the user that the first file is stored successfully.

当写入失败时,存储设备13不会向第一文件对应的设备发送针对第一文件的写入成功的回复消息,第一文件对应的设备也不向接入设备11发送消息,这样,当接入设备11在一段时间内没有接收到写入成功的响应消息时,确定第一文件的存储失败,此时,提示用户第一文件存储失败,那么,文件系统没有存储第一文件,如此,通过接入设备11和索引设备12之间的响应可以保证文件系统中数据的一致性。When the writing fails, the storage device 13 will not send a reply message for the writing success of the first file to the device corresponding to the first file, and the device corresponding to the first file will not send a message to the access device 11, so when When the access device 11 does not receive a write success response message within a period of time, it determines that the storage of the first file has failed. At this time, it prompts the user that the storage of the first file fails. Then, the file system does not store the first file. In this way, The consistency of data in the file system can be guaranteed through the response between the access device 11 and the index device 12 .

针对文件系统来说,除了存储文件,还可以从文件系统中读取已存储的文件,在一种可选的实施例中,上述方法还可以包括:For the file system, in addition to storing the file, the stored file can also be read from the file system. In an optional embodiment, the above method may also include:

接入设备11接收到已存储的第二文件的读取请求;The access device 11 receives a read request of the stored second file;

接入设备11根据已存储的文件的名称与文件的索引号之间的关联关系,确定第二文件的索引号;The access device 11 determines the index number of the second file according to the association between the name of the stored file and the index number of the file;

接入设备11基于确定出的索引设备的路由信息,根据第二文件的已有父目录,从索引设备的第一设备中确定第二文件对应的设备;The access device 11 determines the device corresponding to the second file from the first device of the index device based on the determined routing information of the index device and according to the existing parent directory of the second file;

接入设备11将第二文件的索引号,发送至第二文件对应的设备;The access device 11 sends the index number of the second file to the device corresponding to the second file;

第二文件对应的设备根据已存储的文件的索引号与文件的存储节点的标识之间的对应关系,确定第二文件的存储节点;The device corresponding to the second file determines the storage node of the second file according to the correspondence between the index number of the stored file and the identifier of the storage node of the file;

第二文件对应的设备从第二文件的存储节点中读取第二文件。The device corresponding to the second file reads the second file from the storage node of the second file.

为了读取已存储的第二文件,用户通过接入设备11的界面向接入设备11发送第二文件的读取请求,由于接入设备11中存储有文件的名称与文件的索引号之间的关联关系,所以,接入设备11可以确定出第二文件的索引号。In order to read the stored second file, the user sends a read request of the second file to the access device 11 through the interface of the access device 11. Therefore, the access device 11 can determine the index number of the second file.

然后从确定出的索引设备的路由信息中确定出第二文件的已有父目录对应的第一设备,将其确定为第二文件对应的设备,并将第二文件的索引号发送至第二文件对应的设备。Then determine the first device corresponding to the existing parent directory of the second file from the determined routing information of the index device, determine it as the device corresponding to the second file, and send the index number of the second file to the second The device corresponding to the file.

由于第二文件对应的设备中存储有文件的索引号与文件的存储节点的标识之间的对应关系,所以,第二文件对应的设备根据该对应关系确定出,第二文件的存储节点,并从第二文件的存储节点中读取第二文件。Since the corresponding relationship between the index number of the file and the identifier of the storage node of the file is stored in the device corresponding to the second file, the device corresponding to the second file determines according to the corresponding relationship, the storage node of the second file, and The second file is read from the storage node of the second file.

针对文件系统来说,除了存储文件,还可以从文件系统中修改已存储的文件,在一种可选的实施例中,上述方法还可以包括:For the file system, in addition to storing the file, the stored file can also be modified from the file system. In an optional embodiment, the above method can also include:

当已存储的第三文件的存储节点中的主节点的数据发生改变时,接入设备11根据已存储的文件的名称与文件的索引号之间的关联关系,确定第三文件的索引号;When the data of the master node in the storage node of the stored third file changes, the access device 11 determines the index number of the third file according to the association between the name of the stored file and the index number of the file;

接入设备11基于确定出的索引设备的路由信息,根据第三文件的已有父目录,从索引设备的第一设备中确定第三文件对应的设备;The access device 11 determines the device corresponding to the third file from the first device of the index device according to the existing parent directory of the third file based on the determined routing information of the index device;

接入设备11将修改后的第三文件和第三文件的索引号,发送至第三文件对应的设备。The access device 11 sends the modified third file and the index number of the third file to the device corresponding to the third file.

第三文件对应的设备根据已存储的文件的索引号与文件的存储节点的标识之间的对应关系,确定第三文件的存储节点中的备份节点。The device corresponding to the third file determines the backup node among the storage nodes of the third file according to the corresponding relationship between the index number of the stored file and the identifier of the storage node of the file.

其中,第三文件对应的设备用于根据第三文件的索引号确定第三文件的存储节点中的备份节点,第三文件的备份节点用于将所存储的数据更新为修改后的第三文件。Wherein, the device corresponding to the third file is used to determine the backup node among the storage nodes of the third file according to the index number of the third file, and the backup node of the third file is used to update the stored data to the modified third file .

为了修改已存储的第三文件,用户通过接入设备11的修改第三文件的主节点的数据,由于接入设备11中存储有文件的名称与文件的索引号之间的关联关系,所以,接入设备11可以确定出第三文件的索引号。In order to modify the stored third file, the user modifies the data of the master node of the third file through the access device 11. Since the access device 11 stores the association between the name of the file and the index number of the file, The access device 11 may determine the index number of the third file.

然后,从确定出的索引设备的路由信息中确定出第三文件的已有父目录对应的第一设备,将其确定为第三文件对应的设备,并将第三文件的索引号发送至第三文件对应的设备。Then, determine the first device corresponding to the existing parent directory of the third file from the determined routing information of the index device, determine it as the device corresponding to the third file, and send the index number of the third file to the first device The three files correspond to the device.

由于第三文件对应的设备中存储有文件的索引号与文件的存储节点的标识之间的对应关系,所以,第三文件对应的设备根据该对应关系确定出,第三文件的备份节点,该第三文件的被分界点利用修改后的第三文件更新第三文件的备份节点中的数据。Since the corresponding relationship between the index number of the file and the identifier of the storage node of the file is stored in the device corresponding to the third file, the device corresponding to the third file determines according to the corresponding relationship that the backup node of the third file, the The demarcated point of the third file uses the modified third file to update the data in the backup node of the third file.

当行文件系统发生故障时,为了保证文件系统的正常运行,在一种可选的实施例中,上述方法还可以包括:When the line file system fails, in order to ensure the normal operation of the file system, in an optional embodiment, the above method may also include:

当第二设备所管理的其中一个第一设备发生故障时,第二设备从第二设备所管理的其他的第一设备中选取出一个第一设备;When one of the first devices managed by the second device fails, the second device selects a first device from other first devices managed by the second device;

第二设备将其中一个第一设备中存储的文件的索引号与文件的存储节点的标识之间的对应关系,发送至选取出的一个第一设备并进行存储,并更新索引设备的路由信息。The second device sends the corresponding relationship between the index number of the file stored in one of the first devices and the identifier of the storage node of the file to the selected first device for storage, and updates the routing information of the index device.

也就是说,针对某个第二设备来说,当该第二设备所管理的其中一个第一设备发生故障时,为了保证文件系统的正常运行,第二设备先从第二设备所管理的其他的第一设备中选取出一个第一设备,并且,将预先存储的其中一个第一设备中存储的文件的索引号与文件的存储节点的标识之间的对应关系发送至选取出的一个第一设备中并进行存储。That is to say, for a certain second device, when one of the first devices managed by the second device fails, in order to ensure the normal operation of the file system, the second device first starts from other devices managed by the second device. Select a first device from the first devices, and send the pre-stored correspondence between the index number of the file stored in one of the first devices and the identifier of the storage node of the file to the selected first device device and store it.

这样,使得文件系统在第一设备发生故障时能够及时地利用其它的正常的第一设备来应对,保证文件系统能够应对突发状况,增加了文件系统的可靠性,提高了文件系统的读写效率。In this way, when the first device fails, the file system can use other normal first devices to deal with it in time, ensuring that the file system can cope with emergencies, increasing the reliability of the file system, and improving the read and write of the file system efficiency.

下面举实例来对上述一个或多个实施例中所述的存储方法进行描述。Examples are given below to describe the storage method described in one or more embodiments above.

图3为本发明实施例中的一种可选的文件系统的实例的结构示意图,如图3所示,该文件系统可以包括:接入层,索引层和存储层;FIG. 3 is a schematic structural diagram of an example of an optional file system in an embodiment of the present invention. As shown in FIG. 3, the file system may include: an access layer, an index layer, and a storage layer;

其中,接入层可以为用户客户端或者网关服务器(Posix File System Client),索引层有索引集群构成,包括两种计算服务器,分别为ZFSServer和IndexServer,存储层有存储集群构成,包括至少两个存储服务器(ZFS zpool)。Among them, the access layer can be a user client or a gateway server (Posix File System Client), the index layer is composed of index clusters, including two computing servers, namely ZFSServer and IndexServer, and the storage layer is composed of storage clusters, including at least two Storage server (ZFS zpool).

需要指出的是,上述三层架构之间并非绝对的1:1:1关系,存储集群是索引集群的存储资源提供者,而对接关系完全取决于对物理或逻辑故障域隔离的级别。简单举例来说,多个索引集群可以共用一套存储集群的资源,同时这些索引集群还可以向同一个接入网关提供服务。It should be pointed out that the above-mentioned three-tier architecture is not an absolute 1:1:1 relationship. The storage cluster is the storage resource provider of the index cluster, and the docking relationship depends entirely on the level of isolation of physical or logical fault domains. For example, multiple index clusters can share a set of storage cluster resources, and these index clusters can also provide services to the same access gateway.

一个文件写入流程:A file write process:

第一步,接入层中的设备首先为写入文件分配分布式文件系统(DZFS,DistributeZFS)中Inode号(相当于标识码)。In the first step, the device in the access layer first allocates an Inode number (equivalent to an identification code) in a distributed file system (DZFS, DistributeZFS) for writing a file.

第二步,接入层中的设备将写入文件的父目录(包括DZFS根目录,也包括用于划分命名空间的目录)转化为prefix_id,其自身在DZFS中的Inode号转化为file_id;将两个id拼接为写入文件的索引号,将写入文件与写入文件的索引号关联起来。In the second step, the device in the access layer converts the parent directory of the written file (including the DZFS root directory and the directory used to divide the namespace) into prefix_id, and converts its own Inode number in DZFS into file_id; The two ids are concatenated into the index number of the written file, and the written file is associated with the index number of the written file.

第三步,因为接入层缓存路由,在路由未失效下,接入层中的设备可以直接将写入文件发送至写入文件对应的ZFSServer;假设路由失效,则从IndexServer重新获取写入文件对应的ZFSServer,将写入文件下发至该ZFSServer。The third step, because the access layer caches the route, if the route is not invalid, the device in the access layer can directly send the written file to the ZFSServer corresponding to the written file; if the route is invalid, re-acquire the written file from the IndexServer The corresponding ZFSServer sends the written file to the ZFSServer.

第四步,ZFSServer从存储层中的空闲节点中选出主节点和冗余节点(相当于备份节点),向主节点和冗余节点同时写入文件。In the fourth step, ZFSServer selects the primary node and the redundant node (equivalent to the backup node) from the idle nodes in the storage layer, and writes files to the primary node and the redundant node at the same time.

第五步,主节点和冗余节点共同写入后,回复ZFSServer写入成功。Step 5: After the master node and the redundant node write together, reply ZFSServer that the write is successful.

第六步,ZFSServer将写入文件的索引号与写入文件的主节点的标识和冗余节点的标识对应起来并存储。In the sixth step, the ZFSServer associates and stores the index number written into the file with the identification of the primary node and the identification of the redundant node writing the file.

第七步,ZFSServer回复接入层写入完成,接入层回复用户写入完成。In the seventh step, ZFSServer replies to the access layer that the writing is completed, and the access layer replies to the user that the writing is completed.

一个文件读出流程:A file read process:

第一步:接入层中的设备获取读取文件的命名,确定读取文件的索引号,将读取文件的索引号发送至读取文件的对应的ZFSServer;Step 1: The device in the access layer obtains the name of the read file, determines the index number of the read file, and sends the index number of the read file to the corresponding ZFSServer that reads the file;

第二步,ZFSServer根据读取文件的索引号,确定读取文件的主节点的标识和/或冗余节点的标识,并从ZFS zpool读取文件。In the second step, ZFSServer determines the identity of the primary node and/or the identity of the redundant node that reads the file according to the index number of the read file, and reads the file from the ZFS zpool.

图4为本发明实施例中的一种可选的文件系统的实例的架构示意图,如图4所示,接入层负责文件语义的解析,将应用对文件与目录操作的语义转化为对本DZFS后端索引层和存储层可识别的语义。在公有云环境下还要负责多租户的隔离等,这一层通常是无状态的,业界普遍支持的是NFSv4接口和SMB2.0等。Fig. 4 is a schematic diagram of the structure of an example of an optional file system in the embodiment of the present invention. As shown in Fig. 4, the access layer is responsible for analyzing the file semantics, and transforms the semantics of the application's file and directory operations into the DZFS Semantics recognizable by the backend index layer and storage layer. In the public cloud environment, it is also responsible for the isolation of multiple tenants. This layer is usually stateless, and the industry generally supports NFSv4 interfaces and SMB2.0.

索引层负责在分布式架构上对本地文件系统的目录和文件概念进行仿生,通常是多租户(multi-tenancy)共享的。这种架构的好处在于:The index layer is responsible for bionicing the directory and file concepts of the local file system on a distributed architecture, usually shared by multi-tenancy. The benefits of this architecture are:

索引数据分离,索引更多是增强的中央处理单元(CPU-Intensive,CentralProcessing Unit-Intensive),而数据则是增强的输入/输出(IO-Intensive,Input/Output-Intensive)的,两者不同的硬件要求可以让他们在更有针对性的硬件下分别做最具性价比的部署,分别做向外扩展(scale out),也便于做独立的架构演进。如果混着存就可能存在这样的问题:数据占用的存储池使用率还很低但是索引消耗很大必须扩容,整体的资源利用率就下降了。The index data is separated, the index is more of an enhanced central processing unit (CPU-Intensive, Central Processing Unit-Intensive), while the data is of enhanced input/output (IO-Intensive, Input/Output-Intensive), the two are different The hardware requirements allow them to deploy the most cost-effective deployments on more targeted hardware, scale out separately, and facilitate independent architecture evolution. If the storage is mixed, there may be such a problem: the utilization rate of the storage pool occupied by the data is still very low, but the index consumes a lot and must be expanded, and the overall resource utilization rate drops.

降低索引和IO干扰:元数据操作在整个文件系统操作中实际上占大头,比如,内容分发网络(CDN,Content Delivery Network)的回源使用的HEAD请求在大多数情况下并不需要访问数据,这在多租户场景下表现尤为明显,如果索引和数据共存很容易导致索引密集型应用干扰了IO,使得两者的性能表现都下降。Reduce indexing and IO interference: Metadata operations actually account for the bulk of the entire file system operation. For example, the HEAD request used by the content distribution network (CDN, Content Delivery Network) back-to-source does not need to access data in most cases. This is especially evident in multi-tenant scenarios. If indexes and data coexist, it is easy to cause index-intensive applications to interfere with IO, resulting in a decrease in the performance of both.

更适合支持弹性架构:比如在索引和数据共存的场景下,就很难表示一个超大文件(例如,PB级别),而在分离架构下,根据数据的访问模型可以较为方便地做数据调度等操作。It is more suitable to support elastic architecture: for example, in the scenario where the index and data coexist, it is difficult to represent a very large file (for example, PB level), but in the separation architecture, it is more convenient to do data scheduling and other operations according to the data access model .

存储层是数据高可靠和高可用的保障,还必须考虑业务系统对IO访问模式的需求,考虑到文件存储需要的随机IO需要比较高效地实现。ZFS已经是单机文件存储,兼具统筹磁盘管理可靠性,可用性顶级的文件系统,所以存储层设计更多考虑分布式可用性与一致性。The storage layer is the guarantee of high reliability and high availability of data. It must also consider the requirements of the business system for IO access modes, and the random IO required for file storage needs to be implemented more efficiently. ZFS is already a stand-alone file storage, with overall disk management reliability and top-level availability file system, so the storage layer design more considers distributed availability and consistency.

下面对每一层展开来说:Let's expand each layer as follows:

针对接入层来说,主要有两点:协议层(Protocal Layer)会进行协议的语义转化,例如,上述NFSv4或smb2.0协议;接入层、索引层与存储层各层间通信通过通用远程过程调用(RPC,Remote Procedure Call)框架完成。For the access layer, there are two main points: the protocol layer (Protocal Layer) will carry out the semantic conversion of the protocol, for example, the above-mentioned NFSv4 or smb2.0 protocol; the communication between the access layer, the index layer and the storage layer through the common The remote procedure call (RPC, Remote Procedure Call) framework is completed.

针对索引层来说,在实现上,将目录和文件索引两部分分别实现,称为DirIdx和FileIdx。在索引数据的持久化上,将这两部分切分存储。For the index layer, in terms of implementation, the two parts of directory and file index are implemented separately, called DirIdx and FileIdx. In the persistence of index data, the two parts are divided and stored.

DirIdx由IndexServer负责,依赖外部数据库存储持久化,即使海量小文件场景,DirIdx规模也并不显得庞大,在外部的分布式数据库(Distribute DB,Distribute DataBase)上可以高效地存取,同时下文将解释接入层访问IndexServer的索引频率不会很高。DirIdx is in charge of IndexServer and relies on external database storage for persistence. Even in the scenario of a large number of small files, the scale of DirIdx does not appear to be huge, and it can be efficiently accessed on an external distributed database (Distribute DB, Distribute DataBase). At the same time, it will be explained below The indexing frequency of the access layer accessing IndexServer will not be very high.

FileIdx由ZFSServer负责,由各存储节点ZFS本身持久化,同时IndexServer管理文件到父目录(包括命名空间根目录)为止的一级索引。FileIdx is in charge of ZFSServer, and is persisted by ZFS itself of each storage node. At the same time, IndexServer manages the first-level index from the file to the parent directory (including the root directory of the namespace).

DZFS中每个文件都会被分配所属命名空间中的唯一编号(相当于传统文件存储的Inode号),DZFS使用文件父目录(包括命名空间根目录)编号作为prefix_id,使用文件本身编号作为file_id,prefix_id/file_id作为在整个命名空间中索引的唯一键值。Each file in DZFS will be assigned a unique number in the namespace to which it belongs (equivalent to the Inode number of traditional file storage). DZFS uses the number of the file's parent directory (including the root directory of the namespace) as prefix_id, and uses the number of the file itself as file_id, prefix_id /file_id as a unique key value indexed across the namespace.

DirIdx仅描述目录项存在依据,及用作目录项下子文件的实时分配依据。在客户端创建目录后,DirIdx将被IndexServer的数据库记录,其中,主键即为目录项唯一ID,数据库条目中将包含其子文件路由实时分配。通俗得说,新创建的目录将被IndexServer分配给不同ZFSServer,一旦在集群正常运行中确认ZFSServer,客户端对此目录本身及子文件操作将直接沟通ZFSServer进行。DirIdx only describes the existence basis of the directory item and is used as the basis for real-time allocation of sub-files under the directory item. After the client creates the directory, DirIdx will be recorded by the database of IndexServer, where the primary key is the unique ID of the directory item, and the database entry will contain its sub-file routing real-time distribution. In layman's terms, the newly created directory will be assigned to different ZFSServers by the IndexServer. Once the ZFSServer is confirmed in the normal operation of the cluster, the client will directly communicate with the ZFSServer for operations on the directory itself and sub-files.

图5为本发明实施例中的一种可选的目录示意图,如图5所示,包含目录/dir0/dirx/,dir0/diry/,/dir0/diry/dileα/,/dir1/,/dir2/file0/;多个子目录被划分至多个ZFSServer处理。由以上以DirIdx中唯一编号为key的路由设计可知,客户端读写文件必可获取prefix_id,通过prefix_id即可获取路由,从而最终实现数据分布的目的。Figure 5 is a schematic diagram of an optional directory in the embodiment of the present invention, as shown in Figure 5, including directories /dir0/dirx/, dir0/diry/, /dir0/diry/dileα/, /dir1/, /dir2 /file0/; Multiple subdirectories are divided into multiple ZFSServers for processing. From the above routing design with the unique number in DirIdx as the key, it can be seen that the client can obtain the prefix_id for reading and writing files, and the route can be obtained through the prefix_id, so as to finally achieve the purpose of data distribution.

索引层更详细描述:The index layer is described in more detail:

节点发现:IndexServer和ZFSServer之间的租约心跳(heartbeat)由IndexServer发起,这样可以让IndexServer不需要将服务暴露给ZFSServer,而由zookeeper等一些外部服务发现类应用来保障节点发现。所以IndexServer需要记录当前集群内允许服务的ZFSServer列表,只有在此列表中的ZFSServer才允许服务。Node discovery: The lease heartbeat (heartbeat) between IndexServer and ZFSServer is initiated by IndexServer, so that IndexServer does not need to expose services to ZFSServer, and some external service discovery applications such as zookeeper can guarantee node discovery. Therefore, IndexServer needs to record the list of ZFSServers that are allowed to serve in the current cluster, and only the ZFSServers in this list are allowed to serve.

路由维护:正常情况下,IndexServer需要保证一个叶子目录只被一台ZFSServer服务,需要通过比如租约机制来维护这个路由表的正确性。客户端获取到的路由只会有两种情况:一种是路由正确:通常情况下路由没有变动,客户端维护的路由表和IndexServer维护的是一样的。另一种是路由过期:IndexServer对DirIdx的路由进行了调度,导致客户端维护的路由表过期了。Routing maintenance: Under normal circumstances, IndexServer needs to ensure that a leaf directory is only served by one ZFSServer, and it needs to maintain the correctness of this routing table through, for example, a lease mechanism. There are only two situations for the route obtained by the client: one is that the route is correct: usually the route does not change, and the routing table maintained by the client is the same as that maintained by the IndexServer. The other is route expiration: IndexServer schedules the route of DirIdx, causing the routing table maintained by the client to expire.

在客户端初次获取到某个子目录的路由之后不需要定期和IndexServer通信以获取最新路由,因为在和ZFSServer的常态通信中会校验出来路由是否过期,这样,IndexServer的压力不会很大。同时,由于子目录路由单个条目仅标识单个目录对ZFSServer的路由,对客户端缓存压力也是极低的。ZFSServer和IndexServer之间通过实现租约,以防止出现网络分区后有ZFSServer能够主动退出服务。After the client obtains the route of a certain subdirectory for the first time, it does not need to communicate with IndexServer regularly to obtain the latest route, because it will check whether the route is expired in the normal communication with ZFSServer, so that the pressure on IndexServer will not be great. At the same time, since a single subdirectory routing entry only identifies the routing of a single directory to ZFSServer, the pressure on the client cache is also extremely low. A lease is implemented between ZFSServer and IndexServer to prevent ZFSServer from voluntarily withdrawing from service after a network partition occurs.

ZFSServer是关键IO链路上的核心模块,通过和底层存储的交互,将数据写入到存储节点上。ZFSServer的架构特点是无状态,它通过底层存储层模块与ZFS实现客户端文件和文件属性的持久化,保证数据的高可靠性。ZFSServer is the core module on the key IO link, and writes data to the storage node through the interaction with the underlying storage. The architectural feature of ZFSServer is stateless. It realizes the persistence of client files and file attributes through the underlying storage layer module and ZFS, ensuring high data reliability.

路由调度:IndexServer仅在以下情况下发生路由调度:一种情况是目录分裂:若单个子目录热度过高与子文件数过高目录将发生分裂,通过与客户端相同的语义切分目录并改变文件key为prefix_id/num/file_id以达到分布的目的。热度与使用量由ZFSServer经租约心跳上报。另一种情况是目录迁移:若整体ZFSServer热度用量不平衡,将目录路由迁移至空闲ZFSServer(包含了新加入ZFSServer)。同上由租约心跳上报。还有一种情况是ZFSServer服务异常:由ZFSServer自身租约心跳上报退出,或客户端超时而调度。其他情况是网络异常,网络分区等等。Routing scheduling: IndexServer only occurs routing scheduling in the following cases: one case is directory splitting: if a single subdirectory is too hot and the number of sub-files is too high, the directory will be split, and the directory will be divided and changed through the same semantics as the client. The file key is prefix_id/num/file_id to achieve the purpose of distribution. Heat and usage are reported by ZFSServer through lease heartbeat. Another case is directory migration: if the overall ZFSServer heat usage is unbalanced, the directory routing is migrated to an idle ZFSServer (including the newly added ZFSServer). The above is reported by the lease heartbeat. Another situation is that the ZFSServer service is abnormal: ZFSServer's own lease heartbeat report exits, or the client schedules due to timeout. Other situations are network anomalies, network partitions, and so on.

IndexServer高可用:由上述IndexServer访问压力很小,故同样通过zookeeper等外部服务发现来实现主备的结构,只有主IndexServer可以更新(update)数据库,而从IndexServer仅享有询问(query)数据库权力来维护自己的缓存空间以利于异常时迅速切换。High availability of IndexServer: The access pressure of the above-mentioned IndexServer is very small, so the main-standby structure is also realized through external service discovery such as zookeeper. Only the main IndexServer can update (update) the database, and the slave IndexServer only has the right to query (query) the database to maintain Its own cache space is convenient for rapid switching in case of exception.

附加服务:文件系统附加服务如QUOTA,QOS,快照等租户功能在分布式文件系统内部可统归于对目录文件的属性进行设置,本发明实施例这种对目录索引单独提取的设计在实现这些功能方面均可实现。Additional services: file system additional services such as QUOTA, QOS, snapshot and other tenant functions can be collectively attributed to setting the attributes of directory files in the distributed file system. The design of extracting directory indexes separately in the embodiment of the present invention is to realize these functions All aspects can be realized.

也就是说,索引层以唯一id为主键的数据库索引同时还实现了list的高效(大小范围list)。综上此实现满足了索引分离,索引IO干扰减少等目的。In other words, the index layer uses the unique id as the primary key of the database index and also realizes the efficiency of the list (size range list). In summary, this implementation satisfies the purpose of index separation and index IO interference reduction.

针对存储层来说,通过ZFS单机文件系统已经实现文件存储需要的高效随机IO和高可靠性。存储层还需要通过额外的模块来实现高可用,通常分布式文件系统使用冗余来保障,由此引入Raft作为冗余时的一致性算法。For the storage layer, the efficient random IO and high reliability required by file storage have been realized through the ZFS stand-alone file system. The storage layer also needs to use additional modules to achieve high availability. Usually, distributed file systems use redundancy to ensure that Raft is introduced as a consensus algorithm for redundancy.

由上述DirIdx在索引时索引单个ZFSServer,ZFSServer在基于此DirIdx的子文件写入时会选择存储层单机ZFS进程,此目录在此ZFS上视作主副本,由ZFS进程控制发起向其他节点的副本写入与同步。在副本写入完成后,此主ZFS单机将回复ZFSServer此文件复制到了哪些节点,ZFSServer在内存中为此文件索引记录复制节点。在无异常情况下,文件读取仅通过主副本。The above-mentioned DirIdx indexes a single ZFSServer when indexing. When ZFSServer writes a subfile based on this DirIdx, it will select a stand-alone ZFS process in the storage layer. This directory is regarded as the master copy on this ZFS, and the copy to other nodes is controlled by the ZFS process. Write and sync. After the copy is written, the master ZFS stand-alone will reply to ZFSServer which nodes the file has been copied to, and ZFSServer will record the copy node for this file index in memory. In the absence of exceptions, file reads go through the primary replica only.

存储层最重要的实现即是通过Raft维护副本间一致性。Raft是一种维护复制状态机一致性的算法,通过改造ZFS事务层面,实现副本间一致性,图6为本发明实施例中的一种可选的Raft算法的流程示意图,如图6所示,有赖于ZFS是一种事务型文件存储系统,在Raft接入方面留有入口,同时写时复制(COW)形式的存储又可以保证事务日志(log)操作的幂等,故将存储层ZFS事务处理改造为分布式一致性较为简单。The most important implementation of the storage layer is to maintain consistency between replicas through Raft. Raft is an algorithm for maintaining the consistency of the replication state machine. By transforming the ZFS transaction level, the consistency between replicas is realized. Figure 6 is a schematic flow diagram of an optional Raft algorithm in the embodiment of the present invention, as shown in Figure 6 , relying on ZFS is a transactional file storage system, which has an entry for Raft access, and at the same time, copy-on-write (COW) storage can ensure the idempotence of transaction log (log) operations, so the storage layer ZFS It is relatively simple to transform transaction processing into distributed consistency.

冗余同步写入:Redundant synchronous writes:

如图6所示,As shown in Figure 6,

①ZFS将事务提交Raft节点。① ZFS submits the transaction to the Raft node.

②Raft记录wal log以持久化对事务空间的操作(例如x=1),节点大多数持久化后可提交状态机应用这些操作。②Raft records the wal log to persist the operations on the transaction space (for example, x=1). After most nodes are persisted, they can submit the state machine to apply these operations.

③Raft StateMachine转化提交状态应用操作,对ZFS的事务log存放空间(含缓存)进行操作。(log空间内容如:x:9;y:22;z:33,在应用次操作后变为:x:1;y:22;z:33)。③Raft StateMachine transforms the submitted state application operation, and operates on the ZFS transaction log storage space (including cache). (The contents of the log space, such as: x:9; y:22; z:33, become: x:1; y:22; z:33 after applying this operation).

④⑤ZFS本身的事务流程,以事务log保证文件IO的原子性。④⑤The transaction process of ZFS itself uses the transaction log to ensure the atomicity of file IO.

异步snapshot保存ZFS的事务log,此snapshot由Raft控制生成与获取,用作Raftwal log compaction以避免Raft wal log无限增长。The asynchronous snapshot saves the transaction log of ZFS. This snapshot is generated and acquired by Raft control, and is used as Raftwal log compaction to avoid the infinite growth of Raft wal log.

可见,整个过程通过ZFS本身的事务流程保证的原子性,利用Raft提供的算法安全性,来达成最终的分布式一致性。It can be seen that the whole process achieves the final distributed consistency through the atomicity guaranteed by the transaction process of ZFS itself and the algorithm security provided by Raft.

数据迁移:如上述所述路由调度,无论何种情况触发索引层DirIdx调度都会引发数据迁移,在目录新调度至的ZFSServer可通过租约与路由过期提示开始数据迁移,但上述ZFS的COW特性,数据迁移的开销对集群性能影响很小。Data Migration: As mentioned above in routing scheduling, no matter what happens when DirIdx scheduling of the index layer is triggered, data migration will be triggered. The ZFSServer that is newly scheduled to the directory can start data migration through the lease and routing expiration prompts, but the COW feature of ZFS mentioned above, the data Migration overhead has little impact on cluster performance.

文件索引:FileIdx与文件信息和属性由ZFS zpool自身维护,由prefix_id/file_id扁平化的元数据存储将发挥极高的性能。以prefix_id/file_id作为主要标识后,ZFSPool中的文件将无需再通过目录树区分目录,而是通过prefix_id作为list依据,prefix_id/file_id作为直接索引依据,这是极为高效的。File index: FileIdx, file information and attributes are maintained by ZFS zpool itself, and metadata storage flattened by prefix_id/file_id will exert extremely high performance. After prefix_id/file_id is used as the main identifier, the files in ZFSPool no longer need to distinguish directories through the directory tree, but use prefix_id as the list basis and prefix_id/file_id as the direct index basis, which is extremely efficient.

附加服务:利用ZFS本身特性对prefix_id的list进行附加服务,效率极高。Additional services: Use the characteristics of ZFS to provide additional services to the prefix_id list, which is extremely efficient.

可见,基于此三层架构设计,DZFS系统可屏蔽单模块单节点故障。It can be seen that based on this three-layer architecture design, the DZFS system can shield single-module single-node failures.

举例来说,存储层存储节点ZFS zpool故障,首先会被其消费者所有ZFSServer感知,ZFSServer可以将其目前维护的所有文件索引修改为其他ZFS zpool节点成为主节点,来继续提供正常的服务。接着ZFSServer会对这些新的主节点发送通知消息,通知对涉及的文件重新选出一个副节点存储。(例如从仅剩的两副本重新恢复成三副本)。For example, if a storage node ZFS zpool fails at the storage layer, it will first be detected by all ZFSServers of its consumers. ZFSServer can modify all file indexes it currently maintains to make other ZFS zpool nodes become master nodes to continue to provide normal services. Then ZFSServer will send a notification message to these new primary nodes, instructing to re-elect a secondary node for storage of the files involved. (For example, restore from the remaining two copies to three copies).

索引层ZFSServer故障,将被IndexServer感知,重新分发其维护的路由(DirIdx)到未故障的ZFSServer节点。ZFSServer仅需要简单访问所有存储层节点,就可以针对通过如上文所述prefix_id方式立即收集齐所有现应维护的文件的索引。The failure of the index layer ZFSServer will be sensed by IndexServer, and the route (DirIdx) maintained by it will be redistributed to the non-failure ZFSServer node. ZFSServer only needs to simply visit all storage layer nodes, and can immediately collect the indexes of all files that should be maintained through the prefix_id method as mentioned above.

索引层IndexServer故障,将被zookeeper等服务感知,通知从属IndexServer切换成为主,并从数据库Query获取最新的路由分配继续维护索引层路由分配。The failure of the Index Server at the index layer will be sensed by services such as zookeeper, and the subordinate Index Server will be notified to switch to become the master, and the latest routing allocation will be obtained from the database query to continue to maintain the routing allocation of the index layer.

接入层客户端或网关故障,这其实由用户应用自行管理,本提案DZFS索引层显然支持多客户端接入,故接入层多路径构建即可。The failure of the access layer client or gateway is actually managed by the user application itself. The DZFS index layer in this proposal obviously supports multi-client access, so the multi-path construction of the access layer is sufficient.

从三层对接角度来说,接入层根据命名空间不同,可以将文件分配至不同索引集群,一个命名空间的故障,不会影响另一个命名空间。而不同索引集群可以采用不同冗余设置,由IndexServer维护此设置。例如,使用同样一套存储集群物理资源的两个索引集群,一个可以设置二副本冗余,一个可以设置纠删码冗余,因为在向存储层发送写入时包含了冗余设置信息。From the perspective of three-tier connection, the access layer can allocate files to different index clusters according to different namespaces, and the failure of one namespace will not affect the other namespace. Different index clusters can adopt different redundancy settings, which are maintained by IndexServer. For example, for two index clusters that use the same set of physical resources of the storage cluster, one can be set for two-copy redundancy, and the other can be set for erasure code redundancy, because redundancy setting information is included when writing to the storage layer.

本发明所提供的一种存储方法,该方法包括:在接入设备接收到针对第一文件的存储请求的情况下,向第一文件分配标识码,利用第一文件的已有父目录和标识码,生成第一文件的索引号,将第一文件的名称与第一文件的索引号之间的关联关系进行存储,将第一文件和第一文件的索引号,发送至索引设备,其中,索引设备用于在确定存储设备中用于存储第一文件的存储节点的标识后,将第一文件的索引号与第一文件的存储节点的标识之间的对应关系存储至索引设备的第一设备和第二设备中;也就是说,在本发明中,接入设备在获取到存储请求为第一文件分配标识码时,通过第一文件的已有父目录与标识码生成第一文件的索引号,这样,在接入设备中就能够存储有每个文件的名称与文件的索引号之间的关联关系,有利于读取文件和修改文件,并且,将第一文件和第一文件的索引号发送至索引设备,那么,索引设备可以确定出用于存储第一文件的存储节点的标识,并将第一文件的索引号与第一文件的存储节点标识对应起来并存储至索引设备的第一设备和第二设备中,这样,当第一设备发生故障,第二设备还可以重新设置路由,保障文件的正常存储和读取,从而提高了文件存储的可靠性,进而提高了文件存储的存储效率。A storage method provided by the present invention, the method includes: when the access device receives a storage request for the first file, assigning an identification code to the first file, using the existing parent directory and identification code of the first file code, generate the index number of the first file, store the association relationship between the name of the first file and the index number of the first file, and send the first file and the index number of the first file to the indexing device, wherein, The indexing device is configured to, after determining the identifier of the storage node used to store the first file in the storage device, store the corresponding relationship between the index number of the first file and the identifier of the storage node of the first file in the first device and the second device; that is to say, in the present invention, when the access device obtains the storage request and allocates the identification code for the first file, it generates the first file's ID through the existing parent directory and the identification code of the first file. index number, in this way, the association relationship between the name of each file and the index number of the file can be stored in the access device, which is conducive to reading the file and modifying the file, and the first file and the first file The index number is sent to the index device, then the index device can determine the ID of the storage node used to store the first file, and store the index number of the first file in correspondence with the storage node ID of the first file in the index device's In the first device and the second device, in this way, when the first device fails, the second device can also reset the route to ensure the normal storage and reading of files, thereby improving the reliability of file storage and further improving file storage. storage efficiency.

实施例二Embodiment two

下面以文件系统中所部署的各个设备侧对上述存储方法进行说明。The above storage method will be described below with reference to each device side deployed in the file system.

首先,以接入设备侧对存储方法进行描述。First, the storage method is described on the access device side.

本发明实施例提供一种存储方法,该方法应用于接入设备中,图7为本发明实施例中的一种可选的存储方法的流程示意图,如图7所示,该存储方法可以包括:An embodiment of the present invention provides a storage method, which is applied to an access device. FIG. 7 is a schematic flowchart of an optional storage method in an embodiment of the present invention. As shown in FIG. 7, the storage method may include :

S701:在接收到针对第一文件的存储请求的情况下,向第一文件分配标识码;S701: When receiving a storage request for the first file, assign an identification code to the first file;

S702:利用第一文件的已有父目录和标识码,生成第一文件的索引号;S702: Generate an index number of the first file by using the existing parent directory and the identification code of the first file;

S703:将第一文件的名称与第一文件的索引号之间的关联关系进行存储;S703: Store the association relationship between the name of the first file and the index number of the first file;

S704:将第一文件和第一文件的索引号,发送至索引设备的第一设备;S704: Send the first file and the index number of the first file to the first device of the index device;

其中,索引设备用于在确定存储设备中用于存储第一文件的存储节点的标识后,将第一文件的索引号与第一文件的存储节点的标识之间的对应关系存储至索引设备的第一设备和第二设备中。Wherein, the indexing device is configured to store the corresponding relationship between the index number of the first file and the storage node's identifier of the first file in the indexing device after determining the identifier of the storage node used to store the first file in the storage device. first device and second device.

在一种可选的实施例中,上述方法还包括:In an optional embodiment, the above method also includes:

向第二设备发送针对索引设备的路由信息的获取请求;sending an acquisition request for routing information of the indexing device to the second device;

接收到来自第二设备发送的索引设备的路由信息;receiving routing information from the indexing device sent by the second device;

当接收到的索引设备的路由信息的版本号与已存储的索引设备的路由信息的版本号相同时,将已存储的索引设备的路由信息确定为确定出的索引设备的路由信息;When the version number of the received routing information of the indexing device is the same as the version number of the stored routing information of the indexing device, determining the stored routing information of the indexing device as the determined routing information of the indexing device;

当接收到的索引设备的路由信息的版本号与已存储的索引设备的路由信息的版本号不同时,将接收到的索引设备的路由信息确定为确定出的索引设备的路由信息;When the version number of the received routing information of the indexing device is different from the version number of the stored routing information of the indexing device, determining the received routing information of the indexing device as the determined routing information of the indexing device;

基于确定出的索引设备的路由信息,根据第一文件的已有父目录,从所述索引设备的第一设备中确定第一文件对应的设备。Based on the determined routing information of the indexing device, and according to the existing parent directory of the first file, the device corresponding to the first file is determined from the first devices of the indexing devices.

在一种可选的实施例中,上述方法还包括:In an optional embodiment, the above method also includes:

接收到来自第一文件对应的设备发送的针对第一文件的写入成功的响应消息时,生成提示信息;其中,提示信息用于提示用户第一文件存储成功。When receiving a response message from the device corresponding to the first file that the writing of the first file is successful, a prompt message is generated; wherein the prompt message is used to prompt the user that the first file is successfully stored.

在一种可选的实施例中,上述方法还包括:In an optional embodiment, the above method also includes:

接收到已存储的第二文件的读取请求;receiving a read request of the stored second file;

根据已存储的文件的名称与文件的索引号之间的关联关系,确定第二文件的索引号;Determine the index number of the second file according to the association between the stored file name and the index number of the file;

基于确定出的索引设备的路由信息,根据第二文件的已有父目录,从索引设备的第一设备中确定第二文件对应的设备;Based on the determined routing information of the index device, according to the existing parent directory of the second file, determine the device corresponding to the second file from the first device of the index device;

将第二文件的索引号,发送至第二文件对应的设备;Send the index number of the second file to the device corresponding to the second file;

其中,第二文件的索引号用于:第二文件对应的设备确定第二文件的存储节点并读取第二文件。Wherein, the index number of the second file is used for: the device corresponding to the second file determines the storage node of the second file and reads the second file.

在一种可选的实施例中,上述方法还包括:In an optional embodiment, the above method also includes:

当已存储的第三文件的存储节点中主节点的数据发生改变时,根据已存储的文件的名称与文件的索引号之间的关联关系,确定第三文件的索引号;When the data of the primary node in the storage node of the stored third file is changed, the index number of the third file is determined according to the association relationship between the name of the stored file and the index number of the file;

基于确定出的索引设备的路由信息,根据第三文件的已有父目录,从索引设备的第一设备中确定第三文件对应的设备;Based on the determined routing information of the index device, according to the existing parent directory of the third file, determine the device corresponding to the third file from the first device of the index device;

将修改后的第三文件和第三文件的索引号,发送至第三文件对应的设备;Sending the modified third file and the index number of the third file to the device corresponding to the third file;

其中,第三文件对应的设备用于根据第三文件的索引号确定第三文件的存储节点中的备份节点,第三文件的备份节点用于将所存储数据更新为修改后的第三文件。Wherein, the device corresponding to the third file is used to determine the backup node among the storage nodes of the third file according to the index number of the third file, and the backup node of the third file is used to update the stored data to the modified third file.

然后,以索引设备侧对存储方法进行描述。Then, the storage method is described on the indexing device side.

本发明实施例提供一种存储方法,该方法应用于索引设备中,图8为本发明实施例中的另一种可选的存储方法的流程示意图,如图8所示,该方法可以包括:An embodiment of the present invention provides a storage method, which is applied to an index device. FIG. 8 is a schematic flowchart of another optional storage method in an embodiment of the present invention. As shown in FIG. 8 , the method may include:

S801:接收来自接入设备所发送的第一文件和第一文件的索引号;S801: Receive the first file and the index number of the first file sent from the access device;

其中,第一文件的索引号是由接入设备利用第一文件的已有父目录,和接入设备向第一文件分配的标识码生成;Wherein, the index number of the first file is generated by the access device using the existing parent directory of the first file and the identification code assigned by the access device to the first file;

S802:确定存储设备中,用于存储第一文件的存储节点的标识;S802: Determine an identifier of a storage node used to store the first file in the storage device;

S803:将第一文件的索引号与第一文件的存储节点的标识之间的对应关系存储于索引设备的第一设备和第二设备中。S803: Store the correspondence between the index number of the first file and the identifier of the storage node of the first file in the first device and the second device of the index devices.

在一种可选的实施例中,上述方法还包括:In an optional embodiment, the above method also includes:

当接收到存储设备针对第一文件的写入成功的回复消息时,向接入设备发送针对第一文件的写入成功的响应消息;其中,响应消息用于接入设备提示用户所述第一文件存储成功。When receiving a response message from the storage device that the writing of the first file is successful, send a response message to the access device that the writing of the first file is successful; wherein, the response message is used for the access device to prompt the user that the first The file was saved successfully.

在一种可选的实施例中,上述方法还包括:In an optional embodiment, the above method also includes:

当接入设备接收到已存储的第二文件的读取请求时,第一设备接收到第二文件的索引号;When the access device receives the read request of the stored second file, the first device receives the index number of the second file;

第一设备根据已存储的文件的索引号与文件的存储节点的标识之间的对应关系,确定第二文件的存储节点;The first device determines the storage node of the second file according to the corresponding relationship between the index number of the stored file and the identifier of the storage node of the file;

第一设备从第二文件的存储节点中读取第二文件。The first device reads the second file from the storage node of the second file.

在一种可选的实施例中,上述方法还包括:In an optional embodiment, the above method also includes:

当已存储的第三文件的存储节点中的主节点的数据发生修改时,第一设备接收来自接入设备发送的修改后的第三文件和第三文件的索引号;When the data of the master node in the stored storage node of the third file is modified, the first device receives the modified third file and the index number of the third file sent from the access device;

第一设备根据已存储的文件的索引号与文件的存储节点的标识之间的对应关系,确定第三文件的存储节点中的备份节点;The first device determines the backup node among the storage nodes of the third file according to the corresponding relationship between the index number of the stored file and the identifier of the storage node of the file;

其中,第三文件的备份节点用于:将所存储的数据更新为修改后的第三文件。Wherein, the backup node of the third file is used for: updating the stored data to the modified third file.

在一种可选的实施例中,所述方法还包括:In an optional embodiment, the method also includes:

第二设备接收到来自接入设备针对索引设备的路由信息的获取请求;The second device receives a request from the access device for obtaining routing information of the index device;

第二设备将第二设备所管理的第一设备的路由信息确定为索引设备的路由信息,并发送至接入设备。The second device determines the routing information of the first device managed by the second device as the routing information of the indexing device, and sends the routing information to the access device.

在一种可选的实施例中,所述方法还包括:In an optional embodiment, the method also includes:

当第二设备所管理的其中一个第一设备发生故障时,第二设备从第二设备所管理的其他的第一设备中选取出一个第一设备;When one of the first devices managed by the second device fails, the second device selects a first device from other first devices managed by the second device;

第二设备将其中一个第一设备中存储的文件的索引号与文件的存储节点的标识之间的对应关系,发送至选取出的一个第一设备并进行存储,并更新索引设备的路由信息。The second device sends the corresponding relationship between the index number of the file stored in one of the first devices and the identifier of the storage node of the file to the selected first device for storage, and updates the routing information of the index device.

基于前述实施例相同的发明构思,本发明实施例提供一种接入设备,与上述一个或多个实施例提供的所述接入设备一致。Based on the same inventive concept as the foregoing embodiments, the embodiments of the present invention provide an access device, which is consistent with the access device provided in one or more embodiments above.

图9为本发明实施例中的一种可选的接入设备的结构示意图,如图9所示,该接入设备包括:FIG. 9 is a schematic structural diagram of an optional access device in an embodiment of the present invention. As shown in FIG. 9, the access device includes:

分配模块91,用于在接收到针对第一文件的存储请求的情况下,向第一文件分配标识码;An allocation module 91, configured to allocate an identification code to the first file when a storage request for the first file is received;

生成模块92,用于利用第一文件的已有父目录和标识码,生成第一文件的索引号;A generating module 92, configured to generate an index number of the first file by utilizing the existing parent directory and the identification code of the first file;

第一存储模块93,用于将第一文件的名称与第一文件的索引号之间的关联关系进行存储;The first storage module 93 is configured to store the association relationship between the name of the first file and the index number of the first file;

发送模块94,用于将第一文件的名称和第一文件的索引号,发送至索引设备;A sending module 94, configured to send the name of the first file and the index number of the first file to the indexing device;

其中,索引设备用于在确定存储设备中用于存储第一文件的存储节点的标识后,将第一文件的索引号与第一文件的存储节点的标识之间的对应关系存储至索引设备的第一设备和第二设备中。Wherein, the indexing device is configured to store the corresponding relationship between the index number of the first file and the storage node's identifier of the first file in the indexing device after determining the identifier of the storage node used to store the first file in the storage device. first device and second device.

在一种可选的实施例中,上述接入设备还用于:In an optional embodiment, the above access device is also used for:

向第二设备发送针对索引设备的路由信息的获取请求;sending an acquisition request for routing information of the indexing device to the second device;

接收到来自第二设备发送的索引设备的路由信息;receiving routing information from the indexing device sent by the second device;

当接收到的索引设备的路由信息的版本号与已存储的索引设备的路由信息的版本号相同时,将已存储的索引设备的路由信息确定为确定出的索引设备的路由信息;When the version number of the received routing information of the indexing device is the same as the version number of the stored routing information of the indexing device, determining the stored routing information of the indexing device as the determined routing information of the indexing device;

当接收到的索引设备的路由信息的版本号与已存储的索引设备的路由信息的版本号不同时,将接收到的索引设备的路由信息确定为确定出的索引设备的路由信息;When the version number of the received routing information of the indexing device is different from the version number of the stored routing information of the indexing device, determining the received routing information of the indexing device as the determined routing information of the indexing device;

基于确定出的索引设备的路由信息,根据第一文件的已有父目录,从索引设备的第一设备中确定第一文件对应的设备。Based on the determined routing information of the index device, and according to the existing parent directory of the first file, the device corresponding to the first file is determined from the first devices of the index device.

在一种可选的实施例中,上述接入设备还用于:In an optional embodiment, the above access device is also used for:

接收到来自第一文件对应的设备发送的针对第一文件的写入成功的响应消息时,生成提示信息;其中,提示信息用于提示用户所述第一文件存储成功。When receiving a response message from the device corresponding to the first file that the writing of the first file is successful, a prompt message is generated; wherein the prompt message is used to prompt the user that the first file is successfully stored.

在一种可选的实施例中,上述接入设备还用于:In an optional embodiment, the above access device is also used for:

接收到已存储的第二文件的读取请求;receiving a read request of the stored second file;

根据已存储的文件的名称与文件的索引号之间的关联关系,确定第二文件的索引号;Determine the index number of the second file according to the association between the stored file name and the index number of the file;

基于确定出的索引设备的路由信息,根据第二文件的已有父目录,从索引设备的第一设备中确定第二文件对应的设备;Based on the determined routing information of the index device, according to the existing parent directory of the second file, determine the device corresponding to the second file from the first device of the index device;

将第二文件的索引号,发送至第二文件对应的设备;Send the index number of the second file to the device corresponding to the second file;

其中,第二文件的索引号用于:第二文件对应的设备确定第二文件的存储节点并读取所述第二文件。Wherein, the index number of the second file is used for: the device corresponding to the second file determines the storage node of the second file and reads the second file.

在一种可选的实施例中,上述接入设备还用于:In an optional embodiment, the above access device is also used for:

当已存储的第三文件的存储节点中的主节点的数据发生改变时,根据已存储的文件的名称与文件的索引号之间的关联关系,确定第三文件的索引号;When the data of the primary node in the storage node of the stored third file is changed, the index number of the third file is determined according to the association relationship between the name of the stored file and the index number of the file;

基于确定出的索引设备的路由信息,根据第三文件的已有父目录,从索引设备的第一设备中确定第三文件对应的设备;Based on the determined routing information of the index device, according to the existing parent directory of the third file, determine the device corresponding to the third file from the first device of the index device;

将修改后的第三文件和第三文件的索引号,发送至第三文件对应的设备;Sending the modified third file and the index number of the third file to the device corresponding to the third file;

其中,第三文件对应的设备用于根据第三文件的索引号确定第三文件的存储节点中的备份节点,第三文件的备份节点用于将所存储数据更新为修改后的第三文件。Wherein, the device corresponding to the third file is used to determine the backup node among the storage nodes of the third file according to the index number of the third file, and the backup node of the third file is used to update the stored data to the modified third file.

在实际应用中,上述分配模块91,生成模块92,第一存储模块93和发送模块94可由位于接入设备上的处理器实现,具体为中央处理器(CPU,Central Processing Unit)、微处理器(MPU,Microprocessor Unit)、数字信号处理器(DSP,Digital Signal Processing)或现场可编程门阵列(FPGA,Field Programmable Gate Array)等实现。In practical applications, the above-mentioned distribution module 91, generation module 92, first storage module 93 and sending module 94 can be implemented by a processor located on the access device, specifically a central processing unit (CPU, Central Processing Unit), a microprocessor (MPU, Microprocessor Unit), digital signal processor (DSP, Digital Signal Processing) or field programmable gate array (FPGA, Field Programmable Gate Array) and other implementations.

本发明实施例提供一种第一设备,与上述一个或者多个实施例中所述的第一设备一致。An embodiment of the present invention provides a first device, which is consistent with the first device described in one or more embodiments above.

图10为本发明实施例中的一种可选的索引设备的结构示意图,如图10所示,该索引设备包括:FIG. 10 is a schematic structural diagram of an optional indexing device in an embodiment of the present invention. As shown in FIG. 10, the indexing device includes:

接收模块101,用于接收来自接入设备发送的第一文件和第一文件的索引号;其中,第一文件的索引号是由接入设备利用第一文件的已有父目录,和接入设备向第一文件分配的标识码生成;The receiving module 101 is configured to receive the first file and the index number of the first file sent from the access device; wherein, the index number of the first file is obtained by the access device using the existing parent directory of the first file, and access generating an identification code assigned by the device to the first file;

确定模块102,用于确定存储设备中,用于存储第一文件的存储节点的标识;A determining module 102, configured to determine an identifier of a storage node used to store the first file in the storage device;

第二存储模块103,用于将第一文件的索引号与第一文件的存储节点的标识之间的对应关系存储于索引设备的第一设备和第二设备中。The second storage module 103 is configured to store the corresponding relationship between the index number of the first file and the identifier of the storage node of the first file in the first device and the second device of the index devices.

在一种可选的实施例中,上述第一设备还用于:In an optional embodiment, the above-mentioned first device is also used for:

当接收到存储设备针对第一文件的写入成功的回复消息时,向接入设备发送针对第一文件的写入成功的响应消息;其中,响应消息用于接入设备提示用户第一文件存储成功。When receiving a reply message from the storage device that the writing of the first file is successful, send a response message to the access device that the writing of the first file is successful; wherein, the response message is used by the access device to prompt the user to store the first file success.

在一种可选的实施例中,上述的第一设备还用于:In an optional embodiment, the above-mentioned first device is also used for:

当接入设备接收到已存储的第二文件的读取请求时,接收到第二文件的索引号;When the access device receives the read request of the stored second file, the index number of the second file is received;

根据已存储的文件的索引号与文件的存储节点的标识之间的对应关系,确定第二文件的存储节点;According to the corresponding relationship between the index number of the stored file and the identifier of the storage node of the file, determine the storage node of the second file;

从所述第二文件的存储节点中读取第二文件。The second file is read from the storage node of the second file.

在一种可选的实施例中,上述第一设备还用于:In an optional embodiment, the above-mentioned first device is also used for:

当已存储的第三文件的存储节点中的主节点的数据发生改变时,接收来自接入设备发送的修改后的第三文件和第三文件的索引号;When the data of the master node in the storage node of the stored third file changes, receiving the modified third file and the index number of the third file sent from the access device;

根据已存储的文件的索引号与文件的存储节点的标识之间的对应关系,确定第三文件的存储节点中的备份节点;According to the corresponding relationship between the index number of the stored file and the identification of the storage node of the file, determine the backup node in the storage node of the third file;

其中,第三文件的备份节点用于:将所存储的数据更新为修改后的第三文件。Wherein, the backup node of the third file is used for: updating the stored data to the modified third file.

在一种可选的实施例中,上述第二设备还用于:In an optional embodiment, the above-mentioned second device is also used for:

接收到来自接入设备针对索引设备的路由信息的获取请求;receiving a request from the access device for obtaining routing information of the index device;

将第二设备所管理的第一设备的路由信息确定为索引设备的路由信息,并发送至接入设备。The routing information of the first device managed by the second device is determined as the routing information of the indexing device, and sent to the access device.

在一种可选的实施例中,上述第二设备还用于:In an optional embodiment, the above-mentioned second device is also used for:

当第二设备所管理的其中一个第一设备发生故障时,从第二设备所管理的其他的第一设备中选取出一个第一设备;When one of the first devices managed by the second device fails, select a first device from other first devices managed by the second device;

将其中一个第一设备中存储的文件的索引号与文件的存储节点的标识之间的对应关系,发送至选取出的一个第一设备并进行存储,并更新索引设备的路由信息。The corresponding relationship between the index number of the file stored in one of the first devices and the identifier of the storage node of the file is sent to the selected first device for storage, and the routing information of the index device is updated.

在实际应用中,上述接收模块101、确定模块102和第二存储模块103可由位于索引设备上的处理器实现,具体为CPU、MPU、DSP或FPGA等实现。In practical applications, the above-mentioned receiving module 101, determining module 102 and second storage module 103 may be implemented by a processor located on the indexing device, specifically a CPU, MPU, DSP, or FPGA.

图11为本发明实施例中的另一种可选的接入设备的结构示意图,如图11所示,本发明实施例提供了一种接入设备1100,包括:Fig. 11 is a schematic structural diagram of another optional access device in the embodiment of the present invention. As shown in Fig. 11, the embodiment of the present invention provides an access device 1100, including:

处理器111以及存储有所述处理器111可执行指令的存储介质112,所述存储介质112通过通信总线113依赖所述处理器111执行操作,当所述指令被所述处理器111执行时,执行上述实施例一所述存储方法。The processor 111 and the storage medium 112 storing instructions executable by the processor 111, the storage medium 112 relies on the processor 111 to perform operations through the communication bus 113, when the instructions are executed by the processor 111, Execute the storage method described in Embodiment 1 above.

需要说明的是,实际应用时,终端中的各个组件通过通信总线113耦合在一起。可理解,通信总线113用于实现这些组件之间的连接通信。通信总线113除包括数据总线之外,还包括电源总线、控制总线和状态信号总线。但是为了清楚说明起见,在图11中将各种总线都标为通信总线113。It should be noted that, in actual application, various components in the terminal are coupled together through the communication bus 113 . It can be understood that the communication bus 113 is used to realize connection and communication between these components. In addition to the data bus, the communication bus 113 also includes a power bus, a control bus and a status signal bus. However, the various buses are labeled as communication bus 113 in FIG. 11 for clarity of illustration.

图12为本发明实施例中的另一种可选的索引设备的结构示意图,如图12所示,本发明实施例提供了一种索引设备1200,包括:FIG. 12 is a schematic structural diagram of another optional indexing device in an embodiment of the present invention. As shown in FIG. 12 , an indexing device 1200 is provided in an embodiment of the present invention, including:

处理器121以及存储有所述处理器121可执行指令的存储介质122,所述存储介质122通过通信总线123依赖所述处理器121执行操作,当所述指令被所述处理器121执行时,执行上述实施例一所述存储方法。The processor 121 and the storage medium 122 storing instructions executable by the processor 121, the storage medium 122 relies on the processor 121 to perform operations through the communication bus 123, when the instructions are executed by the processor 121, Execute the storage method described in Embodiment 1 above.

需要说明的是,实际应用时,终端中的各个组件通过通信总线123耦合在一起。可理解,通信总线123用于实现这些组件之间的连接通信。通信总线123除包括数据总线之外,还包括电源总线、控制总线和状态信号总线。但是为了清楚说明起见,在图12中将各种总线都标为通信总线123。It should be noted that, in actual application, various components in the terminal are coupled together through the communication bus 123 . It can be understood that the communication bus 123 is used to realize connection and communication between these components. In addition to the data bus, the communication bus 123 also includes a power bus, a control bus and a status signal bus. However, the various buses are labeled as communication bus 123 in FIG. 12 for clarity of illustration.

本发明实施例提供了一种文件系统,图13为本发明实施例中的一种可选的文件系统的结构示意图,如图13所示,该文件系统1300包括上述一个或多个实施例中所述接入设备,上述一个或多个实施例中所述的索引设备,以及存储设备。An embodiment of the present invention provides a file system. FIG. 13 is a schematic structural diagram of an optional file system in an embodiment of the present invention. As shown in FIG. 13 , the file system 1300 includes The access device, the index device described in one or more embodiments above, and the storage device.

本发明实施例提供了一种计算机存储介质,存储有可执行指令,当所述可执行指令被一个或多个处理器执行的时候,所述处理器执行实施例一所述的存储方法。An embodiment of the present invention provides a computer storage medium storing executable instructions. When the executable instructions are executed by one or more processors, the processors execute the storage method described in Embodiment 1.

其中,计算机可读存储介质可以是磁性随机存取存储器(ferromagnetic randomaccess memory,FRAM)、只读存储器(Read Only Memory,ROM)、可编程只读存储器(Programmable Read-Only Memory,PROM)、可擦除可编程只读存储器(ErasableProgrammable Read-Only Memory,EPROM)、电可擦除可编程只读存储器(ElectricallyErasable Programmable Read-Only Memory,EEPROM)、快闪存储器(Flash Memory)、磁表面存储器、光盘、或只读光盘(Compact Disc Read-Only Memory,CD-ROM)等存储器。Wherein, the computer-readable storage medium may be a magnetic random access memory (ferromagnetic random access memory, FRAM), a read-only memory (Read Only Memory, ROM), a programmable read-only memory (Programmable Read-Only Memory, PROM), an erasable In addition to programmable read-only memory (Erasable Programmable Read-Only Memory, EPROM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), flash memory (Flash Memory), magnetic surface memory, optical disc, Or a memory such as a Compact Disc Read-Only Memory (CD-ROM).

本领域内的技术人员应明白,本发明的实施例可提供为方法、系统、或计算机程序产品。因此,本发明可采用硬件实施例、软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器和光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art should understand that the embodiments of the present invention may be provided as methods, systems, or computer program products. Accordingly, the present invention can take the form of a hardware embodiment, a software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) having computer-usable program code embodied therein.

本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It should be understood that each procedure and/or block in the flowchart and/or block diagram, and a combination of procedures and/or blocks in the flowchart and/or block diagram can be realized by computer program instructions. These computer program instructions may be provided to a general purpose computer, special purpose computer, embedded processor, or processor of other programmable data processing equipment to produce a machine such that the instructions executed by the processor of the computer or other programmable data processing equipment produce a An apparatus for realizing the functions specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.

这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to operate in a specific manner, such that the instructions stored in the computer-readable memory produce an article of manufacture comprising instruction means, the instructions The device realizes the function specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.

这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing device, causing a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, thereby The instructions provide steps for implementing the functions specified in the flow chart or blocks of the flowchart and/or the block or blocks of the block diagrams.

以上所述,仅为本发明的较佳实施例而已,并非用于限定本发明的保护范围。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the protection scope of the present invention.

Claims (14)

1. A storage method is applied to access equipment and comprises the following steps:
in the event that a storage request for a first file is received, assigning an identification code to the first file;
generating an index number of the first file by using the existing parent directory of the first file and the identification code;
storing the incidence relation between the name of the first file and the index number of the first file;
sending the first file and the index number of the first file to index equipment;
the index device is used for storing the corresponding relation between the index number of the first file and the identifier of the storage node of the first file into the first device and the second device of the index device after the identifier of the storage node of the first file in the storage device is determined.
2. The method of claim 1, further comprising:
sending an acquisition request aiming at the routing information of the index device to the second device;
receiving routing information of the index device sent by the second device;
when the received version number of the routing information of the index device is the same as the stored version number of the routing information of the index device, determining the stored routing information of the index device as the determined routing information of the index device;
when the version number of the received routing information of the index device is different from the version number of the stored routing information of the index device, determining the received routing information of the index device as the determined routing information of the index device;
and determining equipment corresponding to the first file from the first equipment of the indexing equipment according to the determined routing information of the indexing equipment and the existing parent directory of the first file.
3. The method according to claim 1 or 2, characterized in that the method further comprises:
receiving a reading request of a stored second file;
determining the index number of the second file according to the association relationship between the name of the stored file and the index number of the file;
determining equipment corresponding to the second file from first equipment of the indexing equipment according to the determined routing information of the indexing equipment and the existing parent directory of the second file;
sending the index number of the second file to the equipment corresponding to the second file;
wherein the index number of the second file is used to: and the device corresponding to the second file determines the storage node of the second file and reads the second file.
4. The method according to claim 1 or 2, characterized in that the method further comprises:
when the data of a main node in a storage node of a stored third file is changed, determining the index number of the third file according to the association relationship between the name of the stored file and the index number of the file;
determining equipment corresponding to the third file from first equipment of the indexing equipment according to the determined routing information of the indexing equipment and the existing parent directory of the third file;
sending the modified third file and the index number of the third file to equipment corresponding to the third file;
the device corresponding to the third file is configured to determine a backup node in the storage node of the third file according to the index number of the third file, where the backup node of the third file is configured to update the stored data to the modified third file.
5. A storage method is applied to an index device and comprises the following steps:
receiving a first file sent by access equipment and an index number of the first file; the index number of the first file is generated by an access device by using an existing parent directory of the first file and an identification code allocated to the first file by the access device;
determining an identifier of a storage node in the storage device for storing the first file;
and storing the corresponding relation between the index number of the first file and the identifier of the storage node of the first file in first equipment and second equipment of the index equipment.
6. The method of claim 5, further comprising:
when the access equipment receives a reading request of a stored second file, the first equipment receives an index number of the second file;
the first equipment determines the storage node of the second file according to the corresponding relation between the index number of the stored file and the identifier of the storage node of the file;
and the first device reads the second file from the storage node of the second file.
7. The method of claim 5, further comprising:
when the data of the main node in the storage node of the stored third file is changed, the first device receives the modified third file sent by the access device and the index number of the third file;
the first equipment determines a backup node in the storage nodes of the third file according to the corresponding relation between the index number of the stored file and the identification of the storage node of the file;
wherein the backup node of the third file is configured to: updating the stored data to the modified third file.
8. The method of claim 5, further comprising:
the second equipment receives an acquisition request of the routing information of the index equipment from the access equipment;
and the second equipment determines the routing information of the first equipment managed by the second equipment as the routing information of the index equipment, and sends the routing information to the access equipment.
9. The method of claim 8, further comprising:
when one of the first devices managed by the second device fails, the second device selects one first device from the other first devices managed by the second device;
and the second equipment sends the corresponding relation between the index number of the file stored in one of the first equipment and the identifier of the storage node of the file to the selected one of the first equipment for storage, and updates the routing information of the index equipment.
10. An access device, comprising:
the device comprises an allocation module, a storage module and a processing module, wherein the allocation module is used for allocating an identification code to a first file under the condition of receiving a storage request aiming at the first file;
the generating module is used for generating an index number of the first file by utilizing the existing parent directory of the first file and the identification code;
the first storage module is used for storing the association relationship between the name of the first file and the index number of the first file;
the sending module is used for sending the first file and the index number of the first file to an index device;
the index device is used for storing the corresponding relation between the index number of the first file and the identifier of the storage node of the first file into the first device and the second device of the index device after the identifier of the storage node of the first file in the storage device is determined.
11. An indexing device, comprising:
the receiving module is used for receiving a first file sent by access equipment and an index number of the first file; the index number of the first file is generated by an access device by using an existing parent directory of the first file and an identification code allocated to the first file by the access device;
the determining module is used for determining the identification of a storage node in the storage equipment, which is used for storing the first file;
and the second storage module is used for storing the corresponding relation between the index number of the first file and the identifier of the storage node of the first file in the first equipment and the second equipment of the index equipment.
12. An access device, comprising:
a processor and a storage medium storing instructions executable by the processor to perform operations dependent on the processor via a communication bus, the instructions when executed by the processor performing the storage method of any of claims 1 to 4.
13. An indexing apparatus, comprising:
a processor and a storage medium storing processor-executable instructions that depend on the processor via a communication bus to perform operations, the instructions when executed by the processor performing the storage method of any of claims 5 to 9 above.
14. A computer storage medium having stored thereon executable instructions which, when executed by one or more processors, perform the storage method of any one of claims 1 to 4 or the storage method of any one of claims 5 to 9.
CN202110823074.5A 2021-07-21 2021-07-21 A storage method, device, system and computer storage medium Pending CN115687250A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110823074.5A CN115687250A (en) 2021-07-21 2021-07-21 A storage method, device, system and computer storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110823074.5A CN115687250A (en) 2021-07-21 2021-07-21 A storage method, device, system and computer storage medium

Publications (1)

Publication Number Publication Date
CN115687250A true CN115687250A (en) 2023-02-03

Family

ID=85044787

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110823074.5A Pending CN115687250A (en) 2021-07-21 2021-07-21 A storage method, device, system and computer storage medium

Country Status (1)

Country Link
CN (1) CN115687250A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116186046A (en) * 2023-02-24 2023-05-30 深圳乐信软件技术有限公司 Device data modification method and device, computer device and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116186046A (en) * 2023-02-24 2023-05-30 深圳乐信软件技术有限公司 Device data modification method and device, computer device and storage medium
CN116186046B (en) * 2023-02-24 2024-02-20 深圳市乐信信息服务有限公司 Device data modification method and device, computer device and storage medium

Similar Documents

Publication Publication Date Title
US11153380B2 (en) Continuous backup of data in a distributed data store
US10929428B1 (en) Adaptive database replication for database copies
US11755415B2 (en) Variable data replication for storage implementing data backup
US10387673B2 (en) Fully managed account level blob data encryption in a distributed storage environment
JP6404907B2 (en) Efficient read replica
CN107734026B (en) Design method, device and equipment for network attached storage cluster
CN111078121B (en) Data migration method and system for distributed storage system and related components
US10659225B2 (en) Encrypting existing live unencrypted data using age-based garbage collection
CN102779185B (en) High-availability distribution type full-text index method
JP6196368B2 (en) Avoiding system-wide checkpoints in distributed database systems
US8918392B1 (en) Data storage mapping and management
US10922303B1 (en) Early detection of corrupt data partition exports
US8930364B1 (en) Intelligent data integration
WO2019001017A1 (en) Inter-cluster data migration method and system, server, and computer storage medium
WO2017167171A1 (en) Data operation method, server, and storage system
US11151162B2 (en) Timestamp consistency for synchronous replication
CN111225003B (en) NFS node configuration method and device
CN113032356B (en) Cabin distributed file storage system and implementation method
CN115687250A (en) A storage method, device, system and computer storage medium
CN105022779A (en) Method for realizing HDFS file access by utilizing Filesystem API
CN112131191A (en) A management method, device and device for a NAMENODE file system
CN115484274B (en) Data synchronization system and method
JP2014174870A (en) Virtual file access system, virtual file access method and virtual file access program
US12242505B1 (en) Recovering from interruptions in database replication streams
Solissa et al. Hadoop high availability with Linux HA

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