Data management method, device, computer equipment and storage medium
By storing the file system's directory tree and data in blocks in metadata servers and cluster servers, and using hash algorithms to determine storage nodes, the problem of low file data reading efficiency under high concurrency is solved and efficient data management is achieved.
Patent Information
- Application Number
- CN202010120131.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-02-26
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2040-02-26
AI Technical Summary
The centralized management of file data in the prior art results in long data reading and low system efficiency in high concurrency scenarios.
Store the directory tree of the file system in the metadata server, and store the file data and attribute information in multiple nodes of the cluster server in blocks. The storage node is determined through the preset hash algorithm to achieve distributed storage, and based on the directory information and read and write operation information to perform read and write operations between nodes.
It greatly reduces the operating pressure on the metadata server, improves data reading efficiency in high concurrency scenarios, and ensures efficient operation of the system.
Smart Images

Figure CN111427841B
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a data management method, apparatus, computer equipment and storage medium. Background Art
[0002] A file system usually includes a large amount of file data, which is distributed in directories or subdirectories of the file system. A directory contains a large number of subdirectories or file data, and each subdirectory contains a large amount of file data. The metadata of the file system includes a directory tree and attribute information. The directory tree is used to record the mapping relationship between the logical and physical locations of file data, and the attribute information is used to record attribute information such as file size, modification time, read and write permissions, etc. In the prior art, directory item metadata, file data, and attribute information are usually managed centrally. In high-concurrency scenarios, the mutual exclusion of data access will lead to low business concurrency, a long time to read data, and low system efficiency. Summary of the invention
[0003] The main purpose of this application is to provide a data management method, device, computer equipment and storage medium, aiming to solve the problems of centralized management of file data, long data reading time and low system efficiency in the prior art.
[0004] This application proposes a data management method, including:
[0005] The directory tree of the file system is stored in the metadata server; the file data of each file contained in the file system is divided into blocks, and each block is stored in a plurality of nodes of the cluster server; the attribute information corresponding to the file system is divided into blocks, and each block is stored in a plurality of nodes of the cluster server;
[0006] Acquire a data read / write instruction sent by a user, wherein the data read / write instruction carries designated directory information and read / write operation information of a file to be read / written;
[0007] Determine whether the directory tree contains the specified directory information, wherein the directory tree is stored in a key-value format, with the directory information of each file as the key and the file identifier corresponding to each file as the value;
[0008] If yes, extracting the specified file identifier corresponding to the specified directory information from the metadata server;
[0009] According to the designated file identifier, determining each designated node in the cluster server where the file data corresponding to the to-be-read / written file is distributed;
[0010] According to the read and write operation information, the read and write operations with each of the designated nodes are completed.
[0011] Furthermore, the step of dividing the file data of each file contained in the file system into blocks and storing each block in a plurality of nodes of the cluster server includes:
[0012] Splitting the file data of each of the files into a plurality of first blocks of data according to a first preset size;
[0013] According to the number of first blocks of data corresponding to each of the files, first nodes for storing each of the first blocks of data are determined from all the nodes of the cluster server according to a preset hash algorithm, and a first mapping relationship between each of the first blocks of data and each of the first nodes is established;
[0014] According to the first mapping relationship, the first block data corresponding to each of the files is stored in each of the first nodes respectively.
[0015] Furthermore, the read / write operation information includes a data read starting point value and a data read length value, and the step of completing the read / write operation with each of the designated nodes according to the read / write operation information includes:
[0016] Extracting the data reading starting point value and the data reading length value from the read and write operation information;
[0017] Determine, from each of the designated nodes, a first target node corresponding to the data reading starting point value;
[0018] In the first target node, taking the data reading starting point value as a starting point, read data corresponding to the data reading length value from a first block of data corresponding to the first target node.
[0019] Further, the read / write operation information includes a data operation starting point value and data writing information, and the step of completing the read / write operation with each of the designated nodes according to the read / write operation information includes:
[0020] Extracting the data operation starting point value and the data writing information from the read and write operation information;
[0021] Determine, from the plurality of designated nodes, a second target node corresponding to the data operation starting point value;
[0022] In the second target node, taking the data operation starting point value as a starting point, writing the data writing information into the first block of data corresponding to the second target node, and obtaining the update block data corresponding to the second target node;
[0023] According to a preset hash algorithm, the update block data is redistributed to each node stored in the cluster server.
[0024] Furthermore, the steps of determining, from all nodes of the cluster server, first nodes for storing each first block of data according to a preset hash algorithm according to the number of first blocks of data corresponding to each of the files, and establishing a first mapping relationship between each of the first blocks of data and each of the first nodes include:
[0025] Numbering all nodes in the cluster server in sequence according to Arabic numerals starting from 0 to obtain the number of each node;
[0026] Sequentially numbering all first blocks of data corresponding to the file according to a preset numbering rule to obtain all file block numbers corresponding to the file;
[0027] According to the preset hash algorithm, hash calculations are performed on the file identifier corresponding to one of the files and the file block number corresponding to each of the first blocks of data, respectively, to obtain hash values corresponding to each of the first blocks of data;
[0028] Performing a modulo operation on the hash value corresponding to each of the first blocks of data with respect to the maximum node number to obtain a modulo operation result;
[0029] Each of the first blocks of data is mapped to each of the first nodes according to a preset mapping rule, wherein the preset mapping rule is that a modulo operation result of the first block of data is equal to the node number of the first node.
[0030] Furthermore, the metadata server is a distributed metadata server cluster, and the step of storing the directory tree of the file system in the metadata server includes:
[0031] The directory tree of the file system is stored in each metadata server in the metadata server cluster, and one of the metadata servers is used as a master metadata server and the other metadata servers are used as slave metadata servers, wherein the master metadata server is used to provide metadata services externally;
[0032] Determining whether the primary metadata server fails;
[0033] If the primary metadata server fails, one of the metadata servers is selected as a new primary metadata server, and the new primary metadata server is used to provide metadata services externally.
[0034] Furthermore, after the step of determining whether the directory tree contains the specified directory information, the following steps are performed:
[0035] If not, assigning a corresponding new file identifier to the specified directory information in the directory tree;
[0036] A node for storing file data corresponding to the newly created file identifier is allocated to the newly created file identifier through a preset hash algorithm.
[0037] The present application also proposes a data management device, comprising:
[0038] A data storage unit, used to store a directory tree of a file system in a metadata server; and to divide file data of each file contained in the file system into blocks, and store each block in a plurality of nodes of a cluster server; and to divide attribute information corresponding to the file system into blocks, and store each block in a plurality of nodes of the cluster server;
[0039] An instruction acquisition unit, used to acquire a data read / write instruction sent by a user, wherein the data read / write instruction carries information about a designated directory of a file to be read / written and information about a read / write operation;
[0040] a judging unit, configured to judge whether the directory tree contains the specified directory information, wherein the directory tree is stored in a key-value format, with the directory information of each file as the key and the file identifier corresponding to each file as the value;
[0041] an identifier extraction unit, configured to extract a specified file identifier corresponding to the specified directory information from the metadata server if the specified directory information is included;
[0042] A node determination unit, configured to determine, according to the specified file identifier, each specified node in the cluster server where the file data corresponding to the file to be read or written is distributed;
[0043] A read / write operation unit is used to complete the read / write operation with each of the designated nodes according to the read / write operation information.
[0044] The present application also proposes a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any one of the above methods when executing the computer program.
[0045] The present application also proposes a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above methods are implemented.
[0046] Beneficial effects of this application:
[0047] The data management method, device, computer equipment and storage medium of the present application store the directory tree of the file system in the metadata server; and divide the file data of each file contained in the file system into blocks, and store each block in multiple nodes of the cluster server respectively; and divide the attribute information corresponding to the file system into blocks, and store each block in multiple nodes of the cluster server respectively; when performing data reading and writing operations, it is only necessary to find the specified file identifier corresponding to the file to be read and written from the metadata server, and then the reading and writing operations can be performed on the specified node corresponding to the file to be read and written according to the specified file identifier, without the need to perform reading and writing operations from the metadata server, which greatly reduces the operating pressure of the metadata server on the one hand, and greatly improves the data reading efficiency in high concurrency scenarios on the other hand. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 It is a flowchart of a data management method according to an embodiment of the present application;
[0049] Figure 2 is a schematic block diagram of the structure of a data management device according to an embodiment of the present application;
[0050] Figure 3 It is a schematic block diagram of the structure of a computer device according to an embodiment of the present application.
[0051] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0052] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0053] Reference Figure 1 In one embodiment of the present application, a data management method is provided, including:
[0054] S1. storing a directory tree of a file system in a metadata server; dividing file data of each file contained in the file system into blocks, and storing each block in a plurality of nodes of a cluster server; dividing attribute information corresponding to the file system into blocks, and storing each block in a plurality of nodes of the cluster server;
[0055] S2. Obtaining a data read / write instruction sent by a user, wherein the data read / write instruction carries designated directory information and read / write operation information of a file to be read / written;
[0056] S3, determining whether the directory tree contains the specified directory information, wherein the directory tree is stored in a key-value format, with the directory information of each file as the key and the file identifier corresponding to each file as the value;
[0057] S4. If yes, extract the specified file identifier corresponding to the specified directory information from the metadata server;
[0058] S5. Determine, according to the designated file identifier, the designated nodes in the cluster server where the file data corresponding to the to-be-read / written file is distributed;
[0059] S6. Complete the read and write operations with each of the designated nodes according to the read and write operation information.
[0060] In this embodiment, in the above step S1, the above file data is data contained in the file content in the file system, and the above attribute information is data recording attribute information such as file size, modification time, read and write permissions, etc. The directory tree is stored in a dedicated metadata server, the file data is distributedly stored in multiple nodes of the cluster server, and the attribute information is also distributedly stored in multiple nodes of the cluster server.
[0061] The above-mentioned metadata server is a metadata server that is specifically used to store directory trees. The above-mentioned metadata server can be a single server; it can also be a distributed metadata server cluster, using multiple metadata servers, and the multiple metadata servers adopt a full peer-to-peer mode, that is, each metadata server is completely peer-to-peer, and each metadata server can independently provide metadata services to the outside world, and the data of each metadata server is kept synchronized. When the metadata server adopts a distributed metadata server cluster, one of the metadata servers is used as the main metadata server to provide metadata services to the outside world, and the data of the remaining metadata servers is kept synchronized and updated, but no metadata services are provided to the outside world; when the main metadata server fails, one of the remaining metadata servers is selected as the new main metadata server; in this way, the reliability of the metadata server's external services is ensured.
[0062] The cluster server includes multiple nodes, and the cluster server is used for distributed storage of file data and attribute information. In the cluster server, each node stores a part of the data, and multiple nodes together constitute the complete data. The distributed cluster server distributes the file data and attribute information to multiple nodes. When a user needs to read and write data of a certain file, it can be performed on the corresponding node without the need to perform read and write operations on the metadata server, which effectively reduces the pressure on the metadata server.
[0063] In the above steps S2 to S4, in the metadata server, the directory tree is stored in the form of key-value. The key-value storage can bring good scalability to the distributed storage management of the file system. If the file data to be processed increases, the mapping relationship of the new file data can be added to the key-value directory tree. Table 1 is a specific example of a directory tree stored in the form of key-value in a certain file system. The folder FS1 of the file system contains dir1, dir2 and dir3 subfolders, and the dir3 subfolder includes files file1 and file2.
[0064] Table 1 File system directory tree
[0065] key value FS1 0001 0001 / dir1 0002 0001 / dir2 0003 0001 / dir3 0004 0001 / 0004 / file1 0005 0001 / 0004 / file2 0006
[0066] When the user wants to open file2 and perform read and write operations on file2, the specified directory information of the file to be read and written is carried in the data read and write instructions, that is, <fs1 dir3 file2>. The metadata server first determines whether the directory tree contains the above-mentioned specified directory information. For the specific example in Table 1, the metadata server first finds that the value of FS1 is 0001, and then searches for a directory named "dir3" under the root directory with a prefix of "0001", that is, the value corresponding to the key "0001 / dir3" is "0004", and then further searches for a file named "file2" under the root directory with a prefix of "0001 / 0004", that is, the value corresponding to the key "0001 / 0004 / file2" is found to be "0006". When the metadata server finds the specified file identifier corresponding to the above-mentioned specified directory information, it determines that the above-mentioned specified directory information is contained in the directory tree, and extracts the specified file identifier, which is the value "0006" for the specific example in Table 1. The logical position of the file data on the cluster server is determined based on the value "0006".
[0067] In the above steps S5-S6, the designated nodes where the files to be read and written are distributed in the cluster server can be determined according to the designated file identifier of the files to be read and written. That is, according to the above designated file identifier, the specific node information where the file data corresponding to the designated file identifier is distributed and stored in the cluster server can be determined. Then, according to the read and write operation information in the data read and write instruction, the corresponding read and write operation is completed in the above designated node.
[0068] The data management method of this embodiment stores the directory tree of the file system in the metadata server; divides the file data of each file contained in the file system into blocks, and stores each block in multiple nodes of the cluster server respectively; divides the attribute information corresponding to the file system into blocks, and stores each block in multiple nodes of the cluster server respectively; when performing data read and write operations, first obtain the data read and write instructions sent by the user, wherein the data read and write instructions carry the specified directory information and read and write operation information of the file to be read and written; when the directory tree contains the specified directory information, extract the specified file identifier corresponding to the specified directory information from the metadata server; then, according to the specified file identifier, determine the various specified nodes in the cluster server where the file data corresponding to the file to be read and written is distributed; finally, complete the read and write operations with each of the specified nodes according to the read and write operation information; in this way, it is only necessary to find the specified file identifier corresponding to the file to be read and written from the metadata server, and then the read and write operations can be performed on the corresponding specified node according to the specified file identifier, without performing the read and write operations from the metadata server, which greatly reduces the operating pressure of the metadata server on the one hand, and greatly improves the data reading efficiency in high concurrency scenarios on the other hand.
[0069] In one embodiment, the step S1 of dividing the file data of each file contained in the file system into blocks and storing each block in multiple nodes of the cluster server includes:
[0070] S101, dividing the file data of each file into a plurality of first blocks of data according to a first preset size;
[0071] S102, according to the number of first blocks of data corresponding to each of the files, determining each first node for storing each of the first blocks of data from all the nodes of the cluster server according to a preset hash algorithm, and establishing a first mapping relationship between each of the first blocks of data and each of the first nodes;
[0072] S103. According to the first mapping relationship, store the first block of data corresponding to each of the files in each of the first nodes respectively.
[0073] In this embodiment, a plurality of first blocks of data are distributed to a plurality of nodes of a cluster server by a preset hash algorithm. The first node is selected from the cluster server, and refers to a single node storing a single first block of data. The first block of data of each file data is distributed by a preset hash algorithm, each first block of data is located to a corresponding first node, and a mapping relationship between each first block of data and each first node is established, so that the load of each node in the cluster server is kept as uniform as possible, and the problem of some nodes being overloaded and some nodes being underloaded will not occur.
[0074] In one embodiment, the read / write operation information includes a data read start point value and a data read length value, and the step S6 of completing the read / write operation with each of the designated nodes according to the read / write operation information includes:
[0075] S601, extracting the data reading starting point value and the data reading length value from the read and write operation information;
[0076] S602, determining a first target node corresponding to the data reading starting point value from each of the designated nodes;
[0077] S603. In the first target node, taking the data reading starting point value as a starting point, read data corresponding to the data reading length value from a first block of data corresponding to the first target node.
[0078] In this embodiment, in the above step S601, when the user needs to read a certain data segment from the file data to be read or written, the corresponding data reading starting point value and data reading length value can be written in the read / write operation information. In a specific example, for example, if the user wants to read a data segment with a length of 2M starting from a data point with an offset of 60M from the first character in the file to be read or written, the corresponding data reading starting point value in the read / write operation information is<off=60M> , the data read length value is<len=2M> .
[0079] In the above step S602, the first target node where the data reading starting point is located is first determined according to the data reading starting point value. For example, in the above specific example, in step S5, the designated nodes where the files to be read and written are distributed are determined according to the designated file identifiers.<off=60M> Specifically, according to the data reading starting point value, a match is made in the first mapping relationship between each first block of data and the first node. For example, if the file data to be read and written is divided into multiple first blocks of data in sequence according to the size of 25M, then according to<off=60M> , it can be determined that the data reading starting point value is located in the third first block of data that has been divided, and then a match is performed from the first mapping relationship to obtain the first node corresponding to the first block of data, and the first target node can be determined.
[0080] In the above step S603, in the above first target node, starting from the data reading starting point value, the read data corresponding to the data reading length value is read. The data reading operation is completed in the node of the cluster server, and there is no need to operate in the metadata server, which greatly reduces the pressure on the metadata server and is conducive to the operation of high-concurrency scenario business.
[0081] In one embodiment, the read / write operation information includes a data operation starting point value and data writing information. The step S6 of completing the read / write operation with each of the designated nodes according to the read / write operation information includes:
[0082] S611, extracting the data operation starting point value and the data writing information from the read and write operation information;
[0083] S612, determining a second target node corresponding to the data operation starting point value from the multiple designated nodes;
[0084] S613: In the second target node, taking the data operation starting point value as a starting point, writing the data writing information into the first block of data corresponding to the second target node, to obtain the update block data corresponding to the second target node;
[0085] S614: reallocate the update block data to each node storing the update block data in the cluster server according to a preset hash algorithm.
[0086] In this embodiment, in the above step S611, when the user needs to write a certain data segment into the file data to be read or written, the corresponding data operation starting point value and data writing information can be written into the read or write operation information. In a specific example, for example, the user wants to start from the data point with an offset of 60M from the first character in the file to be read or written, and write the content as follows: <xxxx>The data segment, then the corresponding read and write operation information has a data reading starting point value of<off=60M> , data write information is <xxxx>.
[0087] In the above step S612, the second target node where the data operation starting point is located is first determined according to the data operation starting point value. For example, in the above specific example, the designated nodes where the files to be read and written are distributed are determined according to the designated file identifier in step S5.<off=60M> Specifically, according to the data operation starting point value, a match is made in the first mapping relationship between each first block of data and the first node. For example, if the file data to be read and written is divided into multiple first blocks of data in sequence according to the size of 25M, then according to<off=60M> , it can be determined that the starting point value of the data operation is located in the third first block of data that has been divided, and then a match is performed from the first mapping relationship to obtain the first node corresponding to the first block of data, and the second target node can be determined.
[0088] In the above steps S613 to S614, in the above second target node, starting from the data operation starting point value, the corresponding data writing information is written to obtain the update block data. If the size of the above update block data exceeds the first preset size, the update block data is again divided into blocks and stored in multiple nodes of the cluster server through the preset hash algorithm, so that the load of each node of the entire cluster server is kept balanced to the greatest extent. After the above step S614, the above first mapping relationship is further updated.
[0089] The data writing operations of this embodiment are all completed in the nodes of the cluster server, and there is no need to perform operations in the metadata server, which greatly reduces the pressure on the metadata server and is conducive to the implementation of high-concurrency scenario services.
[0090] In one embodiment, the step S102 of determining, from all nodes of the cluster server, first nodes for storing each first block of data according to a preset hash algorithm and establishing a first mapping relationship between each first block of data and each first node according to the number of first blocks of data corresponding to each file includes:
[0091] S1021, numbering all nodes in the cluster server in sequence according to Arabic numerals starting from 0 to obtain the number of each node;
[0092] S1022, numbering all first blocks of data corresponding to one of the files in sequence according to a preset numbering rule to obtain all file block numbers corresponding to one of the files;
[0093] S1023, performing hash calculations on a file identifier corresponding to a file and a file block number corresponding to each of the first blocks of data according to the preset hash algorithm, to obtain a hash value corresponding to each of the first blocks of data;
[0094] S1024, performing a modulo operation on the hash value corresponding to each of the first blocks of data and the maximum node number to obtain a modulo operation result;
[0095] S1025. Map each of the first blocks of data to each of the first nodes according to a preset mapping rule, wherein the preset mapping rule is that the modulo operation result of the first block of data is equal to the node number of the first node.
[0096] In this embodiment, each node in the cluster server is numbered, for example, from 0 to N-1, and a hash value corresponding to each first block of data is obtained by performing a hash calculation on the value corresponding to each file data in the directory tree key-value table and the file block number of each first block of data, and the hash value is modulo N to obtain a remainder i, then the node numbered i in the cluster server is the first node corresponding to the first block of data. The hash algorithm is a prior art, and this application does not elaborate on the algorithm here.
[0097] In one embodiment, the metadata server is a distributed metadata server cluster, and the step S1 of storing the directory tree of the file system in the metadata server includes:
[0098] S121, storing the directory tree of the file system in each metadata server in the metadata server cluster, and using one of the metadata servers as a master metadata server and the other metadata servers as slave metadata servers, wherein the master metadata server is used to provide metadata services externally;
[0099] S122, determining whether the primary metadata server fails;
[0100] S123: If the primary metadata server fails, select one of the metadata servers as a new primary metadata server, and use the new primary metadata server to provide metadata services externally.
[0101] In one embodiment, the step S1 of distributively storing the attribute information corresponding to the file system in the cluster server includes:
[0102] S111, dividing the attribute information into a plurality of second blocks of data according to a second preset size;
[0103] S112: according to the number of the second blocks of data, determine, from all the nodes of the cluster server, each second node for storing each second block of data by using a preset hash algorithm, and establish a second mapping relationship between each second block of data and each second node;
[0104] S113. Store each of the second blocks of data in each of the second nodes respectively according to the second mapping relationship.
[0105] In this embodiment, multiple second blocks of data are distributed to multiple nodes of the cluster server by a preset hash algorithm. The above-mentioned second node is selected from the cluster server, which refers to a single node storing a single second block of data. The second block of data of the attribute information is distributed by a preset hash algorithm, each second block of data is located to the corresponding second node, and a mapping relationship between each second block of data and each second node is established, so that the load of each node in the cluster server is kept as uniform as possible, and there will be no problem that some nodes are overloaded and some nodes are underloaded. Specifically, the specific distribution calculation process of the preset hash algorithm is as follows: each node in the cluster server is numbered, for example, from 0 to N-1, and the hash value corresponding to each second block of data is obtained by hashing the file block number of each second block of data, and the hash value is modulo N to obtain the remainder i, then the node numbered i in the cluster server is the second node corresponding to the second block of data. Among them, the specific process of hash calculation is a prior art, and this application will not be repeated here.
[0106] In one embodiment, after the step S6 of completing the read and write operations with each of the designated nodes according to the read and write operation information, the following steps are included:
[0107] S7. Based on the read and write operations, update the attribute information corresponding to the file system.
[0108] In this embodiment, the attribute information is used to record data of attribute information such as file size, modification time, read and write permissions, etc. When a read and write operation is performed on a file of the file system, the attribute information of the file system is also modified. Based on the specific read and write operation, the attribute information is modified. Specifically, according to the aforementioned second mapping relationship, the specific node where the attribute information is stored is determined, and the attribute information is modified at the corresponding node.
[0109] In one embodiment, after the step S3 of determining whether the directory tree contains the specified directory information, the following steps are included:
[0110] S401, if not, assigning a corresponding new file identifier to the specified directory information in the directory tree;
[0111] S501. Allocate a node for storing file data corresponding to the newly created file identifier to the newly created file identifier by using a preset hash algorithm.
[0112] In this embodiment, in the above step S401, when the above directory tree does not contain the above specified directory information, a new file identifier is assigned to the specified directory information, and the directory tree is updated. For example, the above specified directory information is <fs1 dir3 file3>If the corresponding directory information cannot be found in the directory tree of Table 1, a new file identifier is assigned to the directory information, such as "0007", and the directory tree is updated, with a new key "0001 / 0004 / file3" and a corresponding value "0007".
[0113] In the above step S501, the node of the file data corresponding to the above newly created file identifier is allocated through a preset hash algorithm, so as to create a new file corresponding to the above specified directory information in the above node. Through the above steps S401 to S501, the user can add file data to the file system. Only the directory tree needs to be updated in the metadata server, and the remaining file creation, data writing operations, etc. can be completed in the nodes of the cluster server, which greatly reduces the pressure on the metadata server and is conducive to the implementation of high-concurrency scenario business.
[0114] Reference Figure 2 In one embodiment of the present application, a data management device is provided, comprising:
[0115] The data storage unit 10 is used to store the directory tree of the file system in the metadata server; and to divide the file data of each file contained in the file system into blocks, and store each block in multiple nodes of the cluster server respectively; and to divide the attribute information corresponding to the file system into blocks, and store each block in multiple nodes of the cluster server respectively;
[0116] The instruction acquisition unit 20 is used to acquire the data read and write instruction sent by the user, wherein the data read and write instruction carries the designated directory information and the read and write operation information of the file to be read and written;
[0117] A judging unit 30, configured to judge whether the directory tree contains the specified directory information, wherein the directory tree is stored in a key-value format, with the directory information of each file as a key and the file identifier corresponding to each file as a value;
[0118] The identifier extraction unit 40 is used to extract the specified file identifier corresponding to the specified directory information from the metadata server if the specified directory information is included;
[0119] A node determination unit 50, configured to determine, according to the designated file identifier, each designated node in the cluster server where the file data corresponding to the to-be-read / written file is distributed;
[0120] The read / write operation unit 60 is used to complete the read / write operation with each of the designated nodes according to the read / write operation information.
[0121] In this embodiment, the implementation process of the functions and effects of the data storage unit 10, instruction acquisition unit 20, judgment unit 30, identification extraction unit 40, node determination unit 50 and read-write operation unit 60 in the above-mentioned data management device is specifically described in the implementation process of the corresponding steps S1-S6 in the above-mentioned data management method, and will not be repeated here.
[0122] The data management device of this embodiment stores the directory tree of the file system in the metadata server; divides the file data of each file contained in the file system into blocks, and stores each block in multiple nodes of the cluster server respectively; divides the attribute information corresponding to the file system into blocks, and stores each block in multiple nodes of the cluster server respectively; when performing data read and write operations, first obtain the data read and write instructions sent by the user, wherein the data read and write instructions carry the specified directory information and read and write operation information of the file to be read and written; when the directory tree contains the specified directory information, extract the specified file identifier corresponding to the specified directory information from the metadata server; then, according to the specified file identifier, determine the various specified nodes in the cluster server where the file data corresponding to the file to be read and written is distributed; finally, complete the read and write operations with each of the specified nodes according to the read and write operation information; in this way, it is only necessary to find the specified file identifier corresponding to the file to be read and written from the metadata server, and then the read and write operations can be performed on the corresponding specified node according to the specified file identifier, without performing the read and write operations from the metadata server, which greatly reduces the operating pressure of the metadata server on the one hand, and greatly improves the data reading efficiency in high concurrency scenarios on the other hand.
[0123] In one embodiment, the data storage unit 10 includes:
[0124] A first segmentation subunit, used for segmenting the file data of each of the files into a plurality of first blocks of data according to a first preset size;
[0125] A first allocation subunit is used to determine, according to the number of first blocks of data corresponding to each of the files, from all the nodes of the cluster server according to a preset hash algorithm, each first node for storing each of the first blocks of data, and establish a first mapping relationship between each of the first blocks of data and each of the first nodes;
[0126] The first storage subunit is used to store the first block data corresponding to each of the files to each of the first nodes according to the first mapping relationship.
[0127] In this embodiment, the implementation process of the functions and effects of the first segmentation subunit, the first allocation subunit and the first storage subunit in the above data management device is specifically described in the implementation process of the corresponding steps S101-S103 in the above data management method, which will not be repeated here.
[0128] In one embodiment, the read / write operation unit 60 includes:
[0129] A first reading subunit, used for extracting the data reading starting point value and the data reading length value from the read and write operation information;
[0130] A first determining subunit is used to determine a first target node corresponding to the data reading starting point value from each of the designated nodes;
[0131] The first operation sub-unit is used to read, in the first target node, the data reading starting point value as a starting point, from a first block of data corresponding to the first target node, the read data corresponding to the data reading length value.
[0132] In this embodiment, the implementation process of the functions and effects of the first reading subunit, the first determining subunit and the first operating subunit in the above-mentioned data management device is specifically detailed in the implementation process of the corresponding steps S601-S603 in the above-mentioned data management method, and will not be repeated here.
[0133] In one embodiment, the read / write operation unit 60 includes:
[0134] A second reading subunit, used for extracting the data operation starting point value and the data writing information from the read and write operation information;
[0135] A second determining subunit is used to determine a second target node corresponding to the data operation starting point value from the plurality of designated nodes;
[0136] A second operation subunit is used to write the data writing information into the first block data corresponding to the second target node in the second target node with the data operation starting point value as the starting point, so as to obtain the update block data corresponding to the second target node;
[0137] The reallocation subunit is used to reallocate the update block data to each node stored in the cluster server according to a preset hash algorithm.
[0138] In this embodiment, the implementation process of the functions and effects of the second reading subunit, the second determining subunit, the second operating subunit and the reallocation subunit in the above-mentioned data management device is specifically described in the implementation process of the corresponding steps S611-S614 in the above-mentioned data management method, and will not be repeated here.
[0139] In one embodiment, the first allocation subunit includes:
[0140] A first numbering module is used to number all nodes in the cluster server in sequence according to Arabic numerals starting from 0 to obtain the number of each node;
[0141] A second numbering module is used to number all first blocks of data corresponding to one of the files in sequence according to a preset numbering rule to obtain all file block numbers corresponding to one of the files;
[0142] A hash calculation module, used to perform hash calculations on a file identifier corresponding to one of the files and a file block number corresponding to each of the first blocks of data according to the preset hash algorithm, to obtain a hash value corresponding to each of the first blocks of data;
[0143] A modulo operation module, used for performing a modulo operation on the hash value corresponding to each of the first blocks of data with respect to the maximum node number, to obtain a modulo operation result;
[0144] A mapping module is used to map each of the first blocks of data to each of the first nodes according to a preset mapping rule, wherein the preset mapping rule is that the modulo operation result of the first block of data is equal to the node number of the first node.
[0145] In this embodiment, the implementation process of the functions and effects of the first numbering module, the second numbering module, the hash calculation module, the modulus operation module and the mapping module in the above-mentioned first allocation subunit is specifically described in the implementation process of the corresponding steps S1021-S1025 in the above-mentioned data management method, and will not be repeated here.
[0146] In one embodiment, the metadata server is a distributed metadata server cluster, and the data storage unit 10 includes:
[0147] A directory tree storage subunit, used to store the directory tree of the file system in each metadata server in the metadata server cluster, and use one of the metadata servers as a master metadata server and the other metadata servers as slave metadata servers, wherein the master metadata server is used to provide metadata services externally;
[0148] A judging subunit, used to judge whether a failure occurs in the primary metadata server;
[0149] The reselection subunit is used to select one of the metadata servers as a new primary metadata server if the primary metadata server fails, and use the new primary metadata server to provide metadata services externally.
[0150] In this embodiment, the implementation process of the functions and effects of the directory tree storage subunit, judgment subunit and reselection subunit in the above-mentioned data storage unit 10 is specifically described in the implementation process of the corresponding steps S121-S123 in the above-mentioned data management method, and will not be repeated here.
[0151] The data storage unit 10 comprises:
[0152] A second segmentation subunit, configured to segment the attribute information into a plurality of second blocks of data according to a second preset size;
[0153] A second allocation subunit is used to determine, according to the number of the second blocks of data, from all the nodes of the cluster server by a preset hash algorithm, each second node for storing each second block of data, and establish a second mapping relationship between each second block of data and each second node;
[0154] The second storage subunit is used to store each of the second blocks of data to each of the second nodes respectively according to the second mapping relationship.
[0155] In this embodiment, the implementation process of the functions and effects of the second segmentation subunit, the second allocation subunit and the second storage subunit in the above-mentioned data management device is specifically described in the implementation process of the corresponding steps S111-S113 in the above-mentioned data management method, and will not be repeated here.
[0156] In one embodiment, the data management device further includes:
[0157] The attribute updating unit is used to update the attribute information corresponding to the file system based on the read and write operations.
[0158] In this embodiment, the implementation process of the functions and effects of the attribute updating unit in the above data management device is specifically described in the implementation process corresponding to step S7 in the above data management method, which will not be repeated here.
[0159] In one embodiment, the data management device further includes:
[0160] an identifier allocation unit, configured to allocate a corresponding new file identifier to the specified directory information in the directory tree if the specified directory information is not included;
[0161] The node allocation unit is used to allocate a node for storing file data corresponding to the newly created file identifier to the newly created file identifier through a preset hash algorithm.
[0162] In this embodiment, the implementation process of the functions and effects of the identification allocation unit and the node allocation unit in the above data management device is specifically described in the implementation process corresponding to steps S401 to S501 in the above data management method, and will not be repeated here.
[0163] Reference Figure 3 In an embodiment of the present application, a computer device is also provided. The computer device may be a server, and its internal structure may be as follows: Figure 3 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor designed by the computer is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data such as a directory tree. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a data management method is implemented.
[0164] The processor executes the data management method, including:
[0165] The directory tree of the file system is stored in the metadata server; the file data of each file contained in the file system is divided into blocks, and each block is stored in a plurality of nodes of the cluster server; the attribute information corresponding to the file system is divided into blocks, and each block is stored in a plurality of nodes of the cluster server;
[0166] Acquire a data read / write instruction sent by a user, wherein the data read / write instruction carries designated directory information and read / write operation information of a file to be read / written;
[0167] Determine whether the directory tree contains the specified directory information, wherein the directory tree is stored in a key-value format, with the directory information of each file as the key and the file identifier corresponding to each file as the value;
[0168] If yes, extracting the specified file identifier corresponding to the specified directory information from the metadata server;
[0169] According to the designated file identifier, determining each designated node in the cluster server where the file data corresponding to the to-be-read / written file is distributed;
[0170] According to the read and write operation information, the read and write operations with each of the designated nodes are completed.
[0171] In one embodiment, the processor divides the file data of each file included in the file system into blocks, and stores each block in a plurality of nodes of the cluster server respectively, including:
[0172] Splitting the file data of each of the files into a plurality of first blocks of data according to a first preset size;
[0173] According to the number of first blocks of data corresponding to each of the files, first nodes for storing each of the first blocks of data are determined from all the nodes of the cluster server according to a preset hash algorithm, and a first mapping relationship between each of the first blocks of data and each of the first nodes is established;
[0174] According to the first mapping relationship, the first block data corresponding to each of the files is stored in each of the first nodes respectively.
[0175] In one embodiment, the read / write operation information includes a data read starting point value and a data read length value, and the processor completes the steps of the read / write operation with each of the designated nodes according to the read / write operation information, including:
[0176] Extracting the data reading starting point value and the data reading length value from the read and write operation information;
[0177] Determine, from each of the designated nodes, a first target node corresponding to the data reading starting point value;
[0178] In the first target node, taking the data reading starting point value as a starting point, read data corresponding to the data reading length value from a first block of data corresponding to the first target node.
[0179] In one embodiment, the read / write operation information includes a data operation starting point value and data writing information, and the processor completes the steps of performing the read / write operation with each of the designated nodes according to the read / write operation information, including:
[0180] Extracting the data operation starting point value and the data writing information from the read and write operation information;
[0181] Determine, from the plurality of designated nodes, a second target node corresponding to the data operation starting point value;
[0182] In the second target node, taking the data operation starting point value as a starting point, writing the data writing information into the first block of data corresponding to the second target node, and obtaining the update block data corresponding to the second target node;
[0183] According to a preset hash algorithm, the update block data is redistributed to each node stored in the cluster server.
[0184] In one embodiment, the processor determines, according to the number of first blocks of data corresponding to each of the files, from all nodes of the cluster server according to a preset hash algorithm, each first node for storing each of the first blocks of data, and the step of establishing a first mapping relationship between each of the first blocks of data and each of the first nodes includes:
[0185] Numbering all nodes in the cluster server in sequence according to Arabic numerals starting from 0 to obtain the number of each node;
[0186] Sequentially numbering all first blocks of data corresponding to the file according to a preset numbering rule to obtain all file block numbers corresponding to the file;
[0187] According to the preset hash algorithm, hash calculations are performed on the file identifier corresponding to one of the files and the file block number corresponding to each of the first blocks of data, respectively, to obtain hash values corresponding to each of the first blocks of data;
[0188] Performing a modulo operation on the hash value corresponding to each of the first blocks of data with respect to the maximum node number to obtain a modulo operation result;
[0189] Each of the first blocks of data is mapped to each of the first nodes according to a preset mapping rule, wherein the preset mapping rule is that a modulo operation result of the first block of data is equal to the node number of the first node.
[0190] In one embodiment, the metadata server is a distributed metadata server cluster, and the processor stores the directory tree of the file system in the metadata server, including:
[0191] The directory tree of the file system is stored in each metadata server in the metadata server cluster, and one of the metadata servers is used as a master metadata server and the other metadata servers are used as slave metadata servers, wherein the master metadata server is used to provide metadata services externally;
[0192] Determining whether the primary metadata server fails;
[0193] If the primary metadata server fails, one of the metadata servers is selected as a new primary metadata server, and the new primary metadata server is used to provide metadata services externally.
[0194] In one embodiment, after the processor determines whether the directory tree contains the specified directory information, the following steps are performed:
[0195] If not, assigning a corresponding new file identifier to the specified directory information in the directory tree;
[0196] A node for storing file data corresponding to the newly created file identifier is allocated to the newly created file identifier through a preset hash algorithm.
[0197] Those skilled in the art will understand that Figure 3 The structure shown in is merely a block diagram of a portion of the structure related to the present application solution and does not constitute a limitation on the computer device to which the present application solution is applied.
[0198] An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, a data management method is implemented, specifically:
[0199] The directory tree of the file system is stored in the metadata server; the file data of each file contained in the file system is divided into blocks, and each block is stored in a plurality of nodes of the cluster server; the attribute information corresponding to the file system is divided into blocks, and each block is stored in a plurality of nodes of the cluster server;
[0200] Acquire a data read / write instruction sent by a user, wherein the data read / write instruction carries designated directory information and read / write operation information of a file to be read / written;
[0201] Determine whether the directory tree contains the specified directory information, wherein the directory tree is stored in a key-value format, with the directory information of each file as the key and the file identifier corresponding to each file as the value;
[0202] If yes, extracting the specified file identifier corresponding to the specified directory information from the metadata server;
[0203] According to the designated file identifier, determining each designated node in the cluster server where the file data corresponding to the to-be-read / written file is distributed;
[0204] According to the read and write operation information, the read and write operations with each of the designated nodes are completed.
[0205] In one embodiment, the processor divides the file data of each file included in the file system into blocks, and stores each block in a plurality of nodes of the cluster server respectively, including:
[0206] Splitting the file data of each of the files into a plurality of first blocks of data according to a first preset size;
[0207] According to the number of first blocks of data corresponding to each of the files, first nodes for storing each of the first blocks of data are determined from all the nodes of the cluster server according to a preset hash algorithm, and a first mapping relationship between each of the first blocks of data and each of the first nodes is established;
[0208] According to the first mapping relationship, the first block data corresponding to each of the files is stored in each of the first nodes respectively.
[0209] In one embodiment, the read / write operation information includes a data read starting point value and a data read length value, and the processor completes the steps of the read / write operation with each of the designated nodes according to the read / write operation information, including:
[0210] Extracting the data reading starting point value and the data reading length value from the read and write operation information;
[0211] Determine, from each of the designated nodes, a first target node corresponding to the data reading starting point value;
[0212] In the first target node, taking the data reading starting point value as a starting point, read data corresponding to the data reading length value from a first block of data corresponding to the first target node.
[0213] In one embodiment, the read / write operation information includes a data operation starting point value and data writing information, and the processor completes the steps of performing the read / write operation with each of the designated nodes according to the read / write operation information, including:
[0214] Extracting the data operation starting point value and the data writing information from the read and write operation information;
[0215] Determine, from the plurality of designated nodes, a second target node corresponding to the data operation starting point value;
[0216] In the second target node, taking the data operation starting point value as a starting point, writing the data writing information into the first block of data corresponding to the second target node, and obtaining the update block data corresponding to the second target node;
[0217] According to a preset hash algorithm, the update block data is redistributed to each node stored in the cluster server.
[0218] In one embodiment, the processor determines, according to the number of first blocks of data corresponding to each of the files, from all nodes of the cluster server according to a preset hash algorithm, each first node for storing each of the first blocks of data, and the step of establishing a first mapping relationship between each of the first blocks of data and each of the first nodes includes:
[0219] Numbering all nodes in the cluster server in sequence according to Arabic numerals starting from 0 to obtain the number of each node;
[0220] Sequentially numbering all first blocks of data corresponding to the file according to a preset numbering rule to obtain all file block numbers corresponding to the file;
[0221] According to the preset hash algorithm, hash calculations are performed on the file identifier corresponding to one of the files and the file block number corresponding to each of the first blocks of data, respectively, to obtain hash values corresponding to each of the first blocks of data;
[0222] Performing a modulo operation on the hash value corresponding to each of the first blocks of data with respect to the maximum node number to obtain a modulo operation result;
[0223] Each of the first blocks of data is mapped to each of the first nodes according to a preset mapping rule, wherein the preset mapping rule is that a modulo operation result of the first block of data is equal to the node number of the first node.
[0224] In one embodiment, the metadata server is a distributed metadata server cluster, and the processor stores the directory tree of the file system in the metadata server, including:
[0225] The directory tree of the file system is stored in each metadata server in the metadata server cluster, and one of the metadata servers is used as a master metadata server and the other metadata servers are used as slave metadata servers, wherein the master metadata server is used to provide metadata services externally;
[0226] Determining whether the primary metadata server fails;
[0227] If the primary metadata server fails, one of the metadata servers is selected as a new primary metadata server, and the new primary metadata server is used to provide metadata services externally.
[0228] In one embodiment, after the processor determines whether the directory tree contains the specified directory information, the following steps are performed:
[0229] If not, assigning a corresponding new file identifier to the specified directory information in the directory tree;
[0230] A node for storing file data corresponding to the newly created file identifier is allocated to the newly created file identifier through a preset hash algorithm.
[0231] To summarize, the data management method, apparatus, computer equipment and storage medium of the present application store the directory tree of the file system in the metadata server; divide the file data of each file contained in the file system into blocks, and store each block in multiple nodes of the cluster server; divide the attribute information corresponding to the file system into blocks, and store each block in multiple nodes of the cluster server; when performing data reading and writing operations, it is only necessary to search for the specified file identifier corresponding to the file to be read and written from the metadata server, and then the reading and writing operations can be performed on the specified node corresponding to the file to be read and written according to the specified file identifier, without the need to perform reading and writing operations from the metadata server. On the one hand, this greatly reduces the operating pressure of the metadata server, and on the other hand, it greatly improves the data reading efficiency in high concurrency scenarios.
[0232] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing related hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media provided in this application and used in the embodiments may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0233] The above description is only a preferred embodiment of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application. < / xxxx> < / xxxx>
Claims
1. A data management method, characterized in that: include: Store the directory tree of the file system in the metadata server; and dividing the file data of each file contained in the file system into blocks, and storing each block in a plurality of nodes of the cluster server respectively; and dividing the attribute information corresponding to the file system into blocks, and storing each block in a plurality of nodes of the cluster server respectively; Acquire a data read / write instruction sent by a user, wherein the data read / write instruction carries designated directory information and read / write operation information of a file to be read / written; Determining whether the directory tree contains the specified directory information, wherein the directory tree is stored in a key-value format, with the directory information of each file as the key and the file identifier corresponding to each file as the value; If yes, extracting the specified file identifier corresponding to the specified directory information from the metadata server; According to the designated file identifier, determining each designated node in the cluster server where the file data corresponding to the to-be-read / written file is distributed; According to the read and write operation information, complete the read and write operations with each of the designated nodes; The step of dividing the file data of each file contained in the file system into blocks and storing each block in a plurality of nodes of the cluster server includes: Splitting the file data of each of the files into a plurality of first blocks of data according to a first preset size; According to the number of first blocks of data corresponding to each of the files, first nodes for storing each of the first blocks of data are determined from all the nodes of the cluster server according to a preset hash algorithm, and a first mapping relationship between each of the first blocks of data and each of the first nodes is established; According to the first mapping relationship, the first block data corresponding to each of the files is stored in each of the first nodes respectively; The read / write operation information includes a data read starting point value and a data read length value. The step of completing the read / write operation with each of the designated nodes according to the read / write operation information includes: Extracting the data reading starting point value and the data reading length value from the read and write operation information; Determine, from each of the designated nodes, a first target node corresponding to the data reading starting point value; In the first target node, taking the data reading starting point value as a starting point, reading data corresponding to the data reading length value from a first block of data corresponding to the first target node; The read / write operation information includes a data operation starting point value and data writing information. The step of completing the read / write operation with each of the designated nodes according to the read / write operation information includes: Extracting the data operation starting point value and the data writing information from the read and write operation information; Determine, from the plurality of designated nodes, a second target node corresponding to the data operation starting point value; In the second target node, taking the data operation starting point value as a starting point, writing the data writing information into the first block of data corresponding to the second target node, and obtaining the update block data corresponding to the second target node; According to a preset hash algorithm, the update block data is redistributed to each node stored in the cluster server.
2. The data management method according to claim 1, characterized in that: The step of determining, according to the number of first blocks of data corresponding to each of the files, first nodes for storing each of the first blocks of data from all the nodes of the cluster server according to a preset hash algorithm, and establishing a first mapping relationship between each of the first blocks of data and each of the first nodes comprises: Numbering all nodes in the cluster server in sequence according to Arabic numerals starting from 0 to obtain the number of each node; Sequentially numbering all first blocks of data corresponding to the file according to a preset numbering rule to obtain all file block numbers corresponding to the file; According to the preset hash algorithm, hash calculations are performed on the file identifier corresponding to one of the files and the file block number corresponding to each of the first blocks of data, respectively, to obtain hash values corresponding to each of the first blocks of data; Performing a modulo operation on the hash value corresponding to each of the first blocks of data with respect to the maximum node number to obtain a modulo operation result; Each of the first blocks of data is mapped to each of the first nodes according to a preset mapping rule, wherein the preset mapping rule is that a modulo operation result of the first block of data is equal to the node number of the first node.
3. The data management method according to claim 1, characterized in that: The metadata server is a distributed metadata server cluster, and the step of storing the directory tree of the file system in the metadata server includes: The directory tree of the file system is stored in each metadata server in the metadata server cluster, and one of the metadata servers is used as a master metadata server and the other metadata servers are used as slave metadata servers, wherein the master metadata server is used to provide metadata services externally; Determining whether the primary metadata server fails; If the primary metadata server fails, one of the metadata servers is selected as a new primary metadata server, and the new primary metadata server is used to provide metadata services externally.
4. The data management method according to claim 1, characterized in that: After the step of determining whether the directory tree contains the specified directory information, the method further comprises: If not, assigning a corresponding new file identifier to the specified directory information in the directory tree; A node for storing file data corresponding to the newly created file identifier is allocated to the newly created file identifier through a preset hash algorithm.
5. A data management device, applying the data management method according to any one of claims 1 to 4, characterized in that: include: A data storage unit, used for storing a directory tree of the file system in a metadata server; and dividing the file data of each file contained in the file system into blocks, and storing each block in a plurality of nodes of the cluster server respectively; and dividing the attribute information corresponding to the file system into blocks, and storing each block in a plurality of nodes of the cluster server respectively; An instruction acquisition unit, used to acquire a data read / write instruction sent by a user, wherein the data read / write instruction carries information about a designated directory of a file to be read / written and information about a read / write operation; a judging unit, configured to judge whether the directory tree contains the specified directory information, wherein the directory tree is stored in a key-value format, with the directory information of each file as the key and the file identifier corresponding to each file as the value; an identifier extraction unit, configured to extract a specified file identifier corresponding to the specified directory information from the metadata server if the specified directory information is included; A node determination unit, configured to determine, according to the specified file identifier, each specified node in the cluster server where the file data corresponding to the file to be read or written is distributed; A read / write operation unit is used to complete the read / write operation with each of the designated nodes according to the read / write operation information.
6. A computer device comprising a memory and a processor, wherein a computer program is stored in the memory, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 4 are implemented.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.
