WO2021169113A1 - 数据管理方法、装置、计算机设备和存储介质 - Google Patents

数据管理方法、装置、计算机设备和存储介质 Download PDF

Info

Publication number
WO2021169113A1
WO2021169113A1 PCT/CN2020/098793 CN2020098793W WO2021169113A1 WO 2021169113 A1 WO2021169113 A1 WO 2021169113A1 CN 2020098793 W CN2020098793 W CN 2020098793W WO 2021169113 A1 WO2021169113 A1 WO 2021169113A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
file
read
nodes
node
Prior art date
Application number
PCT/CN2020/098793
Other languages
English (en)
French (fr)
Inventor
刘昌鑫
李立帅
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2021169113A1 publication Critical patent/WO2021169113A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/11File system administration, e.g. details of archiving or snapshots
    • G06F16/122File system administration, e.g. details of archiving or snapshots using management policies
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/13File access structures, e.g. distributed indices
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/172Caching, prefetching or hoarding of files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/182Distributed file systems

Definitions

  • This application relates to the field of big data technology, in particular to a data management method, device, computer equipment and storage medium.
  • 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 includes a large amount of file data.
  • the metadata of the file system includes the directory tree and attribute information.
  • the directory tree is used to record the mapping relationship between the file data logic and the physical location, and the attribute information is used to record the file size, modification time, read and write permissions and other attribute information data.
  • the main purpose of this application is to provide a data management method, device, computer equipment and storage medium, which aims to solve the problems of centralized management of file data in the prior art, long data reading time, and low system efficiency.
  • This application proposes a data management method, including:
  • the designated file identifier determine each designated node where the file data corresponding to the file to be read and written is distributed in the cluster server;
  • This application also proposes a data management device, including:
  • the data storage unit is used to 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. And divide the attribute information corresponding to the file system into blocks, and store each block in a plurality of nodes of the cluster server;
  • the instruction acquisition unit is configured to acquire the data read and write instructions sent by the user, wherein the data read and write instructions carry designated directory information and read and write operation information of the file to be read and written;
  • a judging unit for judging whether the specified directory information is contained in the directory tree, 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 the designated file identifier corresponding to the designated directory information from the metadata server if the designated directory information is included;
  • a node determining unit configured to determine, according to the designated file identifier, each designated node where the file data corresponding to the file to be read and written is distributed in the cluster server;
  • the read and write operation unit is used to complete read and write operations with each of the designated nodes according to the read and write operation information.
  • This application also proposes a computer device, including a memory and a processor, the memory stores a computer program, and the processor implements the steps of a data management method when the computer program is executed:
  • the designated file identifier determine each designated node where the file data corresponding to the file to be read and written is distributed in the cluster server;
  • This application also proposes a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of a data management method are realized:
  • the designated file identifier determine each designated node where the file data corresponding to the file to be read and written is distributed in the cluster server;
  • the data management method, device, computer equipment and storage medium of this 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 each block is stored in multiple nodes of the cluster server; and the attribute information corresponding to the file system is divided into blocks, and each block is stored in multiple nodes of the cluster server; during data read and write operations , You only need to find the specified file ID corresponding to the file to be read and written from the metadata server, and then read and write to the specified node corresponding to the file to be read and write according to the specified file ID, without reading and writing from the metadata server Operation, on the one hand, greatly reduces the operating pressure of the metadata server, on the other hand, greatly improves the efficiency of data reading in high-concurrency scenarios.
  • FIG. 1 is a schematic flowchart of a data management method according to an embodiment of the present application
  • FIG. 2 is a schematic block diagram of the structure of a data management device according to an embodiment of the present application.
  • FIG. 3 is a schematic block diagram of the structure of a computer device according to an embodiment of the present application.
  • an embodiment of the present application provides a data management method, including:
  • S1 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; and The attribute information corresponding to the file system is divided into blocks, and each block is respectively stored in multiple nodes of the cluster server;
  • S3. Determine whether the specified directory information is contained in the directory tree, where the directory tree is stored in a key-value format, with the directory information of each file as a key, and a file identifier corresponding to each file as a value;
  • the file data is data contained in the file content in the file system
  • the attribute information is data that records attribute information such as file size, modification time, and read and write permissions.
  • the directory tree is stored in a dedicated metadata server
  • the file data is distributedly stored in multiple nodes of the cluster server
  • the attribute information is also distributedly stored in multiple nodes of the cluster server.
  • the above-mentioned metadata server is a metadata server dedicated to storing directory trees.
  • the above metadata server can be a single server; it can also be a distributed metadata server cluster, using multiple metadata servers, and multiple metadata servers adopt a full peer-to-peer model, that is, each metadata server is completely peer-to-peer.
  • Each metadata server can independently provide metadata services to the outside world, and the data of each metadata server is kept synchronized.
  • 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 externally, and the data of the other metadata servers are kept updated synchronously, but metadata services are not provided externally;
  • the primary metadata server fails, one of the remaining metadata servers is selected as the new primary metadata server; this ensures the reliability of the metadata server's external services.
  • the aforementioned cluster server includes multiple nodes, and the cluster server is used for distributed storage of file data and attribute information.
  • each node stores a part of data, and multiple nodes together constitute complete data.
  • the distributed cluster server distributes file data and attribute information to multiple nodes.
  • the directory tree is stored in the form of key-value.
  • Key-value storage can bring good scalability to the distributed storage management of the file system.
  • Add add a new file data mapping relationship in the key-value directory tree.
  • Table 1 is a specific example of a directory tree stored in a key-value form for 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. .
  • the data read and write instructions carry the specified directory information of the file to be read and written, that is, ⁇ FS1/dir3/file2>.
  • the metadata server first determines whether the specified directory information is included in the directory tree. For the specific example in Table 1, the metadata server first finds the value of FS1 as 0001, and then finds the root directory named "dir3" under the prefix "0001" "", that is, the value corresponding to the key of "0001/dir3" is "0004", and the file named "file2" in the root directory with the prefix "0001/0004" is further searched, that is, "0001/0004/ The value corresponding to the key of file2" is "0006".
  • the metadata server finds the designated file identifier corresponding to the above-mentioned designated directory information, it determines that the above-mentioned designated directory information is included in the directory tree, and extracts the designated file identifier. For the specific example in Table 1, the value is "0006". According to the value "0006", the logical location of the file data on the cluster server is determined.
  • each designated node where the file to be read and written is distributed in the cluster server can be determined. That is, according to the above-mentioned designated file identifier, the specific node information of the file data corresponding to the designated file identifier in distributed storage in the cluster server can be determined. Then, according to the read and write operation information in the data read and write instructions, the corresponding read and write operations are completed in the above-mentioned designated node.
  • the directory tree of the file system is stored in the metadata server; and the file data of each file contained in the file system is divided into blocks, and each block is stored in multiple nodes of the cluster server. And 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 read and write operations, first obtain the data read and write instructions sent by the user, among which, 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 specified directory information is contained in the directory tree, the specified file identification corresponding to the specified directory information is extracted from the metadata server; then the specified file identification is based on the specified file identification , Determine the file data corresponding to the file to be read and write in each designated node distributed in the cluster server; finally complete the read and write operations with each of the designated nodes according to the read and write operation information; in this way, only need to look up from the metadata server
  • the designated file identifier corresponding to the file to be read and written can be
  • 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:
  • S102 According to the number of the first piece of data corresponding to each of the files, from all the nodes of the cluster server, determine each first node for storing each of the first pieces of data according to a preset hash algorithm, and establish A first mapping relationship between each of the first pieces of data and each of the first nodes;
  • multiple first pieces of data are distributed to multiple nodes of the cluster server through a preset hash algorithm.
  • the above-mentioned first node is selected from a cluster server, and refers to a single node that stores a single first piece of data.
  • the first block of data of each file data is allocated by a preset hash algorithm, each first block of data is located to the corresponding first node, and the 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 remains uniform to the greatest extent, and there will be no problem that some nodes are overloaded, and some nodes are overloaded.
  • the above-mentioned read and write operation information includes a data reading starting point value and a data reading length value.
  • the above-mentioned step S6 of completing the read and write operation with each of the designated nodes according to the read and write operation information includes :
  • S602 From each of the designated nodes, determine the first target node corresponding to the starting point value of the data reading;
  • the corresponding data reading starting point value and data reading length value can be written in the reading and writing operation information.
  • Time 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 from the file to be read and written, the data in the corresponding read and write operation information
  • the data reading starting point is located in the third segmented first piece of data, and then matching is performed from the first mapping relationship to obtain the corresponding data of the first piece of data.
  • the first node can determine the first target node.
  • the read data corresponding to the data read length value is read starting from the data read starting point value.
  • the data reading operations 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 execution of high-concurrency scenarios.
  • the above read and write operation information includes the starting point value of the data operation and data writing information
  • the above step S6 of completing the read and write operation with each of the designated nodes according to the read and write operation information includes:
  • the corresponding data operation starting point value and data writing information can be written in the read and write operation information.
  • Block data it can be determined that the starting point value of the data operation is located in the third first block of data to be divided, and then matching is performed from the first mapping relationship to obtain the first corresponding to the first block of data. Node, the second target node can be determined.
  • the corresponding data writing information is written to obtain the update block data.
  • the size of the aforementioned update block data exceeds the first preset size, and the update block data is again stored in blocks of multiple nodes of the cluster server through a preset hash algorithm, so as to maximize the load of each node of the entire cluster server To maintain a balance.
  • the foregoing first mapping relationship is further updated.
  • the data writing operations in 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 facilitates the execution of high-concurrency scenarios.
  • step S102 in establishing a first mapping relationship between each of the first pieces of data and each of the first nodes includes:
  • each node in the cluster server is numbered, for example, from 0 to N-1, through the corresponding value of each file data in the directory tree key-value table and the file block number of each first block of data Perform hash calculation to obtain the hash value corresponding to each first piece of data, and take the modulus of the hash value N to obtain the remainder i. Then the node numbered i in the cluster server is the node corresponding to the first piece of data The first node.
  • the hash algorithm is the prior art, and the algorithm is not described in detail here in this application.
  • the metadata server is a distributed metadata server cluster
  • the step S1 of storing the directory tree of the file system in the metadata server includes:
  • the step S1 of storing the attribute information corresponding to the file system in the cluster server in a distributed manner includes:
  • multiple second pieces of data are distributed to multiple nodes of the cluster server through a preset hash algorithm.
  • the above-mentioned second node is selected from a cluster server, and refers to a single node that stores a single second piece of data.
  • the second piece of data of the attribute information is allocated by the preset hash algorithm, each second piece of data is located to the corresponding second node, and the mapping relationship between each second piece of data and each second node is established, so that the cluster
  • the load of each node in the server remains uniform to the greatest extent, and there will be no problem that some nodes are overloaded, and some nodes are overloaded.
  • each node in the cluster server is numbered, for example, from 0 to N-1, and each second block of data is hashed to obtain each second block number.
  • the hash value corresponding to the two pieces of data is modulo the hash value N to obtain the remainder i, and the node numbered i in the cluster server is the second node corresponding to the second piece of data.
  • the specific process of hash calculation is the prior art, which is not described in detail here in this application.
  • the method includes:
  • the above attribute information is used to record data of attribute information such as file size, modification time, and read and write permissions.
  • attribute information such as file size, modification time, and read and write permissions.
  • the attribute information of the file system is also modified.
  • the above attribute information is modified. Specifically, according to the foregoing second mapping relationship, the specific node stored in the attribute information is determined, and the attribute information is modified at the corresponding node.
  • the method includes:
  • S501 Assign 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.
  • step S401 when the specified directory information is not included in the directory tree, a new file identifier is assigned to the specified directory information, and the directory tree is updated.
  • the above-mentioned designated directory information is ⁇ FS1/dir3/file3>, and the corresponding directory information cannot be found in the directory tree of Table 1, then a new file identifier is assigned to the directory information, such as "0007”, and Update the directory tree and add a new key as "0001/0004/file3", and the corresponding value is "0007".
  • the node of the file data corresponding to the new file identifier is allocated by a preset hash algorithm, so as to be used to create a new file corresponding to the specified directory information in the node.
  • the user can add file data in the file system. Only the directory tree needs to be updated in the metadata server, and the rest of the file creation and data writing operations can be completed on the nodes of the cluster server, which greatly reduces the pressure on the metadata server and is conducive to the progress of high-concurrency scenarios. .
  • an embodiment of the present application provides a data management device, including:
  • the data storage unit 10 is used to 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 a plurality of cluster servers. Node; and dividing the attribute information corresponding to the file system into blocks, and storing each block in multiple nodes of the cluster server;
  • the instruction acquisition unit 20 is configured to acquire the data read and write instructions sent by the user, where the data read and write instructions carry designated directory information and read and write operation information of the file to be read and written;
  • the judging unit 30 is configured to judge whether the specified directory information is contained in the directory tree, 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 is value;
  • the identifier extraction unit 40 is configured to extract the designated file identifier corresponding to the designated directory information from the metadata server if the designated directory information is included;
  • the node determining unit 50 is configured to determine, according to the designated file identifier, each designated node where the file data corresponding to the file to be read and written is distributed in the cluster server;
  • the read and write operation unit 60 is configured to complete read and write operations with each of the designated nodes according to the read and write operation information.
  • the implementation process of the functions and effects of the data storage unit 10, the instruction acquisition unit 20, the judgment unit 30, the identification extraction unit 40, the node determination unit 50, and the read-write operation unit 60 in the above-mentioned data management device is detailed in The implementation process corresponding to steps S1-S6 in the above data management method will not be repeated here.
  • the directory tree of the file system is stored in the metadata server; and the file data of each file contained in the file system is divided into blocks, and each block is stored in multiple nodes of the cluster server. And 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 read and write operations, first obtain the data read and write instructions sent by the user, among which, 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 specified directory information is contained in the directory tree, the specified file identification corresponding to the specified directory information is extracted from the metadata server; then the specified file identification is based on the specified file identification , Determine the file data corresponding to the file to be read and write in each designated node distributed in the cluster server; finally complete the read and write operations with each of the designated nodes according to the read and write operation information; in this way, only need to look up from the metadata server
  • the designated file identifier corresponding to the file to be read and written can be
  • the aforementioned data storage unit 10 includes:
  • the first dividing subunit is configured to divide the file data of each of the files into a plurality of first blocks of data according to a first preset size
  • the first allocation sub-unit is configured to determine, from all nodes of the cluster server, according to the number of the first piece of data corresponding to each of the files, according to a preset hash algorithm, the data used to store each of the first pieces of data
  • Each first node establishes a first mapping relationship between each of the first pieces of data and each of the first nodes;
  • the first storage subunit is configured to respectively store the first piece of data corresponding to each of the files to each of the first nodes according to the first mapping relationship.
  • the implementation process of the functions and roles of the first division subunit, the first allocation subunit, and the first storage subunit in the above data management device is detailed in the implementation of corresponding steps S101-S103 in the above data management method. The process will not be repeated here.
  • the above-mentioned read-write operation unit 60 includes:
  • the first reading subunit is configured to extract the data reading starting point value and the data reading length value from the reading and writing operation information
  • the first determining subunit is configured to determine, from each of the designated nodes, the first target node corresponding to the starting point value of the data reading;
  • the first operation subunit is configured to read the data reading from the first block of data corresponding to the first target node in the first target node, using the data reading starting point as the starting point. Take the read data corresponding to the length value.
  • the realization process of the functions and roles of the first reading subunit, the first determining subunit, and the first operating subunit in the above data management apparatus is detailed in the corresponding steps S601-S603 in the above data management method. The realization process will not be repeated here.
  • the above-mentioned read-write operation unit 60 includes:
  • the second reading subunit is configured to extract the data operation starting point value and the data writing information from the read and write operation information
  • a second determining subunit configured to determine a second target node corresponding to the starting point value of the data operation from a plurality of designated nodes
  • the second operation subunit is configured to write the data writing information into the first piece of data corresponding to the second target node in the second target node, using the data operation starting point as the starting point, Obtaining update block data corresponding to the second target node;
  • the redistribution subunit is used to redistribute each node stored in the cluster server of the update block data according to a preset hash algorithm.
  • the implementation process of the functions and roles of the second reading subunit, the second determining subunit, the second operating subunit, and the redistribution subunit in the above-mentioned data management device is detailed in the corresponding data management method.
  • the implementation process of steps S611-S614 will not be repeated here.
  • the above-mentioned first allocation subunit includes:
  • the first numbering module is used to number all the nodes in the cluster server according to the Arabic numerals starting from 0 to obtain the number of each node respectively;
  • the second numbering module is used to sequentially number all the first blocks of data corresponding to one file according to a preset numbering rule to obtain all file block numbers corresponding to one file;
  • the hash calculation module is configured to perform a hash calculation on the file identifier corresponding to one of the files and the file block number corresponding to each of the first pieces of data according to the preset hash algorithm, respectively Obtaining a hash value corresponding to each of the first pieces of data;
  • a modulus operation module configured to perform a modulus operation on the largest node number of the hash value corresponding to each of the first pieces of data to obtain a modulus operation result
  • the mapping module is configured to map each of the first pieces of data to each of the first nodes according to preset mapping rules, where the preset mapping rules are the modulo operation result of the first piece of data and the first node.
  • the node numbers of the nodes are equal.
  • the implementation process of the functions and roles of the first numbering module, the second numbering module, the hash calculation module, the modulo operation module, and the mapping module in the first allocation subunit is detailed in the above data management method.
  • the implementation process corresponding to steps S1021-S1025 is not repeated here.
  • the metadata server is a distributed metadata server cluster
  • the data storage unit 10 includes:
  • the directory tree storage subunit is 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 the main metadata server, and the remaining metadata
  • the server serves as a slave metadata server, wherein the master metadata server is used to provide metadata services to the outside;
  • the judging subunit is used to judge whether the main metadata server has a failure
  • the reselection subunit is configured 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 externally service.
  • the implementation process of the functions and roles of the directory tree storage subunit, the judgment subunit, and the reselection subunit in the data storage unit 10 is detailed in the implementation process corresponding to steps S121-S123 in the above data management method. I won't repeat them here.
  • the aforementioned data storage unit 10 includes:
  • the second division subunit is configured to divide the attribute information into a plurality of second blocks of data according to a second preset size
  • the second allocation subunit is configured to determine each second node for storing each second piece of data from all nodes of the cluster server through a preset hash algorithm according to the number of the second piece of data, Establishing a second mapping relationship between each of the second pieces of data and each of the second nodes;
  • the second storage subunit is configured to store each of the second blocks of data to each of the second nodes according to the second mapping relationship.
  • the implementation process of the functions and roles of the second division subunit, the second allocation subunit, and the second storage subunit in the aforementioned data management device is detailed in the implementation of corresponding steps S111-S113 in the aforementioned data management method. The process will not be repeated here.
  • the above-mentioned data management device further includes:
  • the attribute update unit is configured to update the attribute information corresponding to the file system based on the read and write operations.
  • the implementation process of the function and role of the attribute update unit in the above-mentioned data management device is detailed in the implementation process corresponding to step S7 in the above-mentioned data management method, which will not be repeated here.
  • the above-mentioned data management device further includes:
  • An identification allocation unit configured to, if the specified directory information is not included, allocate a corresponding new file identification for the specified directory information in the directory tree;
  • the node allocation unit is configured to allocate a node for storing the file data corresponding to the newly created file identification to the newly created file identification by using a preset hash algorithm.
  • the implementation process of the functions and roles of the identification allocation unit and the node allocation unit in the aforementioned data management apparatus is detailed in the implementation process of the corresponding steps S401 to S501 in the aforementioned data management method, which will not be repeated here.
  • an embodiment of the present application also provides a computer device.
  • the computer device may be a server, and its internal structure may be as shown in FIG. 3.
  • the computer equipment 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 calculation 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 computer programs in the non-volatile storage medium.
  • the database of the computer equipment is used to store data such as directory trees.
  • the network interface of the computer device is used to communicate with an external terminal through a network connection.
  • the computer program is executed by the processor to realize a data management method.
  • the foregoing processor executing the foregoing data management method includes:
  • the designated file identifier determine each designated node where the file data corresponding to the file to be read and written is distributed in the cluster server;
  • the above-mentioned processor divides the file data of each file contained in the file system into blocks, and stores each block in a plurality of nodes of a cluster server, including:
  • each first node for storing each of the first pieces of data is determined according to a preset hash algorithm, and each of the first nodes is established.
  • the first piece of data corresponding to each of the files is respectively stored in each of the first nodes.
  • the read and write operation information includes a data read starting point value and a data read length value
  • the above-mentioned processor completes the steps of reading and writing operations with each of the designated nodes according to the read and write operation information.
  • the first target node using the data reading starting point as a starting point, read data corresponding to the data reading length value from the first block of data corresponding to the first target node .
  • the read and write operation information includes a data operation starting point value and data writing information
  • the above-mentioned processor completes the step of reading and writing operations with each of the designated nodes according to the read and write operation information, including :
  • the data writing information is written into the first piece of data corresponding to the second target node to obtain the second target node corresponding The update block data;
  • the above-mentioned processor determines the number of first pieces of data corresponding to each of the files to store each of the first pieces of data from all nodes of the cluster server according to a preset hash algorithm.
  • the step of establishing a first mapping relationship between each of the first pieces of data and each of the first nodes includes:
  • All the nodes in the cluster server are numbered in order according to Arabic numerals starting from 0, and the number of each node number is obtained respectively;
  • the file identifier corresponding to one of the files and the file block number corresponding to each of the first pieces of data are hashed to obtain each of the first pieces of data.
  • Each of the first pieces of data is respectively mapped to each of the first nodes according to a preset mapping rule, where the preset mapping rule is the modulo operation result of the first piece of data and the node number of the first node equal.
  • the metadata server is a distributed metadata server cluster
  • the step of storing the directory tree of the file system in the metadata server by the processor includes:
  • the primary metadata server is used to provide metadata services to the outside;
  • 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.
  • the method includes:
  • a preset hash algorithm is used to allocate a node for storing the file data corresponding to the newly created file identifier to the newly created file identifier.
  • FIG. 3 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied.
  • An embodiment of the present application also provides a computer-readable storage medium.
  • the above-mentioned storage medium may be a non-volatile storage medium or a volatile storage medium.
  • a computer program is stored thereon, and when the computer program is executed by the processor, a data management method is realized, specifically:
  • the designated file identifier determine each designated node where the file data corresponding to the file to be read and written is distributed in the cluster server;
  • the above-mentioned processor divides the file data of each file contained in the file system into blocks, and stores each block in a plurality of nodes of a cluster server, including:
  • each first node for storing each of the first pieces of data is determined according to a preset hash algorithm, and each of the first nodes is established.
  • the first piece of data corresponding to each of the files is respectively stored in each of the first nodes.
  • the read and write operation information includes a data read starting point value and a data read length value
  • the above-mentioned processor completes the steps of reading and writing operations with each of the designated nodes according to the read and write operation information.
  • the first target node using the data reading starting point as a starting point, read data corresponding to the data reading length value from the first block of data corresponding to the first target node .
  • the read and write operation information includes a data operation starting point value and data writing information
  • the above-mentioned processor completes the step of reading and writing operations with each of the designated nodes according to the read and write operation information, including :
  • the data writing information is written into the first piece of data corresponding to the second target node to obtain the second target node corresponding The update block data;
  • the above-mentioned processor determines the number of first pieces of data corresponding to each of the files to store each of the first pieces of data from all nodes of the cluster server according to a preset hash algorithm.
  • the step of establishing a first mapping relationship between each of the first pieces of data and each of the first nodes includes:
  • All the nodes in the cluster server are numbered in order according to Arabic numerals starting from 0, and the number of each node number is obtained respectively;
  • the file identifier corresponding to one of the files and the file block number corresponding to each of the first pieces of data are hashed to obtain each of the first pieces of data.
  • Each of the first pieces of data is respectively mapped to each of the first nodes according to a preset mapping rule, where the preset mapping rule is the modulo operation result of the first piece of data and the node number of the first node equal.
  • the metadata server is a distributed metadata server cluster
  • the step of storing the directory tree of the file system in the metadata server by the processor includes:
  • the primary metadata server is used to provide metadata services to the outside;
  • 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.
  • the method includes:
  • a preset hash algorithm is used to allocate a node for storing the file data corresponding to the newly created file identifier to the newly created file identifier.
  • the directory tree of the file system is stored in the metadata server; and the file data of each file contained in the file system is divided into blocks, And each block is stored in multiple nodes of the cluster server; and the attribute information corresponding to the file system is divided into blocks, and each block is stored in multiple nodes of the cluster server; during data read and write operations , You only need to find the specified file ID corresponding to the file to be read and written from the metadata server, and then read and write to the specified node corresponding to the file to be read and write according to the specified file ID, without reading and writing from the metadata server Operation, on the one hand, greatly reduces the operating pressure of the metadata server, on the other hand, greatly improves the efficiency of data reading in high-concurrency scenarios.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本申请涉及大数据领域,揭示数据管理方法、装置、计算机设备和存储介质,方法包括将文件系统的目录树存储于元数据服务器中;将文件系统所包含的各个文件的文件数据进行分块,并分别存储于集群服务器的多个节点中;将文件系统所对应的属性信息进行分块,并分别存储于集群服务器的多个节点中;获取用户发送的数据读写指令;判断目录树内是否包含指定目录信息;若是,则从所述元数据服务器内提取指定目录信息对应的指定文件标识;根据指定文件标识,确定所述待读写文件对应的文件数据在集群服务器中分布的各个指定节点;根据读写操作信息,完成与各个指定节点的读写操作。本申请减少了元数据服务器的运行压力,提高了高并发场景的数据读取效率。

Description

数据管理方法、装置、计算机设备和存储介质
本申请要求于2020年02月26日提交中国专利局、申请号为202010120131.9,发明名称为“数据管理方法、装置、计算机设备和存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及大数据技术领域,具体涉及一种数据管理方法、装置、计算机设备和存储介质。
背景技术
文件系统中,通常包括大量的文件数据,这些文件数据分布于文件系统的目录或者子目录中。一个目录中包含有大量的子目录或文件数据,且每个子目录中又包括有大量的文件数据。文件系统的元数据包括目录树以及属性信息。其中目录树用于记录文件数据逻辑与物理位置的映射关系,属性信息用于记录文件大小、修改时间、读写权限等属性信息的数据。发明人意识到,在现有技术中,通常将目录项元数据、文件数据和属性信息进行集中管理。在高并发场景中,由于数据访问的互斥会导致业务的并发度低下,数据读取的耗时较长,系统效率低下。
技术问题
本申请的主要目的为提供一种数据管理方法、装置、计算机设备和存储介质,旨在解决现有技术中的文件数据集中管理,数据读取耗时长,系统效率低下的问题。
技术解决方案
本申请提出一种数据管理方法,包括:
将文件系统的目录树存储于元数据服务器中;以及将所述文件系统所包含的各个文件的文件数据进行分块,并将各块分别存储于集群服务器的多个节点中;以及将所述文件系统所对应的属性信息进行分块,并将各块分别存储于所述集群服务器的多个节点中;
获取用户发送的数据读写指令,其中,所述数据读写指令中携带待读写文件的指定目录信息和读写操作信息;
判断所述目录树内是否包含所述指定目录信息,其中所述目录树以键-值的形式存储,以各个文件的目录信息为键,以各个文件对应的文件标识为值;
若是,则从所述元数据服务器内提取所述指定目录信息对应的指定文件标识;
根据所述指定文件标识,确定所述待读写文件对应的文件数据在所述集群服务器中分布的各个指定节点;
根据所述读写操作信息,完成与各个所述指定节点的读写操作。
本申请还提出了一种数据管理装置,包括:
数据存储单元,用于将文件系统的目录树存储于元数据服务器中;以及将所述文件系统所包含的各个文件的文件数据进行分块,并将各块分别存储于集群服务器的多个节点中;以及将所述文件系统所对应的属性信息进行分块,并将各块分别存储于所述集群服务器的多个节点中;
指令获取单元,用于获取用户发送的数据读写指令,其中,所述数据读写指令中携带待读写文件的指定目录信息和读写操作信息;
判断单元,用于判断所述目录树内是否包含所述指定目录信息,其中所述目录树以键-值的形式存储,以各个文件的目录信息为键,以各个文件对应的文件标识为值;
标识提取单元,用于若包含所述指定目录信息,则从所述元数据服务器内提取所述指定目录信息对应的指定文件标识;
节点确定单元,用于根据所述指定文件标识,确定所述待读写文件对应的文件数据在所述集群服务器中分布的各个指定节点;
读写操作单元,用于根据所述读写操作信息,完成与各个所述指定节点的读写操作。
本申请还提出了一种计算机设备,包括存储器和处理器,所述存储器中存储有计算机程序,所述处理器执行所述计算机程序时实现一种数据管理方法的步骤:
将文件系统的目录树存储于元数据服务器中;以及将所述文件系统所包含的各个文件的文件数据进行分块,并将各块分别存储于集群服务器的多个节点中;以及将所述文件系统所对应的属性信息进行分块,并将各块分别存储于所述集群服务器的多个节点中;
获取用户发送的数据读写指令,其中,所述数据读写指令中携带待读写文件的指定目录信息和读写操作信息;
判断所述目录树内是否包含所述指定目录信息,其中所述目录树以键-值的形式存储,以各个文件的目录信息为键,以各个文件对应的文件标识为值;
若是,则从所述元数据服务器内提取所述指定目录信息对应的指定文件标识;
根据所述指定文件标识,确定所述待读写文件对应的文件数据在所述集群服务器中分布的各个指定节点;
根据所述读写操作信息,完成与各个所述指定节点的读写操作。
本申请还提出了一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现一种数据管理方法的步骤:
将文件系统的目录树存储于元数据服务器中;以及将所述文件系统所包含的各个文件的文件数据进行分块,并将各块分别存储于集群服务器的多个节点中;以及将所述文件系统所对应的属性信息进行分块,并将各块分别存储于所述集群服务器的多个节点中;
获取用户发送的数据读写指令,其中,所述数据读写指令中携带待读写文件的指定目录信息和读写操作信息;
判断所述目录树内是否包含所述指定目录信息,其中所述目录树以键-值的形式存储,以各个文件的目录信息为键,以各个文件对应的文件标识为值;
若是,则从所述元数据服务器内提取所述指定目录信息对应的指定文件标识;
根据所述指定文件标识,确定所述待读写文件对应的文件数据在所述集群服务器中分布的各个指定节点;
根据所述读写操作信息,完成与各个所述指定节点的读写操作。
有益效果
本申请的有益效果:本申请的数据管理方法、装置、计算机设备和存储介质,将文件系统的目录树存储于元数据服务器中;以及将文件系统所包含的各个文件的文件数据进行分块,并将各块分别存储于集群服务器的多个节点中;以及将文件系统所对应的属性信息进行分块,并将各块分别存储于集群服务器的多个节点中;在进行数据读写操作时,只需从元数据服务器中查找待读写文件对应的指定文件标识,就可以根据指定文件标识,到待读写文件对应的指定节点进行读写操作,而无需从元数据服务器上进行读写操作,一方面大大减少了元数据服务器的运行压力,另一方面大大提高了高并发场景的数据读取效率。
附图说明
图1是本申请一实施例的数据管理方法的流程示意图;
图2是本申请一实施例的数据管理装置的结构示意框图;
图3是本申请一实施例的计算机设备的结构示意框图。
本发明的最佳实施方式
参照图1,本申请一实施例中提供了一种数据管理方法,包括:
S1、将文件系统的目录树存储于元数据服务器中;以及将所述文件系统所包含的各个文件的文件数据进行分块,并将各块分别存储于集群服务器的多个节点中;以及将所述文件系统所对应的属性信息进行分块,并将各块分别存储于所述集群服务器的多个节点中;
S2、获取用户发送的数据读写指令,其中,所述数据读写指令中携带待读写文件的指 定目录信息和读写操作信息;
S3、判断所述目录树内是否包含所述指定目录信息,其中所述目录树以键-值的形式存储,以各个文件的目录信息为键,以各个文件对应的文件标识为值;
S4、若是,则从所述元数据服务器内提取所述指定目录信息对应的指定文件标识;
S5、根据所述指定文件标识,确定所述待读写文件对应的文件数据在所述集群服务器中分布的各个指定节点;
S6、根据所述读写操作信息,完成与各个所述指定节点的读写操作。
本实施例中,上述步骤S1中,上述文件数据为在文件系统中的文件内容中所包含的数据,上述属性信息为记录文件大小、修改时间、读写权限等属性信息的数据。将目录树存储于专门的元数据服务器中,将文件数据分布式存储于集群服务器的多个节点中,并将属性信息也分布式存储于集群服务器的多个节点中。
上述元数据服务器为专门存储目录树的元数据服务器。上述元数据服务器可以为单台服务器;也可以为分布式元数据服务器集群,采用多台元数据服务器,多台元数据服务器采用全对等模式,即每台元数据服务器是完全对等的,每台元数据服务器都可以独立对外提供元数据服务,各台元数据服务器的数据保持同步。当元数据服务器采用分布式元数据服务器集群时,采用其中一台元数据服务器作为主元数据服务器,对外提供元数据服务,其余元数据服务器的数据保持同步更新,但不对外提供元数据服务;当主元数据服务器发生故障时,从其余元数据服务器中挑选一台作为新的主元数据服务器;以此保证元数据服务器对外服务的可靠性。
上述集群服务器中包括多个节点,集群服务器用于分布式存储文件数据和属性信息。在集群服务器中,每个节点存储一部分数据,多个节点共同构成完整数据。分布式的集群服务器将文件数据和属性信息分别分散到多台节点。当用户需要进行某个文件的数据读写操作时,在对应的节点即可进行,无需从元数据服务器上进行读写操作,有效地降低了元数据服务器的压力。
上述步骤S2~S4中,在元数据服务器中,目录树以键-值的形式存储,键-值存储可以为文件系统的分布式存储管理带来很好的扩展性,如果需要处理的文件数据增加,在键-值目录树中增加新的文件数据的映射关系即可。表1为某个文件系统以键-值的形式存储的目录树的具体例子,该文件系统的文件夹FS1下包含dir1、dir2和dir3子文件夹,其中dir3子文件夹下包括文件file1和file2。
表1文件系统目录树
FS1 0001
0001/dir1 0002
0001/dir2 0003
0001/dir3 0004
0001/0004/file1 0005
0001/0004/file2 0006
当用户想要打开file2文件,并对file2文件进行读写操作时,在数据读写指令中携带待读写文件的指定目录信息,即<FS1/dir3/file2>。元数据服务器首先判断在目录树中是否包含上述指定目录信息,对于表1的具体例子,元数据服务器首先查找到FS1的值为0001,再查找前缀为“0001”的根目录下名为“dir3”的目录,即“0001/dir3”的键对应的值为“0004”,再进一步查找前缀为“0001/0004”的根目录下名为“file2”的文件,即查找到“0001/0004/file2”的键对应的值为“0006”。当元数据服务器查找到上述指定目录信息对应的指定文件标识,即判定在目录树中包含上述指定目录信息,提取出该指定文件标识,对于表1的具体例子,即为值“0006”。根据值“0006”即确定了文件数据在集群服务器上的逻辑位置。
上述步骤S5~S6中,根据待读写文件的指定文件标识,即可确定待读写文件在集群服务 器中分布的各个指定节点。即根据上述指定文件标识,即可确定该指定文件标识对应的文件数据分布式存储于集群服务器中的具体节点信息。再根据数据读写指令中的读写操作信息,在上述指定节点中完成对应的读写操作。
本实施例的数据管理方法,将文件系统的目录树存储于元数据服务器中;以及将文件系统所包含的各个文件的文件数据进行分块,并将各块分别存储于集群服务器的多个节点中;以及将文件系统所对应的属性信息进行分块,并将各块分别存储于集群服务器的多个节点中;在进行数据读写操作时,首先获取用户发送的数据读写指令,其中,数据读写指令中携带待读写文件的指定目录信息和读写操作信息;当目录树内包含指定目录信息时,从元数据服务器内提取指定目录信息对应的指定文件标识;接着根据指定文件标识,确定待读写文件对应的文件数据在集群服务器中分布的各个指定节点;最后根据所述读写操作信息完成与各个所述指定节点之间的读写操作;这样只需从元数据服务器查找待读写文件对应的指定文件标识,就可以根据指定文件标识到对应的指定节点进行读写操作,而无需从元数据服务器上进行读写操作,一方面大大减少了元数据服务器的运行压力,另一方面大大提高了高并发场景的数据读取效率。
在一个实施例中,上述将所述文件系统所包含的各个文件的文件数据进行分块,并将各块分别存储于集群服务器的多个节点中的步骤S1包括:
S101、分别将各个所述文件的文件数据按照第一预置大小分割成多个第一块数据;
S102、分别根据各个所述文件对应的第一块数据的数目,从所述集群服务器的全部节点中,根据预设hash算法确定用于存储各个所述第一块数据的各个第一节点,建立各个所述第一块数据与各个所述第一节点之间的第一映射关系;
S103、根据所述第一映射关系,分别将各个所述文件对应的第一块数据存储至各个所述第一节点。
本实施例中,通过预设hash算法将多个第一块数据分配到集群服务器的多个节点中。上述第一节点选自集群服务器,指的是储存单个第一块数据的单个节点。通过预设hash算法对各个文件数据的第一块数据进行分配,将每个第一块数据定位至对应的第一节点,建立各个第一块数据与各个第一节点之间的映射关系,使得集群服务器中的各个节点的负载保持最大程度的均匀,不会出现某些节点负载过大,而某些节点负载过小的问题。
在一个实施例中,上述读写操作信息中包括数据读取起点值和数据读取长度值,上述根据所述读写操作信息,完成与各个所述指定节点的读写操作的步骤S6,包括:
S601、从所述读写操作信息中提取所述数据读取起点值和所述数据读取长度值;
S602、从各个所述指定节点中,确定所述数据读取起点值对应的第一目标节点;
S603、在所述第一目标节点中,以所述数据读取起点值为起点,从所述第一目标节点对应的第一块数据中,读取与所述数据读取长度值对应的读取数据。
本实施例中,上述步骤S601中,当用户需要从待读写文件数据中读取一定的数据片段时,可以在读写操作信息中写入对应的数据读取起点值和数据读取长度值时。在一个具体例子中,例如用户要从待读写文件中,读取从距首字符的偏移量为60M的数据点开始的、长度为2M的数据片段,则对应的读写操作信息中数据读取起点值为<off=60M>,数据读取长度值为<len=2M>。
上述步骤S602中,首先根据数据读取起点值确定该数据读取起点位置所处的第一目标节点。例如对于前述具体例子,在步骤S5中根据指定文件标识确定了待读写文件分布的各个指定节点,本步骤S602中则用于确定<off=60M>的数据读取起点值具体位于各个指定节点中的哪个节点,该节点即为上述第一目标节点。具体地,根据数据读取起点值,在前述各个第一块数据与第一节点之间的第一映射关系中进行匹配,例如待读写文件数据被按照25M的大小依序分割成多个第一块数据,则根据<off=60M>,可以确定数据读取起点值位于被分割的第3个第一块数据中,则从第一映射关系中进行匹配,得到该第一块数据对应的第一节点,即可确定第一目标节点。
上述步骤S603中,在上述第一目标节点中,从数据读取起点值开始,读取与数据读取长度值对应的读取数据。数据的读取操作均在集群服务器的节点内完成,无需在元数据服务器中进行操作,大大减轻了元数据服务器的压力,并且有利于高并发场景业务的进行。
在一个实施例中,上述读写操作信息中包括数据操作起点值和数据写入信息,上述根据所述读写操作信息,完成与各个所述指定节点的读写操作的步骤S6,包括:
S611、从所述读写操作信息中提取所述数据操作起点值和所述数据写入信息;
S612、从多个所述指定节点中,确定所述数据操作起点值对应的第二目标节点;
S613、在所述第二目标节点中,以所述数据操作起点值为起点,将所述数据写入信息写入所述第二目标节点对应的第一块数据中,得到所述第二目标节点对应的更新块数据;
S614、根据预设hash算法,重新分配所述更新块数据在所述集群服务器中存储的各个节点。
本实施例中,上述步骤S611中,当用户需要对待读写文件数据中写入一定的数据片段时,可以在读写操作信息中写入对应的数据操作起点值和数据写入信息时。在一个具体例子中,例如用户要从待读写文件中,从距首字符的偏移量为60M的数据点开始,写入内容为<xxxx>的数据片段,则对应的读写操作信息中数据读取起点值为<off=60M>,数据写入信息为<xxxx>。
上述步骤S612中,首先根据数据操作起点值确定该数据操作起点位置所处的第二目标节点。例如对于前述具体例子,在步骤S5中根据指定文件标识确定了待读写文件分布的各个指定节点,本步骤S612中则用于确定<off=60M>的数据操作起点值具体位于各个指定节点中的哪个节点,该节点即为上述第二目标节点。具体地,根据数据操作起点值,在前述各个第一块数据与第一节点之间的第一映射关系中进行匹配,例如待读写文件数据被按照25M的大小依序分割成多个第一块数据,则根据<off=60M>,可以确定数据操作起点值位于被分割的第3个第一块数据中,则从第一映射关系中进行匹配,得到该第一块数据对应的第一节点,即可确定第二目标节点。
上述步骤S613~S614中,在上述第二目标节点中,从数据操作起点值开始,写入对应的数据写入信息,得到更新块数据。上述更新块数据的大小超出了第一预置大小,则再次通过预设hash算法将更新块数据进行分块存储至集群服务器的多个节点中,以使得整个集群服务器的各个节点的负载最大程度地保持均衡。在上述步骤S614后,进一步地对上述第一映射关系进行更新。
本实施例的数据的写入操作均在集群服务器的节点内完成,无需在元数据服务器中进行操作,大大减轻了元数据服务器的压力,并且有利于高并发场景业务的进行。
在一个实施例中,上述分别根据各个所述文件对应的第一块数据的数目,从所述集群服务器的全部节点中,根据预设hash算法确定用于存储各个所述第一块数据的各个第一节点,建立各个所述第一块数据与各个所述第一节点之间的第一映射关系中的步骤S102包括:
S1021、将所述集群服务器中的全部节点按照从0开始的阿拉伯数字依序进行编号,分别得到各个节点编号数;
S1022、对一个所述文件对应的全部第一块数据按照预设编号规则依序进行编号,得到一个所述文件对应的全部文件块编号;
S1023、根据所述预设hash算法,分别对一个所述文件对应的文件标识和其对应的每个所述第一块数据所对应的文件块编号,进行哈希计算,分别得到每个所述第一块数据对应的哈希值;
S1024、分别将每个所述第一块数据对应的哈希值,对最大的节点编号数进行取模运算,得到取模运算结果;
S1025、将各个所述第一块数据,按照预设映射规则分别映射至各个所述第一节点,其中,所述预设映射规则为第一块数据的取模运算结果与第一节点的节点编号数相等。
本实施例中,对集群服务器中的各个节点进行编号,例如从0到N-1,通过对每个文件 数据在目录树键-值表中对应的值和各个第一块数据的文件块编号进行哈希计算得到各个第一块数据对应的哈希值,对该哈希值按N取模,得到余数i,则在集群服务器中编号为i的节点即为与该第一块数据对应的第一节点。其中,哈希算法为现有技术,本申请在此不对算法进行赘述。
在一个实施例中,上述元数据服务器为分布式元数据服务器集群,上述将文件系统的目录树存储于元数据服务器中的步骤S1,包括:
S121、将所述文件系统的目录树存储于所述元数据服务器集群中的每台元数据服务器中,并将其中一台元数据服务器作为主元数据服务器,其余元数据服务器作为从元数据服务器,其中,所述主元数据服务器用于对外提供元数据服务;
S122、判断所述主元数据服务器是否发生故障;
S123、若所述主元数据服务器发生故障,则从所述元数据服务器中选择一台作为新的主元数据服务器,并采用所述新的主元数据服务器对外提供元数据服务。
在一个实施例中,上述将所述文件系统所对应的属性信息分布式存储于所述集群服务器中的步骤S1包括:
S111、将所述属性信息按照第二预置大小分割成多个第二块数据;
S112、根据所述第二块数据的数目,从所述集群服务器的全部节点中,通过预设hash算法确定用于存储各个所述第二块数据的各个第二节点,建立各个所述第二块数据与各个所述第二节点之间的第二映射关系;
S113、根据所述第二映射关系,将各个所述第二块数据分别存储至各个所述第二节点。
本实施例中,通过预设hash算法将多个第二块数据分配到集群服务器的多个节点中。上述第二节点选自集群服务器,指的是储存单个第二块数据的单个节点。通过预设hash算法对属性信息的第二块数据进行分配,将每个第二块数据定位至对应的第二节点,建立各个第二块数据与各个第二节点之间的映射关系,使得集群服务器中的各个节点的负载保持最大程度的均匀,不会出现某些节点负载过大,而某些节点负载过小的问题。具体地,预设hash算法的具体分配计算过程如下,对集群服务器中的各个节点进行编号,例如从0到N-1,通过对各个第二块数据的文件块编号进行哈希计算得到各个第二块数据对应的哈希值,对该哈希值按N取模,得到余数i,则在集群服务器中编号为i的节点即为与该第二块数据对应的第二节点。其中,哈希计算的具体过程为现有技术,本申请在此不做赘述。
在一个实施例中,上述根据所述读写操作信息,完成与各个所述指定节点的读写操作的步骤S6后,包括:
S7、基于所述读写操作,更新所述文件系统对应的属性信息。
本实施例中,上述属性信息用于记录文件大小、修改时间、读写权限等属性信息的数据。当对文件系统的文件进行了读写操作后,文件系统的属性信息也被修改。基于具体的读写操作,对上述属性信息进行修改。具体地,根据前述第二映射关系,确定属性信息所存储的具体节点,在对应的节点对属性信息进行修改。
在一个实施例中,上述判断所述目录树内是否包含所述指定目录信息的步骤S3后,包括:
S401、若否,则在所述目录树内为所述指定目录信息分配对应的新建文件标识;
S501、通过预设hash算法为所述新建文件标识分配用于存储所述新建文件标识对应的文件数据的节点。
本实施例中,上述步骤S401中,当上述目录树中没有包含上述指定目录信息时,则为该指定目录信息分配一个新建文件标识,并更新目录树。举例来说,上述指定目录信息为<FS1/dir3/file3>,在表1的目录树中查找不到对应的目录信息,则在为该目录信息分配一个新建文件标识,例如“0007”,并更新目录树,新增一条键为“0001/0004/file3”,对应的值为“0007”。
上述步骤S501中,通过预设hash算法分配上述新建文件标识对应的文件数据的节点, 以用于在上述节点中新建与上述指定目录信息对应的文件。通过上述步骤S401~S501,用户可以在文件系统中新增文件数据。在元数据服务器内仅需对目录树进行更新,其余文件新建、数据写入的操作等均可在集群服务器的节点完成,大大减轻了元数据服务器的压力,并且有利于高并发场景业务的进行。
参照图2,本申请一实施例中提供了一种数据管理装置,包括:
数据存储单元10,用于将文件系统的目录树存储于元数据服务器中;以及将所述文件系统所包含的各个文件的文件数据进行分块,并将各块分别存储于集群服务器的多个节点中;以及将所述文件系统所对应的属性信息进行分块,并将各块分别存储于所述集群服务器的多个节点中;
指令获取单元20,用于获取用户发送的数据读写指令,其中,所述数据读写指令中携带待读写文件的指定目录信息和读写操作信息;
判断单元30,用于判断所述目录树内是否包含所述指定目录信息,其中所述目录树以键-值的形式存储,以各个文件的目录信息为键,以各个文件对应的文件标识为值;
标识提取单元40,用于若包含所述指定目录信息,则从所述元数据服务器内提取所述指定目录信息对应的指定文件标识;
节点确定单元50,用于根据所述指定文件标识,确定所述待读写文件对应的文件数据在所述集群服务器中分布的各个指定节点;
读写操作单元60,用于根据所述读写操作信息,完成与各个所述指定节点的读写操作。
本实施例中,上述数据管理装置中的数据存储单元10、指令获取单元20、判断单元30、标识提取单元40、节点确定单元50与读写操作单元60的功能和作用的实现过程具体详见上述数据管理方法中对应步骤S1-S6的实现过程,在此不再赘述。
本实施例的数据管理装置,将文件系统的目录树存储于元数据服务器中;以及将文件系统所包含的各个文件的文件数据进行分块,并将各块分别存储于集群服务器的多个节点中;以及将文件系统所对应的属性信息进行分块,并将各块分别存储于集群服务器的多个节点中;在进行数据读写操作时,首先获取用户发送的数据读写指令,其中,数据读写指令中携带待读写文件的指定目录信息和读写操作信息;当目录树内包含指定目录信息时,从元数据服务器内提取指定目录信息对应的指定文件标识;接着根据指定文件标识,确定待读写文件对应的文件数据在集群服务器中分布的各个指定节点;最后根据所述读写操作信息完成与各个所述指定节点之间的读写操作;这样只需从元数据服务器查找待读写文件对应的指定文件标识,就可以根据指定文件标识到对应的指定节点进行读写操作,而无需从元数据服务器上进行读写操作,一方面大大减少了元数据服务器的运行压力,另一方面大大提高了高并发场景的数据读取效率。
在一个实施例中,上述数据存储单元10包括:
第一分割子单元,用于分别将各个所述文件的文件数据按照第一预置大小分割成多个第一块数据;
第一分配子单元,用于分别根据各个所述文件对应的第一块数据的数目,从所述集群服务器的全部节点中,根据预设hash算法确定用于存储各个所述第一块数据的各个第一节点,建立各个所述第一块数据与各个所述第一节点之间的第一映射关系;
第一存储子单元,用于根据所述第一映射关系,分别将各个所述文件对应的第一块数据存储至各个所述第一节点。
本实施例中,上述数据管理装置中的第一分割子单元、第一分配子单元与第一存储子单元的功能和作用的实现过程具体详见上述数据管理方法中对应步骤S101-S103的实现过程,在此不再赘述。
在一个实施例中,上述读写操作单元60包括:
第一读取子单元,用于从所述读写操作信息中提取所述数据读取起点值和所述数据读取长度值;
第一确定子单元,用于从各个所述指定节点中,确定所述数据读取起点值对应的第一目标节点;
第一操作子单元,用于在所述第一目标节点中,以所述数据读取起点值为起点,从所述第一目标节点对应的第一块数据中,读取与所述数据读取长度值对应的读取数据。
本实施例中,上述数据管理装置中的第一读取子单元、第一确定子单元与第一操作子单元的功能和作用的实现过程具体详见上述数据管理方法中对应步骤S601-S603的实现过程,在此不再赘述。
在一个实施例中,上述读写操作单元60,包括:
第二读取子单元,用于从所述读写操作信息中提取所述数据操作起点值和所述数据写入信息;
第二确定子单元,用于从多个所述指定节点中,确定所述数据操作起点值对应的第二目标节点;
第二操作子单元,用于在所述第二目标节点中,以所述数据操作起点值为起点,将所述数据写入信息写入所述第二目标节点对应的第一块数据中,得到所述第二目标节点对应的更新块数据;
重新分配子单元,用于根据预设hash算法,重新分配所述更新块数据在所述集群服务器中存储的各个节点。
本实施例中,上述数据管理装置中的第二读取子单元、第二确定子单元、第二操作子单元与重新分配子单元的功能和作用的实现过程具体详见上述数据管理方法中对应步骤S611-S614的实现过程,在此不再赘述。
在一个实施例中,上述第一分配子单元包括:
第一编号模块,用于将所述集群服务器中的全部节点按照从0开始的阿拉伯数字依序进行编号,分别得到各个节点编号数;
第二编号模块,用于对一个所述文件对应的全部第一块数据按照预设编号规则依序进行编号,得到一个所述文件对应的全部文件块编号;
哈希计算模块,用于根据所述预设hash算法,分别对一个所述文件对应的文件标识和其对应的每个所述第一块数据所对应的文件块编号,进行哈希计算,分别得到每个所述第一块数据对应的哈希值;
取模运算模块,用于分别将每个所述第一块数据对应的哈希值,对最大的节点编号数进行取模运算,得到取模运算结果;
映射模块,用于将各个所述第一块数据,按照预设映射规则分别映射至各个所述第一节点,其中,所述预设映射规则为第一块数据的取模运算结果与第一节点的节点编号数相等。
本实施例中,上述第一分配子单元中的第一编号模块、第二编号模块、哈希计算模块、取模运算模块与映射模块的功能和作用的实现过程具体详见上述数据管理方法中对应步骤S1021-S1025的实现过程,在此不再赘述。
在一个实施例中,上述元数据服务器为分布式元数据服务器集群,上述数据存储单元10,包括:
目录树存储子单元,用于将所述文件系统的目录树存储于所述元数据服务器集群中的每台元数据服务器中,并将其中一台元数据服务器作为主元数据服务器,其余元数据服务器作为从元数据服务器,其中,所述主元数据服务器用于对外提供元数据服务;
判断子单元,用于判断所述主元数据服务器是否发生故障;
重选子单元,用于若所述主元数据服务器发生故障,则从所述元数据服务器中选择一台作为新的主元数据服务器,并采用所述新的主元数据服务器对外提供元数据服务。
本实施例中,上述数据存储单元10中的目录树存储子单元、判断子单元与重选子单元的功能和作用的实现过程具体详见上述数据管理方法中对应步骤S121-S123的实现过程,在 此不再赘述。
上述数据存储单元10包括:
第二分割子单元,用于将所述属性信息按照第二预置大小分割成多个第二块数据;
第二分配子单元,用于根据所述第二块数据的数目,从所述集群服务器的全部节点中,通过预设hash算法确定用于存储各个所述第二块数据的各个第二节点,建立各个所述第二块数据与各个所述第二节点之间的第二映射关系;
第二存储子单元,用于根据所述第二映射关系,将各个所述第二块数据分别存储至各个所述第二节点。
本实施例中,上述数据管理装置中的第二分割子单元、第二分配子单元与第二存储子单元的功能和作用的实现过程具体详见上述数据管理方法中对应步骤S111-S113的实现过程,在此不再赘述。
在一个实施例中,上述数据管理装置,还包括:
属性更新单元,用于基于所述读写操作,更新所述文件系统对应的属性信息。
本实施例中,上述数据管理装置中的属性更新单元的功能和作用的实现过程具体详见上述数据管理方法中对应步骤S7的实现过程,在此不再赘述。
在一个实施例中,上述数据管理装置,还包括:
标识分配单元,用于若不包含所述指定目录信息,则在所述目录树内为所述指定目录信息分配对应的新建文件标识;
节点分配单元,用于通过预设hash算法为所述新建文件标识分配用于存储所述新建文件标识对应的文件数据的节点。
本实施例中,上述数据管理装置中的标识分配单元与节点分配单元的功能和作用的实现过程具体详见上述数据管理方法中对应步骤S401~S501的实现过程,在此不再赘述。
参照图3,本申请实施例中还提供一种计算机设备,该计算机设备可以是服务器,其内部结构可以如图3所示。该计算机设备包括通过系统总线连接的处理器、存储器、网络接口和数据库。其中,该计算机设计的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统、计算机程序和数据库。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的数据库用于存储目录树等数据。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机程序被处理器执行时以实现一种数据管理方法。
上述处理器执行上述数据管理方法,包括:
将文件系统的目录树存储于元数据服务器中;以及将所述文件系统所包含的各个文件的文件数据进行分块,并将各块分别存储于集群服务器的多个节点中;以及将所述文件系统所对应的属性信息进行分块,并将各块分别存储于所述集群服务器的多个节点中;
获取用户发送的数据读写指令,其中,所述数据读写指令中携带待读写文件的指定目录信息和读写操作信息;
判断所述目录树内是否包含所述指定目录信息,其中所述目录树以键-值的形式存储,以各个文件的目录信息为键,以各个文件对应的文件标识为值;
若是,则从所述元数据服务器内提取所述指定目录信息对应的指定文件标识;
根据所述指定文件标识,确定所述待读写文件对应的文件数据在所述集群服务器中分布的各个指定节点;
根据所述读写操作信息,完成与各个所述指定节点的读写操作。
在一实施例中,上述处理器将所述文件系统所包含的各个文件的文件数据进行分块,并将各块分别存储于集群服务器的多个节点中的步骤包括:
分别将各个所述文件的文件数据按照第一预置大小分割成多个第一块数据;
分别根据各个所述文件对应的第一块数据的数目,从所述集群服务器的全部节点中,根据预设hash算法确定用于存储各个所述第一块数据的各个第一节点,建立各个所述第一 块数据与各个所述第一节点之间的第一映射关系;
根据所述第一映射关系,分别将各个所述文件对应的第一块数据存储至各个所述第一节点。
在一实施例中,所述读写操作信息中包括数据读取起点值和数据读取长度值,上述处理器根据所述读写操作信息,完成与各个所述指定节点的读写操作的步骤,包括:
从所述读写操作信息中提取所述数据读取起点值和所述数据读取长度值;
从各个所述指定节点中,确定所述数据读取起点值对应的第一目标节点;
在所述第一目标节点中,以所述数据读取起点值为起点,从所述第一目标节点对应的第一块数据中,读取与所述数据读取长度值对应的读取数据。
在一实施例中,所述读写操作信息中包括数据操作起点值和数据写入信息,上述处理器根据所述读写操作信息,完成与各个所述指定节点的读写操作的步骤,包括:
从所述读写操作信息中提取所述数据操作起点值和所述数据写入信息;
从多个所述指定节点中,确定所述数据操作起点值对应的第二目标节点;
在所述第二目标节点中,以所述数据操作起点值为起点,将所述数据写入信息写入所述第二目标节点对应的第一块数据中,得到所述第二目标节点对应的更新块数据;
根据预设hash算法,重新分配所述更新块数据在所述集群服务器中存储的各个节点。
在一实施例中,上述处理器分别根据各个所述文件对应的第一块数据的数目,从所述集群服务器的全部节点中,根据预设hash算法确定用于存储各个所述第一块数据的各个第一节点,建立各个所述第一块数据与各个所述第一节点之间的第一映射关系中的步骤包括:
将所述集群服务器中的全部节点按照从0开始的阿拉伯数字依序进行编号,分别得到各个节点编号数;
对一个所述文件对应的全部第一块数据按照预设编号规则依序进行编号,得到一个所述文件对应的全部文件块编号;
根据所述预设hash算法,分别对一个所述文件对应的文件标识和其对应的每个所述第一块数据所对应的文件块编号,进行哈希计算,分别得到每个所述第一块数据对应的哈希值;
分别将每个所述第一块数据对应的哈希值,对最大的节点编号数进行取模运算,得到取模运算结果;
将各个所述第一块数据,按照预设映射规则分别映射至各个所述第一节点,其中,所述预设映射规则为第一块数据的取模运算结果与第一节点的节点编号数相等。
在一实施例中,上述元数据服务器为分布式元数据服务器集群,上述处理器将文件系统的目录树存储于元数据服务器中的步骤,包括:
将所述文件系统的目录树存储于所述元数据服务器集群中的每台元数据服务器中,并将其中一台元数据服务器作为主元数据服务器,其余元数据服务器作为从元数据服务器,其中,所述主元数据服务器用于对外提供元数据服务;
判断所述主元数据服务器是否发生故障;
若所述主元数据服务器发生故障,则从所述元数据服务器中选择一台作为新的主元数据服务器,并采用所述新的主元数据服务器对外提供元数据服务。
在一实施例中,上述处理器判断所述目录树内是否包含所述指定目录信息的步骤后,包括:
若否,则在所述目录树内为所述指定目录信息分配对应的新建文件标识;
通过预设hash算法为所述新建文件标识分配用于存储所述新建文件标识对应的文件数据的节点。
本领域技术人员可以理解,图3中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定。
本申请一实施例还提供一种计算机可读存储介质,上述存储介质可以是非易失性存储 介质,也可以是易失性存储介质。其上存储有计算机程序,计算机程序被处理器执行时实现一种数据管理方法,具体为:
将文件系统的目录树存储于元数据服务器中;以及将所述文件系统所包含的各个文件的文件数据进行分块,并将各块分别存储于集群服务器的多个节点中;以及将所述文件系统所对应的属性信息进行分块,并将各块分别存储于所述集群服务器的多个节点中;
获取用户发送的数据读写指令,其中,所述数据读写指令中携带待读写文件的指定目录信息和读写操作信息;
判断所述目录树内是否包含所述指定目录信息,其中所述目录树以键-值的形式存储,以各个文件的目录信息为键,以各个文件对应的文件标识为值;
若是,则从所述元数据服务器内提取所述指定目录信息对应的指定文件标识;
根据所述指定文件标识,确定所述待读写文件对应的文件数据在所述集群服务器中分布的各个指定节点;
根据所述读写操作信息,完成与各个所述指定节点的读写操作。
在一实施例中,上述处理器将所述文件系统所包含的各个文件的文件数据进行分块,并将各块分别存储于集群服务器的多个节点中的步骤包括:
分别将各个所述文件的文件数据按照第一预置大小分割成多个第一块数据;
分别根据各个所述文件对应的第一块数据的数目,从所述集群服务器的全部节点中,根据预设hash算法确定用于存储各个所述第一块数据的各个第一节点,建立各个所述第一块数据与各个所述第一节点之间的第一映射关系;
根据所述第一映射关系,分别将各个所述文件对应的第一块数据存储至各个所述第一节点。
在一实施例中,所述读写操作信息中包括数据读取起点值和数据读取长度值,上述处理器根据所述读写操作信息,完成与各个所述指定节点的读写操作的步骤,包括:
从所述读写操作信息中提取所述数据读取起点值和所述数据读取长度值;
从各个所述指定节点中,确定所述数据读取起点值对应的第一目标节点;
在所述第一目标节点中,以所述数据读取起点值为起点,从所述第一目标节点对应的第一块数据中,读取与所述数据读取长度值对应的读取数据。
在一实施例中,所述读写操作信息中包括数据操作起点值和数据写入信息,上述处理器根据所述读写操作信息,完成与各个所述指定节点的读写操作的步骤,包括:
从所述读写操作信息中提取所述数据操作起点值和所述数据写入信息;
从多个所述指定节点中,确定所述数据操作起点值对应的第二目标节点;
在所述第二目标节点中,以所述数据操作起点值为起点,将所述数据写入信息写入所述第二目标节点对应的第一块数据中,得到所述第二目标节点对应的更新块数据;
根据预设hash算法,重新分配所述更新块数据在所述集群服务器中存储的各个节点。
在一实施例中,上述处理器分别根据各个所述文件对应的第一块数据的数目,从所述集群服务器的全部节点中,根据预设hash算法确定用于存储各个所述第一块数据的各个第一节点,建立各个所述第一块数据与各个所述第一节点之间的第一映射关系中的步骤包括:
将所述集群服务器中的全部节点按照从0开始的阿拉伯数字依序进行编号,分别得到各个节点编号数;
对一个所述文件对应的全部第一块数据按照预设编号规则依序进行编号,得到一个所述文件对应的全部文件块编号;
根据所述预设hash算法,分别对一个所述文件对应的文件标识和其对应的每个所述第一块数据所对应的文件块编号,进行哈希计算,分别得到每个所述第一块数据对应的哈希值;
分别将每个所述第一块数据对应的哈希值,对最大的节点编号数进行取模运算,得到取模运算结果;
将各个所述第一块数据,按照预设映射规则分别映射至各个所述第一节点,其中,所述预设映射规则为第一块数据的取模运算结果与第一节点的节点编号数相等。
在一实施例中,上述元数据服务器为分布式元数据服务器集群,上述处理器将文件系统的目录树存储于元数据服务器中的步骤,包括:
将所述文件系统的目录树存储于所述元数据服务器集群中的每台元数据服务器中,并将其中一台元数据服务器作为主元数据服务器,其余元数据服务器作为从元数据服务器,其中,所述主元数据服务器用于对外提供元数据服务;
判断所述主元数据服务器是否发生故障;
若所述主元数据服务器发生故障,则从所述元数据服务器中选择一台作为新的主元数据服务器,并采用所述新的主元数据服务器对外提供元数据服务。
在一实施例中,上述处理器判断所述目录树内是否包含所述指定目录信息的步骤后,包括:
若否,则在所述目录树内为所述指定目录信息分配对应的新建文件标识;
通过预设hash算法为所述新建文件标识分配用于存储所述新建文件标识对应的文件数据的节点。
综上所述,为本申请的数据管理方法、装置、计算机设备和存储介质,将文件系统的目录树存储于元数据服务器中;以及将文件系统所包含的各个文件的文件数据进行分块,并将各块分别存储于集群服务器的多个节点中;以及将文件系统所对应的属性信息进行分块,并将各块分别存储于集群服务器的多个节点中;在进行数据读写操作时,只需从元数据服务器中查找待读写文件对应的指定文件标识,就可以根据指定文件标识,到待读写文件对应的指定节点进行读写操作,而无需从元数据服务器上进行读写操作,一方面大大减少了元数据服务器的运行压力,另一方面大大提高了高并发场景的数据读取效率。

Claims (20)

  1. 一种数据管理方法,其中,包括:
    将文件系统的目录树存储于元数据服务器中;以及将所述文件系统所包含的各个文件的文件数据进行分块,并将各块分别存储于集群服务器的多个节点中;以及将所述文件系统所对应的属性信息进行分块,并将各块分别存储于所述集群服务器的多个节点中;
    获取用户发送的数据读写指令,其中,所述数据读写指令中携带待读写文件的指定目录信息和读写操作信息;
    判断所述目录树内是否包含所述指定目录信息,其中所述目录树以键-值的形式存储,以各个文件的目录信息为键,以各个文件对应的文件标识为值;
    若是,则从所述元数据服务器内提取所述指定目录信息对应的指定文件标识;
    根据所述指定文件标识,确定所述待读写文件对应的文件数据在所述集群服务器中分布的各个指定节点;
    根据所述读写操作信息,完成与各个所述指定节点的读写操作。
  2. 如权利要求1所述的数据管理方法,其中,所述将所述文件系统所包含的各个文件的文件数据进行分块,并将各块分别存储于集群服务器的多个节点中的步骤包括:
    分别将各个所述文件的文件数据按照第一预置大小分割成多个第一块数据;
    分别根据各个所述文件对应的第一块数据的数目,从所述集群服务器的全部节点中,根据预设hash算法确定用于存储各个所述第一块数据的各个第一节点,建立各个所述第一块数据与各个所述第一节点之间的第一映射关系;
    根据所述第一映射关系,分别将各个所述文件对应的第一块数据存储至各个所述第一节点。
  3. 如权利要求2所述的数据管理方法,其中,所述读写操作信息中包括数据读取起点值和数据读取长度值,所述根据所述读写操作信息,完成与各个所述指定节点的读写操作的步骤,包括:
    从所述读写操作信息中提取所述数据读取起点值和所述数据读取长度值;
    从各个所述指定节点中,确定所述数据读取起点值对应的第一目标节点;
    在所述第一目标节点中,以所述数据读取起点值为起点,从所述第一目标节点对应的第一块数据中,读取与所述数据读取长度值对应的读取数据。
  4. 如权利要求2所述的数据管理方法,其中,所述读写操作信息中包括数据操作起点值和数据写入信息,所述根据所述读写操作信息,完成与各个所述指定节点的读写操作的步骤,包括:
    从所述读写操作信息中提取所述数据操作起点值和所述数据写入信息;
    从多个所述指定节点中,确定所述数据操作起点值对应的第二目标节点;
    在所述第二目标节点中,以所述数据操作起点值为起点,将所述数据写入信息写入所述第二目标节点对应的第一块数据中,得到所述第二目标节点对应的更新块数据;
    根据预设hash算法,重新分配所述更新块数据在所述集群服务器中存储的各个节点。
  5. 如权利要求2所述的数据管理方法,其中,所述分别根据各个所述文件对应的第一块数据的数目,从所述集群服务器的全部节点中,根据预设hash算法确定用于存储各个所述第一块数据的各个第一节点,建立各个所述第一块数据与各个所述第一节点之间的第一映射关系中的步骤包括:
    将所述集群服务器中的全部节点按照从0开始的阿拉伯数字依序进行编号,分别得到各个节点编号数;
    对一个所述文件对应的全部第一块数据按照预设编号规则依序进行编号,得到一个所述文件对应的全部文件块编号;
    根据所述预设hash算法,分别对一个所述文件对应的文件标识和其对应的每个所述第 一块数据所对应的文件块编号,进行哈希计算,分别得到每个所述第一块数据对应的哈希值;
    分别将每个所述第一块数据对应的哈希值,对最大的节点编号数进行取模运算,得到取模运算结果;
    将各个所述第一块数据,按照预设映射规则分别映射至各个所述第一节点,其中,所述预设映射规则为第一块数据的取模运算结果与第一节点的节点编号数相等。
  6. 如权利要求1所述的数据管理方法,其中,所述元数据服务器为分布式元数据服务器集群,所述将文件系统的目录树存储于元数据服务器中的步骤,包括:
    将所述文件系统的目录树存储于所述元数据服务器集群中的每台元数据服务器中,并将其中一台元数据服务器作为主元数据服务器,其余元数据服务器作为从元数据服务器,其中,所述主元数据服务器用于对外提供元数据服务;
    判断所述主元数据服务器是否发生故障;
    若所述主元数据服务器发生故障,则从所述元数据服务器中选择一台作为新的主元数据服务器,并采用所述新的主元数据服务器对外提供元数据服务。
  7. 如权利要求1所述的数据管理方法,其中,所述判断所述目录树内是否包含所述指定目录信息的步骤后,包括:
    若否,则在所述目录树内为所述指定目录信息分配对应的新建文件标识;
    通过预设hash算法为所述新建文件标识分配用于存储所述新建文件标识对应的文件数据的节点。
  8. 一种数据管理装置,其中,包括:
    数据存储单元,用于将文件系统的目录树存储于元数据服务器中;以及将所述文件系统所包含的各个文件的文件数据进行分块,并将各块分别存储于集群服务器的多个节点中;以及将所述文件系统所对应的属性信息进行分块,并将各块分别存储于所述集群服务器的多个节点中;
    指令获取单元,用于获取用户发送的数据读写指令,其中,所述数据读写指令中携带待读写文件的指定目录信息和读写操作信息;
    判断单元,用于判断所述目录树内是否包含所述指定目录信息,其中所述目录树以键-值的形式存储,以各个文件的目录信息为键,以各个文件对应的文件标识为值;
    标识提取单元,用于若包含所述指定目录信息,则从所述元数据服务器内提取所述指定目录信息对应的指定文件标识;
    节点确定单元,用于根据所述指定文件标识,确定所述待读写文件对应的文件数据在所述集群服务器中分布的各个指定节点;
    读写操作单元,用于根据所述读写操作信息,完成与各个所述指定节点的读写操作。
  9. 一种计算机设备,包括存储器和处理器,所述存储器中存储有计算机程序,其中,所述处理器执行所述计算机程序时实现一种数据管理方法的步骤:
    将文件系统的目录树存储于元数据服务器中;以及将所述文件系统所包含的各个文件的文件数据进行分块,并将各块分别存储于集群服务器的多个节点中;以及将所述文件系统所对应的属性信息进行分块,并将各块分别存储于所述集群服务器的多个节点中;
    获取用户发送的数据读写指令,其中,所述数据读写指令中携带待读写文件的指定目录信息和读写操作信息;
    判断所述目录树内是否包含所述指定目录信息,其中所述目录树以键-值的形式存储,以各个文件的目录信息为键,以各个文件对应的文件标识为值;
    若是,则从所述元数据服务器内提取所述指定目录信息对应的指定文件标识;
    根据所述指定文件标识,确定所述待读写文件对应的文件数据在所述集群服务器中分布的各个指定节点;
    根据所述读写操作信息,完成与各个所述指定节点的读写操作。
  10. 如权利要求9所述的计算机设备,其中,所述将所述文件系统所包含的各个文件的文件数据进行分块,并将各块分别存储于集群服务器的多个节点中的步骤包括:
    分别将各个所述文件的文件数据按照第一预置大小分割成多个第一块数据;
    分别根据各个所述文件对应的第一块数据的数目,从所述集群服务器的全部节点中,根据预设hash算法确定用于存储各个所述第一块数据的各个第一节点,建立各个所述第一块数据与各个所述第一节点之间的第一映射关系;
    根据所述第一映射关系,分别将各个所述文件对应的第一块数据存储至各个所述第一节点。
  11. 如权利要求10所述的计算机设备,其中,所述读写操作信息中包括数据读取起点值和数据读取长度值,所述根据所述读写操作信息,完成与各个所述指定节点的读写操作的步骤,包括:
    从所述读写操作信息中提取所述数据读取起点值和所述数据读取长度值;
    从各个所述指定节点中,确定所述数据读取起点值对应的第一目标节点;
    在所述第一目标节点中,以所述数据读取起点值为起点,从所述第一目标节点对应的第一块数据中,读取与所述数据读取长度值对应的读取数据。
  12. 如权利要求10所述的计算机设备,其中,所述读写操作信息中包括数据操作起点值和数据写入信息,所述根据所述读写操作信息,完成与各个所述指定节点的读写操作的步骤,包括:
    从所述读写操作信息中提取所述数据操作起点值和所述数据写入信息;
    从多个所述指定节点中,确定所述数据操作起点值对应的第二目标节点;
    在所述第二目标节点中,以所述数据操作起点值为起点,将所述数据写入信息写入所述第二目标节点对应的第一块数据中,得到所述第二目标节点对应的更新块数据;
    根据预设hash算法,重新分配所述更新块数据在所述集群服务器中存储的各个节点。
  13. 如权利要求10所述的计算机设备,其中,所述分别根据各个所述文件对应的第一块数据的数目,从所述集群服务器的全部节点中,根据预设hash算法确定用于存储各个所述第一块数据的各个第一节点,建立各个所述第一块数据与各个所述第一节点之间的第一映射关系中的步骤包括:
    将所述集群服务器中的全部节点按照从0开始的阿拉伯数字依序进行编号,分别得到各个节点编号数;
    对一个所述文件对应的全部第一块数据按照预设编号规则依序进行编号,得到一个所述文件对应的全部文件块编号;
    根据所述预设hash算法,分别对一个所述文件对应的文件标识和其对应的每个所述第一块数据所对应的文件块编号,进行哈希计算,分别得到每个所述第一块数据对应的哈希值;
    分别将每个所述第一块数据对应的哈希值,对最大的节点编号数进行取模运算,得到取模运算结果;
    将各个所述第一块数据,按照预设映射规则分别映射至各个所述第一节点,其中,所述预设映射规则为第一块数据的取模运算结果与第一节点的节点编号数相等。
  14. 如权利要求9所述的计算机设备,其中,所述元数据服务器为分布式元数据服务器集群,所述将文件系统的目录树存储于元数据服务器中的步骤,包括:
    将所述文件系统的目录树存储于所述元数据服务器集群中的每台元数据服务器中,并将其中一台元数据服务器作为主元数据服务器,其余元数据服务器作为从元数据服务器,其中,所述主元数据服务器用于对外提供元数据服务;
    判断所述主元数据服务器是否发生故障;
    若所述主元数据服务器发生故障,则从所述元数据服务器中选择一台作为新的主元数据服务器,并采用所述新的主元数据服务器对外提供元数据服务。
  15. 如权利要求9所述的计算机设备,其中,所述判断所述目录树内是否包含所述指定目录信息的步骤后,包括:
    若否,则在所述目录树内为所述指定目录信息分配对应的新建文件标识;
    通过预设hash算法为所述新建文件标识分配用于存储所述新建文件标识对应的文件数据的节点。
  16. 一种计算机可读存储介质,其上存储有计算机程序,其中,所述计算机程序被处理器执行时实现一种数据管理方法的步骤。
    将文件系统的目录树存储于元数据服务器中;以及将所述文件系统所包含的各个文件的文件数据进行分块,并将各块分别存储于集群服务器的多个节点中;以及将所述文件系统所对应的属性信息进行分块,并将各块分别存储于所述集群服务器的多个节点中;
    获取用户发送的数据读写指令,其中,所述数据读写指令中携带待读写文件的指定目录信息和读写操作信息;
    判断所述目录树内是否包含所述指定目录信息,其中所述目录树以键-值的形式存储,以各个文件的目录信息为键,以各个文件对应的文件标识为值;
    若是,则从所述元数据服务器内提取所述指定目录信息对应的指定文件标识;
    根据所述指定文件标识,确定所述待读写文件对应的文件数据在所述集群服务器中分布的各个指定节点;
    根据所述读写操作信息,完成与各个所述指定节点的读写操作。
  17. 如权利要求16所述的计算机可读存储介质,其中,所述将所述文件系统所包含的各个文件的文件数据进行分块,并将各块分别存储于集群服务器的多个节点中的步骤包括:
    分别将各个所述文件的文件数据按照第一预置大小分割成多个第一块数据;
    分别根据各个所述文件对应的第一块数据的数目,从所述集群服务器的全部节点中,根据预设hash算法确定用于存储各个所述第一块数据的各个第一节点,建立各个所述第一块数据与各个所述第一节点之间的第一映射关系;
    根据所述第一映射关系,分别将各个所述文件对应的第一块数据存储至各个所述第一节点。
  18. 如权利要求17所述的计算机可读存储介质,其中,所述读写操作信息中包括数据读取起点值和数据读取长度值,所述根据所述读写操作信息,完成与各个所述指定节点的读写操作的步骤,包括:
    从所述读写操作信息中提取所述数据读取起点值和所述数据读取长度值;
    从各个所述指定节点中,确定所述数据读取起点值对应的第一目标节点;
    在所述第一目标节点中,以所述数据读取起点值为起点,从所述第一目标节点对应的第一块数据中,读取与所述数据读取长度值对应的读取数据。
  19. 如权利要求17所述的计算机可读存储介质,其中,所述读写操作信息中包括数据操作起点值和数据写入信息,所述根据所述读写操作信息,完成与各个所述指定节点的读写操作的步骤,包括:
    从所述读写操作信息中提取所述数据操作起点值和所述数据写入信息;
    从多个所述指定节点中,确定所述数据操作起点值对应的第二目标节点;
    在所述第二目标节点中,以所述数据操作起点值为起点,将所述数据写入信息写入所述第二目标节点对应的第一块数据中,得到所述第二目标节点对应的更新块数据;
    根据预设hash算法,重新分配所述更新块数据在所述集群服务器中存储的各个节点。
  20. 如权利要求17所述的计算机可读存储介质,其中,所述分别根据各个所述文件对应的第一块数据的数目,从所述集群服务器的全部节点中,根据预设hash算法确定用于存储各个所述第一块数据的各个第一节点,建立各个所述第一块数据与各个所述第一节点之间的第一映射关系中的步骤包括:
    将所述集群服务器中的全部节点按照从0开始的阿拉伯数字依序进行编号,分别得到各 个节点编号数;
    对一个所述文件对应的全部第一块数据按照预设编号规则依序进行编号,得到一个所述文件对应的全部文件块编号;
    根据所述预设hash算法,分别对一个所述文件对应的文件标识和其对应的每个所述第一块数据所对应的文件块编号,进行哈希计算,分别得到每个所述第一块数据对应的哈希值;
    分别将每个所述第一块数据对应的哈希值,对最大的节点编号数进行取模运算,得到取模运算结果;
    将各个所述第一块数据,按照预设映射规则分别映射至各个所述第一节点,其中,所述预设映射规则为第一块数据的取模运算结果与第一节点的节点编号数相等。
PCT/CN2020/098793 2020-02-26 2020-06-29 数据管理方法、装置、计算机设备和存储介质 WO2021169113A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010120131.9 2020-02-26
CN202010120131.9A CN111427841A (zh) 2020-02-26 2020-02-26 数据管理方法、装置、计算机设备和存储介质

Publications (1)

Publication Number Publication Date
WO2021169113A1 true WO2021169113A1 (zh) 2021-09-02

Family

ID=71547266

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/098793 WO2021169113A1 (zh) 2020-02-26 2020-06-29 数据管理方法、装置、计算机设备和存储介质

Country Status (2)

Country Link
CN (1) CN111427841A (zh)
WO (1) WO2021169113A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115292247A (zh) * 2022-09-28 2022-11-04 北京鼎轩科技有限责任公司 一种文件读取方法、装置、电子设备和存储介质
CN116760850A (zh) * 2023-08-17 2023-09-15 浪潮电子信息产业股份有限公司 一种数据处理方法、装置、设备、介质及系统

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111831618A (zh) * 2020-07-21 2020-10-27 北京青云科技股份有限公司 数据写入方法、数据读取方法、装置、设备及存储介质
CN112000618B (zh) * 2020-08-07 2022-06-07 北京浪潮数据技术有限公司 集群节点的文件变动管理方法、装置、设备及存储介质
CN112947864B (zh) * 2021-03-29 2024-03-08 南方电网数字平台科技(广东)有限公司 元数据的存储方法、装置、设备和存储介质
CN113076298A (zh) * 2021-04-15 2021-07-06 上海卓钢链科技有限公司 分布式小文件存储系统
CN113392068A (zh) * 2021-06-28 2021-09-14 上海商汤科技开发有限公司 数据处理方法、装置和系统
CN114328421B (zh) * 2022-03-17 2022-06-10 联想凌拓科技有限公司 元数据服务架构管理方法、计算机系统、电子设备及介质
CN115827261B (zh) * 2023-01-10 2023-05-19 北京燧原智能科技有限公司 基于分布式网络的数据同步方法、装置、服务器及介质
CN116185965B (zh) * 2023-05-04 2023-08-04 联想凌拓科技有限公司 用于服务质量控制的方法、装置、设备及介质
CN116795636B (zh) * 2023-06-21 2024-02-13 广州市玄武无线科技股份有限公司 一种业务系统数据监控方法、装置、电子设备及存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101692239A (zh) * 2009-10-19 2010-04-07 浙江大学 一种分布式文件系统元数据分配方法
CN104660643A (zh) * 2013-11-25 2015-05-27 南京中兴新软件有限责任公司 请求响应方法、装置及分布式文件系统
CN105718484A (zh) * 2014-12-04 2016-06-29 中兴通讯股份有限公司 写文件、读文件、删除文件、查询文件的方法及客户端
CN108769137A (zh) * 2018-05-08 2018-11-06 北京初志科技有限公司 基于多群架构的分布式架构数据存储读取方法及装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101692239A (zh) * 2009-10-19 2010-04-07 浙江大学 一种分布式文件系统元数据分配方法
CN104660643A (zh) * 2013-11-25 2015-05-27 南京中兴新软件有限责任公司 请求响应方法、装置及分布式文件系统
CN105718484A (zh) * 2014-12-04 2016-06-29 中兴通讯股份有限公司 写文件、读文件、删除文件、查询文件的方法及客户端
CN108769137A (zh) * 2018-05-08 2018-11-06 北京初志科技有限公司 基于多群架构的分布式架构数据存储读取方法及装置

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115292247A (zh) * 2022-09-28 2022-11-04 北京鼎轩科技有限责任公司 一种文件读取方法、装置、电子设备和存储介质
CN115292247B (zh) * 2022-09-28 2022-12-06 北京鼎轩科技有限责任公司 一种文件读取方法、装置、电子设备和存储介质
CN116760850A (zh) * 2023-08-17 2023-09-15 浪潮电子信息产业股份有限公司 一种数据处理方法、装置、设备、介质及系统
CN116760850B (zh) * 2023-08-17 2024-01-12 浪潮电子信息产业股份有限公司 一种数据处理方法、装置、设备、介质及系统

Also Published As

Publication number Publication date
CN111427841A (zh) 2020-07-17

Similar Documents

Publication Publication Date Title
WO2021169113A1 (zh) 数据管理方法、装置、计算机设备和存储介质
US10901796B2 (en) Hash-based partitioning system
US11797498B2 (en) Systems and methods of database tenant migration
US9967298B2 (en) Appending to files via server-side chunking and manifest manipulation
US9460111B2 (en) Method and apparatus for virtualization of a file system, data storage system for virtualization of a file system, and file server for use in a data storage system
US9183213B2 (en) Indirection objects in a cloud storage system
JP5759881B2 (ja) 情報処理システム
US20130218934A1 (en) Method for directory entries split and merge in distributed file system
JP2017195004A (ja) モジュール式ブロックおよび関連付けられたログファイルを伴う分散型データベース
US10712964B2 (en) Pre-forking replicas for efficient scaling of a distributed data storage system
EP3495964B1 (en) Apparatus and program for data processing
CN111427847A (zh) 面向用户自定义元数据的索引与查询方法和系统
US11675743B2 (en) Web-scale distributed deduplication
EP3362808B1 (en) Cache optimization for data preparation
US11163730B2 (en) Hard link operations for files in a file system
US10628391B1 (en) Method and system for reducing metadata overhead in a two-tier storage architecture
CN117075823B (zh) 对象查找方法、系统、电子设备及存储介质
US20200342065A1 (en) Replicating user created snapshots
Chalabi et al. BlobSeer Scalability: A Multi-version Managers Approach
CN111782150A (zh) 一种基于对象存储的多桶存储系统及方法
Gomes Distributed Deduplication in a Cloud-based Object Storage System

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20922031

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20922031

Country of ref document: EP

Kind code of ref document: A1