Movatterモバイル変換


[0]ホーム

URL:


CN115454994A - Metadata storage method and device based on distributed key value database - Google Patents

Metadata storage method and device based on distributed key value database
Download PDF

Info

Publication number
CN115454994A
CN115454994ACN202210906067.6ACN202210906067ACN115454994ACN 115454994 ACN115454994 ACN 115454994ACN 202210906067 ACN202210906067 ACN 202210906067ACN 115454994 ACN115454994 ACN 115454994A
Authority
CN
China
Prior art keywords
metadata
value
hash
preset
key
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
CN202210906067.6A
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 Telecom Cloud Technology Co Ltd
Original Assignee
China Telecom Cloud Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Telecom Cloud Technology Co LtdfiledCriticalChina Telecom Cloud Technology Co Ltd
Priority to CN202210906067.6ApriorityCriticalpatent/CN115454994A/en
Publication of CN115454994ApublicationCriticalpatent/CN115454994A/en
Priority to PCT/CN2022/141807prioritypatent/WO2024021488A1/en
Pendinglegal-statusCriticalCurrent

Links

Images

Classifications

Landscapes

Abstract

Translated fromChinese

本发明公开了一种基于分布式键值数据库的元数据存储方法及装置,涉及数据处理领域,该方法包括:确定桶内存储的对象的元数据,并确定所述元数据的预设类型以及键‑值对;基于所述元数据已确定的预设类型以及键‑值对,将所述元数据保存至对应的哈希表以及有序列表中;所述分布式存储系统中每个桶均通过至少一个哈希表和至少一个有序列表存储元数据,所述哈希表用于存储元数据,所述有序列表用于存储元数据的检索信息。本发明减少了I/O操作的复杂度,在保证效率的同时提升单桶存储规模,实现了高效率、低空间利用率的适用于跨多有序列表的元数据的检索。

Figure 202210906067

The invention discloses a metadata storage method and device based on a distributed key-value database, and relates to the field of data processing. The method includes: determining the metadata of an object stored in a bucket, and determining the preset type of the metadata and key-value pair; based on the determined preset type and key-value pair of the metadata, save the metadata into a corresponding hash table and an ordered list; each bucket in the distributed storage system The metadata is stored through at least one hash table and at least one ordered list, the hash table is used to store the metadata, and the ordered list is used to store retrieval information of the metadata. The present invention reduces the complexity of I/O operations, increases the storage scale of a single bucket while ensuring efficiency, and realizes the retrieval of metadata applicable to multiple ordered lists with high efficiency and low space utilization.

Figure 202210906067

Description

Translated fromChinese
一种基于分布式键值数据库的元数据存储方法及装置Method and device for storing metadata based on distributed key-value database

技术领域technical field

本发明涉及数据处理领域,具体涉及一种基于分布式键值数据库的元数据存储方法及装置。The invention relates to the field of data processing, in particular to a metadata storage method and device based on a distributed key-value database.

背景技术Background technique

分布式对象存储系统中会为每个桶维护一份索引表,保存了桶和桶内全部对象元数据之间的映射关系,当用户访问桶内对象时,是通过桶索引获取对象的具体数据,而当桶内存储的对象数量过大时,超大的索引会造成性能和可靠性的问题。为了解决单桶对象规模的限制,现有技术中采用了动态分片机制,通过创建多份索引表,但是在进行桶分片时会对桶内的对象元数据进行再平衡,如果桶内存储了大量的对象,在分片时数据再平衡操作会非常耗时,阻塞了前端的写入,给用户带来非常不友好的体验。The distributed object storage system maintains an index table for each bucket, which saves the mapping relationship between the bucket and all object metadata in the bucket. When a user accesses an object in a bucket, the specific data of the object is obtained through the bucket index , and when the number of objects stored in the bucket is too large, a large index will cause performance and reliability problems. In order to solve the limitation of single-bucket object size, dynamic fragmentation mechanism is adopted in the existing technology, by creating multiple index tables, but the object metadata in the bucket will be rebalanced during bucket fragmentation, if the bucket stores With a large number of objects, the data rebalancing operation during sharding will be very time-consuming, blocking the front-end writing, and bringing a very unfriendly experience to users.

因此,如何解决分布式对象存储系统中单桶对象存储规模受限和分片机制带来的业务阻塞问题,是目前业界亟待解决的重要课题。Therefore, how to solve the problem of business congestion caused by the limited scale of single-bucket object storage and the fragmentation mechanism in the distributed object storage system is an important issue that needs to be solved urgently in the industry.

发明内容Contents of the invention

有鉴于此,本发明实施例提供了一种基于分布式键值数据库的元数据存储方法及装置,以解决分布式对象存储系统中单桶对象存储规模受限和分片机制带来的业务阻塞问题。In view of this, the embodiment of the present invention provides a metadata storage method and device based on a distributed key-value database to solve the business congestion caused by the limited scale of single-bucket object storage and the sharding mechanism in a distributed object storage system question.

根据第一方面,本发明实施例提供了一种基于分布式键值数据库的元数据存储方法,所述方法应用于服务端,所述服务端安装有分布式对象存储系统,所述方法包括:According to the first aspect, an embodiment of the present invention provides a metadata storage method based on a distributed key-value database, the method is applied to a server, and the server is installed with a distributed object storage system, and the method includes:

确定桶内存储的对象的元数据,并确定所述元数据的预设类型以及键-值对;Determine the metadata of the object stored in the bucket, and determine the preset type and key-value pair of the metadata;

基于所述元数据已确定的预设类型以及键-值对,将所述元数据保存至对应的哈希表以及有序列表中;所述分布式存储系统中每个桶均通过至少一个哈希表和至少一个有序列表存储元数据,所述哈希表用于存储元数据,所述有序列表用于存储元数据的检索信息。Based on the determined preset type and key-value pair of the metadata, save the metadata into a corresponding hash table and an ordered list; each bucket in the distributed storage system passes at least one hash The hash table and at least one ordered list store metadata, the hash table is used to store metadata, and the ordered list is used to store retrieval information of metadata.

结合第一方面,在第一方面第一实施方式中,所述预设类型包括第一、第二、第三和第四类型,第一类型的元数据为基本元数据,第二类型的元数据为对象属性元数据,第三类型的元数据为索引元数据,第四类型的元数据为索引顺序元数据;With reference to the first aspect, in the first implementation manner of the first aspect, the preset types include the first, second, third and fourth types, the first type of metadata is basic metadata, and the second type of metadata The data is object attribute metadata, the third type of metadata is index metadata, and the fourth type of metadata is index sequence metadata;

所述基于所述元数据已确定的预设类型以及键-值对,将所述元数据保存至对应的哈希表以及有序列表中,具体包括:The method of storing the metadata in a corresponding hash table and an ordered list based on the determined preset type and key-value pair of the metadata specifically includes:

基于已确定的预设类型,将所述元数据存储至预设类型对应的容器组中;每一种预设类型的元数据均对应一个所述容器组,每一个所述容器组均对应至少一个哈希槽,且,所述容器组对应的哈希槽的数量彼此相等;Based on the determined preset type, the metadata is stored in a container group corresponding to the preset type; each preset type of metadata corresponds to one container group, and each container group corresponds to at least One hash slot, and the number of hash slots corresponding to the container group is equal to each other;

基于所述元数据的键-值对,确定所述元数据的CRC16值,基于哈希槽的总数以及已确定的CRC16值,确定元数据对应的哈希槽;Determine the CRC16 value of the metadata based on the key-value pair of the metadata, and determine the hash slot corresponding to the metadata based on the total number of hash slots and the determined CRC16 value;

将所述元数据映射并存储至已确定的哈希槽对应的所述哈希表;每一个所述哈希表对应至少一个哈希槽;Mapping and storing the metadata to the hash tables corresponding to the determined hash slots; each of the hash tables corresponds to at least one hash slot;

为所述元数据分配对应的分数值,基于已分配的所述分数值,确定所述元数据对应的所述有序列表,并将所述元数据存储至对应的所述有序列表中;所述有序列表中各项所述元数据按照所述分数值进行顺序排序。assigning a corresponding score value to the metadata, determining the ordered list corresponding to the metadata based on the assigned score value, and storing the metadata in the corresponding ordered list; The metadata of each item in the ordered list is sorted according to the score value.

结合第一方面第一实施方式,在第一方面第二实施方式中,所述哈希表的数量是基于预设数量和所述哈希槽的总数确定的,所述哈希表的数量超过所述预设数量且为所述总数的因数。With reference to the first implementation of the first aspect, in the second implementation of the first aspect, the number of the hash tables is determined based on the preset number and the total number of the hash slots, and the number of the hash tables exceeds The preset number is a factor of the total number.

结合第一方面,在第一方面第三实施方式中,该方法还包括以下步骤:With reference to the first aspect, in the third implementation manner of the first aspect, the method further includes the following steps:

确定客户端的元数据检索请求;所述元数据检索请求中包含检索信息,所述检索信息包括每个所述有序列表的索引顺序和索引元素数目;Determine the metadata retrieval request of the client; the metadata retrieval request includes retrieval information, and the retrieval information includes the index order and the number of index elements of each of the ordered lists;

基于所述检索信息,从每个所述有序列表中取出对应的所述元数据;Based on the search information, extract the corresponding metadata from each of the ordered lists;

将所述元数据存放至预设map表中,基于所述预设map表,对所述预设map表中存储的所述元数据进行顺序排序,将完成所述元数据存放及排序的所述预设map表返回给客户端。Storing the metadata into a preset map table, and sorting the metadata stored in the preset map table based on the preset map table, will complete all the steps of storing and sorting the metadata The above preset map table is returned to the client.

结合第一方面,在第一方面第四实施方式中,该方法还包括以下步骤:With reference to the first aspect, in the fourth implementation manner of the first aspect, the method further includes the following steps:

确定客户端的元数据检索请求;所述元数据检索请求中包含检索信息,所述检索信息包括基准元数据和索引元素数目;Determine the metadata retrieval request of the client; the metadata retrieval request includes retrieval information, and the retrieval information includes reference metadata and the number of index elements;

确定所述基准元数据在每个所述有序列表中的存储位置;determining a storage location of said reference metadata in each of said ordered lists;

基于所述检索信息和所述存储位置,从每个所述有序列表中取出对应的所述元数据;Based on the retrieval information and the storage location, fetch the corresponding metadata from each of the ordered lists;

将所述元数据存放至预设map表中,基于所述预设map表,对所述预设map表中存储的所述元数据进行顺序排序,将完成所述元数据存放及排序的所述预设map表返回给客户端。Storing the metadata into a preset map table, and sorting the metadata stored in the preset map table based on the preset map table, will complete all the steps of storing and sorting the metadata The above preset map table is returned to the client.

结合第一方面第三实施方式或者第四实施方式,在第一方面第五实施方式中,所述将所述元数据存放至预设map表中,基于所述预设map表,对所述预设map表中存储的所述元数据进行顺序排序,将完成所述元数据存放及排序的所述预设map表返回给客户端,还包括:With reference to the third implementation manner or the fourth implementation manner of the first aspect, in the fifth implementation manner of the first aspect, the metadata is stored in a preset map table, and based on the preset map table, the The metadata stored in the preset map table is sorted sequentially, and the preset map table that completes the storage and sorting of the metadata is returned to the client, and further includes:

确定所述预设map表达到存储上限且存在未存入的所述元数据,基于所述预设map表,确定未存入的所述元数据与所述预设map表中最尾端的元数据的map表排序值;It is determined that the preset map expression has reached the storage limit and there is metadata that has not been stored, and based on the preset map table, it is determined that the metadata that has not been stored and the last metadata in the preset map table The sorting value of the map table of the data;

确定所述最尾端的元数据对应的map表排序值超过未存入的所述元数据对应的map表排序值,删除所述所述最尾端的元数据,并将未存入的所述元数据存储至所述预设map表中。Determine that the map table sorting value corresponding to the last metadata exceeds the map table sorting value corresponding to the unstored metadata, delete the last metadata, and replace the unstored metadata The data is stored in the preset map table.

根据第二方面,本发明实施例还提供了一种所述基于分布式键值数据库的元数据存储装置,所述装置应用于服务端,所述服务端安装有分布式对象存储系统,所述装置包括:According to the second aspect, the embodiment of the present invention also provides a metadata storage device based on a distributed key-value database, the device is applied to a server, and the server is installed with a distributed object storage system, the Devices include:

第一确定模块,用于确定桶内存储的对象的元数据,并确定所述元数据的预设类型以及键-值对;The first determination module is used to determine the metadata of the object stored in the bucket, and determine the preset type and key-value pair of the metadata;

数据存储模块,用于基于所述元数据已确定的预设类型以及键-值对,将所述元数据保存至对应的哈希表以及有序列表中;所述分布式存储系统中每个桶均通过至少一个哈希表和至少一个有序列表存储元数据,所述哈希表用于存储元数据,所述有序列表用于存储元数据的检索信息。A data storage module, configured to store the metadata in a corresponding hash table and an ordered list based on the determined preset type and key-value pair of the metadata; each of the distributed storage systems Each bucket stores metadata through at least one hash table and at least one ordered list, the hash table is used to store metadata, and the ordered list is used to store retrieval information of metadata.

根据第三方面,本发明实施例还提供了一种电子设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述程序时实现如上述任一种所述基于分布式键值数据库的元数据存储方法的步骤。According to the third aspect, an embodiment of the present invention also provides an electronic device, including a memory, a processor, and a computer program stored on the memory and operable on the processor. When the processor executes the program, the above-mentioned Steps in any one of the distributed key-value database-based metadata storage methods.

根据第四方面,本发明实施例还提供了一种非暂态计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现如上述任一种所述基于分布式键值数据库的元数据存储方法的步骤。According to the fourth aspect, an embodiment of the present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the distributed key-based Steps in the metadata storage method for the value database.

根据第五方面,本发明实施例还提供了一种计算机程序产品,包括计算机程序,所述计算机程序被处理器执行时实现如上述任一种所述基于分布式键值数据库的元数据存储方法的步骤。According to the fifth aspect, an embodiment of the present invention also provides a computer program product, including a computer program, and when the computer program is executed by a processor, it implements the metadata storage method based on a distributed key-value database as described above. A step of.

本发明提供的基于分布式键值数据库的元数据存储方法及装置,通过将对象的元数据以键值对的形式存储在分布式key-value集群中,并且采用分表的方式,用多个哈希表以及多个有序列表来承载一个桶内对象的元数据,通过哈希表进行元数据的存储减少了I/O操作的复杂度,在保证效率的同时提升单桶存储规模,通过有序列表进行元数据的存储提供对象元数据的增删改查的接口,在不增加存储成本的基础上,实现了高效率、低空间利用率的适用于跨多有序列表的元数据的检索。The metadata storage method and device based on the distributed key-value database provided by the present invention store the metadata of objects in the distributed key-value cluster in the form of key-value pairs, and adopt the method of sub-table, using multiple A hash table and multiple ordered lists are used to carry the metadata of objects in a bucket. The storage of metadata through the hash table reduces the complexity of I/O operations and improves the storage scale of a single bucket while ensuring efficiency. The ordered list stores metadata and provides an interface for adding, deleting, modifying and querying object metadata. On the basis of not increasing the storage cost, it realizes the retrieval of metadata suitable for multiple ordered lists with high efficiency and low space utilization. .

附图说明Description of drawings

通过参考附图会更加清楚的理解本发明的特征和优点,附图是示意性的而不应理解为对本发明进行任何限制,在附图中:The features and advantages of the present invention will be more clearly understood by referring to the accompanying drawings, which are schematic and should not be construed as limiting the invention in any way. In the accompanying drawings:

图1示出了本发明提供的基于分布式键值数据库的元数据存储方法的流程示意图;Fig. 1 shows the schematic flow chart of the metadata storage method based on the distributed key-value database provided by the present invention;

图2示出了本发明提供的基于分布式键值数据库的元数据存储方法中步骤S20的流程示意图;FIG. 2 shows a schematic flow diagram of step S20 in the metadata storage method based on the distributed key-value database provided by the present invention;

图3示出了本发明提供的基于分布式键值数据库的元数据存储装置的结构示意图;FIG. 3 shows a schematic structural diagram of a metadata storage device based on a distributed key-value database provided by the present invention;

图4示出了本发明提供的电子设备的结构示意图。Fig. 4 shows a schematic structural diagram of an electronic device provided by the present invention.

具体实施方式detailed description

为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments It is a part of embodiments of the present invention, but not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative efforts fall within the protection scope of the present invention.

目前基于分布式存储架构的分布式对象存储系统成为了云计算的一种优选方案,其文件存储更是具有可共享、价格低廉等优势。分布式对象存储系统中对象元数据分为两部分进行存储:一部分为对象的索引元数据,称为omap,omap指代的是object map,即用来保存key-value键值对map数据的对象,在分布式存储中,omap对象有着非常重要的作用,在分布式存储提供的文件和对象服务中,omap性能的表现直接影响集群存储性能的表现,omap保存在本地文件系统之外的独立的key-value(键-值)存储系统中,在使用filestore时是levelDB,在使用bluestore时是rocksDB;另一部分为对象的扩展属性,称为xattr,通常用来保存对象的版本信息等,xattr保存在桶(bucket)的RADOS(Reliable AutonomicDistributed Object Store)的对象中,RADOS的对象又存储在本地文件系统内,其大小受文件系统限制,导致其所能承载的对象数受限保。这就导致在读取对象的元数据时需要分两个I/O路径进行相关数据的读取,分别对应本地文件系统和key-value存储系统。At present, the distributed object storage system based on the distributed storage architecture has become a preferred solution for cloud computing, and its file storage has the advantages of being shareable and low in price. The object metadata in the distributed object storage system is divided into two parts for storage: one part is the index metadata of the object, called omap, and omap refers to the object map, that is, the object used to store the key-value pair map data , in distributed storage, the omap object plays a very important role. In the file and object services provided by distributed storage, the performance of omap directly affects the performance of cluster storage. Omap is stored in an independent file system outside the local file system. In the key-value (key-value) storage system, it is levelDB when using filestore, and rocksDB when using bluestore; the other part is the extended attribute of the object, called xattr, which is usually used to save the version information of the object, etc., xattr saves In the RADOS (Reliable Autonomic Distributed Object Store) object in the bucket, the RADOS object is stored in the local file system, and its size is limited by the file system, resulting in a limited number of objects it can carry. This leads to the need to divide two I/O paths to read related data when reading the metadata of the object, corresponding to the local file system and the key-value storage system respectively.

分布式对象存储系统中会为每个桶维护一份索引表,保存了桶和桶内全部对象元数据之间的映射关系,当用户访问桶内对象时,是通过桶索引获取对象的具体数据,而当桶内存储的对象数量过大时,超大的索引会造成性能和可靠性的问题。为了解决单桶对象规模的限制,现有技术中采用了动态分片机制,也就是使用多个RADOS对象维护桶索引,通过创建多份索引表,解决单个索引对象可能过大导致不能满足数据增长等业务需要的问题。但是在进行桶分片时会对桶内的对象元数据进行再平衡,将旧的RADOS对象中的索引数据重新进行计算和组织迁移到新的RADOS对象中。那么,如果桶内存储了大量的对象,在分片时数据再平衡操作会非常耗时,阻塞了前端的写入,给用户带来非常不友好的体验。The distributed object storage system maintains an index table for each bucket, which saves the mapping relationship between the bucket and all object metadata in the bucket. When a user accesses an object in a bucket, the specific data of the object is obtained through the bucket index , and when the number of objects stored in the bucket is too large, a large index will cause performance and reliability problems. In order to solve the limitation of the size of a single bucket object, the existing technology adopts a dynamic fragmentation mechanism, that is, uses multiple RADOS objects to maintain the bucket index, and creates multiple index tables to solve the problem that a single index object may be too large to meet the data growth and other business needs. However, during bucket sharding, the object metadata in the bucket will be rebalanced, and the index data in the old RADOS object will be recalculated and organized and migrated to the new RADOS object. Then, if a large number of objects are stored in the bucket, the data rebalancing operation during sharding will be very time-consuming, blocking front-end writing, and bringing a very unfriendly experience to users.

针对上述问题,下面结合图1对本发明的基于分布式键值数据库的元数据存储方法进行描述,该方法旨在解决原生分布式对象存储中单桶对象存储规模受限和分片机制带来的业务阻塞的问题,该方法应用于服务端,服务端安装有分布式对象存储系统,该方法包括:In view of the above problems, the metadata storage method based on the distributed key-value database of the present invention will be described in conjunction with Fig. 1 below. For the problem of business blocking, this method is applied to the server, and the server is installed with a distributed object storage system. The method includes:

S10、确定桶(bucket)内存储的对象的元数据,并确定元数据的预设类型(type)以及键-值对。具体的,确定服务端中每个桶内存储的元数据以及元数据的预设类型以及键-值对。S10. Determine the metadata of the object stored in the bucket (bucket), and determine the preset type (type) and key-value pair of the metadata. Specifically, determine the metadata stored in each bucket in the server, as well as the preset type and key-value pair of the metadata.

在本申请中,预设类型包括第一、第二、第三和第四类型。其中,第一类型的元数据为基本元数据(object metadata),基本元数据保存了对象最新版本的基本信息包括size、instance和last version等;第二类型的元数据为对象属性元数据(xattrs),也就是对象自身的属性信息;第三类型的元数据为索引元数据(omap),索引元数据保存了桶对象索引信息也就是omap信息;第四类型的元数据为索引顺序元数据(omap order),索引顺序元数保存了桶内对象所有omap的顺序列表。In the present application, the preset types include first, second, third and fourth types. Among them, the first type of metadata is basic metadata (object metadata), which stores the basic information of the latest version of the object, including size, instance, and last version, etc.; the second type of metadata is object attribute metadata (xattrs ), which is the attribute information of the object itself; the third type of metadata is index metadata (omap), which stores the index information of the bucket object, that is, omap information; the fourth type of metadata is index sequence metadata ( omap order), the index order element saves the ordered list of all omaps of objects in the bucket.

S20、基于元数据已确定的预设类型以及键-值对,将元数据保存至对应的哈希表(hash table)以及有序列表(zset)中。在本申请中,分布式存储系统中每个桶均通过至少一个哈希表和至少一个有序列表存储元数据,具体的,本申请中哈希表用于存储元数据,有序列表用于存储元数据的检索信息。S20. Based on the determined preset type and key-value pair of the metadata, save the metadata into a corresponding hash table (hash table) and ordered list (zset). In this application, each bucket in the distributed storage system stores metadata through at least one hash table and at least one ordered list. Specifically, in this application, the hash table is used to store metadata, and the ordered list is used to Retrieval information for storing metadata.

在本申请中,依托分布式key-value数据的数据结构构建单桶多表的元数据存储模型,原生分布式对象存储系统中只包括对象网关和后端数据存储,本发明在此基础上增加了专有的分布式key-value模块用来存储对象的元数据,实现对象数据和元数据的分离存储。同时本申请重新组织了对象的元数据,去除冗余的数据类型,将元数据重新归纳为四种类型的元数据。由于在对象操作过程中不会同时操作原生分布式对象存储系统中多达几十种类型的元数据,因此可以减小对象元数据粒度,元数据读写操作更灵活,效率更高。In this application, relying on the data structure of distributed key-value data to build a single-bucket multi-table metadata storage model, the original distributed object storage system only includes object gateways and back-end data storage. A proprietary distributed key-value module is used to store metadata of objects, realizing the separate storage of object data and metadata. At the same time, this application reorganizes the metadata of the object, removes redundant data types, and reclassifies the metadata into four types of metadata. Since dozens of types of metadata in the native distributed object storage system will not be operated at the same time during object operation, the granularity of object metadata can be reduced, and metadata read and write operations are more flexible and efficient.

对于同一个桶中的四种预设类型的元数据,该方法均会使用至少一个哈希表和至少一个有序列表进行存储,并且在存储元数据时还会确保在容器组(container)内部是均匀分布的,具体如何实现元数据在容器组中的均匀分布,将在下文阐述。For the four preset types of metadata in the same bucket, this method will use at least one hash table and at least one ordered list for storage, and when storing metadata, it will also ensure that it is inside the container group (container) It is evenly distributed. How to realize the uniform distribution of metadata in the container group will be explained below.

在本申请中,对象的元数据以键值对的形式存储在分布式key-value集群中,该方法采用分表的方式,用多个哈希表来承载一个桶内对象的元数据,每个哈希表最多能存储42亿个键值对,多个哈希表能轻松支撑百亿级别的对象的元数据,通过将对象的元数据统一存储在分布式key-value的哈希表中,其读写操作的时间复杂度为0或者1,减少了I/O操作的复杂度,并且在保证效率的同时提升单桶存储规模,不需要再从本地文件系统中加载RADOS对象数据了。In this application, the metadata of objects is stored in the form of key-value pairs in the distributed key-value cluster. This method adopts the method of sub-tables, and uses multiple hash tables to carry the metadata of objects in a bucket. A hash table can store up to 4.2 billion key-value pairs, and multiple hash tables can easily support the metadata of tens of billions of objects, by uniformly storing the metadata of objects in a distributed key-value hash table , the time complexity of its read and write operations is 0 or 1, which reduces the complexity of I/O operations, and improves the storage scale of a single bucket while ensuring efficiency, and does not need to load RADOS object data from the local file system.

本申请的提供的基于分布式键值数据库的元数据存储方法,通过将对象的元数据以键值对的形式存储在分布式key-value集群中,并且采用分表的方式,用多个哈希表以及多个有序列表来承载一个桶内对象的元数据,通过哈希表进行元数据的存储减少了I/O操作的复杂度,在保证效率的同时提升单桶存储规模,通过有序列表进行元数据的存储提供对象元数据的增删改查的接口,在不增加存储成本的基础上,实现了高效率、低空间利用率的适用于跨多有序列表的元数据的检索。The metadata storage method based on the distributed key-value database provided by this application stores the metadata of the object in the form of key-value pairs in the distributed key-value cluster, and adopts the method of sub-table, using multiple hash The hash table and multiple ordered lists are used to carry the metadata of objects in a bucket. The storage of metadata through the hash table reduces the complexity of I/O operations and improves the storage scale of a single bucket while ensuring efficiency. The sequence table stores metadata and provides an interface for adding, deleting, modifying and querying object metadata. On the basis of not increasing storage costs, it realizes metadata retrieval suitable for multiple ordered lists with high efficiency and low space utilization.

下面结合图2对本发明的基于分布式键值数据库的元数据存储方法进行描述,步骤S20具体包括:The metadata storage method based on the distributed key-value database of the present invention is described below in conjunction with FIG. 2, and step S20 specifically includes:

S21、基于已确定的预设类型,将元数据存储至预设类型对应的容器组中。在本申请中,每一种预设类型的元数据均对应一个容器组,每一个容器组均对应至少一个哈希槽(hash slot),且,容器组对应的哈希槽的数量彼此相等,即,各个容器组对应的哈希槽的数量保持一致。S21. Based on the determined preset type, store the metadata into a container group corresponding to the preset type. In this application, each preset type of metadata corresponds to a container group, and each container group corresponds to at least one hash slot (hash slot), and the number of hash slots corresponding to the container group is equal to each other, That is, the number of hash slots corresponding to each container group remains consistent.

S22、基于元数据的键-值对,确定元数据的CRC16值,基于哈希槽的总数以及已确定的CRC16值,确定元数据对应的哈希槽。S22. Determine the CRC16 value of the metadata based on the key-value pair of the metadata, and determine the hash slot corresponding to the metadata based on the total number of hash slots and the determined CRC16 value.

具体的,先基于元数据的键(key)计算元数据的CRC16值,然后对哈希槽(hashslot)的总数取模,可以获取到元数据对应的哈希槽(hash slot)。Specifically, the CRC16 value of the metadata is first calculated based on the key of the metadata, and then the total number of hash slots is moduloed to obtain the hash slot corresponding to the metadata.

S23、将元数据映射并存储至已确定的哈希槽对应的哈希表,在该方法中,每一个哈希表对应至少一个哈希槽。S23. Map and store the metadata to a hash table corresponding to the determined hash slot. In this method, each hash table corresponds to at least one hash slot.

为了做到元数据在容器组的各个哈希表中均匀分布,本申请中需要预先对每个哈希表分配槽(slot)分区。对于每一个容器组,整个容器组中的槽(slot)的总数为16384,哈希表数量我们配置为超过预设数量(例如5)且为16384的因数,之后,将这16384个槽(slot)平均分配到容器组中的各个哈希表中。In order to achieve uniform distribution of metadata in each hash table of the container group, it is necessary to pre-allocate slot partitions to each hash table in this application. For each container group, the total number of slots in the entire container group is 16384, and the number of hash tables is configured to exceed the preset number (for example, 5) and is a factor of 16384. After that, the 16384 slots (slot ) are evenly distributed among the hash tables in the container group.

因此,可以通过以下方式确定元数据对应的哈希槽:Therefore, the hash slot corresponding to the metadata can be determined in the following ways:

HASH_SLOT=CRC16(key)mod 16384HASH_SLOT = CRC16(key) mod 16384

通过HASH_SLOT算法可以将桶对象的元数据映射到相应的哈希表中,实现元数据在对应容器组中均匀分布。The metadata of the bucket object can be mapped to the corresponding hash table through the HASH_SLOT algorithm, so that the metadata is evenly distributed in the corresponding container group.

S24、为元数据分配对应的分数值(score),基于已分配的分数值,确定元数据对应的有序列表,并将元数据存储至对应的有序列表中,在该方法中,有序列表中各项元数据按照分数值进行顺序排序,例如基于元数据分配/赋予的分数值,按照分数值由低至高进行单个有序列表中元数据的有序排序。S24. Assign a corresponding score value (score) to the metadata, determine the ordered list corresponding to the metadata based on the assigned score value, and store the metadata into the corresponding ordered list. In this method, the ordered list The metadata in the list are sorted according to the score value, for example, based on the score value assigned/assigned by the metadata, the metadata in a single ordered list is sorted according to the score value from low to high.

在本实施例中,是为元数据的键(key)赋予分数值。In this embodiment, a score value is assigned to a metadata key (key).

相对于上传、下载、删除等单个对象元数据操作的流程,有序对象列表业务无疑是比较复杂的,本申请中使用多个有序列表来维护桶内对象的有序元数据(omap key),这些omap key在单个有序列表内部是有序的,但是为了元数据的均匀分布,跨多个有序列表之间的omap key是做不到有序排列的,为了解决数据检索的效率低的问题,现有技术中又会将元数据分离存储在高性能的磁盘上,例如固态硬盘(Solid State Disk,SSD),然而,虽然对象的读写效率提高了,但是所需的存储成本也大幅增加了。Compared with the process of uploading, downloading, deleting and other single object metadata operations, the ordered object list business is undoubtedly more complicated. In this application, multiple ordered lists are used to maintain the ordered metadata (omap key) of objects in the bucket , these omap keys are ordered within a single ordered list, but for the uniform distribution of metadata, the omap keys across multiple ordered lists cannot be arranged in an orderly manner, in order to solve the low efficiency of data retrieval However, although the read and write efficiency of the object is improved, the required storage cost is also increased. increased substantially.

在一些可能的实施例中,该方法还包括以下步骤,旨在不增加存储成本的基础上,实现了高效率、低空间利用率的适用于跨多有序列表的元数据的检索:In some possible embodiments, the method further includes the following steps, aiming at achieving high-efficiency, low-space-utility retrieval of metadata applicable across multiple ordered lists without increasing storage costs:

A10、确定客户端的元数据检索请求,在这些实施例中,元数据检索请求中包含检索信息,检索信息包括每个有序列表的索引顺序和索引元素数目等。A10. Determine the metadata retrieval request of the client. In these embodiments, the metadata retrieval request includes retrieval information, and the retrieval information includes the index order and the number of index elements of each ordered list.

在本实施例中,不同有序列表的索引顺序和索引元素数目均是一致的,例如元数据检索请求是检索每个有序列表中最靠前的10个元素,即,索引顺序是以最前端的元素开始进行连续的顺序检索,索引元素数目是10。In this embodiment, the index order and the number of index elements of different ordered lists are consistent. For example, the metadata retrieval request is to retrieve the top 10 elements in each ordered list, that is, the index order is the most The elements at the front end start to be retrieved sequentially, and the number of index elements is 10.

A20、基于检索信息,从每个有序列表中取出对应的元数据。例如,从每个有序列表中取出最前端、最尾端、第i至第i+n-1的连续的n个元素(元数据将)。A20. Based on the retrieved information, fetch corresponding metadata from each ordered list. For example, take out the frontmost, the last, i-th to i+n-1 consecutive n elements (metadata will) from each ordered list.

A30、将元数据存放至预设map表中,基于预设map表,对预设map表中存储的元数据进行顺序排序,将完成元数据存放及排序的预设map表返回给客户端。A30. Store the metadata in a preset map table, sort the metadata stored in the preset map table based on the preset map table, and return the preset map table with the metadata stored and sorted to the client.

由于map表本身可以基于元素的字母对元素进行排序,因此当元数据存入预设map表后,预设map表可以对存入的元数据进行顺序排序。预设map表也就是对取出的各个元数据再次进行顺序排序的列表,用户基于预设map表可以进行跨多有序列表的高效率、低空间利用率的元数据的检索。Since the map table itself can sort the elements based on the letters of the elements, after the metadata is stored in the preset map table, the preset map table can sort the stored metadata sequentially. The preset map table is a list that sorts the extracted metadata again. Based on the preset map table, the user can retrieve metadata with high efficiency and low space utilization across multiple ordered lists.

在一些可能的实施例中,该方法还包括以下步骤:In some possible embodiments, the method also includes the following steps:

A40、确定客户端的元数据检索请求,同样的,与步骤A10类似在这些实施例中,元数据检索请求也中包含检索信息,区别在于,检索信息包括基准元数据和索引元素数目等,基准元数据也就是start key。A40. Determine the metadata retrieval request of the client. Similarly, similar to step A10, in these embodiments, the metadata retrieval request also includes retrieval information. The difference is that the retrieval information includes reference metadata and the number of index elements. The data is also the start key.

A50、确定基准元数据在每个有序列表中的存储位置。A50. Determine the storage location of the benchmark metadata in each ordered list.

需要说明的是,基准元数据(start key)是一个确定存在于桶内的元数据,可以理解而是,该基准元数据有且仅会存储在其中一个有序列表中。因此步骤A50中会得到基准元数据在其对应存储的一个有序列表中具体的存储位置也就是存储顺序,也就是在该有序列表中的存储元素编号/序号;对于未存储基准元数据的有序列表,会先确定若基准元数据存储在这些有序列表中的存储位置也就是在有序列表中的存储顺序。例如基于基准元数据的字母以及其他各个有序列表中已存入的元数据的字母,确定基准元数据在未存储基准元数据的有序列表中的预存储位置。It should be noted that the baseline metadata (start key) is metadata that is determined to exist in the bucket. It can be understood that the baseline metadata is stored in only one of the ordered lists. Therefore, in step A50, the specific storage location of the reference metadata in its corresponding stored ordered list is the storage order, that is, the storage element number/serial number in the ordered list; For ordered lists, first determine the storage location if the benchmark metadata is stored in these ordered lists, that is, the storage order in the ordered list. For example, based on the letter of the reference metadata and the letters of the metadata stored in other ordered lists, the pre-storage position of the reference metadata in the ordered list that does not store the reference metadata is determined.

A60、基于检索信息和存储位置,存储位置包括真实的存储位置和预存储位置,从每个有序列表中取出对应的元数据。例如,从预存储位置开始,从未存储基准元数据的有序列表中取出连续的n个元素(元数据)。A60. Based on the retrieved information and the storage location, the storage location includes a real storage location and a pre-storage location, and fetches corresponding metadata from each ordered list. For example, starting from the pre-stored position, consecutive n elements (metadata) are fetched from the ordered list of unstored reference metadata.

A70、将元数据存放至预设map表中,基于预设map表,对预设map表中存储的元数据进行顺序排序,将完成元数据存放及排序的预设map表返回给客户端。A70. Store the metadata in a preset map table, sort the metadata stored in the preset map table based on the preset map table, and return the preset map table with the metadata stored and sorted to the client.

由于map表本身可以基于元素的字母对元素进行排序,因此当元数据存入预设map表后,预设map表可以对存入的元数据进行顺序排序。预设map表也就是对取出的各个元数据再次进行顺序排序的列表,用户基于预设map表可以进行跨多有序列表的高效率、低空间利用率的元数据的检索。Since the map table itself can sort the elements based on the letters of the elements, after the metadata is stored in the preset map table, the preset map table can sort the stored metadata sequentially. The preset map table is a list that sorts the extracted metadata again. Based on the preset map table, the user can retrieve metadata with high efficiency and low space utilization across multiple ordered lists.

预设map表会有存储上限,该存储上限可由用户进行设置,例如存储上限为N个元素,当未打到预设map表的存储上限并且需要存入元数据时,会直接进行元数据的存储,当预设map表达到存储上限时还需要设计相应的检索算法,因此,步骤A30以及步骤A70还会包括:The preset map table has a storage limit, which can be set by the user. For example, the storage limit is N elements. When the storage limit of the preset map table is not reached and metadata needs to be stored, the metadata will be stored directly. For storage, when the preset map expression reaches the storage limit, a corresponding retrieval algorithm needs to be designed. Therefore, steps A30 and A70 will also include:

A80、确定预设map表达到存储上限且存在未存入的元数据,例如存储上限N小于取出的元数据的总数S,基于预设map表,确定未存入的元数据与预设map表中最尾端的元数据的map表排序值,在本实施例中,排序值可以理解为存储位置/存储顺序。A80. Determine that the preset map expression has reached the storage limit and there is metadata that has not been stored. For example, the storage limit N is less than the total number S of metadata taken out. Based on the preset map table, determine the metadata that has not been stored and the preset map table. The sorting value of the map table of the metadata at the end, in this embodiment, the sorting value can be understood as a storage location/storage order.

A90、确定最尾端/最末端的元数据对应的map表排序值超过未存入的元数据对应的map表排序值,删除最尾端的元数据,并将未存入的元数据存储至预设map表。通过以上方式确定每一个未存入的元数据是否需要存入预设map表中,需要说明的是,当删除最尾端的元素且新的元数据存入预设map表后,会对预设map表中所有已存入的元数据依照map表排序值进行重新排序,确保预设map表最尾端的元数据对应的map表排序值是所有元素的map表排序值中的最大值。A90. Determine that the map table sorting value corresponding to the most tail/end metadata exceeds the map table sorting value corresponding to the metadata that has not been stored, delete the metadata at the tail end, and store the metadata that is not stored in the preset Set up a map table. Through the above method, it is determined whether each unsaved metadata needs to be stored in the preset map table. It should be noted that when the last element is deleted and the new metadata is stored in the preset map table, the preset All stored metadata in the map table are reordered according to the sorting value of the map table to ensure that the sorting value of the map table corresponding to the metadata at the end of the preset map table is the maximum value among the sorting values of the map table of all elements.

下面对本发明提供的基于分布式键值数据库的元数据存储装置进行描述,下文描述的基于分布式键值数据库的元数据存储装置与上文描述的基于分布式键值数据库的元数据存储方法可相互对应参照。The metadata storage device based on the distributed key-value database provided by the present invention is described below. The metadata storage device based on the distributed key-value database described below can be compared with the metadata storage method based on the distributed key-value database described above. refer to each other.

下面结合图3对本发明的基于分布式键值数据库的元数据存储装置进行描述,该装置旨在解决原生分布式对象存储中单桶对象存储规模受限和分片机制带来的业务阻塞的问题,该装置应用于服务端,服务端安装有分布式对象存储系统,该装置包括:The metadata storage device based on the distributed key-value database of the present invention will be described in conjunction with Fig. 3 below. The device aims to solve the problem of the limited scale of single-bucket object storage in native distributed object storage and the problem of business congestion caused by the sharding mechanism. , the device is applied to the server, and the server is installed with a distributed object storage system, the device includes:

第一确定模块10,用于确定桶(bucket)内存储的对象的元数据,并确定元数据的预设类型(type)以及键-值对。具体的,确定服务端中每个桶内存储的元数据以及元数据的预设类型以及键-值对。The first determiningmodule 10 is configured to determine metadata of objects stored in the bucket, and determine a preset type (type) and key-value pairs of the metadata. Specifically, determine the metadata stored in each bucket in the server, as well as the preset type and key-value pair of the metadata.

在本申请中,预设类型包括第一、第二、第三和第四类型。其中,第一类型的元数据为基本元数据(object metadata),基本元数据保存了对象最新版本的基本信息包括size、instance和last version等;第二类型的元数据为对象属性元数据(xattrs),也就是对象自身的属性信息;第三类型的元数据为索引元数据(omap),索引元数据保存了桶对象索引信息也就是omap信息;第四类型的元数据为索引顺序元数据(omap order),索引顺序元数保存了桶内对象所有omap的顺序列表。In the present application, the preset types include first, second, third and fourth types. Among them, the first type of metadata is basic metadata (object metadata), which stores the basic information of the latest version of the object, including size, instance, and last version, etc.; the second type of metadata is object attribute metadata (xattrs ), which is the attribute information of the object itself; the third type of metadata is index metadata (omap), which stores the index information of the bucket object, that is, omap information; the fourth type of metadata is index sequence metadata ( omap order), the index order element saves the ordered list of all omaps of objects in the bucket.

数据存储模块20,用于基于元数据已确定的预设类型以及键-值对,将元数据保存至对应的哈希表(hash table)以及有序列表(zset)中。在本申请中,分布式存储系统中每个桶均通过至少一个哈希表和至少一个有序列表存储元数据,具体的,本申请中哈希表用于存储元数据,有序列表用于存储元数据的检索信息。Thedata storage module 20 is configured to store the metadata in a corresponding hash table (hash table) and ordered list (zset) based on the determined preset type and key-value pair of the metadata. In this application, each bucket in the distributed storage system stores metadata through at least one hash table and at least one ordered list. Specifically, in this application, the hash table is used to store metadata, and the ordered list is used to Retrieval information for storing metadata.

在本申请中,依托分布式key-value数据的数据结构构建单桶多表的元数据存储模型,原生分布式对象存储系统中只包括对象网关和后端数据存储,本发明在此基础上增加了专有的分布式key-value模块用来存储对象的元数据,实现对象数据和元数据的分离存储。同时本申请重新组织了对象的元数据,去除冗余的数据类型,将元数据重新归纳为四种类型的元数据。由于在对象操作过程中不会同时操作原生分布式对象存储系统中多达几十种类型的元数据,因此可以减小对象元数据粒度,元数据读写操作更灵活,效率更高。In this application, relying on the data structure of distributed key-value data to build a single-bucket multi-table metadata storage model, the original distributed object storage system only includes object gateways and back-end data storage. A proprietary distributed key-value module is used to store metadata of objects, realizing the separate storage of object data and metadata. At the same time, this application reorganizes the metadata of the object, removes redundant data types, and reclassifies the metadata into four types of metadata. Since dozens of types of metadata in the native distributed object storage system will not be operated at the same time during object operation, the granularity of object metadata can be reduced, and metadata read and write operations are more flexible and efficient.

对于同一个桶中的四种预设类型的元数据,该装置均会使用至少一个哈希表和至少一个有序列表进行存储,并且在存储元数据时还会确保在容器组(container)内部是均匀分布的,具体如何实现元数据在容器组中的均匀分布,将在下文阐述。For the four preset types of metadata in the same bucket, the device will use at least one hash table and at least one ordered list for storage, and also ensure that the metadata is stored inside the container group (container) It is evenly distributed. How to realize the uniform distribution of metadata in the container group will be explained below.

在本申请中,对象的元数据以键值对的形式存储在分布式key-value集群中,该装置采用分表的方式,用多个哈希表来承载一个桶内对象的元数据,每个哈希表最多能存储42亿个键值对,多个哈希表能轻松支撑百亿级别的对象的元数据,通过将对象的元数据统一存储在分布式key-value的哈希表中,其读写操作的时间复杂度为0或者1,减少了I/O操作的复杂度,并且在保证效率的同时提升单桶存储规模,不需要再从本地文件系统中加载RADOS对象数据了。In this application, the metadata of the object is stored in the distributed key-value cluster in the form of key-value pairs. A hash table can store up to 4.2 billion key-value pairs, and multiple hash tables can easily support the metadata of tens of billions of objects, by uniformly storing the metadata of objects in a distributed key-value hash table , the time complexity of its read and write operations is 0 or 1, which reduces the complexity of I/O operations, and improves the storage scale of a single bucket while ensuring efficiency, and does not need to load RADOS object data from the local file system.

本申请的提供的基于分布式键值数据库的元数据存储装置,通过将对象的元数据以键值对的形式存储在分布式key-value集群中,并且采用分表的方式,用多个哈希表以及多个有序列表来承载一个桶内对象的元数据,通过哈希表进行元数据的存储减少了I/O操作的复杂度,在保证效率的同时提升单桶存储规模,通过有序列表进行元数据的存储提供对象元数据的增删改查的接口,在不增加存储成本的基础上,实现了高效率、低空间利用率的适用于跨多有序列表的元数据的检索。The metadata storage device based on the distributed key-value database provided by this application stores the metadata of objects in the distributed key-value cluster in the form of key-value The hash table and multiple ordered lists are used to carry the metadata of objects in a bucket. The storage of metadata through the hash table reduces the complexity of I/O operations and improves the storage scale of a single bucket while ensuring efficiency. The sequence table stores metadata and provides an interface for adding, deleting, modifying and querying object metadata. On the basis of not increasing storage costs, it realizes metadata retrieval suitable for multiple ordered lists with high efficiency and low space utilization.

图4示例了一种电子设备的实体结构示意图,如图4所示,该电子设备可以包括:处理器(processor)810、通信接口(Communications Interface)820、存储器(memory)830和通信总线840,其中,处理器810,通信接口820,存储器830通过通信总线840完成相互间的通信。处理器810可以调用存储器830中的逻辑指令,以执行基于分布式键值数据库的元数据存储方法,该方法包括:FIG. 4 illustrates a schematic diagram of the physical structure of an electronic device. As shown in FIG. 4, the electronic device may include: a processor (processor) 810, a communication interface (Communications Interface) 820, a memory (memory) 830, and acommunication bus 840, Wherein, theprocessor 810 , thecommunication interface 820 , and thememory 830 communicate with each other through thecommunication bus 840 . Theprocessor 810 can invoke logic instructions in thememory 830 to execute a method for storing metadata based on a distributed key-value database, and the method includes:

确定桶内存储的对象的元数据,并确定所述元数据的预设类型以及键-值对;Determine the metadata of the object stored in the bucket, and determine the preset type and key-value pair of the metadata;

基于所述元数据已确定的预设类型以及键-值对,将所述元数据保存至对应的哈希表以及有序列表中;所述分布式存储系统中每个桶均通过至少一个哈希表和至少一个有序列表存储元数据,所述哈希表用于存储元数据,所述有序列表用于存储元数据的检索信息。Based on the determined preset type and key-value pair of the metadata, save the metadata into a corresponding hash table and an ordered list; each bucket in the distributed storage system passes at least one hash The hash table and at least one ordered list store metadata, the hash table is used to store metadata, and the ordered list is used to store retrieval information of metadata.

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

另一方面,本发明还提供一种计算机程序产品,所述计算机程序产品包括计算机程序,计算机程序可存储在非暂态计算机可读存储介质上,所述计算机程序被处理器执行时,计算机能够执行上述各方法所提供的基于分布式键值数据库的元数据存储方法,该方法包括:On the other hand, the present invention also provides a computer program product. The computer program product includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can Executing the metadata storage method based on the distributed key-value database provided by the above methods, the method includes:

确定桶内存储的对象的元数据,并确定所述元数据的预设类型以及键-值对;Determine the metadata of the object stored in the bucket, and determine the preset type and key-value pair of the metadata;

基于所述元数据已确定的预设类型以及键-值对,将所述元数据保存至对应的哈希表以及有序列表中;所述分布式存储系统中每个桶均通过至少一个哈希表和至少一个有序列表存储元数据,所述哈希表用于存储元数据,所述有序列表用于存储元数据的检索信息。Based on the determined preset type and key-value pair of the metadata, save the metadata into a corresponding hash table and an ordered list; each bucket in the distributed storage system passes at least one hash The hash table and at least one ordered list store metadata, the hash table is used to store metadata, and the ordered list is used to store retrieval information of metadata.

又一方面,本发明还提供一种非暂态计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现以执行上述各方法提供的基于分布式键值数据库的元数据存储方法,该方法包括:In yet another aspect, the present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it is implemented to execute the metadata based on the distributed key-value database provided by the above methods. A data storage method, the method comprising:

确定桶内存储的对象的元数据,并确定所述元数据的预设类型以及键-值对;Determine the metadata of the object stored in the bucket, and determine the preset type and key-value pair of the metadata;

基于所述元数据已确定的预设类型以及键-值对,将所述元数据保存至对应的哈希表以及有序列表中;所述分布式存储系统中每个桶均通过至少一个哈希表和至少一个有序列表存储元数据,所述哈希表用于存储元数据,所述有序列表用于存储元数据的检索信息。Based on the determined preset type and key-value pair of the metadata, save the metadata into a corresponding hash table and an ordered list; each bucket in the distributed storage system passes at least one hash The hash table and at least one ordered list store metadata, the hash table is used to store metadata, and the ordered list is used to store retrieval information of metadata.

以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性的劳动的情况下,即可以理解并实施。The device embodiments described above are only illustrative, and the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in One place, or it can be distributed to multiple network elements. Part or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. It can be understood and implemented by those skilled in the art without any creative effort.

通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到各实施方式可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件。基于这样的理解,上述技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在计算机可读存储介质中,如ROM/RAM、磁碟、光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行各个实施例或者实施例的某些部分所述的方法。Through the above description of the implementations, those skilled in the art can clearly understand that each implementation can be implemented by means of software plus a necessary general hardware platform, and of course also by hardware. Based on this understanding, the essence of the above technical solution or the part that contributes to the prior art can be embodied in the form of software products, and the computer software products can be stored in computer-readable storage media, such as ROM/RAM, magnetic discs, optical discs, etc., including several instructions to make a computer device (which may be a personal computer, server, or network device, etc.) execute the methods described in various embodiments or some parts of the embodiments.

最后应说明的是:以上实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围。Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: it can still be Modifications are made to the technical solutions described in the foregoing embodiments, or equivalent replacements are made to some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the various embodiments of the present invention.

Claims (10)

Translated fromChinese
1.一种基于分布式键值数据库的元数据存储方法,其特征在于,所述方法应用于服务端,所述服务端安装有分布式对象存储系统,所述方法包括:1. A metadata storage method based on a distributed key-value database, wherein the method is applied to a server, and the server is equipped with a distributed object storage system, and the method includes:确定桶内存储的对象的元数据,并确定所述元数据的预设类型以及键-值对;Determine the metadata of the object stored in the bucket, and determine the preset type and key-value pair of the metadata;基于所述元数据已确定的预设类型以及键-值对,将所述元数据保存至对应的哈希表以及有序列表中;所述分布式存储系统中每个桶均通过至少一个哈希表和至少一个有序列表存储元数据,所述哈希表用于存储元数据,所述有序列表用于存储元数据的检索信息。Based on the determined preset type and key-value pair of the metadata, save the metadata into a corresponding hash table and an ordered list; each bucket in the distributed storage system passes at least one hash The hash table and at least one ordered list store metadata, the hash table is used to store metadata, and the ordered list is used to store retrieval information of metadata.2.根据权利要求1所述的基于分布式键值数据库的元数据存储方法,其特征在于,所述预设类型包括第一、第二、第三和第四类型,第一类型的元数据为基本元数据,第二类型的元数据为对象属性元数据,第三类型的元数据为索引元数据,第四类型的元数据为索引顺序元数据;2. The metadata storage method based on a distributed key-value database according to claim 1, wherein the preset types include first, second, third and fourth types, and the metadata of the first type is basic metadata, the second type of metadata is object attribute metadata, the third type of metadata is index metadata, and the fourth type of metadata is index sequence metadata;所述基于所述元数据已确定的预设类型以及键-值对,将所述元数据保存至对应的哈希表以及有序列表中,具体包括:The method of storing the metadata in a corresponding hash table and an ordered list based on the determined preset type and key-value pair of the metadata specifically includes:基于已确定的预设类型,将所述元数据存储至预设类型对应的容器组中;每一种预设类型的元数据均对应一个所述容器组,每一个所述容器组均对应至少一个哈希槽,且,所述容器组对应的哈希槽的数量彼此相等;Based on the determined preset type, the metadata is stored in a container group corresponding to the preset type; each preset type of metadata corresponds to one container group, and each container group corresponds to at least One hash slot, and the number of hash slots corresponding to the container group is equal to each other;基于所述元数据的键-值对,确定所述元数据的CRC16值,基于哈希槽的总数以及已确定的CRC16值,确定元数据对应的哈希槽;Determine the CRC16 value of the metadata based on the key-value pair of the metadata, and determine the hash slot corresponding to the metadata based on the total number of hash slots and the determined CRC16 value;将所述元数据映射并存储至已确定的哈希槽对应的所述哈希表;每一个所述哈希表对应至少一个哈希槽;Mapping and storing the metadata to the hash tables corresponding to the determined hash slots; each of the hash tables corresponds to at least one hash slot;为所述元数据分配对应的分数值,基于已分配的所述分数值,确定所述元数据对应的所述有序列表,并将所述元数据存储至对应的所述有序列表中;所述有序列表中各项所述元数据按照所述分数值进行顺序排序。assigning a corresponding score value to the metadata, determining the ordered list corresponding to the metadata based on the assigned score value, and storing the metadata in the corresponding ordered list; The metadata of each item in the ordered list is sorted according to the score value.3.根据权利要求2所述的基于分布式键值数据库的元数据存储方法,其特征在于,所述哈希表的数量是基于预设数量和所述哈希槽的总数确定的,所述哈希表的数量超过所述预设数量且为所述总数的因数。3. the metadata storage method based on distributed key-value database according to claim 2, is characterized in that, the quantity of described hash table is determined based on the total number of preset quantity and described hash groove, and described The number of hash tables exceeds the preset number and is a factor of the total number.4.根据权利要求1所述的基于分布式键值数据库的元数据存储方法,其特征在于,该方法还包括以下步骤:4. the metadata storage method based on distributed key-value database according to claim 1, is characterized in that, this method also comprises the following steps:确定客户端的元数据检索请求;所述元数据检索请求中包含检索信息,所述检索信息包括每个所述有序列表的索引顺序和索引元素数目;Determine the metadata retrieval request of the client; the metadata retrieval request includes retrieval information, and the retrieval information includes the index order and the number of index elements of each of the ordered lists;基于所述检索信息,从每个所述有序列表中取出对应的所述元数据;Based on the search information, extract the corresponding metadata from each of the ordered lists;将所述元数据存放至预设map表中,基于所述预设map表,对所述预设map表中存储的所述元数据进行顺序排序,将完成所述元数据存放及排序的所述预设map表返回给客户端。Storing the metadata into a preset map table, and sorting the metadata stored in the preset map table based on the preset map table, will complete all the steps of storing and sorting the metadata The above preset map table is returned to the client.5.根据权利要求1所述的基于分布式键值数据库的元数据存储方法,其特征在于,该方法还包括以下步骤:5. the metadata storage method based on distributed key-value database according to claim 1, is characterized in that, this method also comprises the following steps:确定客户端的元数据检索请求;所述元数据检索请求中包含检索信息,所述检索信息包括基准元数据和索引元素数目;Determine the metadata retrieval request of the client; the metadata retrieval request includes retrieval information, and the retrieval information includes reference metadata and the number of index elements;确定所述基准元数据在每个所述有序列表中的存储位置;determining a storage location of said reference metadata in each of said ordered lists;基于所述检索信息和所述存储位置,从每个所述有序列表中取出对应的所述元数据;Based on the retrieval information and the storage location, fetch the corresponding metadata from each of the ordered lists;将所述元数据存放至预设map表中,基于所述预设map表,对所述预设map表中存储的所述元数据进行顺序排序,将完成所述元数据存放及排序的所述预设map表返回给客户端。Storing the metadata into a preset map table, and sorting the metadata stored in the preset map table based on the preset map table, will complete all the steps of storing and sorting the metadata The above preset map table is returned to the client.6.根据权利要求4或者5所述的基于分布式键值数据库的元数据存储方法,其特征在于,所述将所述元数据存放至预设map表中,基于所述预设map表,对所述预设map表中存储的所述元数据进行顺序排序,将完成所述元数据存放及排序的所述预设map表返回给客户端,还包括:6. The metadata storage method based on a distributed key-value database according to claim 4 or 5, wherein the metadata is stored in a preset map table, based on the preset map table, Sequentially sorting the metadata stored in the preset map table, and returning the preset map table with the metadata stored and sorted to the client, further comprising:确定所述预设map表达到存储上限且存在未存入的所述元数据,基于所述预设map表,确定未存入的所述元数据与所述预设map表中最尾端的元数据的map表排序值;It is determined that the preset map expression has reached the storage limit and there is metadata that has not been stored, and based on the preset map table, it is determined that the metadata that has not been stored and the last metadata in the preset map table The sorting value of the map table of the data;确定所述最尾端的元数据对应的map表排序值超过未存入的所述元数据对应的map表排序值,删除所述所述最尾端的元数据,并将未存入的所述元数据存储至所述预设map表中。Determine that the map table sorting value corresponding to the last metadata exceeds the map table sorting value corresponding to the unstored metadata, delete the last metadata, and replace the unstored metadata The data is stored in the preset map table.7.一种基于分布式键值数据库的元数据存储装置,其特征在于,所述装置应用于服务端,所述服务端安装有分布式对象存储系统,所述装置包括:7. A metadata storage device based on a distributed key-value database, wherein the device is applied to a server, and the server is equipped with a distributed object storage system, and the device includes:第一确定模块,用于确定桶内存储的对象的元数据,并确定所述元数据的预设类型以及键-值对;The first determination module is used to determine the metadata of the object stored in the bucket, and determine the preset type and key-value pair of the metadata;数据存储模块,用于基于所述元数据已确定的预设类型以及键-值对,将所述元数据保存至对应的哈希表以及有序列表中;所述分布式存储系统中每个桶均通过至少一个哈希表和至少一个有序列表存储元数据,所述哈希表用于存储元数据,所述有序列表用于存储元数据的检索信息。A data storage module, configured to store the metadata in a corresponding hash table and an ordered list based on the determined preset type and key-value pair of the metadata; each of the distributed storage systems Each bucket stores metadata through at least one hash table and at least one ordered list, the hash table is used to store metadata, and the ordered list is used to store retrieval information of metadata.8.一种电子设备,包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述程序时实现如权利要求1至6任一项所述基于分布式键值数据库的元数据存储方法的步骤。8. An electronic device comprising a memory, a processor, and a computer program stored on the memory and operable on the processor, wherein the processor according to claim 1 is implemented when executing the program. Steps of the method for storing metadata based on a distributed key-value database according to any one of 6.9.一种非暂态计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至6任一项所述基于分布式键值数据库的元数据存储方法的步骤。9. A non-transitory computer-readable storage medium, on which a computer program is stored, characterized in that, when the computer program is executed by a processor, the distributed key-value-based The steps of the metadata storage method of the database.10.一种计算机程序产品,包括计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至6任一项所述基于分布式键值数据库的元数据存储方法的步骤。10. A computer program product, comprising a computer program, characterized in that, when the computer program is executed by a processor, it implements the steps of the metadata storage method based on a distributed key-value database according to any one of claims 1 to 6 .
CN202210906067.6A2022-07-292022-07-29Metadata storage method and device based on distributed key value databasePendingCN115454994A (en)

Priority Applications (2)

Application NumberPriority DateFiling DateTitle
CN202210906067.6ACN115454994A (en)2022-07-292022-07-29Metadata storage method and device based on distributed key value database
PCT/CN2022/141807WO2024021488A1 (en)2022-07-292022-12-26Metadata storage method and apparatus based on distributed key-value database

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202210906067.6ACN115454994A (en)2022-07-292022-07-29Metadata storage method and device based on distributed key value database

Publications (1)

Publication NumberPublication Date
CN115454994Atrue CN115454994A (en)2022-12-09

Family

ID=84297062

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202210906067.6APendingCN115454994A (en)2022-07-292022-07-29Metadata storage method and device based on distributed key value database

Country Status (2)

CountryLink
CN (1)CN115454994A (en)
WO (1)WO2024021488A1 (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN116204130A (en)*2023-02-232023-06-02贝格迈思(深圳)技术有限公司Key value storage system and management method thereof
WO2024021488A1 (en)*2022-07-292024-02-01天翼云科技有限公司Metadata storage method and apparatus based on distributed key-value database
CN117724663A (en)*2024-02-072024-03-19济南浪潮数据技术有限公司Data storage method, system, equipment and computer readable storage medium
CN118069650A (en)*2024-02-272024-05-24中国船舶科学研究中心 Distributed data management method based on key value
WO2024212610A1 (en)*2023-12-122024-10-17天翼云科技有限公司Method and device for file data and metadata separation for object storage

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN118760687B (en)*2024-09-042024-12-13北京星辰天合科技股份有限公司 Metadata index processing method, device, electronic device and storage medium
CN119166857A (en)*2024-09-202024-12-20国网北京市电力公司 Photovoltaic grid-connected data storage method, device and electronic equipment
CN119996157B (en)*2025-04-112025-09-12山东鲁软数字科技有限公司智慧能源分公司Fault processing method and system considering timeliness of transformer substation fault recording file

Citations (4)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN108897859A (en)*2018-06-292018-11-27郑州云海信息技术有限公司A kind of metadata retrieval method, apparatus, equipment and computer readable storage medium
US10318491B1 (en)*2015-03-312019-06-11EMC IP Holding Company LLCObject metadata query with distributed processing systems
CN110874360A (en)*2018-09-042020-03-10北京奇虎科技有限公司Ordered queue caching method and device based on fixed capacity
CN113010477A (en)*2021-03-232021-06-22中兴通讯股份有限公司Method and device for retrieving metadata of persistent memory file system and storage structure

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
EP2879325A1 (en)*2013-11-292015-06-03Thomson LicensingMethod for determining a statistic value on data based on encrypted data
CN113821171B (en)*2021-09-012024-06-11上海沄熹科技有限公司Key value storage method based on hash table and LSM tree
CN113886331B (en)*2021-12-032022-03-08苏州浪潮智能科技有限公司 Distributed object storage method, apparatus, electronic device and readable storage medium
CN115454994A (en)*2022-07-292022-12-09天翼云科技有限公司Metadata storage method and device based on distributed key value database

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US10318491B1 (en)*2015-03-312019-06-11EMC IP Holding Company LLCObject metadata query with distributed processing systems
CN108897859A (en)*2018-06-292018-11-27郑州云海信息技术有限公司A kind of metadata retrieval method, apparatus, equipment and computer readable storage medium
CN110874360A (en)*2018-09-042020-03-10北京奇虎科技有限公司Ordered queue caching method and device based on fixed capacity
CN113010477A (en)*2021-03-232021-06-22中兴通讯股份有限公司Method and device for retrieving metadata of persistent memory file system and storage structure

Cited By (6)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
WO2024021488A1 (en)*2022-07-292024-02-01天翼云科技有限公司Metadata storage method and apparatus based on distributed key-value database
CN116204130A (en)*2023-02-232023-06-02贝格迈思(深圳)技术有限公司Key value storage system and management method thereof
WO2024212610A1 (en)*2023-12-122024-10-17天翼云科技有限公司Method and device for file data and metadata separation for object storage
CN117724663A (en)*2024-02-072024-03-19济南浪潮数据技术有限公司Data storage method, system, equipment and computer readable storage medium
CN118069650A (en)*2024-02-272024-05-24中国船舶科学研究中心 Distributed data management method based on key value
CN118069650B (en)*2024-02-272025-03-28中国船舶科学研究中心 Distributed data management method based on key value

Also Published As

Publication numberPublication date
WO2024021488A1 (en)2024-02-01

Similar Documents

PublicationPublication DateTitle
CN115454994A (en)Metadata storage method and device based on distributed key value database
US11061786B1 (en)Cloud-based disaster recovery of a storage system
US10114908B2 (en)Hybrid table implementation by using buffer pool as permanent in-memory storage for memory-resident data
CN105487818B (en)For the efficient De-weight method of repeated and redundant data in cloud storage system
US10831736B2 (en)Fast multi-tier indexing supporting dynamic update
KR102564170B1 (en)Method and device for storing data object, and computer readable storage medium having a computer program using the same
US11169978B2 (en)Distributed pipeline optimization for data preparation
US11580162B2 (en)Key value append
US8868926B2 (en)Cryptographic hash database
CN103345472B (en) Deduplication File System Based on Finite Binary Tree Bloom Filter and Its Construction Method
US20160350302A1 (en)Dynamically splitting a range of a node in a distributed hash table
KR102195836B1 (en)Method for managing index
KR20200053512A (en) KVS tree database
US20200210399A1 (en)Signature-based cache optimization for data preparation
CN111241108A (en) Indexing method, device, electronic device and medium based on key-value pair KV system
US11249968B2 (en)Large object containers with size criteria for storing mid-sized large objects
US10810174B2 (en)Database management system, database server, and database management method
CN113535670B (en)Virtual resource mirror image storage system and implementation method thereof
WO2022121274A1 (en)Metadata management method and apparatus in storage system, and storage system
CN110618790A (en)Mist storage data redundancy removing method based on repeated data deletion
JP2021527291A (en) Chunk base data deduplication
US10747773B2 (en)Database management system, computer, and database management method
WO2024255613A1 (en)Data processing method and apparatus, computer device, and storage medium
US20200019539A1 (en)Efficient and light-weight indexing for massive blob/objects
US20230385240A1 (en)Optimizations for data deduplication operations

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination

[8]ページ先頭

©2009-2025 Movatter.jp