Data storage method, device and equipment, readable storage medium and program product
By storing metadata to multiple sharded databases in the Ceph distributed storage system, the problem of slowing metadata access speed caused by Rocksdb database data sorting operations is solved, and more efficient storage and response speed is achieved.
Patent Information
- Application Number
- CN202311331338.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-13
- Publication Date
- 2025-04-15
AI Technical Summary
In Ceph distributed storage system, when the Rocksdb database stores a large amount of data and performs data sorting operations, the metadata access speed slows down, affecting the system response speed.
By storing the metadata of system objects into multiple shard databases, and storing index information using the index database, the time of data sorting operations and the impact on metadata access is reduced.
It realizes rapid access to metadata, improves the utilization rate of storage space, reduces the impact of data sorting operations on system response, and improves the stability and response speed of distributed storage systems.
Smart Images

Figure CN119828953A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a data storage method, a data storage device, a computer device, a computer-readable storage medium, and a computer program product. Background Art
[0002] Ceph is a distributed storage system with high reliability and scalability. The Ceph distributed storage system includes multiple object storage nodes, each of which can include one or more object storage units (OSDs). Each OSD can allocate and manage disk data through different storage engines (for example, FileStore).
[0003] The storage engine in OSD usually stores the metadata of system objects in a key-value database (for example, Rocksdb database). The amount of metadata stored in Rocksdb database is large, and it takes a long time to search for metadata. After Rocksdb database stores a large amount of data, it will perform data sorting operations on the stored data. Due to the large amount of stored data, it takes a long time for Rocksdb database to perform data sorting operations, and when performing data sorting operations, Rocksdb database will not be able to access metadata, which causes the storage system to respond slowly to data access requests. Summary of the invention
[0004] The embodiments of the present application provide a data storage method, apparatus, device, readable storage medium, and program product, which can utilize multiple shard databases to evenly store metadata of system objects, thereby reducing the time spent on data sorting operations in the shard databases, reducing the impact of data sorting operations on metadata access operations, and improving the speed of responding to requests.
[0005] In one aspect, an embodiment of the present application provides a data storage method, the method comprising:
[0006] In response to a storage request for metadata of a system object, determine the index information to be stored corresponding to the metadata; the system object includes a data group object in an object storage unit, and the object storage unit is a storage space in an object storage node included in a distributed storage system; the index information to be stored includes identification information, and the identification information is determined according to the number of index information currently stored in the index database;
[0007] The index information to be stored is stored in the index database, where the index database is a shard database for storing index information determined from a plurality of shard databases, where the plurality of shard databases are obtained by dividing a key-value database included in the object storage unit, and the key-value database is used to store metadata of a system object corresponding to the object storage unit;
[0008] Determine a target shard database from shard databases other than the index database among the multiple shard databases according to the identification information;
[0009] The data to be stored is determined according to the metadata and the identification information, and the data to be stored is stored in the target shard database.
[0010] In one aspect, an embodiment of the present application provides a data storage device, the device comprising:
[0011] A response unit, configured to respond to a storage request for metadata of a system object and determine index information to be stored corresponding to the metadata; the system object includes a data group object in an object storage unit, and the object storage unit is a storage space in an object storage node included in a distributed storage system; the index information to be stored includes identification information, and the identification information is determined according to the number of index information currently stored in the index database;
[0012] a processing unit, configured to store the index information to be stored in the index database, wherein the index database is a shard database for storing index information determined from a plurality of shard databases, wherein the plurality of shard databases are obtained by dividing a key-value database included in the object storage unit, and the key-value database is used to store metadata of a system object corresponding to the object storage unit;
[0013] The processing unit is further configured to determine a target shard database from shard databases other than the index database among the multiple shard databases according to the identification information;
[0014] A determination unit is used to determine the data to be stored according to the metadata and the identification information, and store the data to be stored in the target shard database.
[0015] On the one hand, an embodiment of the present application provides a computer device, comprising: a processor, a communication interface and a memory, wherein the processor, the communication interface and the memory are interconnected, wherein the memory stores an executable program code, and the processor is used to call the executable program code to implement the data storage method provided in the embodiment of the present application.
[0016] Accordingly, an embodiment of the present application further provides a computer-readable storage medium, in which instructions are stored. When the computer-readable storage medium is executed on a computer, the computer implements the data storage method provided in the embodiment of the present application.
[0017] Accordingly, an embodiment of the present application further provides a computer program product, the computer program product comprising a computer program or a computer instruction, the computer program or the computer instruction being stored in a computer-readable storage medium. A processor of a computer device reads the computer program or the computer instruction from the computer-readable storage medium, and the processor executes the computer program or the computer instruction, so that the computer device implements the data storage method provided in the embodiment of the present application.
[0018] The data storage method provided in the embodiment of the present application can realize fast access operation of metadata by determining index information corresponding to metadata; by storing index information in an index database, hierarchical storage of metadata can be realized, thereby improving the utilization rate of storage space; by determining the target shard database according to identification information, and storing the data to be stored corresponding to the metadata in the target shard database, balanced storage of metadata of system objects is realized, the amount of data stored in a single shard database is reduced, the time spent on searching the shard database is reduced, and the time spent on the shard database for data sorting operations is also reduced, thereby ensuring the stability of the distributed storage system; in the present application, the shard database can be used to realize the storage of metadata. When a shard database performs a sorting operation, other shard databases can respond to data access requests normally, thereby effectively reducing the impact of data sorting operations on accessing metadata, and at the same time, the speed at which the distributed storage system responds to data access requests can be improved, thereby improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0020] Figure 1 is a schematic diagram of a distributed storage system provided in an embodiment of the present application;
[0021] Figure 2 is a schematic diagram of the system architecture of a data storage system provided in an embodiment of the present application;
[0022] Figure 3 It is a flowchart of a data storage method provided by an embodiment of the present application;
[0023] Figure 4 It is a flowchart of another data storage method provided by an embodiment of the present application;
[0024] Figure 5 is a schematic diagram of a data storage method provided in an embodiment of the present application;
[0025] Figure 6 is a schematic diagram of a metadata storage method provided in an embodiment of the present application;
[0026] Figure 7 It is a schematic diagram of a shard database determination method provided in an embodiment of the present application;
[0027] Figure 8 is a schematic diagram of a hierarchical storage method provided in an embodiment of the present application;
[0028] Fig. 9 is a schematic diagram of another distributed storage system provided in an embodiment of the present application;
[0029] Fig.10 is a structural block diagram of a data storage device provided in an embodiment of the present application;
[0030] Fig.11 It is a structural block diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0031] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0032] It should be noted that the descriptions of "first", "second", etc. involved in the embodiments of the present application are only for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the technical features defined as "first" or "second" may explicitly or implicitly include at least one of the features.
[0033] Ceph is a distributed storage system that can provide object, file, and block storage services. The underlying layer of Ceph is Rados, which is an object-based storage system consisting of object storage devices (OSDs) and object management units (MONs). OSDs can allocate and manage disk data through different storage engines. Disk data includes data objects associated with terminal devices and metadata of system objects. The metadata of system objects is usually stored in a key-value database (for example, Rocksdb database). Rocksdb database is a key-value database that can be used to store keywords (keys) and values (values). Keys and values can be arbitrary byte streams and support atomic reading and writing. When the Rocksdb database stores a large amount of data, it will perform data sorting operations. See Figure 1 , which is a schematic diagram of a distributed storage system provided in an embodiment of the present application. Figure 1 In the Ceph distributed storage system, there are two object storage units, namely OSD0 and OSD1. The terminal device can send data access requests to the two object storage units in the Ceph distributed storage system, and the object storage units can respond to the data access requests. Each object storage unit includes a storage engine ( Figure 1 The storage engine in the Rocksdb database is FileStore, which stores the metadata of system objects in the Rocksdb database and other data in the distributed file system XFS (X FileSystem, a new generation of file system). When there is a lot of data stored in the Rocksdb database, the database will perform a data compaction operation (also known as a compaction operation). During the compaction operation, the Rocksdb database will stop responding to data access requests. This will cause a delay in the operation of obtaining metadata, which in turn causes the distributed storage system to respond slowly to data access requests.
[0034] Based on this, an embodiment of the present application provides a data storage method, which can determine the index information to be stored corresponding to the metadata in response to a storage request for the metadata of a system object; the system object includes a data group object in an object storage unit, and the object storage unit is a storage space in an object storage node included in a distributed storage system; the index information to be stored includes identification information, and the identification information is determined according to the number of index information currently stored in the index database; the index information to be stored is stored in the index database, which is a shard database for storing index information determined from multiple shard databases, and the multiple shard databases are obtained by dividing the key-value database included in the object storage unit, and the key-value database is used to store the metadata of the system object corresponding to the object storage unit; a target shard database is determined from the shard databases other than the index database according to the identification information; the data to be stored is determined according to the metadata and the identification information, and the data to be stored is stored in the target shard database. Through the method provided in the embodiment of the present application, hierarchical storage of metadata can be achieved, thereby improving the utilization rate of storage space; balanced storage of system object metadata can be achieved, reducing the time spent on data sorting operations in the sharded database, ensuring the stability of the storage system, and effectively reducing the impact of sorting operations on accessing metadata. At the same time, the speed at which the distributed storage system responds to data access requests can be improved, thereby enhancing the user experience.
[0035] The data storage method provided in the embodiment of the present application can be applied to the field of cloud storage. Cloud storage is a new concept extended and developed from the concept of cloud computing. A distributed cloud storage system (hereinafter referred to as the storage system) refers to a storage system that uses cluster applications, grid technology, and distributed storage file systems to bring together a large number of storage devices of various types (storage devices are also called storage nodes) in the network through application software or application interfaces to work together and jointly provide data storage and business access functions to the outside world. According to the data storage method provided in the embodiment of the present application, it can be applied to a cloud storage system: In this application, the distributed storage system can be a cloud storage system, and the object storage node can be a storage node in the cloud storage system. The data storage method provided in the present application can be used to store the metadata of the system objects, thereby effectively improving the stability of the cloud storage system, increasing the speed at which the cloud storage system responds to data access requests, and improving the user experience.
[0036] The architecture of the data storage system provided in the embodiments of the present application will be introduced below with reference to the accompanying drawings.
[0037] See also Figure 2, which is a schematic diagram of the system architecture of a data storage system provided in an embodiment of the present application, wherein the data storage system includes a terminal device 201 and a distributed storage system, wherein the distributed storage system includes one or more object storage nodes ( Figure 2 The object storage node 202 is taken as an example), and the object storage node may include one or more object storage units ( Figure 2 In the example, the object storage node 202 includes an object storage unit 2021), each of which may include an index database and multiple shard databases ( Figure 2 In the object storage unit 2021, the index database 0 and N shard databases from shard database 1, shard database 2 to shard database N, where N is an integer greater than 2, are isolated from each other and are used to store metadata of system objects. Among them:
[0038] The terminal device 201 can store data in the distributed storage system, and can also obtain data from the distributed storage system. The terminal device 201 can be a handheld device with communication functions (such as a smart phone, a tablet computer), a computing device (such as a personal computer (PC), a vehicle terminal, an intelligent voice interaction device, a wearable device or other intelligent device, but is not limited thereto.
[0039] The object storage node 202 is a storage device in a distributed storage system. Each object storage node may include multiple object storage units, each object storage unit may include an index database and multiple shard databases. The database in the object storage node may be a local database in the object storage node 202.
[0040] The following will explain in detail Figure 2 The data storage system shown works as follows:
[0041] The object storage unit 2021 in the object storage node 202 determines the index information to be stored corresponding to the metadata in response to a storage request for the metadata of the system object, where the system object includes the data group object in the object storage unit 2021, and the index information to be stored includes identification information, which is determined according to the number of index information currently stored in the index database 0 in the object storage unit 2021; the index information to be stored is stored in the index database 0, where the index database 0 is a shard database for storing index information determined from multiple shard databases, and the multiple shard databases are obtained by dividing the key-value database included in the object storage unit 2021, and the key-value database is used to store the metadata of the system object corresponding to the object storage unit 2021; the target shard database can be determined from the shard databases other than the index database in the multiple shard databases according to the identification information ( Figure 2is shard database 1); determine the data to be stored according to the metadata and identification information, and store the data to be stored in the target shard database. When the terminal device 201 sends a data access request to the object storage unit 2021 in the object storage node 202, the object storage unit 2021 responds to the data access request and obtains the metadata of the system object from the corresponding shard database (i.e., shard database 1). Through the data storage method provided in the embodiment of the present application, hierarchical storage of metadata can be achieved, and the utilization rate of storage space can be improved; balanced storage of metadata of system objects can be achieved, the amount of data stored in a single shard database can be reduced, the time spent on searching the shard database can be reduced, and the time spent on data sorting operations on the shard database can be reduced, which can effectively reduce the impact of sorting operations on accessing metadata, while increasing the speed at which the distributed storage system responds to data access requests and improving the user experience.
[0042] It is to be understood that the schematic diagram of the data storage system described in the embodiment of the present application is to more clearly illustrate the data storage method of the embodiment of the present application, and does not constitute a limitation on the data storage method provided in the embodiment of the present application. Figure 2 The number of terminal devices 201, object storage nodes 202 in the distributed storage system, and object storage units 2021 in the object storage nodes are only schematic. Any number of devices and nodes can be configured according to business implementation needs. Moreover, with the evolution of system architecture and the emergence of new business scenarios, the data storage method provided in the embodiment of the present application is also applicable to similar technical problems.
[0043] See also Figure 3 , Figure 3 A schematic diagram of a data storage method provided in an embodiment of the present application. The data storage method can be implemented by the above-mentioned object storage node 202, or by other devices. The process of the data storage method provided in the embodiment of the present application includes but is not limited to:
[0044] S301. In response to a storage request for metadata of a system object, determine the index information to be stored corresponding to the metadata; the system object includes a data group object in an object storage unit, and the object storage unit is a storage space in an object storage node included in a distributed storage system; the index information to be stored includes identification information, and the identification information is determined based on the number of index information currently stored in the index database.
[0045] In an embodiment of the present application, an object storage node may be a storage device in a distributed storage system, and the distributed storage system may include multiple object storage nodes, each object storage node may include multiple object storage units, and the object storage unit is a storage space in the object storage node. An object storage unit may include multiple data group objects, and each data group object may correspond to multiple data objects. For example: the distributed storage system may be a Ceph distributed storage system, the object storage node may be a storage device in the Ceph distributed storage system, and the object storage unit may be a data storage service (OSD for short) in the storage device, which is used to manage the reading and writing of data. When the OSD performs data storage, multiple data objects will correspond to a data group (also called a placement group (PG)). An OSD may include 100 to 200 data groups, and a data group may correspond to tens of thousands of data objects. System objects may include data group objects in an object storage unit, and may also include data objects in an object storage unit that are not related to a terminal device. The metadata of a system object includes attribute data of the system object, etc. After receiving a storage request for metadata of a system object, the object storage unit determines the to-be-stored index information corresponding to the metadata in response to the storage request for metadata of the system object. The to-be-stored index information includes identification information. The identification information is determined based on the number of index information currently stored in the index database. The numerical value corresponding to the identification information increases with the number of index information currently stored in the index database. For example: if the number of index information currently stored in the index database is 10, then it can be determined that the numerical value corresponding to the identification information in the to-be-stored index information is 11. Through the method provided in the embodiment of the present application, the to-be-stored index information corresponding to the metadata can be determined, which is conducive to realizing the hierarchical indexing of the metadata of the system object and effectively improving the access efficiency of the metadata.
[0046] S302. Store the index information to be stored in the index database, where the index database is a shard database for storing index information determined from a plurality of shard databases, and the plurality of shard databases are obtained by dividing the key-value database included in the object storage unit, and the key-value database is used to store metadata of the system object corresponding to the object storage unit.
[0047] In an embodiment of the present application, the object storage unit includes a key-value database, which is used to store metadata of system objects corresponding to the object storage unit. The key-value database refers to a Key-Value database, referred to as a KV database, which is a type of non-relational database that stores, retrieves and manages key-value sets. In some cases, when the key-value database in the object storage unit stores a lot of data, the key-value database will perform data sorting operations. When performing data sorting operations, the metadata stored in the key-value database will not be accessible, resulting in the object storage unit being unable to respond to data access requests in a timely manner. For example: when the distributed storage system is a Ceph distributed storage system, the key-value database can be a Rocksdb database, and the Rocksdb database can store a large number of operation record logs, and can also store metadata of system objects. After a large amount of data is stored, the Rocksdb database will perform data sorting operations, resulting in the Rocksdb database being unable to respond to data access requests in a timely manner. The data storage method provided in the embodiment of the present application can be used to store metadata of system objects. In the present application, the object storage unit includes a plurality of shard databases, which are obtained by dividing the key-value database, and each shard database is isolated from each other, and the type of the shard database is the same as the type of the key-value database. The index database can be any one of the plurality of shard databases, and the index database can be used to store the index information of the metadata. For example: the key-value database is a Rocksdb database, and the plurality of shard databases (including the index database) obtained by dividing the key-value database are also Rocksdb databases, that is, when a large amount of data is stored in the shard database, the shard database will also perform data sorting operations. The index database can be used to store the index information of the metadata of the system object, and the amount of data stored in the database is usually small, so generally no data sorting operation occurs. After determining the index information to be stored corresponding to the metadata, the object storage unit can store the index information to be stored in the index database. Through the method provided in the embodiment of the present application, the sharding processing of the database can be realized, and the index information of the metadata is stored by using a shard database, which is conducive to the hierarchical storage of metadata, effectively improving the efficiency of metadata storage and search, thereby improving the processing efficiency of the distributed storage system.
[0048] In one embodiment, the numbering information of the index database and the multiple shard databases is incremented sequentially starting from the index database. For example, if the object storage unit includes an index database and three shard databases, the numbering information of the index database is 0, and the numbering information of the three shard databases is 1, 2, and 3 respectively. Through the method provided in the embodiment of the present application, the numbering information of each database can be determined, which is convenient for the subsequent hierarchical storage of metadata of system objects and balanced distribution of data, and improves the stability of the data storage system.
[0049] S303: Determine a target shard database from the shard databases other than the index database according to the identification information.
[0050] In the embodiment of the present application, multiple shard databases are obtained by dividing the key-value database in the object storage unit, and the index database can be any one of the multiple shard databases. In order to realize the hierarchical storage of metadata, the shard databases other than the index database in the multiple shard databases can be used to store metadata and metadata-related data (such as: metadata attribute information, etc.), for example: the key-value database is divided and processed to obtain 8 shard databases, one of which is used as the index database, and the remaining 7 shard databases can be used to store metadata and metadata-related data, the index database is numbered 0, and the 7 shard databases are numbered from 1 to 7. The target shard database can be determined from the shard databases other than the index database in the multiple shard databases according to the identification information. The target shard database can be used to store the metadata and the metadata-related data. Through the method provided in the embodiment of the present application, the target shard database can be determined from the multiple shard databases, so that the metadata can be stored in the specified shard database, which is conducive to realizing the hierarchical storage of metadata and improving the access efficiency of the metadata of the system objects in the distributed storage system.
[0051] S304: Determine the data to be stored according to the metadata and the identification information, and store the data to be stored in the target shard database.
[0052] In the embodiment of the present application, the data to be stored can be determined according to the metadata and the identification information, the data to be stored includes the metadata, and the data to be stored can be stored in the target shard database. In some cases, the data to be stored of the metadata can be used as the secondary index information corresponding to the metadata. After determining the index information to be stored of the metadata and storing the index information to be stored in the index database, the target shard database can be determined according to the identification information, and the secondary index information of the metadata can be determined according to the metadata and the identification information, and the secondary index information of the metadata includes the metadata; the secondary index information of the metadata is stored in the target shard database, and the hierarchical index storage of the metadata can be realized. When other shard databases are performing data sorting operations, the target shard database can store or read data normally, for example: the object storage unit includes 7 shard databases (the number information of the 7 shard databases is 0 to 6), wherein the shard database with the number information 0 is the index database, and the target shard database is the shard database with the number information 1, then if the shard databases with the number information 2 to 6 are performing data sorting operations, the target shard database can be unaffected and perform data storage or reading operations normally, thereby reducing the impact of the data sorting operation on the database response to the data access request. Through the method provided in the embodiment of the present application, hierarchical index storage of metadata can be implemented, effectively improving the access efficiency of metadata of system objects, effectively reducing the impact of data sorting operations on responding to data access requests, and improving the processing efficiency of distributed storage systems.
[0053] The data storage method provided in the embodiment of the present application can determine the index information to be stored corresponding to the metadata of the system object, which is conducive to realizing hierarchical index storage of metadata and improving the data storage and search efficiency of metadata; multiple shard databases can be determined according to the key-value database included in the object storage unit, and the shard databases can be used to store the index information to be stored and the data to be stored of the metadata, thereby reducing the impact of the database performing data sorting operations, so that the distributed storage system can respond to the user's data access request in a timely manner, improve the user's experience, and ensure the stability of the distributed storage system.
[0054] See also Figure 4 , Figure 4 A flowchart of another data storage method provided in an embodiment of the present application. The data storage method can be implemented by the above-mentioned object storage node 202, or by other devices. The process of the data storage method provided in the embodiment of the present application includes but is not limited to:
[0055] S401. In response to a storage request for metadata of a system object, determine index information to be stored corresponding to the metadata; the system object includes a data group object in an object storage unit, and the object storage unit is a storage space in an object storage node included in a distributed storage system; the index information to be stored includes identification information, and the identification information is determined based on the number of index information currently stored in the index database.
[0056] In an embodiment of the present application, an object storage node may be a storage device in a distributed storage system, and the distributed storage system may include multiple object storage nodes, each object storage node may include multiple object storage units, and the object storage unit is a storage space in the object storage node. An object storage unit may include multiple data group objects, and each data group object may correspond to multiple data objects. For example: the distributed storage system may be a Ceph distributed storage system, the object storage node may be a storage device in the Ceph distributed storage system, and the object storage unit may be a data storage service (OSD for short) in the storage device, which is used to manage the reading and writing of data. When the OSD performs data storage, multiple data objects will correspond to a data group (also called a placement group (PG)). An OSD may include 100 to 200 data groups, and a data group may correspond to tens of thousands of data objects. System objects may include data group objects in an object storage unit, and may also include objects in the object storage unit that are not associated with a terminal device. The metadata of a system object includes attribute data of the system object, etc. After receiving a storage request for metadata of a system object, the object storage unit determines the to-be-stored index information corresponding to the metadata in response to the storage request for metadata of the system object, and the to-be-stored index information includes identification information, and the identification information is determined according to the number of index information currently stored in the index database. Through the method provided in the embodiment of the present application, the to-be-stored index information corresponding to the metadata can be determined, which is conducive to realizing the hierarchical indexing of metadata of the system object and effectively improving the access efficiency of the metadata.
[0057] In one embodiment, the identification information may be associated with the number of system objects in the object storage unit. When a new system object is created in the object storage unit, the metadata of the system object needs to be stored in the database, and the index information to be stored corresponding to the metadata of the system object is determined. The index information to be stored includes identification information, and the identification information may be determined according to the number of index information currently stored in the index database. That is, when a new system object is created, the number of index information stored in the index database will increase, and the value corresponding to the identification information will also increase.
[0058] In one embodiment, the implementation method of determining the index information to be stored corresponding to the metadata may be: performing type analysis processing on the metadata to obtain the data type information of the metadata, and determining the data type information as prefix information; obtaining the object information of the system object corresponding to the metadata, and determining the object information as keyword information; obtaining identification information, and determining the identification information as index value information; performing integration processing according to the prefix information, keyword information and index value information to obtain the index information to be stored corresponding to the metadata. Since the index database is any one of the multiple shard databases, and the multiple shard databases are obtained by dividing the key-value database included in the object storage unit, the index database is also a key-value database, and the format of the index information stored in the index database is a key-value format. The metadata of the system object may be subjected to type analysis processing to obtain the data type information of the metadata, and the data type information corresponding to different types of metadata is different, for example: the data type information may be "O", "L", etc. The data type information is determined as prefix information, and the prefix information may be used to quickly find the metadata stored in the database. The object information of the system object corresponding to the metadata is obtained, and the object information may be the name of the system object, etc., and the object information is determined as keyword information (i.e., key). The identification information can be obtained, and the identification information can be determined as index value information (i.e., value); by integrating the prefix information, keyword information, and index value information, the index information to be stored corresponding to the metadata can be obtained. For example: the index information to be stored of the metadata may include three parts: prefix information (prefix), keyword information (key), and index value information (value), wherein the prefix information is "_HOBJTOSEQ_", indicating the type of the metadata; the keyword information is "pg numbered 0", indicating the name of the system object corresponding to the metadata; the index value information is "seq=1", indicating that the identification information is "seq=1", that is, the value corresponding to the identification information is 1. Through the method provided in the embodiment of the present application, the index information to be stored corresponding to the metadata can be accurately determined, which facilitates the subsequent rapid search for metadata based on the index information and improves the efficiency of reading data in the distributed storage system.
[0059] S402. Store the index information to be stored in the index database, where the index database is a shard database for storing index information determined from a plurality of shard databases, and the plurality of shard databases are obtained by dividing the key-value database included in the object storage unit, and the key-value database is used to store metadata of the system object corresponding to the object storage unit.
[0060] In an embodiment of the present application, the object storage unit includes a key-value database, which is used to store metadata of the system object corresponding to the object storage unit. The key-value database refers to a Key-Value database, referred to as a KV database, which is a type of non-relational database that stores, retrieves and manages key-value sets. In some cases, when the key-value database in the object storage unit stores a lot of data, the key-value database will perform a data sorting operation. When performing the data sorting operation, the metadata stored in the key-value database will not be accessible, resulting in the object storage unit being unable to respond to data access requests in a timely manner. For example: when the distributed storage system is a Ceph distributed storage system, the key-value database can be a Rocksdb database. The Rocksdb database is a key-value database that can be used to store keywords (keys) and values (values), and keys and values can be arbitrary byte streams, and the database supports atomic reading and writing. After storing a large amount of data, the Rocksdb database will perform a data sorting operation, resulting in the Rocksdb database being unable to respond to data access requests in a timely manner. The data storage method provided in the embodiment of the present application can be used to store metadata of system objects. In the present application, the object storage unit includes multiple shard databases, which are obtained by dividing the key-value database. Each shard database is isolated from each other, and the type of the shard database is the same as that of the key-value database. The index database can be any shard database among the multiple shard databases, and the index database can be used to store index information of metadata. For example: the key-value database is a Rocksdb database, and the multiple shard databases (including the index database) obtained by dividing the key-value database are also Rocksdb databases, that is, when a large amount of data is stored in the shard database, the shard database will also perform data sorting operations. The index database can be used to store index information of metadata of system objects. The amount of data stored in this database is usually small, so data sorting operations generally do not occur. The numerical values corresponding to the numbering information of the index database and the multiple shard databases in the object storage unit are incremented in sequence, for example: the numbering information of the index database is 0, and the numbering information of the three shard databases is 1, 2, and 3 respectively. After determining the index information to be stored corresponding to the metadata, the object storage unit can store the index information to be stored in the index database. Through the method provided in the embodiment of the present application, database sharding processing can be implemented, and a sharded database can be used to store index information of metadata, which is conducive to realizing hierarchical storage of metadata, effectively improving the efficiency of metadata storage and search, and thus improving the processing efficiency of the distributed storage system.
[0061] See also Figure 5 , which is a schematic diagram of a data storage method provided in an embodiment of the present application. Figure 5In the example, the distributed storage system is a Ceph distributed storage system. The Ceph distributed storage system can include three storage types, namely object storage type, file storage type and block storage type. When storing data, these three storage types can divide data into the form of data objects for storage. Ceph distributed storage includes multiple object storage nodes. Each object storage node can include an object storage unit OSD. When storing data, the object storage unit usually stores the metadata of data objects other than system objects in the form of file extension attributes in XFS, stores data objects other than system objects in XFS, and stores the metadata of system objects in the Rocksdb database. The Rocksdb database can be sharded to obtain multiple sharded databases ( Figure 5 The index database includes an index database with number information "Shard0", N shard databases with number information "Shard1", "Shard2" ... "ShardN" (N is an integer greater than 2, and the type of these databases is Rocksdb database). For the metadata of system objects corresponding to the object storage type, file storage type, and block storage type, the index information to be stored of these metadata can be determined, and the index information of these metadata can be stored in the index database of the object storage node. The index database is one of the multiple shard databases ( Figure 5 The number information corresponding to the index database in the shard is "Shard0"); the data to be stored corresponding to these metadata can be stored in one or more of the remaining multiple shard databases (i.e. Figure 5 The method provided in the embodiment of the present application can realize hierarchical storage of metadata of system objects, improve the stability of the distributed storage system, and also improve the efficiency of storing and searching metadata of system objects.
[0062] S403: Obtain quantity information of shard databases other than the index database among the multiple shard databases, each shard database among the multiple shard databases corresponds to a numbering information, and the numbering information of the multiple shard databases is continuous.
[0063] In the embodiment of the present application, multiple shard databases are obtained by dividing the key-value database included in the object storage node, and each shard database in the multiple shard databases corresponds to a numbering information, and the numbering information of the multiple shard databases is continuous. For example, if the key-value database is divided and processed to obtain 7 shard databases, then each shard database in the 7 shard databases corresponds to a numbering information, and the numerical values corresponding to the numbering information corresponding to the 7 shard databases are successively increased, and the numbering information corresponding to the 7 shard databases can be "0", "1", "2"... "6". The number information of the shard databases other than the index database in the multiple shard databases is obtained, and the number information can indicate the number of shard databases used to store the data to be stored corresponding to the metadata. For example: there are 7 shard databases in total, and the shard database with the numbering information of "0" is used as the index database, then the numerical value corresponding to the number information of the shard databases other than the index database is 6. Through the method provided in the embodiment of the present application, the number information of the shard databases used to store the data to be stored can be determined, which is convenient for the subsequent selection of the target shard database and realizes the balanced storage of metadata.
[0064] S404: Determine target numbering information according to the identification information and the quantity information, and determine, according to the numbering information of the multiple shard databases, a target shard database whose numbering information matches the target numbering information from the multiple shard databases.
[0065] In the embodiment of the present application, in addition to the index database, the object storage unit generally includes multiple shard databases, and these shard databases can be used to store metadata of system objects. When storing the metadata of system objects in the shard databases, the amount of metadata stored in each shard database should be as close as possible (that is, the amount of metadata stored in each shard database is relatively balanced); if the amount of metadata stored in a shard database is much greater than the amount of metadata stored in other shard databases, then this shard database will frequently perform data sorting operations, thereby affecting the speed at which the distributed storage system responds to access requests. Therefore, the target numbering information can be determined based on the identification information and the quantity information, and the target numbering information can indicate the shard database used to store the metadata; and based on the numbering information of the multiple shard databases, the target shard database whose numbering information matches the target numbering information is determined from the multiple shard databases. Please refer to . Figure 6 , which is a schematic diagram of a metadata storage method provided in an embodiment of the present application. Figure 6 For metadata 1, metadata 2, and metadata 3, the target shard database corresponding to the three metadata can be determined according to the identification information and quantity information ( Figure 6In the example, the target shard database corresponding to metadata 1 is the shard database with number information "Shard1", the target shard database corresponding to metadata 2 is the shard database with number information "Shard2", and the target shard database corresponding to metadata 3 is the shard database with number information "Shard3"), so that the three metadata can be stored in three different shard databases in a balanced manner, avoiding the difference in the number of metadata stored in the shard databases. Through the method provided in the embodiment of the present application, the target shard database can be determined according to the identification information and the quantity information, and balanced data storage between multiple shard databases is achieved, avoiding a single shard database from frequently performing data sorting operations due to excessive storage of data, reducing the impact of data sorting operations on data access requests, and effectively improving the processing efficiency of the distributed storage system.
[0066] In one embodiment, the implementation method of determining the target numbering information based on the identification information and the quantity information can be: determining the reference number based on the quantity information; performing a modulo operation on the numerical value corresponding to the identification information and the numerical value corresponding to the reference number, and determining the target numbering information based on the result of the modulo operation. Each shard database in the multiple shard databases corresponds to a numbering information, and the numbering information of the multiple shard databases is continuous and increases in sequence. Therefore, the reference number can be determined based on the quantity information, and a modulo operation can be performed on the numerical value corresponding to the identification information and the numerical value corresponding to the reference number to obtain a modulo operation result, and the target numbering information can be determined based on the modulo operation result. In some cases, when the numbering information of the index database is 0, and the numbering information of the multiple shard databases increases one by one starting from 1, the implementation method of performing a modulo operation on the numerical value corresponding to the identification information and the numerical value corresponding to the reference number can be shown in the following formula (1):
[0067] Shard_idx=(seq%(shard_items-1))+1 (1)
[0068] In formula (1), Shard_idx represents the value corresponding to the target number information, seq represents the value corresponding to the identification information, shard_items represents the value corresponding to the quantity information, and shard_items-1 represents the value corresponding to the reference quantity. For example, there are 8 shard databases obtained by partitioning the key-value database, and the number information of the shard databases are "0", "1", "2" ... "7" respectively, and the number information of the shard database as the index database is "0". Assuming that the value corresponding to the identification information in the index information to be stored corresponding to a certain metadata is 13 (that is, seq is 13), and the value corresponding to the quantity information of the shard databases other than the index database is 7 (that is, shard_items is 7), then according to the calculation method shown in formula (1), it can be known that the value corresponding to the target number information (Shard_idx) is 2, and the target number information corresponding to the metadata is "2". Please refer to Figure 7 , which is a schematic diagram of a shard database determination method provided in an embodiment of the present application. Figure 7 After determining the index information to be stored corresponding to the metadata of the system object (the index information to be stored includes identification information), the index information to be stored can be stored in the index database ( Figure 7 The number information corresponding to the index database in the index database is "Shard0"), and the modulus operation shown in the embodiment of the present application is performed according to the identification information to determine the target number information, and the target shard database ( Figure 7 The target shard database includes N shard databases whose numbering information is "Shard1", "Shard2" ... "ShardN" (N is an integer greater than 2), and the determined target shard database is the shard database whose numbering information is "Shard2"). Through the method provided in the embodiment of the present application, the target numbering information can be determined by using the modulus operation method, and the balanced storage of multiple shard databases can be achieved by using the modulus balanced distribution method, which is conducive to maintaining the stability of the distributed storage system, reducing the frequency of data sorting operations performed by the shard database, and thus improving the efficiency of data storage and data search in the shard database.
[0069] S405: Determine the data to be stored according to the metadata and the identification information, and store the data to be stored in the target shard database.
[0070] In the embodiment of the present application, the data to be stored can be determined according to the metadata and the identification information, and one metadata can determine one or more data to be stored. After determining the data to be stored, the data to be stored can be stored in the target shard database. In some cases, the data to be stored of the metadata can be used as the secondary index information corresponding to the metadata. After determining the index information to be stored of the metadata and storing the index information to be stored in the index database, the target shard database can be determined according to the identification information, and the secondary index information of the metadata can be determined according to the metadata and the identification information, and the secondary index information of the metadata includes the metadata; the secondary index information of the metadata is stored in the target shard database, and the hierarchical index storage of the metadata can be realized. When other shard databases perform data sorting operations, the target shard database can store or read data normally. The index information to be stored of the metadata includes the object information and identification information of the system object, and the shard database for storing the data to be stored of the metadata can be determined according to the identification information. When the object information of the system object changes (for example: the system object performs a rename operation), the identification information included in the index information to be stored will not change, and the shard database where the metadata corresponding to the system object is stored will not change, thereby avoiding the occurrence of data migration and ensuring the stability of the distributed storage system. Through the method provided in the embodiment of the present application, hierarchical index storage of metadata can be realized, which can effectively improve the access efficiency of metadata of system objects, effectively reduce the impact of data sorting operations on responding to data access requests, improve the processing efficiency of the distributed storage system, and ensure the stability of the distributed storage system.
[0071] In one embodiment, the implementation method of determining the data to be stored according to the metadata and the identification information can be: constructing the identification information to obtain the construction information; analyzing the metadata to obtain the characteristic information of the metadata; integrating the construction information, characteristic information and metadata to obtain the data to be stored corresponding to the metadata. The target shard database is one of multiple shard databases, and the multiple shard databases are obtained by dividing the key-value database included in the object storage unit, so the target shard database is also a key-value database, and the data format stored in the target shard database is a key value format, so the data to be stored can include prefix information, keyword information and value information. The construction information in the index information to be stored of the metadata can be constructed to obtain the construction information, and the construction information can be used as the prefix information in the data to be stored; the metadata is analyzed to obtain the characteristic information of the metadata, and the characteristic information can be used as the keyword information in the data to be stored, and the metadata can be used as the value information in the data to be stored; the construction information, characteristic information and metadata are integrated to obtain the data to be stored corresponding to the metadata. For example, the metadata to be stored may include prefix information (prefix), keyword information (key) and value information (value), wherein the prefix information is "_USER_1_USER_", indicating the construction information determined according to the identification information, the keyword information is "_biginfo", indicating the attribute information of the metadata, and the value information is "metadata", indicating the metadata itself. The method provided in the embodiment of the present application can realize hierarchical storage of metadata, effectively improve the storage and search efficiency of metadata in the database, thereby improving the speed at which the distributed storage system responds to data access requests.
[0072] See also Figure 8 , which is a schematic diagram of a hierarchical storage method provided in an embodiment of the present application. Figure 8In the example, the number information of the index database is "Shard0", and the number information of the shard databases for storing metadata to be stored are "Shard2" and "Shard3". Two index information are stored in the index database. The prefix information of the first index information is "_HOBJTOSEQ_", the keyword information is "pg of number 0", and the index value information is "Seq=1"; the prefix information of the second index information is "_HOBJTOSEQ_", the keyword information is "pg of number 0", and the index value information is "Seq=1"; OSEQ_", the keyword information is "rbd_directory object", and the index value information is "Seq=2"; for the first index information corresponding to the first metadata, the identification information included in the index information is "Seq=1", and the method shown in the above formula (1) is used for modular operation, it can be determined that the target shard database corresponding to the first index information is the shard database with the number information "Shard2", and the "Shard2" shard database stores two pieces of data to be stored (or secondary index data) corresponding to the first metadata, the prefix information of the first piece of data to be stored is "_USER_1_USER_", the keyword information is "_biginfo", and the index value information is "metadata 1" (metadata 1 is included in the first metadata); the prefix information of the second piece of data to be stored is "_USER_1_USER_", the keyword information is "_epoch", and the index value information is "metadata 2" (metadata 2 is included in the first metadata). For the second index information corresponding to the second metadata, the identification information included in the index information is "Seq=2". By using the method shown in the above formula (1) to perform modular operation, it can be determined that the target shard database corresponding to the second index information is the shard database with the number information "Shard3". The "Shard3" shard database stores two data to be stored (or secondary index data) corresponding to the second metadata, the prefix information of the third data to be stored is "_USER_2_USER_", the keyword information is "id_100c6b8b4567", and the index value information is "metadata 3" (metadata 3 is included in the second metadata); the prefix information of the fourth data to be stored is "_USER_2_USER_", the keyword information is "name_test", and the index value information is "metadata 4" (metadata 4 is included in the second metadata). Through the method provided in the embodiment of the present application, multiple shard databases can be used to realize hierarchical index storage of metadata, and balanced storage between each shard database can be realized at the same time, effectively improving the data search efficiency of metadata data storage, thereby increasing the speed of the object storage unit responding to data access requests and improving the experience of storage services.
[0073] In one embodiment, the data storage method provided by the embodiment of the present application may also include: obtaining a query request, the query request includes prefix information to be queried, object information to be queried, and feature information to be queried; querying the index database using the prefix information to be queried and the object information to be queried, and determining the identification information to be queried from the index database; determining the shard database to be queried from the shard databases other than the index database in multiple shard databases according to the identification information to be queried; searching the shard database to be queried using the identification information to be queried and the feature information to be queried, and obtaining the metadata of the system object requested by the query request. When the distributed storage system receives a query request for a data object, it can first obtain the metadata of the system object corresponding to the data object, thereby realizing rapid acquisition of the data object without traversing the database for search processing. The object storage unit can obtain a query request, which may include prefix information to be queried, object information to be queried, and feature information to be queried. The prefix information to be queried is used to indicate the type of metadata to be queried, the object information to be queried is used to indicate the object information of the system object corresponding to the metadata to be queried, and the feature information to be queried is used to indicate the features of the metadata to be queried; the prefix information to be queried and the object information to be queried can be used to query the index database, and the identification information to be queried can be determined from the index database; the shard database to be queried can be determined from the shard databases other than the index database in multiple shard databases according to the identification information to be queried; the identification information to be queried can be used to perform construction processing to obtain the construction information to be queried, and the construction information to be queried and the feature information to be queried can be used to perform search processing on the shard database to be queried, and the metadata of the system object requested by the query request can be obtained. Through the method provided in the embodiment of the present application, the metadata of the system object can be quickly queried, which effectively improves the speed at which the distributed storage system responds to data access requests and enhances the experience.
[0074] In one embodiment, before searching the shard database to be queried using the identification information to be queried and the characteristic information to be queried to obtain the metadata of the system object requested by the query request, the following method may be implemented: if the query request is received when a data sorting operation is performed on the first shard database, and the shard database to be queried is determined to be the first shard database, then after the data sorting operation is completed, the step of searching the shard database to be queried using the identification information to be queried and the characteristic information to be queried to obtain the metadata of the system object requested by the query request is executed, and the first shard database is any one of the shard databases except the index database among the multiple shard databases; if the query request is received when a data sorting operation is performed on the first shard database, and the shard database to be queried is determined to be the second shard database, the step of searching the shard database to be queried using the identification information to be queried and the characteristic information to be queried to obtain the metadata of the system object requested by the query request is executed, and the second shard database is any one of the shard databases except the index database and the first shard database among the multiple shard databases. If the query request is received when a data sorting operation is performed on a first shard database (the first shard database may be any shard database among multiple shard databases except the index database), and the shard database to be queried is determined to be the first shard database, then after the data sorting operation of the first shard database is completed, the first shard database is searched and processed using the identification information to be queried and the characteristic information to be queried to obtain the metadata of the system object requested by the query request; if the query request is received when a data sorting operation is performed on the first shard database, and the shard database to be queried is determined to be a second shard database (the second shard database may be any shard database among multiple shard databases except the index database and the first shard database, and the second shard database has not undergone a data sorting operation), the second shard database may be directly searched and processed using the identification information to be queried and the characteristic information to be queried to obtain the metadata of the system object requested by the query request, that is, when one or several shard databases among multiple shard databases undergo a data sorting operation, it does not affect the metadata storage and reading operations of other shard databases (the index database among multiple shard databases usually does not undergo a data sorting operation due to the small amount of data stored). Through the method provided in the embodiment of the present application, when one or several shard databases are performing data sorting operations, other shard databases can normally perform metadata storage and reading operations, thereby effectively reducing the impact of the database's data sorting operations and ensuring the speed at which the distributed storage system responds to data access requests.
[0075] See also Fig. 9 , which is a schematic diagram of another distributed storage system provided in an embodiment of the present application. Fig. 9 In the embodiment, the distributed storage system is a Ceph distributed storage system, the object storage node includes an object storage unit OSD0, and the data storage engine (FileStore) in the object storage unit is used to store data. The method provided in the embodiment of the present application can be used to store the metadata of the system object in multiple shard databases. Fig. 9 There are M shard databases in total (the type of the M shard databases is Rocksdb database, and the three shard databases are obtained by dividing the key-value database in the object storage unit, and M is an integer greater than 3). The numbering information corresponding to the M shard databases is "Shard0", "Shard1"... "ShardM", among which the shard database with numbering information "Shard0" is an index database, which is used to store index information of metadata of system objects in the object storage unit, and the M-1 shard databases with numbering information from "Shard1" to "ShardM" are used to store data to be stored corresponding to the metadata. Fig. 9 In the process, the object storage unit receives a data access request sent by a terminal device, and at this time, the shard database with the number information "Shard1" is undergoing a data sorting operation. The object storage unit can determine the prefix information to be queried, the object information to be queried, and the feature information to be queried according to the data access request, and use the prefix information to be queried and the object information to be queried to query the shard database with the number information "Shard0" to obtain the identification information to be queried; according to the identification information to be queried, a modulo operation can be performed to determine that the shard database storing the target metadata is the shard database with the number information "ShardM", and then the identification information to be queried and the feature information to be queried can be used to search and process the shard database with the number information "ShardM", and the metadata of the system object requested by the data access request can be obtained, and the relevant data objects can be further obtained from the XFS according to the obtained metadata and returned to the terminal device. Through the method provided in the embodiment of the present application, while ensuring the stability of the distributed storage system, the impact of the data sorting operation of the database can be reduced, the speed at which the distributed storage system responds to data access requests can be increased, and the user experience can be improved.
[0076] The data storage method provided in the embodiment of the present application can use index information and shard databases to achieve hierarchical and balanced storage of metadata of system objects, reduce the amount of metadata stored in a single shard database, and effectively improve the efficiency of metadata data storage and data search; the shard database for metadata storage can be determined according to identification information, and balanced data storage between multiple shard databases is achieved, which also effectively avoids abnormal situations of data migration and ensures the stability of the distributed storage system; the sharding concept can be used to divide a single key-value database into multiple shard databases, effectively reducing the frequency of data sorting operations performed by the database. At the same time, when one or several shard databases perform data sorting operations, the remaining shard databases can store and read data normally, thereby reducing the impact of data sorting operations on data access requests, effectively improving the response speed of the distributed storage system to data access requests, and improving the user experience.
[0077] See also Fig.10 , Fig.10 This is a structural block diagram of a data storage device provided in an embodiment of the present application. The device includes:
[0078] A response unit 1001 is used to respond to a storage request for metadata of a system object and determine index information to be stored corresponding to the metadata; the system object includes a data group object in an object storage unit, and the object storage unit is a storage space in an object storage node included in a distributed storage system; the index information to be stored includes identification information, and the identification information is determined according to the number of index information currently stored in the index database;
[0079] The processing unit 1002 is used to store the index information to be stored in the index database, where the index database is a shard database for storing index information determined from a plurality of shard databases, where the plurality of shard databases are obtained by dividing the key-value database included in the object storage unit, and the key-value database is used to store metadata of the system object corresponding to the object storage unit;
[0080] The processing unit 1002 is further configured to determine a target shard database from shard databases other than the index database among the multiple shard databases according to the identification information;
[0081] The determination unit 1003 is used to determine the data to be stored according to the metadata and the identification information, and store the data to be stored in the target shard database.
[0082] In one embodiment, each shard database in the multiple shard databases corresponds to a numbering information, and the numbering information of the multiple shard databases is continuous; when the processing unit 1002 determines the target shard database from the shard databases other than the index database according to the identification information, it is specifically used to: obtain the quantity information of the shard databases other than the index database in the multiple shard databases; determine the target numbering information according to the identification information and the quantity information; and determine, according to the numbering information of the multiple shard databases, from the multiple shard databases, a target shard database whose numbering information matches the target numbering information.
[0083] In one embodiment, when the processing unit 1002 determines the target number information based on the identification information and the quantity information, it is specifically used to: determine a reference quantity based on the quantity information; perform a modulo operation on a numerical value corresponding to the identification information and a numerical value corresponding to the reference quantity, and determine the target number information based on the result of the modulo operation.
[0084] In one embodiment, when determining the index information to be stored corresponding to the metadata, the response unit 1001 is specifically used to: perform type analysis processing on the metadata to obtain data type information of the metadata, and determine the data type information as prefix information; obtain object information of the system object corresponding to the metadata, and determine the object information as keyword information; obtain the identification information, and determine the identification information as index value information; perform integration processing based on the prefix information, the keyword information and the index value information to obtain the index information to be stored corresponding to the metadata.
[0085] In one embodiment, when the determination unit 1003 determines the data to be stored based on the metadata and the identification information, it is specifically used to: construct the identification information to obtain construction information; analyze the metadata to obtain feature information of the metadata; integrate the construction information, the feature information and the metadata to obtain the data to be stored corresponding to the metadata.
[0086] In one embodiment, the processing unit 1002 is also used to: obtain a query request, the query request including prefix information to be queried, object information to be queried and feature information to be queried; query the index database using the prefix information to be queried and the object information to be queried, and determine the identification information to be queried from the index database; determine the shard database to be queried from the multiple shard databases except the index database according to the identification information to be queried; and perform search processing on the shard database to be queried using the identification information to be queried and the feature information to be queried to obtain the metadata of the system object requested by the query request.
[0087] In one embodiment, the processing unit 1002 is further used for: if the query request is received when a data sorting operation is performed on a first shard database, and the shard database to be queried is determined to be the first shard database, then after the data sorting operation is completed, the step of searching the shard database to be queried using the identification information to be queried and the characteristic information to be queried to obtain metadata of the system object requested by the query request is executed, and the first shard database is any one of the shard databases among the multiple shard databases except the index database; if the query request is received when a data sorting operation is performed on the first shard database, and the shard database to be queried is determined to be a second shard database, then the step of searching the shard database to be queried using the identification information to be queried and the characteristic information to be queried to obtain metadata of the system object requested by the query request is executed, and the second shard database is any one of the shard databases among the multiple shard databases except the index database and the first shard database.
[0088] It can be understood that the functions of each functional unit of the data storage device of the embodiment of the present application can be specifically implemented according to the data storage method in the above method embodiment, and its specific implementation process can refer to the relevant description in the above data storage method embodiment, which will not be repeated here.
[0089] The data storage device provided in the embodiment of the present application can use index information and shard databases to achieve hierarchical and balanced storage of metadata of system objects, effectively improving the efficiency of metadata data storage and data search; the shard database for metadata storage can be determined according to identification information, achieving balanced data storage among multiple shard databases, and effectively avoiding abnormal situations in data migration, thereby ensuring the stability of the distributed storage system; the sharding concept can be used to divide a single key-value database into multiple shard databases, effectively reducing the frequency of data sorting operations performed by the database. At the same time, when one or several shard databases are performing data sorting operations, the remaining shard databases can store and read data normally, thereby reducing the impact of data sorting operations on data access requests, effectively improving the response speed of the distributed storage system to data access requests, and improving the user experience.
[0090] See also Fig.11 , Fig.11The present invention provides a block diagram of a computer device according to an embodiment of the present invention. The computer device described in the embodiment of the present invention includes: a processor 1101, a communication interface 1102, and a memory 1103. The processor 1101, the communication interface 1102, and the memory 1103 may be connected via a bus or other means, and the present invention takes the connection via a bus as an example.
[0091] Among them, the processor 1101 (or CPU (Central Processing Unit)) is the computing core and control core of the computer device, which can parse various instructions in the computer device and process various data of the computer device. For example, the CPU can be used to parse the power on and off instructions sent by the user to the computer device, and control the computer device to perform power on and off operations; for another example, the CPU can transmit various interactive data between the internal structures of the computer device, and so on. The communication interface 1102 can optionally include a standard wired interface, a wireless interface (such as Wi-Fi, a mobile communication interface, etc.), which is controlled by the processor 1101 to send and receive data. The memory 1103 (Memory) is a memory device in the computer device for storing programs and data. It can be understood that the memory 1103 here can include both the built-in memory of the computer device and the extended memory supported by the computer device. The memory 1103 provides a storage space, which stores the operating system of the computer device, which may include but is not limited to: Android system, iOS system, Windows Phone system, etc., and this application does not limit this.
[0092] In the embodiment of the present application, the processor 1101 implements the following operations by running the executable program code in the memory 1103:
[0093] In response to a storage request for metadata of a system object, determine the index information to be stored corresponding to the metadata; the system object includes a data group object in an object storage unit, and the object storage unit is a storage space in an object storage node included in a distributed storage system; the index information to be stored includes identification information, and the identification information is determined according to the number of index information currently stored in the index database;
[0094] The index information to be stored is stored in the index database, where the index database is a shard database for storing index information determined from a plurality of shard databases, where the plurality of shard databases are obtained by dividing a key-value database included in the object storage unit, and the key-value database is used to store metadata of a system object corresponding to the object storage unit;
[0095] Determine a target shard database from shard databases other than the index database among the multiple shard databases according to the identification information;
[0096] The data to be stored is determined according to the metadata and the identification information, and the data to be stored is stored in the target shard database.
[0097] In one embodiment, each shard database in the multiple shard databases corresponds to a numbering information, and the numbering information of the multiple shard databases is continuous; the processor 1101 is specifically used to: determine the target shard database from the shard databases other than the index database according to the identification information, including: obtaining the quantity information of the shard databases other than the index database in the multiple shard databases; determining the target numbering information according to the identification information and the quantity information; and determining, according to the numbering information of the multiple shard databases, from the multiple shard databases a target shard database whose numbering information matches the target numbering information.
[0098] In one embodiment, when the processor 1101 determines the target number information based on the identification information and the quantity information, it is specifically used to: determine a reference quantity based on the quantity information; perform a modulo operation on a numerical value corresponding to the identification information and a numerical value corresponding to the reference quantity, and determine the target number information based on the result of the modulo operation.
[0099] In one embodiment, when determining the index information to be stored corresponding to the metadata, the processor 1101 is specifically used to: perform type analysis processing on the metadata to obtain data type information of the metadata, and determine the data type information as prefix information; obtain object information of the system object corresponding to the metadata, and determine the object information as keyword information; obtain the identification information, and determine the identification information as index value information; perform integration processing based on the prefix information, the keyword information and the index value information to obtain the index information to be stored corresponding to the metadata.
[0100] In one embodiment, when the processor 1101 determines the data to be stored based on the metadata and the identification information, it is specifically used to: construct the identification information to obtain construction information; analyze the metadata to obtain feature information of the metadata; integrate the construction information, the feature information and the metadata to obtain the data to be stored corresponding to the metadata.
[0101] In one embodiment, the processor 1101 is further used to: obtain a query request, the query request including prefix information to be queried, object information to be queried, and feature information to be queried; query the index database using the prefix information to be queried and the object information to be queried, and determine the identification information to be queried from the index database; determine the shard database to be queried from the multiple shard databases except the index database according to the identification information to be queried; and perform search processing on the shard database to be queried using the identification information to be queried and the feature information to be queried to obtain the metadata of the system object requested by the query request.
[0102] In one embodiment, the processor 1101 is further used for: if the query request is received when a data sorting operation is performed on a first shard database, and the shard database to be queried is determined to be the first shard database, then after the data sorting operation is completed, executing the step of searching the shard database to be queried using the identification information to be queried and the characteristic information to be queried to obtain metadata of the system object requested by the query request, wherein the first shard database is any one of the multiple shard databases except the index database; if the query request is received when a data sorting operation is performed on the first shard database, and the shard database to be queried is determined to be a second shard database, executing the step of searching the shard database to be queried using the identification information to be queried and the characteristic information to be queried to obtain metadata of the system object requested by the query request, wherein the second shard database is any one of the multiple shard databases except the index database and the first shard database.
[0103] In a specific implementation, the processor 1101, communication interface 1102 and memory 1103 described in the embodiments of the present application can implement an implementation method of an object storage node described in a data storage method provided in an embodiment of the present application, and can also implement an implementation method described in a data storage device provided in an embodiment of the present application, which will not be repeated here.
[0104] The computer device provided in the embodiment of the present application can use index information and shard databases to implement hierarchical and balanced storage of metadata of system objects, effectively improving the efficiency of metadata data storage and data search; the shard database for metadata storage can be determined according to identification information, achieving balanced data storage among multiple shard databases, and effectively avoiding abnormal situations of data migration, thereby ensuring the stability of the distributed storage system; the sharding concept can be used to divide a single key-value database into multiple shard databases, effectively reducing the frequency of data sorting operations performed by the database. At the same time, when one or several shard databases perform data sorting operations, the remaining shard databases can store and read data normally, thereby reducing the impact of data sorting operations on data access requests, effectively improving the response speed of the distributed storage system to data access requests, and improving the user experience.
[0105] The embodiment of the present application also provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is run on a computer, the computer executes the data storage method as described in the embodiment of the present application. The specific implementation method can be referred to the above description, and will not be repeated here.
[0106] The embodiment of the present application also provides a computer program product, which includes a computer program or a computer instruction, and the computer program or the computer instruction is stored in a computer-readable storage medium. The processor of the computer device reads the computer program or the computer instruction from the computer-readable storage medium, and the processor executes the computer program or the computer instruction, so that the computer device implements the data storage method as described in the embodiment of the present application. The specific implementation method can be referred to the above description, which will not be repeated here.
[0107] It should be noted that, for the above-mentioned various method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.
[0108] A person skilled in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0109] The above disclosure is only part of the embodiments of the present application, which certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims
1. A data storage method, characterized in that: The method comprises: In response to a storage request for metadata of a system object, determine the index information to be stored corresponding to the metadata; the system object includes a data group object in an object storage unit, and the object storage unit is a storage space in an object storage node included in a distributed storage system; the index information to be stored includes identification information, and the identification information is determined according to the number of index information currently stored in the index database; The index information to be stored is stored in the index database, where the index database is a shard database for storing index information determined from a plurality of shard databases, where the plurality of shard databases are obtained by dividing a key-value database included in the object storage unit, and the key-value database is used to store metadata of a system object corresponding to the object storage unit; Determine a target shard database from shard databases other than the index database among the multiple shard databases according to the identification information; The data to be stored is determined according to the metadata and the identification information, and the data to be stored is stored in the target shard database.
2. The method according to claim 1, characterized in that Each of the multiple shard databases corresponds to a number information, and the number information of the multiple shard databases is continuous; The determining a target shard database from shard databases other than the index database among the multiple shard databases according to the identification information includes: Obtaining quantity information of the shard databases other than the index database among the multiple shard databases; Determine target number information according to the identification information and the quantity information; According to the numbering information of the multiple shard databases, a target shard database whose numbering information matches the target numbering information is determined from the multiple shard databases.
3. The method according to claim 2, characterized in that The determining the target number information according to the identification information and the quantity information includes: determining a reference quantity according to the quantity information; A modulo operation is performed on a numerical value corresponding to the identification information and a numerical value corresponding to the reference number, and target number information is determined according to the modulo operation result.
4. The method according to claim 1, characterized in that: The determining the index information to be stored corresponding to the metadata includes: Performing type analysis processing on the metadata to obtain data type information of the metadata, and determining the data type information as prefix information; Acquire object information of a system object corresponding to the metadata, and determine the object information as keyword information; Acquire the identification information, and determine the identification information as index value information; An integration process is performed according to the prefix information, the keyword information and the index value information to obtain the index information to be stored corresponding to the metadata.
5. The method according to claim 1, characterized in that The determining the data to be stored according to the metadata and the identification information includes: Performing construction processing on the identification information to obtain construction information; Analyzing and processing the metadata to obtain feature information of the metadata; The construction information, the characteristic information and the metadata are integrated to obtain the data to be stored corresponding to the metadata.
6. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: Obtaining a query request, wherein the query request includes prefix information to be queried, object information to be queried, and feature information to be queried; Querying the index database using the prefix information to be queried and the object information to be queried, and determining the identification information to be queried from the index database; Determine a shard database to be queried from shard databases other than the index database among the multiple shard databases according to the identification information to be queried; The shard database to be queried is searched using the identification information to be queried and the characteristic information to be queried to obtain metadata of the system object requested by the query request.
7. The method according to claim 6, characterized in that The method further comprises: If the query request is received when a data sorting operation is performed on a first shard database, and the shard database to be queried is determined to be the first shard database, then after the data sorting operation is completed, the step of performing a search process on the shard database to be queried using the identification information to be queried and the characteristic information to be queried to obtain metadata of the system object requested by the query request is performed, and the first shard database is any one of the shard databases among the multiple shard databases except the index database; If the query request is received when performing a data sorting operation on a first shard database, and the shard database to be queried is determined to be a second shard database, then the step of performing a search process on the shard database to be queried using the identification information to be queried and the feature information to be queried to obtain metadata of the system object requested by the query request is performed, and the second shard database is any one of the multiple shard databases except the index database and the first shard database.
8. A data storage device, characterized in that: The device comprises: A response unit, configured to respond to a storage request for metadata of a system object and determine index information to be stored corresponding to the metadata; the system object includes a data group object in an object storage unit, and the object storage unit is a storage space in an object storage node included in a distributed storage system; the index information to be stored includes identification information, and the identification information is determined according to the number of index information currently stored in the index database; a processing unit, configured to store the index information to be stored in the index database, wherein the index database is a shard database for storing index information determined from a plurality of shard databases, wherein the plurality of shard databases are obtained by dividing a key-value database included in the object storage unit, and the key-value database is used to store metadata of a system object corresponding to the object storage unit; The processing unit is further configured to determine a target shard database from shard databases other than the index database among the multiple shard databases according to the identification information; A determination unit is used to determine the data to be stored according to the metadata and the identification information, and store the data to be stored in the target shard database.
9. A computer device, characterized in that: include: A processor, a communication interface and a memory, wherein the processor, the communication interface and the memory are interconnected, wherein the memory stores an executable program code, and the processor is used to call the executable program code to implement the data storage method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, which, when executed on a computer, enable the computer to implement the data storage method according to any one of claims 1 to 7.
11. A computer program product, characterized in that The computer program product comprises a computer program or a computer instruction, and when the computer program or the computer instruction is executed by a processor, the data storage method according to any one of claims 1 to 7 is implemented.