WO2014082203A1 - Metadata management method and device - Google Patents

Metadata management method and device Download PDF

Info

Publication number
WO2014082203A1
WO2014082203A1 PCT/CN2012/085344 CN2012085344W WO2014082203A1 WO 2014082203 A1 WO2014082203 A1 WO 2014082203A1 CN 2012085344 W CN2012085344 W CN 2012085344W WO 2014082203 A1 WO2014082203 A1 WO 2014082203A1
Authority
WO
WIPO (PCT)
Prior art keywords
directory
subtree
flag
metadata
attribute
Prior art date
Application number
PCT/CN2012/085344
Other languages
French (fr)
Chinese (zh)
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 华为技术有限公司
Priority to CN201280002998.8A priority Critical patent/CN103688257B/en
Priority to PCT/CN2012/085344 priority patent/WO2014082203A1/en
Publication of WO2014082203A1 publication Critical patent/WO2014082203A1/en

Links

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/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/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/11File system administration, e.g. details of archiving or snapshots
    • G06F16/119Details of migration of file systems

Definitions

  • the present invention relates to storage technologies, and in particular, to a metadata management method and apparatus. Background technique
  • the cluster file system is a system for uniformly managing files of multiple machines included in the cluster.
  • the file system provides a unified storage space for multiple machines, which is called a namespace.
  • the namespace is used to store each machine in the cluster.
  • the storage path of the file for example, the storage path of the file a is C/aa/c/a (where C/aa/c may be referred to as a directory); the metadata includes the information for indicating the file storage path.
  • the namespace is divided into multiple shares, each of which is assigned to a machine in the cluster for storing metadata in the corresponding machine; assuming that the space in the C directory of a machine stores two file paths, respectively C/aa/c/a and C/bb/d, C/aa/c/a can be called a subtree, C/bb/d is also called a subtree, and aa/c/a can also be called As a subtree, the subtree is actually metadata, just the image title set according to the hierarchical connection between the directories or files in the metadata.
  • the file will be accessed by the user's application.
  • the file access amount can be represented by the load.
  • the prior art will migrate part of the load of the machine to another machine (actually file migration) when the load of one machine is heavy; correspondingly, The metadata of the machine is also updated as the load moves, and the subtree corresponding to the migration load is also migrated to another machine, that is, the corresponding metadata of the load migration also migrates, and the distribution of the metadata changes.
  • the distribution of metadata in the cluster is scattered. It is possible that the user is supposed to migrate a file from one directory to another. When the two directories are located on different machines, the distribution management of the metadata requires cross-machine operation, that is, the metadata is sent from one machine to another, causing the file system to perform files in the user. The efficiency of metadata distribution management corresponding to the operation is low, which affects the access performance of the cluster to user applications. Summary of the invention The present invention provides a metadata management method and apparatus for improving metadata management efficiency of a file system.
  • a metadata management method including:
  • Finding a directory attribute of a directory in the metadata selecting a directory attribute including load information matching the load information to be migrated and having a subtree flag as a target directory, and determining all the root directory of the target directory a subtree as a target subtree to be migrated; the subtree flag is preset in a directory attribute of a root directory identified by the subtree flag;
  • the target subtree is migrated as a whole.
  • the subtree of the root directory of the subtree identifier identifier includes metadata corresponding to a smallest unit of the service access operation range.
  • the subtree of the root directory of the subtree identifier is included in the sub-tree whose access frequency reaches a preset threshold within a preset time period.
  • the method before searching for the directory attribute of the directory in the metadata, the method further includes: selecting, having the same in at least two subtrees of the directory attribute of the root directory having the subtree flag
  • the plurality of subtrees of the load change trend are used as a concurrent group, and the concurrent group flag is set in the directory attribute of the root directory of each subtree in the concurrent group; the selected directory attribute includes the load information to be migrated
  • the matching load information and the directory having the subtree flag are the target directory, including: the selected directory attribute includes not only the load information but also a subtree flag, and a directory including the concurrent group flag as the target directory.
  • the selecting the directory attribute includes not only the load information, and a subtree flag, including the directory of the concurrent group flag, as the target directory, including: from a concurrent group including the largest number of subtrees, selecting a directory attribute includes not only the load information, and a subtree flag, but also includes The directory of the concurrent group flag is used as the target directory.
  • the directory attribute is an attribute that is received by a user through an application programming interface API, and the attribute includes the sub-tree flag and Concurrent group logo.
  • a metadata management apparatus including:
  • a load determining unit configured to acquire load information to be migrated
  • a subtree searching unit configured to search for a directory attribute of a directory in the metadata, and selecting a directory attribute including load information matching the load information to be migrated and having a subtree flag as the subtree flag in advance Set in the directory attribute of the root directory identified by the subtree flag
  • a subtree migration unit configured to migrate the target subtree as a whole.
  • the subtree of the root directory of the subtree identifier identifier includes the metadata corresponding to the smallest unit of the service access operation range.
  • the subtree of the root directory of the subtree identifier identifier includes metadata that has reached a preset threshold in a preset time period.
  • the method further includes: an attribute setting unit, configured to: before the subtree searching unit searches for a directory attribute of a directory in the metadata, the directory attribute in the root directory has a sub Among the at least two subtrees of the tree flag, a plurality of subtrees having the same load change tendency are selected as one concurrent group, and a concurrent group flag is set in a directory attribute of a root directory of each subtree in the concurrent group; a tree search unit, specifically configured to find a directory attribute of a directory in the metadata, where the selected directory attribute includes not only the load information but also a subtree flag, and the subtree as a target subtree to be migrated; the subtree The flag is preset in the directory attribute of the root directory identified by the subtree flag.
  • the subtree searching unit is specifically configured to include a subtree In the most concurrent group, the selected directory attribute includes not only the load information, and the subtree flag, but also a directory of the concurrent group flag as the target directory.
  • the method further includes: an attribute obtaining unit, configured to receive an attribute set by a user through an application programming interface API, where the attribute includes the Subtree flag and concurrency group flag.
  • a third aspect provides a computing node for metadata management, where the computing node includes: a processor, a communication interface, a memory, and a bus; wherein the processor, the communication interface, and the memory complete each other through the bus Communication;
  • the communication interface the computing node for the metadata management receiving program
  • the processor is configured to execute a program
  • the memory is configured to store a program
  • the program includes: a load determining unit, a subtree searching unit, and a subtree migrating unit; and the load determining unit, configured to acquire load information to be migrated;
  • the subtree searching unit is configured to search for a directory attribute of a directory in the metadata, and select a directory tree that includes load information matching the load information to be migrated and has a subtree flag; the subtree The flag is preset in the directory attribute of the root directory identified by the subtree flag; the subtree migration unit is configured to migrate the target subtree as a whole.
  • the subtree of the root directory of the subtree identifier identifier includes the metadata corresponding to the smallest unit of the service access operation range.
  • the subtree of the root directory of the subtree identifier is included in the sub-tree whose access frequency reaches a preset threshold within a preset time period.
  • the method further includes: an attribute setting unit, configured to: before the subtree search unit searches for a directory attribute of a directory in the metadata, the directory attribute in the root directory has a sub Among the at least two subtrees of the tree flag, a plurality of subtrees having the same load change tendency are selected as one concurrent group, and a concurrent group flag is set in a directory attribute of a root directory of each subtree in the concurrent group; a tree search unit, specifically configured to find a directory attribute of a directory in the metadata, where the selected directory attribute includes not only the load information but also a subtree flag, and the subtree as a target subtree to be migrated; the subtree The flag is preset in the directory attribute of the root directory identified by the subtree flag.
  • the sub-tree search unit is specifically configured to include a subtree In the most concurrent group, the selected directory attribute includes not only the load information, and the subtree flag, but also a directory of the concurrent group flag as the target directory.
  • the method further includes: an attribute obtaining unit, configured to receive an attribute set by a user through an application programming interface API, where the attribute includes the Subtree flag and concurrency group flag.
  • a fourth aspect a computer program product for repairing data, comprising a computer readable storage medium storing program code;
  • the program code includes instructions for acquiring load information to be migrated; searching for a directory attribute of a directory in the metadata, and selecting a directory attribute including load information matching the load information to be migrated and having a subtree flag
  • the directory is the target directory, and all subtrees having the target directory as the root directory are determined as the target subtree to be migrated; the subtree flag is preset in the directory attribute of the root directory identified by the subtree flag. ; migrate the target subtree as a whole.
  • FIG. 1 is a metadata distribution diagram of a file system applied to an embodiment of a metadata management method according to the present invention
  • FIG. 2 is a flow chart of an embodiment of a metadata management method according to the present invention
  • FIG. 3 is a schematic flowchart of another embodiment of a metadata management method according to the present invention.
  • FIG. 4 is a file system metadata distribution diagram of another embodiment of the metadata management method of the present invention
  • FIG. 5 is a comparison diagram of overall performance of an MDS cluster according to an embodiment of the metadata management method of the present invention
  • FIG. 6 is a metadata management method of the present invention
  • the overall performance comparison of the MDS cluster of the embodiment is shown in FIG. 2
  • FIG. 7 is a diagram of the MDS cluster load distribution before the improvement of the metadata management method embodiment of the present invention
  • FIG. 8 is a modified MDS cluster load of the metadata management method embodiment of the present invention.
  • FIG. 9 is a schematic structural diagram of an embodiment of a metadata management apparatus according to the present invention.
  • FIG. 10 is a schematic structural diagram of another embodiment of a metadata management apparatus according to the present invention.
  • FIG. 11 is a schematic structural diagram of an embodiment of a computing node for metadata management according to the present invention.
  • DETAILED DESCRIPTION OF THE EMBODIMENTS In order to make the metadata management method of the embodiment of the present invention easier to understand, first, some basic concepts involved in the embodiments of the present invention are described in conjunction with FIG. 1.
  • FIG. 1 is a schematic diagram of an embodiment of a metadata management method according to the present invention.
  • the metadata management of this embodiment actually manages the metadata in the file system, specifically the management of the metadata distribution; the metadata is management information about a directory or a file, for example, a directory or a file. Name, genus Sex, hierarchical relationship, etc.
  • a Metadata Server (MDS) cluster is taken as an example.
  • MDS Metadata Server
  • the cluster multiple MDSs are included, and each MDS is responsible for managing metadata of one machine; the metadata is a graph.
  • a tree-like information composed of respective blocks connected to each other as shown in 1, for example, k1, bucket-1, and the like.
  • the three storage spaces are enclosed by dashed lines, which belong to MDS1, MDS2 and MDS3 respectively.
  • the dotted box pi is the metadata stored in MDS1
  • the dotted box p2 is stored in MDS2.
  • Metadata, in the dashed box p3 is the metadata stored in MDS3. Metadata that is not within the dashed box is metadata on other MDSs.
  • the metadata of the MDS cluster is stored in a tree structure as shown in FIG. 1.
  • the metadata of the tree structure involves the following concepts, wherein, the directories, files, and subtrees mentioned below are required to be explained.
  • the node and the like refer to the metadata.
  • the embodiment of the present invention discusses the distribution structure of the metadata.
  • the file k-e.avi in FIG. 1 mentioned above is actually the element of the file k-e.avi. Data;
  • the load mentioned in the embodiment of the present invention also refers to the load for metadata access, but the update of the metadata load is also caused by actual access to files or directories.
  • k_e.avi, k-d.avi, etc. shown in Figure 1 the file is located in the directory, for example, k-e.avi is located under directory k3, and the upper directory of the directory k3 is k2
  • the directory above the directory k2 is kl-1, and so on, the directory at the top of the tree structure is the total root directory; the above files and directories, and the hierarchical relationship between them (that is, the files are located in a directory)
  • the following is the storage path of the file; for example, the storage path of the file k-b.avi is
  • Subtree If the directory "/" at the top of the tree structure in Figure 1 is likened to the root of a large tree, any branch of the large tree can be called a subtree;
  • the entirety of all metadata (including all directories and files) of the directory kobe and its subordinates is called a subtree
  • the whole of all metadata of the directory kl and its subordinates is called a subtree (ie kl -k_b.avi )
  • the whole of all metadata of the directory k2 and its subordinates is called a subtree (the subtree includes k2, k3, k_e.avi, k_c.avi).
  • the subtree is rooted at a directory, including the directory and all the branches connected to it, which is called a subtree.
  • Node Each box in Figure 1 is referred to as a node, which may be a directory or a file; for example, k_e.avi, bucket-1, kobe, etc. are all a node;
  • Node attributes and load The attributes of the node include, for example, creation time, load value, etc.
  • Each directory or file has a creation time, which is a property of the node; the load value can be seen in the top left of each node in Figure 1.
  • the number indicated by the corner for example, 31 in the upper left corner of bucket-1, 71 in the upper left corner of kobe, and so on.
  • the load value of the node indicates the current load of the node, which is a parameter that indicates the access volume of the file under the node. Generally, the larger the file access amount, the higher the load, so the load value of the node is actually the MDS where the node is located.
  • the load that is being carried of course, the load of the entire MDS is the sum of the load values of all the nodes located on it.
  • the load value of bucket-1 is 31, and the load value of kobe is 71;
  • the load value of a directory is the sum of the load values of the next-level nodes (directories or files) connected to the directory, for example, from the figure 1
  • the file k_e.avi is in the directory k3
  • the load value of the file k_e.avi is 2
  • the load value is a characterization value calculated according to an algorithm according to the file access amount or the access frequency
  • the load value of the directory k3 is the same as the load value of the file k-e.avi;
  • Figure 1 includes many subtrees, and these subtrees belong to different MDSs respectively; for example, subtree bucket-1/kl/k-b.avi is located on MDS1, which means file k_b The metadata of .avi, directory kl, and directory bucket-1 are managed and served by MDS1. The large amount of access to the metadata of the file k_b.avi, directory kl, and directory bucket-1 will make the load of MDS1 larger. The subtree k2 - 1 / k - d.
  • the load of the MDS refers to the load of the metadata on the MDS, and the load of the metadata is also caused by the access of the actual directory or file corresponding to the metadata. For example: Assume that the actual access to the file k_b.avi, the corresponding load value of the metadata of the file k_b.avi stored on MDS1 will increase, and the load value of the metadata of the file k_b.avi increases.
  • the load value of the upper directory will also increase, for example, the metadata load value of the directory bucket-1/kl increases; or, if the access to the directory k2-1 is accessed, the corresponding storage on the MDS2 The load value of the metadata of the directory k2-1 will increase.
  • the load on the current MDS is usually large.
  • migrating a portion of the load to another MDS it actually migrates the metadata of certain files and directories to another MDS, so that another MDS accesses the migrated files and directories, reducing the current MDS. load.
  • the storage location of the metadata of files and directories changes, such as MDS2 to MDS3.
  • the migration of metadata is based on a subtree, for example, the subtree k2 - 1 / k - d.avi can only be migrated.
  • the subtree migration is to change the storage location of the subtree, which is equivalent to enclosing the subtree k2-1/k-d.avi in the dashed box p3 in Figure 1, but the connection relationship of the subtree in the entire tree structure There is no change. For example, the subtree k2—1/k—d.avi is still connected to the directory kl-1.
  • Embodiment 1 the metadata management method of the embodiment of the present invention is described in detail below: Embodiment 1
  • FIG. 2 is a schematic flowchart of an embodiment of a metadata management method according to the present invention. As shown in FIG. 2, the method may include:
  • the load information refers to a load value, such as the number indicated in the upper left corner of each node as shown in FIG. 1, for example, 31 in the upper left corner of the bucket-1.
  • the cluster includes three MDSs.
  • Each MDS updates the load value of the corresponding metadata according to the access information of files and directories that it is responsible for. And periodically detecting the difference between the total load value carried by itself and other MDS load values. When the difference exceeds a certain threshold, the load distribution between the MDSs is uneven, and the load is heavier. MDS will initiate load balancing processing and migrate some of its own load to other MDSs.
  • the migration of the load is a migration of a subtree in the metadata, and the access corresponding to the subtree is migrated to another MDS, and the access is served by another MDS, and the corresponding heavily loaded MDS is The load carried is reduced.
  • the load information that is acquired by an MDS is 7 load values, that is, 7 load values need to be migrated to other MDSs.
  • 202 Search for a directory attribute of a directory in the metadata, select a directory attribute that includes load information that matches the migrated load information, and a directory that has a subtree flag as a target directory, and determine that all the target directory is the root directory.
  • the subtree is the target subtree to be migrated; the subtree flag is pre-set in the directory attribute of the root directory identified by the subtree flag;
  • the directory in the metadata is searched for.
  • a directory attribute including a directory attribute including a load information matching the load information to be migrated and having a subtree flag as a target directory; load information in a directory attribute of the target directory indicating that the target directory is a root directory
  • the maximum subtree corresponds to the load value.
  • the matching refers to that the load value corresponding to the subtree is not necessarily equal to the load information, and may be similar, and the specific numerical similar range may be determined by a commonly used load balancing fuzzy matching algorithm. The embodiments of the present invention are not described in detail.
  • the load value matches the load information, but also the root directory of the subtree, that is, the attribute of the directory k2-1, including the subtree flag attribute.
  • the concept of a subtree has been described above with reference to Figure 1.
  • the subtree is rooted at a directory, including the directory and all branches connected to the directory. This whole is called a subtree; then the root directory is here. Called the root directory.
  • the root directory of the subtree k2 - 1 / k - d.avi is the directory k2 - 1; the subtree consisting of two branches k2 / k3 / k_e.avi and k2 / k - c.avi, the root directory is the directory K2.
  • the subtree to be migrated selected in this embodiment must have a subtree flag in its root directory.
  • the subtree flag is used to indicate that all subtrees with the target directory as the root directory can only be moved by the target subtree.
  • the feature: the metadata included in the target subtree is the smallest unit corresponding to the scope of the business access operation. For example, when the user performs a certain service, an application (that is, an application used by the user) is used, and the application pair
  • the access of the directory or file corresponding to the subtree is basically an internal access of the subtree, and the target subtree includes all the metadata corresponding to the application access operation (the all metadata may be equivalent to the smallest unit of the service access operation range) ).
  • the metadata related to A and B can be involved.
  • the metadata as a whole (the whole can be equivalent to the smallest unit of the business access operation range), the whole is completely included in the target subtree.
  • the metadata involved in the application A may be used as a whole (the whole may be equivalent to the smallest unit of the service access operation range),
  • the target subtree completely includes the whole.
  • the subtree in FIG. 1 can be used as an example to illustrate an optional meta-data included in the target sub-tree:
  • FIG. 1 includes k2/k3/k-e.avi and k2/k- C.avi sub-tree of two branches, the sub-tree k2 of the sub-tree is set to the sub-tree flag attribute, then the sub-tree is a whole; the user application access to the sub-tree includes, for example: the user will file k-e. Avi moves from the directory k3 to the directory k2, or moves the file k_c.avi from the directory k2 to the directory k3, or creates a file under the directory k3.
  • K_e.avi is moved from the directory k3 to the directory k2, and the metadata involved is k_e.avi, k3, k2, and the metadata is inside the subtree; suppose the directory k3 is set as a subtree The flag, the corresponding subtree k3/k-e.avi does not actually include the metadata k2 involved in the application access operation, that is, only a part of the metadata is included, which does not conform to the target subtree described in this embodiment. The case of metadata included.
  • the metadata included in the target subtree corresponds to the rule of experience migration; that is, the subtree flag can be set according to the characteristics of the metadata changes in the respective MDS, for example, if a certain part of the metadata is found frequently It is accessed simultaneously for a period of time, and the access frequency of the part of the metadata reaches a preset threshold within a preset time period.
  • the preset threshold is 50 times, and the access frequency of the metadata is within a preset time period.
  • the overall migration of the subtree corresponding to the directory in which the subtree flag is set means that the subtree including the two branches k2/k3/k_e.avi and k2/k_c.avi is used as an example, and the subtree is used as an example.
  • the branch of the subtree can also be divided, for example, the branch k3/k-e.avi is separately migrated (the The branch is actually a Subtree), that is, two load values are migrated; however, if the root directory k2 is set to the subtree flag attribute, it indicates that the above includes k2/k3/k-e.avi and k2/k-c.avi
  • the subtrees of the branches can no longer be split, but can only be migrated as a whole, and no more of them can be migrated.
  • the embodiment when searching for a subtree to be migrated, the embodiment is performed by searching a directory in the metadata, if the attribute of a certain directory includes a subtree flag, and the load attribute of the directory and the load If the information matches, the load value of the subtree with the directory as the root directory is the load value to be migrated, and the subtree can only be migrated in a holistic manner. This is the subtree to be migrated.
  • This embodiment will search for The root directory of the subtree is called the target directory.
  • the target subtree is migrated as a whole.
  • the metadata management method of the embodiment is implemented to improve the metadata management efficiency of the file system by: setting a subtree flag in the directory attribute, and using all the subtrees having the subtree flag as the root directory as The overall migration of the target subtree of the migration, compared to the migration of the metadata in the prior art, since the metadata included in the target subtree is always migrated in a holistic manner, it is inevitable to effectively reduce the metadata operations across the MDS, for example When some metadata related to the change is actually the metadata inside the target subtree, it only changes within the target subtree, and does not involve operations across the MDS, thereby saving the difference across the MDS. The time of information transmission between MDS, the efficiency of metadata distribution management is improved.
  • the distribution of metadata is managed by the MDS itself, and the MDS is responsible for load migration when the load is heavy; when the metadata is distributed among the MDSs, the child with the root directory of the subtree tag attribute is located.
  • the tree is placed in the same MDS as a whole, and the parts in this type of subtree are not placed in different MDSs. Therefore, when the metadata is distributed, it can be based on the subtree tag attributes.
  • the subtree tag attribute is located in the same MDS as the subtree of the root directory.
  • the subtree including the target directory is to be migrated, the subtree is migrated as a whole, and only a part of the subtree is migrated, so that the whole of the subtree can be guaranteed.
  • the subtree is migrated as a whole, and only a part of the subtree is migrated, so that the whole of the subtree can be guaranteed.
  • the metadata included in the target subtree is an example of all the metadata involved in an application.
  • the assumption is that the access operation of a user application is to move the file k_e.avi from the directory k3 to the directory k2. - 1 , correspondingly, because the storage path of the file changes, the corresponding metadata (which can be understood as metadata means the storage path of the file) also changes accordingly, as shown in Figure 1, the tree in Figure 1
  • the k-e.avi connection in the structure is changed to the directory k2-1 in the directory k3;
  • the fruit tree k2—1/k—d.avi is located on MDS3, and the subtree k3/k-e.avi is located on MDS2.
  • MDS2 When the distribution of the meta-metadata is changed, MDS2 will pass the metadata of the file k_e.avi.
  • the MDS operation is sent to the MDS3, and the updated metadata is stored by the MDS3, that is, the subtree k2-1/k-e.avi, and the file storage path service is provided by the MDS3 when the subsequent file k_e.avi is accessed. Access actually becomes the load of MDS3. If the subtree k2—1/k—d.avi and the subtree k3/k—e.avi are both located in the MDS2, the above metadata distribution change can be performed inside the MDS, eliminating the need for different MDSs across the MDS. The time of information transmission, the efficiency of metadata distribution update is improved.
  • FIG. 3 is a schematic flowchart of another embodiment of a metadata management method according to the present invention. This embodiment mainly describes how to migrate a certain load value from a certain MDS.
  • FIG. 4 is a file of another embodiment of the metadata management method of the present invention.
  • System metadata distribution diagram which shows the metadata distribution structure on one of the MDSs in the cluster. Referring to Figures 3 and 4, the method includes:
  • the cluster file system that includes multiple MDSs in the cluster and uniformly manages the metadata of the cluster may first set the attributes of the metadata before the cluster metadata is distributed among the plurality of MDSs, where the metadata is set.
  • the work of the attribute is performed by the cluster's metadata control module; the metadata control module is responsible for setting attributes for the metadata and distributing the metadata to multiple MDSs in the cluster.
  • the metadata distribution processing in the subsequent cluster running process such as load balancing, is performed by each MDS, and each MDS manages the metadata stored by itself, and manages the metadata according to the load. Distribution.
  • the metadata control module sets a subtree flag attribute for the directory in the metadata; the setting principle of the subtree flag attribute is as follows: the metadata involved in the application access is used as a As a whole, the subtree flag attribute of the subtree corresponding to the whole is set to ensure that the access of the application corresponds to the metadata change inside the subtree whose root directory is the root directory.
  • the corresponding access operation of the application includes moving the file k_e.avi from the directory k3 to the directory k2-1, or moving the file k_c.avi from the directory k2 to Directory k3, or create a new file under directory k3.
  • the access characteristics of the application if it will include kl-1, k2-1, k2, k3, k_e.avi, k-e.avi and The metadata of k_d.avi as a whole, then the access of the above application corresponds to the internal metadata change of the whole; the whole is a subtree, and the whole root directory kl-1 is set to the subtree flag attribute.
  • the subtree flag is used to indicate that the subtree corresponding to the root directory k1-1 can only be migrated in a holistic manner.
  • subtree flag attribute is actually set according to the access characteristics of the application. Based on this, the following two attribute setting modes are set in this embodiment:
  • One way is to provide a user application programming interface (API), and the user directly sets the attributes of the directory according to the access characteristics of the user's application; that is, if the application has the above access characteristics, The user can then set the properties of the directory to the subtree flag.
  • API application programming interface
  • the setting of the directory attribute is automatically performed by the metadata control module; for example, the attribute setting policy can be set by the user for the metadata control module, for example, the above-mentioned "access to the corresponding application"
  • the meta-data is changed to the sub-tree internal sub-tree set to a whole "etc.
  • the metadata control module can perform the application access operation that occurs during the running of the cluster, and detect the access characteristics of the application access operation. If the above policy is met, the shell J metadata control module can set the attribute of the root directory of the whole subtree to the subtree flag according to the policy.
  • a sub-tree queue may be set, and each MDS may internally establish a sub-tree queue corresponding to its own storage metadata, and the sub-tree queue All directories that have the subtree flag attribute set are included; or, MDS sets a subtree queue that includes all of its metadata, and inserts a pointer to the subtree queue that points to the directory in which the subtree flag attributes are set.
  • the directories k1-1, j1, and j2 set the subtree flag attributes.
  • the metadata control module also sets other attributes for the metadata, for example, the creation time of the directory or the file, the load value, etc.; after setting the attributes for the cluster metadata according to the above rules, the metadata control module distributes the metadata in each MDS, wherein The subtree corresponding to the root directory of the above subtree flag attribute is set to be allocated in the same MDS as a whole.
  • the subtree tag attribute is initially set as an example for description; however, the specific implementation is not limited thereto, and the setting of the metadata attribute includes, for example, the setting of the subtree tag attribute.
  • the setup time There is no limit to the setup time, and it can also be applied at any time during the operation of the MDS system.
  • Features Set this subtree tag property When the subtree tag attribute is set in the system running, if the subtree whose root directory is the directory of the subtree tag attribute is distributed on different MDSs, the system will mark the attribute according to the subtree tag attribute. The subtree migrates to the same MDS as a whole. The way to set the subtree tag attribute in the system operation is the same as the previous method, such as API mode or automatic setting.
  • each MDS manages the distribution of the stored metadata and performs load balancing processing between the MDSs.
  • the MDS1 updates the load value attribute of the metadata stored by the application according to the access of the application.
  • an application enabled by the user currently accesses the file k_b.avi multiple times, and the MDS1 will be The file access provides a path service, that is, the application is accessed to the file k-b.avi according to the stored file path, and correspondingly, the MDS1 accesses the load value of the metadata involved in the access according to the file access.
  • the load value of the update file k_b.avi is increased from 10 to 12.
  • the upper directory of the file k-b.avi such as the directory kl, bucket-1, kobe, and / will update the load value. Increase the two load values.
  • MDS1 In addition to updating the load value, MDS1 also periodically detects the load difference between each MDS. In a cluster including multiple MDSs, each MDS communicates with each other, and can exchange their respective load information, etc., MDS1 is able to obtain load information of other MDSs, and compares its own load information with load information of other MDSs to determine whether the trigger condition for performing load balancing is reached. For example, it can be set that if the load difference between the load of MDS1 and another MDS reaches 20 load values, load balancing is triggered to balance the load distribution between the MDSs. In this embodiment, it is assumed that the MDS1 is detected to determine that the load is too heavy, and eight load values need to be migrated to other MDSs, that is, the acquired load information to be migrated is eight load values.
  • the attribute includes a subtree flag, and the load attribute matches the load information.
  • the step is to find whether a target directory exists in the metadata, the target directory attribute includes a subtree flag, and the load attribute of the target directory matches the load information.
  • the MDS1 in Figure 4 is still taken as an example. After determining the load information to be migrated, the MDS1 will first search for the directory in which the subtree flag attribute is set in the stored metadata, and determine the load attribute of the directory ( That is, the load value) matches the load information to be migrated. In this embodiment, the subtree having the load value equal to the load information will be preferentially searched. For example: MDS1 will look in the directories kl-1, jl and j2 first, because the three directories have the subtree flag attribute set; determine whether there are load attributes and the load information to be migrated in the three directories. Match the directory. After judging, the load values of these three directories are not 8, therefore, there is no suitable directory.
  • the target directory exists after the search, that is, the attribute is a sub-tree flag whose load attribute is the same as the load information, proceed to execute 305, and the entire sub-tree with the target directory as the root directory is migrated. Otherwise, if it is found that it is found that the target directory does not exist, then execution 304 is continued.
  • the dynamic subtree root of the MDS refers to the directory kobe and the directory james in the MDS1, from FIG. It can also be seen that these two directories are the starting root of all the metadata in MDS1, and other directories or files are extended from the two directories, so it can be called a subtree root; and, because of this The subtrees of the embodiment are all separable. For example, dividing a directory into two subdirectories, etc., is called a dynamic subtree root.
  • the traversal finds a suitable directory, enters recursion, and refers to, along the directory hierarchy shown in FIG. 4, step by step to find whether there is a directory of load values matching the load information; when encountered in the search process When the directory with the subtree flag attribute is stopped, it returns to the previous directory.
  • MDS1 starts looking down from the directory kobe and judges whether the load value of the directory is 8, for example, in the following order, kobe bucket-1 kl k_b. Avi, kobe bucket - 1 kl-1, etc., in fact, in the kobe - bucket - 1 - kl - k_b.avi path, it has been found that the load value of the directory kl is 8, then continue Execute 305.
  • MDS1 first searches for the kobe-bucket-1-kl-1 path. When it finds the directory kl-1, it finds that the directory kl-1 has the subtree flag attribute, so it will not continue to search for the directory kl-1. Subdirectories or files (such as directory k2, file k_e.avi, etc.), because the subtree of the root directory with the subtree flag attribute is a whole, there is no need to continue to look inside the whole subtree. Then MDS1 will stop at the directory kl-1, return to the previous directory, bucket-1, and then look up the bucket-1 along the path of bucket-1, kl-k_b.avi.
  • Subdirectories or files such as directory k2, file k_e.avi, etc.
  • the load value of the directory kl is 8, then determining the subtree kl_k_b.avi is The subtree of the migration.
  • the directory in which the subtree flag attribute is set is preferentially searched; and, in the subtree of the root directory having the subtree flag attribute, The subtree is not selected, that is, the subtree with the root of the subtree flag attribute is a whole, and the whole is migrated, which is equivalent to the "static subtree" because the subtree is no longer split. .
  • the metadata segmentation is prevented from being too fragmented, and the metadata corresponding to the application access operation is included in the same subtree, so that the metadata change of the application access is performed in one MDS, and there is no case of crossing the MDS. Effectively reduce the frequency of subtree migration.
  • This embodiment also describes how to migrate a certain load value from a certain MDS, but the main difference from the second embodiment is that the embodiment also sets the concept of the concurrent group to improve the efficiency of metadata distribution management. On, further improve the effect of load balancing.
  • the concept of the concurrent group is explained: among the at least two subtrees in which the subtree flag attribute is set, multiple subtrees having the same load change trend are selected as one concurrent group, and the root directory of each subtree in the concurrent group is set.
  • Concurrent group properties On the one hand, the concurrency group includes multiple subtrees, and the root directory of each subtree is a directory in which the subtree flag attributes are set.
  • the characteristics of the multiple subtrees in the concurrent group are that they have the same load change trend.
  • the same load change trend refers to, for example, assuming that there are two subtrees in the concurrent group, and the load values of the two subtrees always rise sharply in a certain period of time, or drop sharply in a certain period of time.
  • the load values of the two subtrees are increased by 10, or a subtree can be increased by 9 load values, and the other subtree is increased by 10 load values, that is, only the emphasis is emphasized.
  • the load values of the two subtrees all rise, and the specific values of the rise can be somewhat deviated, while the other subtrees are basically unchanged. Or, the load values of the two subtrees are reduced by 8 in a certain period of time. Load values.
  • the same load change trend usually indicates that the files corresponding to the two subtrees are usually accessed at the same time, so the load changes at the same time.
  • the subtree with the directory kl-1 as the root directory, and The subtree with the directory jl as the root directory belongs to a concurrent group.
  • both the file ke.avi and the file james.avi are usually accessed, because the two files are It is related, so the load values of the above two subtrees always appear synchronously rising or falling, which means "concurrent", the user application is at the same time Access multiple subtrees within the same group.
  • this embodiment sets the concurrent group attribute to distinguish such subtrees, and the set rule is, if To migrate subtrees, try to prioritize the subtrees in the concurrent group for migration, so that subtrees in the concurrent group can increase the burden of MDS in the same MDS.
  • the search process of the migrated subtree is the same as that in the second embodiment, and is not detailed. Only some steps related to the concurrent group in the search process are described: In the process of preferentially finding the directory in which the subtree flag is set, it is found that the directory kl-1, the directory jl, and the directory j2 are all set with the subtree flag attribute, and the load values of the directory kl-1 and the directory j2 are 15, At this point, it is necessary to determine whether to select the subtree corresponding to the directory kl-1 or the subtree corresponding to the directory j2.
  • the directory k1-1 and the directory j2 have a concurrent group attribute. If the concurrent group attribute is present, it indicates that the subtree with the directory as the root directory is a subtree in the concurrent group, and the subtree is preferentially selected.
  • the directory kl-1 has the concurrency group attribute, and the subtree corresponding to the directory k1-1 is the same concurrency group as the subtree corresponding to the directory jl; then the subtree with the directory kl-1 as the root directory is preferentially selected.
  • the directory kl-1 is also referred to as the target directory to be looked up.
  • the burden of the MDS can be divided; for example, the subtree corresponding to the directory k1-1 in FIG. 4 above and the subtree corresponding to the directory j1, if the directory kl
  • the subtree corresponding to -1 is moved out, even if the load trends of the two subtrees are the same, for example, the load value increases during a certain period of time, which is increased in the two MDSs respectively, and is not increased only in MDS 1.
  • the distribution of the load before each MDS is made more balanced.
  • the setting manner of the concurrent group attribute in this embodiment is the same as the setting method of the sub-tree flag attribute, and details are not described herein again.
  • the concurrent group in which the selected subtree is located is the concurrent group including the largest number of subtrees in the plurality of concurrent groups; for example, one of the concurrent groups includes five subtrees. If another sub-tree includes 2 sub-trees, the sub-trees in the concurrent group including 5 sub-trees are preferred, because the more sub-trees are included, the greater the MDS burden caused when the load increases.
  • the embodiment of the present invention makes metadata by setting a subtree flag attribute and a concurrency group attribute for a directory.
  • the distribution management efficiency is higher, the load balancing effect is better, and the overall performance of the MDS cluster is improved.
  • the subtree flag attribute the subtree corresponding to the root directory of the subtree flag attribute is set in the same MDS as a whole, and the operation across the MDS can be reduced, and the metadata change is performed inside the MDS, thus saving MDS is able to handle more metadata distribution management tasks when information is transmitted across MDS operations.
  • FIG. 5 is a comparison diagram of the overall performance of the MDS cluster according to the embodiment of the metadata management method of the present invention
  • FIG. 6 is a comparison chart 2 of the overall performance of the MDS cluster according to the embodiment of the metadata management method of the present invention.
  • the ordinate of the table indicates the load value. It can be seen from the figure that after the scheme of the embodiment of the present invention is adopted (i.e., after the improvement), the load values of the indexes before the implementation (i.e., before the improvement) are improved.
  • the file creation load, file removal load, directory creation load, directory removal load, tree creation load, and subtree deletion (shown in the figure) Tree removal ) load, and file start load, directory start load, these loads are the load corresponding to the MDS cluster receiving and processing related application access operations, such as processing file creation operations. load.
  • the above load increase before the improvement indicates that the application access operation task of the improved MDS cluster processing is increased compared with the previous one. For example, only two file creation operations can be processed before the improvement in a certain period of time, and five file creations can be processed after the improvement. The operation has significantly improved the performance of the MDS.
  • the sub-trees belonging to the same concurrent group are preferentially selected for migration, so that multiple sub-trees in the concurrent group can be distributed in multiple MDSs to avoid concentration in the same MDS.
  • the MDS burden is too large.
  • the burden of the MDS is alleviated, the metadata processing efficiency of the MDS is improved, and higher application access operations can be handled; for example, the MDS 1 in FIG. 4 has a concurrent group before the improvement.
  • the load of the MDS 1 is heavy, and the processing efficiency of the MDS1 is slowed down.
  • the load of the MDS1 is reduced due to load balancing, the metadata processing efficiency is improved, and the amount of processing tasks is more.
  • FIG. 7 is a diagram showing an improved MDS cluster load distribution chart of the metadata management method embodiment of the present invention
  • FIG. 8 is a modified MDS cluster load distribution chart of the metadata management method embodiment of the present invention.
  • the ordinates of both tables represent the load value.
  • the embodiment of the present invention is directed to the MDS of the cluster file system, and the method for managing the distribution of the metadata is described.
  • the specific implementation is not limited to the MDS scenario, and the method of the embodiment of the present invention can be used for other management needs.
  • FIG. 9 is a schematic structural diagram of an embodiment of a metadata management apparatus according to the present invention.
  • the apparatus may perform the method according to any embodiment of the present invention.
  • the apparatus may include: a load determining unit 91, a subtree searching unit 92, and a sub Tree migration unit 93; wherein
  • a load determining unit 91 configured to acquire load information to be migrated
  • the subtree searching unit 92 is configured to search for a directory attribute of a directory in the metadata, and select, in the directory attribute, load information that matches the load information to be migrated, and the directory having the subtree flag is the subtree flag in advance.
  • the subtree migration unit 93 is configured to migrate the target subtree as a whole.
  • subtree of the root directory of the subtree identifier identifier includes metadata corresponding to the smallest unit of the service access operation range.
  • the subtree of the root directory of the subtree flag identifier includes metadata whose access frequency reaches a preset threshold within a preset time period.
  • the metadata management apparatus further includes: an attribute setting unit 94, configured to search in the subtree. Before the unit searches the directory attribute of the directory in the metadata, in the at least two subtrees of the root directory whose directory attribute has the subtree flag, select multiple subtrees having the same load change trend as one concurrent group, and the concurrent group Set the concurrency group flag in the directory attribute of the root directory of each subtree;
  • the subtree searching unit 92 is specifically configured to search for a directory attribute of a directory in the metadata, where the selected directory attribute includes not only the load information but also a subtree flag, and the target subtree of the concurrent group flag shift;
  • the subtree flag is preset in a directory attribute of a root directory identified by the subtree flag.
  • the subtree searching unit 92 is specifically configured to select, from the concurrent group including the largest number of subtrees, the directory attribute to include not only the load information, and the subtree flag, but also the directory of the concurrent group flag.
  • the target directory is specifically configured to search for a directory attribute of a directory in the metadata, where the selected directory attribute includes not only the load information but also a subtree flag, and the target subtree of the concurrent group flag shift;
  • the subtree flag is preset in a directory attribute of a root directory identified by the subtree flag.
  • the subtree searching unit 92 is specifically configured to select, from the concurrent group including the largest number of
  • the metadata management apparatus of this embodiment further includes: an attribute obtaining unit 95, configured to receive an attribute set by a user through an application programming interface API, where the attribute includes the subtree flag and a concurrent group flag.
  • FIG. 11 is a schematic structural diagram of an embodiment of a computing node for metadata management according to the present invention. As shown in FIG. 11, this embodiment provides a schematic diagram of a computing node 700.
  • the computing node 700 may be a host server including computing power, or a personal computer (PC), or a portable computer or terminal, etc., and the specific embodiment of the present invention does not implement a computing node. Make a limit.
  • the compute node 700 includes a processor 710, a communications interface 720, a memory 730, and a bus 740.
  • the processor 710, the communication interface 720, and the memory 730 complete communication with each other via the bus 740.
  • the communication interface 720 is configured to receive a program by communicating with the network element.
  • the processor 710 is configured to execute the program 732.
  • program 732 can include program code, the program code including computer operating instructions.
  • the processor 710 may be a central processing unit (CPU), or an Application Specific Integrated Circuit (ASIC), or one or more configured to implement the embodiments of the present invention. integrated circuit.
  • CPU central processing unit
  • ASIC Application Specific Integrated Circuit
  • the memory 730 is configured to store the program 732.
  • the memory 730 may include a random access memory (RAM) and may also include a non-volatile memory such as at least one disk storage.
  • the program 732 may specifically include: a load determining unit 91, configured to acquire load information to be migrated;
  • the subtree searching unit 92 is configured to search for a directory attribute of a directory in the metadata, and select, in the directory attribute, load information that matches the load information to be migrated, and the directory having the subtree flag is the subtree flag in advance.
  • the subtree migration unit 93 is configured to migrate the target subtree as a whole.
  • subtree of the root directory of the subtree identifier identifier includes metadata corresponding to the smallest unit of the service access operation range.
  • the subtree of the root directory of the subtree flag identifier includes metadata whose access frequency reaches a preset threshold within a preset time period.
  • program further includes:
  • an attribute setting unit configured to: before the sub-tree search unit finds the directory attribute of the directory in the metadata, select at least two sub-trees having the same load change trend in at least two sub-trees of the root directory having the sub-tree flag
  • the tree acts as a concurrent group, and sets the concurrent group flag in the directory attribute of the root directory of each subtree in the concurrent group;
  • the subtree search unit is specifically configured to search for a directory attribute of a directory in the metadata, and the selected directory attribute includes not only the load information but also a subtree flag, and a target subtree of the concurrent group flag;
  • the subtree flag is preset in the directory attribute of the root directory identified by the subtree flag.
  • the subtree searching unit is specifically configured to select, from the concurrent group that includes the largest number of subtrees, the directory attribute, not only the load information, and the subtree flag, but also the directory of the concurrent group flag.
  • the target directory is specifically configured to select, from the concurrent group that includes the largest number of subtrees, the directory attribute, not only the load information, and the subtree flag, but also the directory of the concurrent group flag.
  • program further includes:
  • An attribute obtaining unit configured to receive an attribute set by a user through an application programming interface API, where the attribute includes the subtree flag and a concurrent group flag.
  • the embodiment of the invention further provides a computer program product for repairing data, comprising a computer readable storage medium storing the program code;
  • the program code includes instructions for acquiring load information to be migrated; searching for a directory attribute of a directory in the metadata, and selecting a directory attribute including load information matching the load information to be migrated and having a subtree flag
  • the directory is the target directory, and all subtrees having the target directory as the root directory are determined as the target subtree to be migrated; the subtree flag is preset in the directory attribute of the root directory identified by the subtree flag. ; migrate the target subtree as a whole.
  • the disclosed systems, devices, and methods may be implemented in other ways.
  • the device embodiments described above are merely illustrative.
  • the division of the unit is only a logical function division.
  • there may be another division manner for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not executed.
  • the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some communication interface, device or unit, and may be in electrical, mechanical or other form.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solution of the embodiment.
  • each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
  • the functions, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium.
  • the technical solution of the present invention which is essential or contributes to the prior art, or a part of the technical solution, may be embodied in the form of a software product, which is stored in a storage medium, including
  • the instructions are used to cause a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention.
  • the foregoing storage medium includes: a USB flash drive, a removable hard disk, a read-only memory (Read-Only Memory, ROM for short), a random access memory (RAM), a magnetic disk, or an optical disk, and the like.
  • the medium of the program code includes: a USB flash drive, a removable hard disk, a read-only memory (Read-Only Memory, ROM for short), a random access memory (RAM), a magnetic disk, or an optical disk, and the like.
  • the medium of the program code includes: a USB flash drive, a removable hard disk, a read-only memory (Read-Only Memory, ROM for short), a random access memory (RAM), a magnetic disk, or an optical disk, and the like.
  • the medium of the program code includes: a USB flash drive, a removable hard disk, a read-only memory (Read-Only Memory, ROM for short), a random access memory (RAM), a magnetic disk, or an optical disk, and the like.
  • the medium of the program code

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)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

Provided are a metadata management method and device. The method comprises: acquiring load information to be migrated; looking up directory attributes of directories in metadata, selecting a directory with the directory attributes thereof containing load information matching the load information to be migrated and having a subtree flag as a target directory, and determining all subtrees with the target directory as a root directory as target subtrees to be migrated, the subtree flag being preset in the directory attributes of the root directory identified by the subtree flag; and migrating the target subtrees entirely. The present invention improves the metadata management efficiency of a file system.

Description

元数据管理方法和装置 技术领域 本发明涉及存储技术, 尤其涉及一种元数据管理方法和装置。 背景技术  TECHNICAL FIELD The present invention relates to storage technologies, and in particular, to a metadata management method and apparatus. Background technique
集群文件系统是对集群中包括的多台机器的文件进行统一管理的系统, 该文件系统对多台机器提供统一的存储空间称为名字空间, 该名字空间用于 存储集群中的各台机器中的文件的存放路径; 例如, 文件 a 的存放路径是 C/aa/c/a (其中的 C/aa/c可以称为目录); 元数据包括所述的用于表示文件存 放路径的信息。 名字空间被分割为多份, 每份分配给集群中的一台机器, 用 于存储对应机器中的元数据; 假设在某台机器中的 C目录下的空间存储了两 个文件路径,分别为 C/aa/c/a和 C/bb/d,则可以将 C/aa/c/a称为一个子树, C/bb/d 也称为一个子树, aa/c/a也可以称为一个子树, 即子树实际上也是元数据, 只 是根据元数据中的目录或文件之间的层次连接关系设定的形象称谓。  The cluster file system is a system for uniformly managing files of multiple machines included in the cluster. The file system provides a unified storage space for multiple machines, which is called a namespace. The namespace is used to store each machine in the cluster. The storage path of the file; for example, the storage path of the file a is C/aa/c/a (where C/aa/c may be referred to as a directory); the metadata includes the information for indicating the file storage path. The namespace is divided into multiple shares, each of which is assigned to a machine in the cluster for storing metadata in the corresponding machine; assuming that the space in the C directory of a machine stores two file paths, respectively C/aa/c/a and C/bb/d, C/aa/c/a can be called a subtree, C/bb/d is also called a subtree, and aa/c/a can also be called As a subtree, the subtree is actually metadata, just the image title set according to the hierarchical connection between the directories or files in the metadata.
在集群的运行过程中, 文件会被用户的应用所访问, 文件的访问量可以 用负载表示, 某台机器的文件访问量越大该机器的负载较高。 为了使得集群 中的各机器的负载均衡, 现有技术会在某台机器的负载较重时, 将该机器的 一部分负载迁移到另一台机器上(实际是文件的迁移) ; 相应的, 该机器的 元数据也要随着负载的移动进行更新, 将与迁移负载对应的子树也迁移到另 一台机器, 即负载迁移其对应的元数据也会迁移, 元数据的分布发生了改变。  During the running of the cluster, the file will be accessed by the user's application. The file access amount can be represented by the load. The larger the file access volume of a certain machine, the higher the load of the machine. In order to balance the load of each machine in the cluster, the prior art will migrate part of the load of the machine to another machine (actually file migration) when the load of one machine is heavy; correspondingly, The metadata of the machine is also updated as the load moves, and the subtree corresponding to the migration load is also migrated to another machine, that is, the corresponding metadata of the load migration also migrates, and the distribution of the metadata changes.
但是, 在为了负载均衡而进行的负载迁移和子树迁移中, 会使得元数据 在集群中的分布较为零散, 有可能出现的情况是, 假设用户要将某个文件从 一个目录迁移到另一个目录下时, 而这两个目录分别位于不同的机器上, 造 成对元数据的分布管理就要进行跨机器操作, 即将元数据从一个机器发送到 另一台机器, 从而导致文件系统在用户进行文件操作时相应进行的元数据分 布管理的效率较低, 影响集群对用户应用的访问性能。 发明内容 本发明提供一种元数据管理方法和装置, 以提高文件系统的元数据管理 效率。 However, in the load migration and subtree migration for load balancing, the distribution of metadata in the cluster is scattered. It is possible that the user is supposed to migrate a file from one directory to another. When the two directories are located on different machines, the distribution management of the metadata requires cross-machine operation, that is, the metadata is sent from one machine to another, causing the file system to perform files in the user. The efficiency of metadata distribution management corresponding to the operation is low, which affects the access performance of the cluster to user applications. Summary of the invention The present invention provides a metadata management method and apparatus for improving metadata management efficiency of a file system.
第一方面, 提供一种元数据管理方法, 包括:  In a first aspect, a metadata management method is provided, including:
获取将迁移的负载信息;  Get the load information that will be migrated;
查找元数据中的目录的目录属性, 选择目录属性中包括与所述将迁移的 负载信息相匹配的负载信息且具有子树标志的目录为目标目录, 确定以所述 目标目录为根目录的所有子树作为将迁移的目标子树; 所述子树标志预先设 置在被所述子树标志标识出的根目录的目录属性中;  Finding a directory attribute of a directory in the metadata, selecting a directory attribute including load information matching the load information to be migrated and having a subtree flag as a target directory, and determining all the root directory of the target directory a subtree as a target subtree to be migrated; the subtree flag is preset in a directory attribute of a root directory identified by the subtree flag;
将所述目标子树整体迁移。  The target subtree is migrated as a whole.
结合第一方面, 在第一种可能的实现方式中, 所述子树标志标识的根目 录的子树中包括业务访问操作范围的最小单元对应的元数据。  With reference to the first aspect, in a first possible implementation, the subtree of the root directory of the subtree identifier identifier includes metadata corresponding to a smallest unit of the service access operation range.
结合第一方面, 在第二种可能的实现方式中, 所述子树标志标识的根目 录的子树中包括在预设时间段内访问频度达到预设阈值的元数据。  With reference to the first aspect, in a second possible implementation, the subtree of the root directory of the subtree identifier is included in the sub-tree whose access frequency reaches a preset threshold within a preset time period.
结合第一方面, 在第三种可能的实现方式中, 在查找元数据中的目录的 目录属性之前, 还包括: 在根目录的目录属性具有子树标志的至少两个子树 中, 选择具有相同负载变化趋势的多个子树作为一个并发组, 并将所述并发 组中的每个子树的根目录的目录属性中设置并发组标志; 所述选择目录属性 中包括与所述将迁移的负载信息相匹配的负载信息且具有及子树标志的目录 为目标目录, 包括: 选择目录属性中不仅包括所述负载信息且具有子树标志, 还包括所述并发组标志的目录作为所述目标目录。  In combination with the first aspect, in a third possible implementation, before searching for the directory attribute of the directory in the metadata, the method further includes: selecting, having the same in at least two subtrees of the directory attribute of the root directory having the subtree flag The plurality of subtrees of the load change trend are used as a concurrent group, and the concurrent group flag is set in the directory attribute of the root directory of each subtree in the concurrent group; the selected directory attribute includes the load information to be migrated The matching load information and the directory having the subtree flag are the target directory, including: the selected directory attribute includes not only the load information but also a subtree flag, and a directory including the concurrent group flag as the target directory.
结合第一方面的第一种可能的实现方式至第三种可能的实现方式中的任 意一种, 在第四种可能的实现方式中, 所述选择目录属性中不仅包括所述负 载信息、 以及子树标志, 还包括所述并发组标志的目录作为所述目标目录, 包括: 从包括子树数量最多的并发组中, 选择目录属性中不仅包括所述负载 信息、 以及子树标志, 还包括所述并发组标志的目录作为所述目标目录。  With reference to any one of the first possible implementation of the first aspect to the third possible implementation, in the fourth possible implementation, the selecting the directory attribute includes not only the load information, and a subtree flag, including the directory of the concurrent group flag, as the target directory, including: from a concurrent group including the largest number of subtrees, selecting a directory attribute includes not only the load information, and a subtree flag, but also includes The directory of the concurrent group flag is used as the target directory.
结合第一方面的第三种可能的实现方式, 在第五种可能的实现方式中, 所述目录属性是接收用户通过应用程序编程接口 API设置的属性, 所述属性 包括所述子树标志和并发组标志。  In conjunction with the third possible implementation of the first aspect, in a fifth possible implementation, the directory attribute is an attribute that is received by a user through an application programming interface API, and the attribute includes the sub-tree flag and Concurrent group logo.
第二方面, 提供一种元数据管理装置, 包括:  In a second aspect, a metadata management apparatus is provided, including:
负载确定单元, 用于获取将迁移的负载信息; 子树查找单元, 用于查找元数据中的目录的目录属性, 选择目录属性中 包括与所述将迁移的负载信息相匹配的负载信息且具有子树标志的目录为目 所述子树标志预先设置在被所述子树标志标识出的根目录的目录属性中; 子树迁移单元, 用于将所述目标子树整体迁移。 a load determining unit, configured to acquire load information to be migrated; a subtree searching unit, configured to search for a directory attribute of a directory in the metadata, and selecting a directory attribute including load information matching the load information to be migrated and having a subtree flag as the subtree flag in advance Set in the directory attribute of the root directory identified by the subtree flag; a subtree migration unit, configured to migrate the target subtree as a whole.
结合第二方面, 在第一种可能的实现方式中, 所述子树标志标识的根目 录的子树中包括业务访问操作范围的最小单元对应的元数据。  With reference to the second aspect, in a first possible implementation, the subtree of the root directory of the subtree identifier identifier includes the metadata corresponding to the smallest unit of the service access operation range.
结合第二方面, 在第二种可能的实现方式中, 所述子树标志标识的根目 录的子树中包括在预设时间段内访问频度达到预设阈值的元数据。  With reference to the second aspect, in a second possible implementation manner, the subtree of the root directory of the subtree identifier identifier includes metadata that has reached a preset threshold in a preset time period.
结合第二方面, 在第三种可能的实现方式中, 还包括: 属性设置单元, 用于在所述子树查找单元查找元数据中的目录的目录属性之前, 在根目录的 目录属性具有子树标志的至少两个子树中, 选择具有相同负载变化趋势的多 个子树作为一个并发组, 并将所述并发组中的每个子树的根目录的目录属性 中设置并发组标志; 所述子树查找单元, 具体用于查找元数据中的目录的目 录属性, 选择目录属性中不仅包括所述负载信息且具有子树标志, 还包括所 子树作为将迁移的目标子树; 所述子树标志预先设置在被所述子树标志标识 出的根目录的目录属性中。  With reference to the second aspect, in a third possible implementation, the method further includes: an attribute setting unit, configured to: before the subtree searching unit searches for a directory attribute of a directory in the metadata, the directory attribute in the root directory has a sub Among the at least two subtrees of the tree flag, a plurality of subtrees having the same load change tendency are selected as one concurrent group, and a concurrent group flag is set in a directory attribute of a root directory of each subtree in the concurrent group; a tree search unit, specifically configured to find a directory attribute of a directory in the metadata, where the selected directory attribute includes not only the load information but also a subtree flag, and the subtree as a target subtree to be migrated; the subtree The flag is preset in the directory attribute of the root directory identified by the subtree flag.
结合第二方面的第一种可能的实现方式至第三种可能的实现方式中的任 意一种, 在第四种可能的实现方式中, 所述子树查找单元, 具体用于从包括 子树数量最多的并发组中, 选择目录属性中不仅包括所述负载信息、 以及子 树标志, 还包括所述并发组标志的目录作为所述目标目录。  With reference to any one of the first possible implementation of the second aspect to the third possible implementation, in a fourth possible implementation, the subtree searching unit is specifically configured to include a subtree In the most concurrent group, the selected directory attribute includes not only the load information, and the subtree flag, but also a directory of the concurrent group flag as the target directory.
结合第二方面的第三种可能的实现方式, 在第五种可能的实现方式中, 还包括: 属性获取单元, 用于接收用户通过应用程序编程接口 API设置的属 性, 所述属性包括所述子树标志和并发组标志。  In conjunction with the third possible implementation of the second aspect, in a fifth possible implementation, the method further includes: an attribute obtaining unit, configured to receive an attribute set by a user through an application programming interface API, where the attribute includes the Subtree flag and concurrency group flag.
第三方面, 提供一种用于元数据管理的计算节点, 所述计算节点包括: 处理器、 通信接口、 存储器和总线; 其中, 所述处理器、 通信接口和存储器 通过所述总线完成相互间的通信;  A third aspect provides a computing node for metadata management, where the computing node includes: a processor, a communication interface, a memory, and a bus; wherein the processor, the communication interface, and the memory complete each other through the bus Communication;
所述通信接口, 用于所述元数据管理的计算节点接收程序;  The communication interface, the computing node for the metadata management receiving program;
所述处理器, 用于执行程序; 所述存储器, 用于存放程序; The processor is configured to execute a program; The memory is configured to store a program;
所述程序包括: 负载确定单元、 子树查找单元和子树迁移单元; 所述负载确定单元, 用于获取将迁移的负载信息;  The program includes: a load determining unit, a subtree searching unit, and a subtree migrating unit; and the load determining unit, configured to acquire load information to be migrated;
所述子树查找单元, 用于查找元数据中的目录的目录属性, 选择目录属 性中包括与所述将迁移的负载信息相匹配的负载信息且具有子树标志的目录 树;所述子树标志预先设置在被所述子树标志标识出的根目录的目录属性中; 所述子树迁移单元, 用于将所述目标子树整体迁移。  The subtree searching unit is configured to search for a directory attribute of a directory in the metadata, and select a directory tree that includes load information matching the load information to be migrated and has a subtree flag; the subtree The flag is preset in the directory attribute of the root directory identified by the subtree flag; the subtree migration unit is configured to migrate the target subtree as a whole.
结合第三方面, 在第一种可能的实现方式中, 所述子树标志标识的根目 录的子树中包括业务访问操作范围的最小单元对应的元数据。  With reference to the third aspect, in a first possible implementation, the subtree of the root directory of the subtree identifier identifier includes the metadata corresponding to the smallest unit of the service access operation range.
结合第三方面, 在第二种可能的实现方式中, 所述子树标志标识的根目 录的子树中包括在预设时间段内访问频度达到预设阈值的元数据。  With reference to the third aspect, in a second possible implementation manner, the subtree of the root directory of the subtree identifier is included in the sub-tree whose access frequency reaches a preset threshold within a preset time period.
结合第三方面, 在第三种可能的实现方式中, 还包括: 属性设置单元, 用于在所述子树查找单元查找元数据中的目录的目录属性之前, 在根目录的 目录属性具有子树标志的至少两个子树中, 选择具有相同负载变化趋势的多 个子树作为一个并发组, 并将所述并发组中的每个子树的根目录的目录属性 中设置并发组标志; 所述子树查找单元, 具体用于查找元数据中的目录的目 录属性, 选择目录属性中不仅包括所述负载信息且具有子树标志, 还包括所 子树作为将迁移的目标子树; 所述子树标志预先设置在被所述子树标志标识 出的根目录的目录属性中。  In combination with the third aspect, in a third possible implementation, the method further includes: an attribute setting unit, configured to: before the subtree search unit searches for a directory attribute of a directory in the metadata, the directory attribute in the root directory has a sub Among the at least two subtrees of the tree flag, a plurality of subtrees having the same load change tendency are selected as one concurrent group, and a concurrent group flag is set in a directory attribute of a root directory of each subtree in the concurrent group; a tree search unit, specifically configured to find a directory attribute of a directory in the metadata, where the selected directory attribute includes not only the load information but also a subtree flag, and the subtree as a target subtree to be migrated; the subtree The flag is preset in the directory attribute of the root directory identified by the subtree flag.
结合第三方面的第一种可能的实现方式至第三种可能的实现方式中的任 意一种, 在第四种可能的实现方式中, 所述子树查找单元, 具体用于从包括 子树数量最多的并发组中, 选择目录属性中不仅包括所述负载信息、 以及子 树标志, 还包括所述并发组标志的目录作为所述目标目录。  With reference to any one of the first possible implementation to the third possible implementation of the third aspect, in a fourth possible implementation, the sub-tree search unit is specifically configured to include a subtree In the most concurrent group, the selected directory attribute includes not only the load information, and the subtree flag, but also a directory of the concurrent group flag as the target directory.
结合第三方面的第三种可能的实现方式, 在第五种可能的实现方式中, 还包括: 属性获取单元, 用于接收用户通过应用程序编程接口 API设置的属 性, 所述属性包括所述子树标志和并发组标志。  In conjunction with the third possible implementation of the third aspect, in a fifth possible implementation, the method further includes: an attribute obtaining unit, configured to receive an attribute set by a user through an application programming interface API, where the attribute includes the Subtree flag and concurrency group flag.
第四方面, 提供一种修复数据的计算机程序产品, 包括存储了程序代码 的计算机可读存储介质; 所述程序代码包括的指令, 用于获取将迁移的负载信息; 查找元数据中 的目录的目录属性, 选择目录属性中包括与所述将迁移的负载信息相匹配的 负载信息且具有子树标志的目录为目标目录, 确定以所述目标目录为根目录 的所有子树作为将迁移的目标子树; 所述子树标志预先设置在被所述子树标 志标识出的根目录的目录属性中; 将所述目标子树整体迁移。 A fourth aspect, a computer program product for repairing data, comprising a computer readable storage medium storing program code; The program code includes instructions for acquiring load information to be migrated; searching for a directory attribute of a directory in the metadata, and selecting a directory attribute including load information matching the load information to be migrated and having a subtree flag The directory is the target directory, and all subtrees having the target directory as the root directory are determined as the target subtree to be migrated; the subtree flag is preset in the directory attribute of the root directory identified by the subtree flag. ; migrate the target subtree as a whole.
本发明提供的元数据管理方法和装置的技术效果是: 通过在目录属性中 设置子树标志, 并将以具有子树标志的目录为根目录的所有子树作为将迁移 的目标子树整体迁移, 相对于现有技术中的元数据分散的迁移方式, 能够有 效减少跨 MDS的元数据操作, 节省了跨 MDS时不同 MDS之间信息传输的 时间, 元数据分布管理的效率得到提高。 附图说明 图 1为本发明元数据管理方法实施例应用的文件系统的元数据分布图; 图 2为本发明元数据管理方法一实施例的流程示意图;  The technical effects of the metadata management method and apparatus provided by the present invention are as follows: by setting a subtree flag in a directory attribute, and all subtrees having a directory having a subtree flag as a root directory are migrated as a target subtree to be migrated as a whole. Compared with the metadata migration mode in the prior art, the metadata operation across the MDS can be effectively reduced, the time for information transmission between different MDSs across the MDS is saved, and the efficiency of metadata distribution management is improved. BRIEF DESCRIPTION OF THE DRAWINGS FIG. 1 is a metadata distribution diagram of a file system applied to an embodiment of a metadata management method according to the present invention; FIG. 2 is a flow chart of an embodiment of a metadata management method according to the present invention;
图 3为本发明元数据管理方法另一实施例的流程示意图;  3 is a schematic flowchart of another embodiment of a metadata management method according to the present invention;
图 4为本发明元数据管理方法另一实施例的文件系统元数据分布图; 图 5为本发明元数据管理方法实施例的 MDS集群整体性能对比图表一; 图 6为本发明元数据管理方法实施例的 MDS集群整体性能对比图表二; 图 7为本发明元数据管理方法实施例的改进前的 MDS集群负载分布图表; 图 8为本发明元数据管理方法实施例的改进后的 MDS集群负载分布图表; 图 9为本发明元数据管理装置一实施例的结构示意图;  4 is a file system metadata distribution diagram of another embodiment of the metadata management method of the present invention; FIG. 5 is a comparison diagram of overall performance of an MDS cluster according to an embodiment of the metadata management method of the present invention; FIG. 6 is a metadata management method of the present invention; The overall performance comparison of the MDS cluster of the embodiment is shown in FIG. 2; FIG. 7 is a diagram of the MDS cluster load distribution before the improvement of the metadata management method embodiment of the present invention; FIG. 8 is a modified MDS cluster load of the metadata management method embodiment of the present invention. FIG. 9 is a schematic structural diagram of an embodiment of a metadata management apparatus according to the present invention;
图 10为本发明元数据管理装置另一实施例的结构示意图;  FIG. 10 is a schematic structural diagram of another embodiment of a metadata management apparatus according to the present invention; FIG.
图 11为本发明元数据管理的计算节点实施例的结构示意图。 具体实施方式 为了使得本发明实施例的元数据管理方法更加容易理解, 首先结合图 1 , 对本发明实施例中涉及到的一些基本概念进行说明, 图 1为本发明元数据管 理方法实施例应用的文件系统的元数据分布图。 本实施例的元数据管理实际 上是对文件系统中的元数据进行管理, 具体是对元数据分布的管理; 所述的 元数据是关于目录或者文件等的管理信息, 例如, 目录或者文件的名称、 属 性、 层次关系等。 FIG. 11 is a schematic structural diagram of an embodiment of a computing node for metadata management according to the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS In order to make the metadata management method of the embodiment of the present invention easier to understand, first, some basic concepts involved in the embodiments of the present invention are described in conjunction with FIG. 1. FIG. 1 is a schematic diagram of an embodiment of a metadata management method according to the present invention. The metadata distribution of the file system. The metadata management of this embodiment actually manages the metadata in the file system, specifically the management of the metadata distribution; the metadata is management information about a directory or a file, for example, a directory or a file. Name, genus Sex, hierarchical relationship, etc.
参见图 1 , 以元数据服务器(Metadata server, 简称: MDS ) 集群为例, 在该集群中, 包括多个 MDS, 每个 MDS负责管理一台机器的元数据; 所述 的元数据即为图 1中所示的由相互连接的各个方框组成的树状信息, 例如, kl、 bucket— 1等。图 1中用虚线框出了三个存储空间的范围,分别属于 MDS1、 MDS2和 MDS3 , 例如, 虚线框 pi中的是存储在 MDS1中的元数据, 虚线框 p2中的是存储在 MDS2中的元数据, 虚线框 p3中的是存储在 MDS3中的元 数据。 未在虚线框范围内的元数据是其他 MDS上的元数据。  Referring to FIG. 1 , a Metadata Server (MDS) cluster is taken as an example. In the cluster, multiple MDSs are included, and each MDS is responsible for managing metadata of one machine; the metadata is a graph. A tree-like information composed of respective blocks connected to each other as shown in 1, for example, k1, bucket-1, and the like. In Figure 1, the three storage spaces are enclosed by dashed lines, which belong to MDS1, MDS2 and MDS3 respectively. For example, the dotted box pi is the metadata stored in MDS1, and the dotted box p2 is stored in MDS2. Metadata, in the dashed box p3, is the metadata stored in MDS3. Metadata that is not within the dashed box is metadata on other MDSs.
该 MDS集群的元数据是以图 1所示的树状结构存储的,该树状结构的元 数据涉及到如下一些概念, 其中, 需要说明的是, 如下所提到的目录、 文件、 子树、 节点等均是指的元数据, 本发明实施例讨论的是元数据的分布结构, 例如, 所提到的图 1中的文件 k— e.avi , 实际是文件 k— e.avi的元数据; 此外, 本发明实施例中所提到的负载也是指的对于元数据访问的负载, 不过该元数 据负载的更新也是由对于文件或目录的实际访问所引起的。  The metadata of the MDS cluster is stored in a tree structure as shown in FIG. 1. The metadata of the tree structure involves the following concepts, wherein, the directories, files, and subtrees mentioned below are required to be explained. The node and the like refer to the metadata. The embodiment of the present invention discusses the distribution structure of the metadata. For example, the file k-e.avi in FIG. 1 mentioned above is actually the element of the file k-e.avi. Data; In addition, the load mentioned in the embodiment of the present invention also refers to the load for metadata access, but the update of the metadata load is also caused by actual access to files or directories.
目录: 例如图 1中所示的 kobe、 james、 bucket— 1等;  Directory: For example, kobe, james, bucket-1, etc. shown in Figure 1;
文件: 例如图 1中所示的 k_e.avi、 k— d.avi等, 文件是位于目录下的, 比 如, k— e.avi是位于目录 k3下, 该目录 k3的上一级目录是 k2, 目录 k2的上 一级目录是 kl— 1 , 依次类推, 该树状结构顶部的目录 " 是总的根目录; 上述的文件和目录、 及其之间的层次关系 (即文件位于某个目录下)组 成了文件的存储路径; 例如, 文件 k— b.avi的存储路径是  File: For example, k_e.avi, k-d.avi, etc. shown in Figure 1, the file is located in the directory, for example, k-e.avi is located under directory k3, and the upper directory of the directory k3 is k2 The directory above the directory k2 is kl-1, and so on, the directory at the top of the tree structure is the total root directory; the above files and directories, and the hierarchical relationship between them (that is, the files are located in a directory) The following is the storage path of the file; for example, the storage path of the file k-b.avi is
/kobe/bucket—l/kl/k— b.avi。 又例如, 图 1中的目录 bucket— 2下还未放置文件。  /kobe/bucket—l/kl/k—b.avi. For another example, the file in the directory bucket-2 in Figure 1 has not been placed yet.
子树: 如果将图 1中的树状结构顶部的目录 "/" 比喻成大树的根, 则该 大树的任何一个分支都可以称为一个子树;  Subtree: If the directory "/" at the top of the tree structure in Figure 1 is likened to the root of a large tree, any branch of the large tree can be called a subtree;
例如, 目录 kobe及其下属的所有元数据 (包括所有的目录和文件 )的整 体称为一个子树, 目录 kl及其下属的所有元数据的整体称为一个子树(即 kl -k_b.avi ), 目录 k2及其下属的所有元数据的整体称为一个子树(该子树 包括了 k2、 k3、 k_e.avi、 k_c.avi ) 。 可以看到, 子树即以某个目录为根, 包 括该目录以及连接到该目录下的所有分支, 这个整体称为一个子树。  For example, the entirety of all metadata (including all directories and files) of the directory kobe and its subordinates is called a subtree, and the whole of all metadata of the directory kl and its subordinates is called a subtree (ie kl -k_b.avi ), the whole of all metadata of the directory k2 and its subordinates is called a subtree (the subtree includes k2, k3, k_e.avi, k_c.avi). As you can see, the subtree is rooted at a directory, including the directory and all the branches connected to it, which is called a subtree.
在后续所述的元数据的迁移中, 均是以子树的迁移来描述, 因为元数据 的迁移是以子树为单位的。 节点: 将图 1中的每个方框都称为一个节点, 该节点可以是目录也可以 是文件; 例如, k_e.avi、 bucket— 1、 kobe等都是一个节点; In the migration of metadata described later, it is described by the migration of subtrees, because the migration of metadata is in units of subtrees. Node: Each box in Figure 1 is referred to as a node, which may be a directory or a file; for example, k_e.avi, bucket-1, kobe, etc. are all a node;
节点的属性和负载: 节点的属性例如包括创建时间、 负载值等, 每个目 录或者文件都会有个创建时间, 该创建时间就是节点的一个属性; 负载值可 以参见图 1中的每个节点左上角标示的数字, 例如, bucket— 1左上角的 31、 kobe左上角的 71等。节点的负载值表示了该节点的当前负载,是表征节点下 的文件的访问量的参数, 通常文件的访问量越大负载也就越高, 所以节点的 负载值实际上也是该节点所在的 MDS所承受的负载, 当然, 整个 MDS的负 载是位于其上的所有节点的负载值的总和。  Node attributes and load: The attributes of the node include, for example, creation time, load value, etc. Each directory or file has a creation time, which is a property of the node; the load value can be seen in the top left of each node in Figure 1. The number indicated by the corner, for example, 31 in the upper left corner of bucket-1, 71 in the upper left corner of kobe, and so on. The load value of the node indicates the current load of the node, which is a parameter that indicates the access volume of the file under the node. Generally, the larger the file access amount, the higher the load, so the load value of the node is actually the MDS where the node is located. The load that is being carried, of course, the load of the entire MDS is the sum of the load values of all the nodes located on it.
比如, bucket— 1的负载值是 31 , kobe的负载值是 71; 某个目录的负载值 是连接在该目录下的下一级节点 (目录或者文件) 的负载值的总和, 比如, 从图 1可以看到, 文件 k— e.avi是在目录 k3下, 该文件 k_e.avi的负载值是 2 (负载值是根据文件访问量或访问频率等按照某种算法计算得到的一个表征 值), 目录 k3的负载值与该文件 k— e.avi的负载值相同; 而目录 k2的负载值 是其下属的文件 k_e.avi和文件 k— c.avi的负载值的总和, k2的负载值 =k3的 负载值 +k— c.avi的负载值。  For example, the load value of bucket-1 is 31, and the load value of kobe is 71; the load value of a directory is the sum of the load values of the next-level nodes (directories or files) connected to the directory, for example, from the figure 1 It can be seen that the file k_e.avi is in the directory k3, and the load value of the file k_e.avi is 2 (the load value is a characterization value calculated according to an algorithm according to the file access amount or the access frequency) The load value of the directory k3 is the same as the load value of the file k-e.avi; and the load value of the directory k2 is the sum of the load values of the file k_e.avi and the file k-c.avi of the subordinate, the load value of k2 Load value of =k3 +k - load value of c.avi.
子树的迁移: 图 1中包括很多子树, 并且这多个子树是分别属于不同的 MDS的;比如,子树 bucket— 1/kl/k— b.avi位于 MDS1上,也即表示文件 k_b.avi、 目录 kl和目录 bucket— 1的元数据是由 MDS1管理和提供服务的, 对该文件 k_b.avi、 目录 kl和目录 bucket— 1的元数据的访问量较大将使得 MDS1的负 载较大; 而子树 k2— 1/k— d.avi是存储在 MDS2上的, 也即表示文件 k— d.avi和 目录 k2— 1的元数据存储在 MDS2,对该文件 k_d.avi或者目录 k2— 1的访问量 较大将使得 MDS2的负载较大。 MDS的负载指的是该 MDS上的元数据的负 载, 而元数据的负载也是由该元数据对应的实际的目录或文件的访问而引起 的。举例如下:假设对文件 k_b.avi进行了实际访问,则相对应的存储在 MDS1 上的该文件 k_b.avi的元数据的负载值将增加, 并且, 文件 k_b.avi的元数据 的负载值增加后 , 其上级目录的负载值也会随之增加 , 例如目录 bucket— 1/kl 的元数据负载值增加; 或者, 假设对目录 k2— 1进行了访问, 则相对应的存储 在 MDS2上的该目录 k2— 1的元数据的负载值将增加。  Subtree migration: Figure 1 includes many subtrees, and these subtrees belong to different MDSs respectively; for example, subtree bucket-1/kl/k-b.avi is located on MDS1, which means file k_b The metadata of .avi, directory kl, and directory bucket-1 are managed and served by MDS1. The large amount of access to the metadata of the file k_b.avi, directory kl, and directory bucket-1 will make the load of MDS1 larger. The subtree k2 - 1 / k - d. avi is stored in MDS2, that is, the metadata representing the file k - d.avi and the directory k2 - 1 is stored in MDS2, the file k_d.avi or the directory k2 A large amount of access to 1 will make the load of MDS2 larger. The load of the MDS refers to the load of the metadata on the MDS, and the load of the metadata is also caused by the access of the actual directory or file corresponding to the metadata. For example: Assume that the actual access to the file k_b.avi, the corresponding load value of the metadata of the file k_b.avi stored on MDS1 will increase, and the load value of the metadata of the file k_b.avi increases. After that, the load value of the upper directory will also increase, for example, the metadata load value of the directory bucket-1/kl increases; or, if the access to the directory k2-1 is accessed, the corresponding storage on the MDS2 The load value of the metadata of the directory k2-1 will increase.
为了在这多个 MDS之间保持负载均衡, 通常会在当前 MDS的负载较大 时, 迁移一部分负载到另一个 MDS, 实际上是将某些文件和目录的元数据迁 移到另一个 MDS,这样就由另一个 MDS对该迁移的文件和目录的访问服务, 降低了当前 MDS的负载。 负载迁移时,文件和目录的元数据的存储位置发生 变化, 比如由 MDS2转移到了 MDS3。 需要说明的是, 元数据的迁移是以子 树为单元的, 比如只能将子树 k2— 1/k— d.avi迁移。 子树的迁移是将子树的存 储位置发生改变, 相当于将图 1中的虚线框 p3框住子树 k2— 1/k— d.avi, 但是 该子树在整个树状结构的连接关系是没有变化的, 比如, 该子树 k2— 1/k— d.avi 仍然是连接在目录 kl— 1下。 In order to maintain load balancing between these multiple MDSs, the load on the current MDS is usually large. When migrating a portion of the load to another MDS, it actually migrates the metadata of certain files and directories to another MDS, so that another MDS accesses the migrated files and directories, reducing the current MDS. load. When the load is migrated, the storage location of the metadata of files and directories changes, such as MDS2 to MDS3. It should be noted that the migration of metadata is based on a subtree, for example, the subtree k2 - 1 / k - d.avi can only be migrated. The subtree migration is to change the storage location of the subtree, which is equivalent to enclosing the subtree k2-1/k-d.avi in the dashed box p3 in Figure 1, but the connection relationship of the subtree in the entire tree structure There is no change. For example, the subtree k2—1/k—d.avi is still connected to the directory kl-1.
在上述说明的基础上, 下面详细描述本发明实施例的元数据管理方法: 实施例一  Based on the above description, the metadata management method of the embodiment of the present invention is described in detail below: Embodiment 1
图 2为本发明元数据管理方法一实施例的流程示意图, 如图 2所示, 该 方法可以包括:  2 is a schematic flowchart of an embodiment of a metadata management method according to the present invention. As shown in FIG. 2, the method may include:
201、 获取将迁移的负载信息;  201. Obtain load information to be migrated;
其中, 所述的负载信息指的是负载值, 比如图 1中所示的在每个节点左 上角标示的数字, 例如, bucket— 1左上角的 31。  The load information refers to a load value, such as the number indicated in the upper left corner of each node as shown in FIG. 1, for example, 31 in the upper left corner of the bucket-1.
本实施例获取的是将迁移的负载信息,举例如下:集群中包括三个 MDS, 每个 MDS都会根据其自身负责的文件和目录的访问量等访问信息,更新对应 的元数据中的负载值, 并且可以定期检测自身所承载的总的负载值与其他 MDS负载值之间的差值, 当该差值超出了一定的阈值则表明各 MDS之间的 负载分布不均衡,则负载较重的 MDS将启动负载均衡处理,将自身的一部分 负载迁移到其他的 MDS上。实际上该负载的迁移是元数据中的某个子树的迁 移, 是将该子树对应的访问迁移到另一个 MDS, 由另一个 MDS来服务所述 的访问, 相应的负载较重的 MDS所承载的负载得到降低。  This example obtains the load information to be migrated. For example, the cluster includes three MDSs. Each MDS updates the load value of the corresponding metadata according to the access information of files and directories that it is responsible for. And periodically detecting the difference between the total load value carried by itself and other MDS load values. When the difference exceeds a certain threshold, the load distribution between the MDSs is uneven, and the load is heavier. MDS will initiate load balancing processing and migrate some of its own load to other MDSs. In fact, the migration of the load is a migration of a subtree in the metadata, and the access corresponding to the subtree is migrated to another MDS, and the access is served by another MDS, and the corresponding heavily loaded MDS is The load carried is reduced.
本实施例中, 例如某个 MDS获取到得将迁移的负载信息是 7个负载值, 即需要将 7个负载值迁移到其他 MDS。  In this embodiment, for example, the load information that is acquired by an MDS is 7 load values, that is, 7 load values need to be migrated to other MDSs.
202、 查找元数据中的目录的目录属性, 选择目录属性中包括与将迁移的 负载信息相匹配的负载信息且具有子树标志的目录为目标目录, 确定以所述 目标目录为根目录的所有子树作为将迁移的目标子树; 子树标志预先设置在 被子树标志标识出的根目录的目录属性中;  202. Search for a directory attribute of a directory in the metadata, select a directory attribute that includes load information that matches the migrated load information, and a directory that has a subtree flag as a target directory, and determine that all the target directory is the root directory. The subtree is the target subtree to be migrated; the subtree flag is pre-set in the directory attribute of the root directory identified by the subtree flag;
其中, 在 201中确定将要迁移的负载信息后, 将查找元数据中的目录的 目录属性, 选择目录属性中包括与所述将迁移的负载信息相匹配的负载信息 且具有子树标志的目录为目标目录; 该目标目录的目录属性中的负载信息表 示以该目标目录为根目录的最大的子树对应的负载值。 需要说明的是, 所述 的相匹配指的是, 子树对应的负载值与所述的负载信息不一定相等, 可以是 相近, 具体的数值相近范围可以由常用的负载均衡的模糊匹配算法确定, 本 发明实施例不再详述。 Wherein, after determining the load information to be migrated in 201, the directory in the metadata is searched for. a directory attribute, including a directory attribute including a load information matching the load information to be migrated and having a subtree flag as a target directory; load information in a directory attribute of the target directory indicating that the target directory is a root directory The maximum subtree corresponds to the load value. It should be noted that the matching refers to that the load value corresponding to the subtree is not necessarily equal to the load information, and may be similar, and the specific numerical similar range may be determined by a commonly used load balancing fuzzy matching algorithm. The embodiments of the present invention are not described in detail.
举例如下: 可以参见图 1 , 假设是 MDS2要将自身的 7个负载值迁移出 去,在图 2中可以看到,子树 k2— 1/k— d.avi的负载就是 7个负载值(目录 k2— 1 左上角标注的负载值是 7, 该负载值也是目录 k2—l的其中一个属性, 可以称 为负载属性) ; 此时, 子树对应的负载值与所述的负载信息是相等。 而如果 MDS2要将自身的 8个负载值迁移出去, 并且假设其不存在具有完全相等的 负载值的子树, 也可以将上述的负载值为 7的子树 k2— 1/k— d.avi迁移出去, 8 和 7数值相近, 可以认为子树对应的负载值与所述的负载信息相匹配。  For example: See Figure 1 for the assumption that MDS2 will migrate its own 7 load values. As you can see in Figure 2, the load of subtree k2 - 1 / k - d.avi is 7 load values (directory The load value marked in the upper left corner of k2—1 is 7. The load value is also one of the attributes of the directory k2-1, which can be called the load attribute. At this time, the load value corresponding to the subtree is equal to the load information. If MDS2 wants to migrate its own 8 load values and assume that it does not have subtrees with exactly equal load values, the subtree k2-1/k-d.avi with the above load value of 7 can also be used. After migration, the values of 8 and 7 are similar, and the load value corresponding to the subtree can be considered to match the load information.
需要说明的是, 本实施例中所选择的迁移的子树, 不仅负载值与所述负 载信息相匹配, 并且该子树的根目录即目录 k2— 1的属性还包括子树标志属 性。  It should be noted that, in the subtree of the migration selected in this embodiment, not only the load value matches the load information, but also the root directory of the subtree, that is, the attribute of the directory k2-1, including the subtree flag attribute.
前边已经结合图 1说明过子树的概念, 子树即以某个目录为根, 包括该 目录以及连接到该目录下的所有分支, 这个整体称为一个子树; 则该为根的 目录这里称为根目录。 比如, 子树 k2— 1/k— d.avi的根目录是目录 k2— 1 ; 包括 k2/k3/k_e.avi和 k2/k— c.avi两个分支的子树 ,其根目录是目录 k2。本实施例所 选择的要迁移的子树, 其根目录必须具有子树标志。  The concept of a subtree has been described above with reference to Figure 1. The subtree is rooted at a directory, including the directory and all branches connected to the directory. This whole is called a subtree; then the root directory is here. Called the root directory. For example, the root directory of the subtree k2 - 1 / k - d.avi is the directory k2 - 1; the subtree consisting of two branches k2 / k3 / k_e.avi and k2 / k - c.avi, the root directory is the directory K2. The subtree to be migrated selected in this embodiment must have a subtree flag in its root directory.
所述的子树标志是用于表示以所述目标目录为根目录的所有子树仅能以 移的目标子树。 的特点: 该目标子树包括的元数据是对应业务访问操作范围的最小单元的, 例如, 用户在执行某一业务时, 使用了一个应用 (即用户使用的某个应用程 序) , 该应用对该子树对应的目录或者文件的访问, 基本上都是该子树内部 的访问, 目标子树包括了应用访问操作对应的所有元数据(该所有元数据可 以相当于业务访问操作范围的最小单元) 。 或者, 用户在执行某一业务时, 使用了两个应用 A和 B, A涉及到了一部分元数据的变更, B涉及到了另一 部分元数据的变更, 这两部分元数据具有交集, 则可以将 A涉及到的元数据 和 B涉及到的元数据作为一个整体 (该整体可以相当于业务访问操作范围的 最小单元) , 该整体完全被包括在所述目标子树中。 或者, 上述两个应用 A 和 B涉及到的元数据之间没有交集, 则可以将应用 A涉及到的元数据单独作 为一个整体(该整体可以相当于业务访问操作范围的最小单元) , 所述目标 子树完全包括该整体。 以上只是举例, 具体实施中可以灵活变通不局限于此。 The subtree flag is used to indicate that all subtrees with the target directory as the root directory can only be moved by the target subtree. The feature: the metadata included in the target subtree is the smallest unit corresponding to the scope of the business access operation. For example, when the user performs a certain service, an application (that is, an application used by the user) is used, and the application pair The access of the directory or file corresponding to the subtree is basically an internal access of the subtree, and the target subtree includes all the metadata corresponding to the application access operation (the all metadata may be equivalent to the smallest unit of the service access operation range) ). Or, when the user is performing a certain business, Two applications A and B are used, A involves a part of the metadata change, B involves another part of the metadata change, and the two parts of the metadata have an intersection, then the metadata related to A and B can be involved. The metadata as a whole (the whole can be equivalent to the smallest unit of the business access operation range), the whole is completely included in the target subtree. Alternatively, if there is no intersection between the metadata involved in the two applications A and B, the metadata involved in the application A may be used as a whole (the whole may be equivalent to the smallest unit of the service access operation range), The target subtree completely includes the whole. The above is only an example, and the flexibility in the specific implementation is not limited to this.
可以结合图 1中的子树为例说明一种可选的所述的目标子树包括的元数 据的意思: 比如, 图 1中的包括 k2/k3/k— e.avi和 k2/k— c.avi两个分支的子树, 将该子树的根目录 k2设置子树标志属性, 则该子树为一个整体; 用户应用对 该子树的访问例如包括: 用户将文件 k— e.avi从目录 k3下移动到目录 k2下, 或者, 将文件 k— c.avi从目录 k2移动到目录 k3 , 或者, 在目录 k3下再创建一 个文件等。 可以看到, 这些操作都是在所述子树内部的操作, 不涉及到子树 之外的其他子树, 所述的子树已经包括了应用访问操作对应的元数据, 例如, 应用访问操作是将 k— e.avi从目录 k3下移动到目录 k2下,其涉及到的元数据 是 k_e.avi、 k3、 k2, 这些元数据都在该子树内部; 假设将目录 k3设置为子树 标志, 对应的子树 k3/k— e.avi实际上没有包括应用访问操作涉及到的元数据 k2, 即只包括了一部分元数据, 这种情况就不符合本实施例所述的目标子树 包括的元数据的情况。 下的特点: 该目标子树包括的元数据是对应经验迁移规律的; 即, 可以根据 该各个 MDS中的元数据变更的特点进行子树标志的设置,例如,如果发现某 一部分元数据经常在一段时间内被同时访问到, 并且在预设时间段内这部分 元数据的访问频度达到了预设阈值, 例如, 该预设阈值是 50次, 在预设时间 段内元数据的访问频度达到了 50次,则可以确定将包括这些元数据的子树整 体作为目标子树。  The subtree in FIG. 1 can be used as an example to illustrate an optional meta-data included in the target sub-tree: For example, FIG. 1 includes k2/k3/k-e.avi and k2/k- C.avi sub-tree of two branches, the sub-tree k2 of the sub-tree is set to the sub-tree flag attribute, then the sub-tree is a whole; the user application access to the sub-tree includes, for example: the user will file k-e. Avi moves from the directory k3 to the directory k2, or moves the file k_c.avi from the directory k2 to the directory k3, or creates a file under the directory k3. It can be seen that these operations are all operations inside the subtree, and do not involve other subtrees other than the subtree, and the subtree already includes metadata corresponding to the application access operation, for example, an application access operation. K_e.avi is moved from the directory k3 to the directory k2, and the metadata involved is k_e.avi, k3, k2, and the metadata is inside the subtree; suppose the directory k3 is set as a subtree The flag, the corresponding subtree k3/k-e.avi does not actually include the metadata k2 involved in the application access operation, that is, only a part of the metadata is included, which does not conform to the target subtree described in this embodiment. The case of metadata included. The following features: The metadata included in the target subtree corresponds to the rule of experience migration; that is, the subtree flag can be set according to the characteristics of the metadata changes in the respective MDS, for example, if a certain part of the metadata is found frequently It is accessed simultaneously for a period of time, and the access frequency of the part of the metadata reaches a preset threshold within a preset time period. For example, the preset threshold is 50 times, and the access frequency of the metadata is within a preset time period. When the degree reaches 50 times, it can be determined that the whole subtree including these metadata is taken as the target subtree.
所述的将设置了子树标志的目录对应的子树整体迁移的意思是, 以包括 k2/k3/k_e.avi和 k2/k— c.avi两个分支的子树为例,对子树标志属性的作用进行 说明: 假设该子树的根目录 k2没有设置子树标志属性, 则该子树的分支其实 也是可以分割的, 比如, 将其分支 k3/k— e.avi单独迁移(该分支其实也是一个 子树), 即迁移出了 2个负载值; 但是,如果将根目录 k2设置子树标志属性, 则表明所述的包括 k2/k3/k— e.avi和 k2/k— c.avi两个分支的子树,不能再被分割, 而是只能整体迁移, 不能再仅迁移其中的一部分。 The overall migration of the subtree corresponding to the directory in which the subtree flag is set means that the subtree including the two branches k2/k3/k_e.avi and k2/k_c.avi is used as an example, and the subtree is used as an example. The role of the flag attribute is explained: Assuming that the subtree k2 of the subtree does not have the subtree flag attribute set, the branch of the subtree can also be divided, for example, the branch k3/k-e.avi is separately migrated (the The branch is actually a Subtree), that is, two load values are migrated; however, if the root directory k2 is set to the subtree flag attribute, it indicates that the above includes k2/k3/k-e.avi and k2/k-c.avi The subtrees of the branches can no longer be split, but can only be migrated as a whole, and no more of them can be migrated.
在具体实施中, 查找要迁移的子树时, 本实施例是以查找元数据中的目 录来执行的, 如果某个目录的属性包括子树标志、 且所述目录的负载属性与 所述负载信息相匹配, 则表明, 以该目录为根目录的子树的负载值就是要迁 移的负载值, 并且该子树只能以整体方式迁移, 这就是要迁移的子树, 本实 施例将查找到得该子树的根目录称为目标目录。  In a specific implementation, when searching for a subtree to be migrated, the embodiment is performed by searching a directory in the metadata, if the attribute of a certain directory includes a subtree flag, and the load attribute of the directory and the load If the information matches, the load value of the subtree with the directory as the root directory is the load value to be migrated, and the subtree can only be migrated in a holistic manner. This is the subtree to be migrated. This embodiment will search for The root directory of the subtree is called the target directory.
203、 将所述目标子树整体迁移。  203. The target subtree is migrated as a whole.
本实施例的元数据管理方法, 是这样实现提高文件系统的元数据管理效 率的: 通过在目录属性中设置子树标志, 并将以具有子树标志的目录为根目 录的所有子树作为将迁移的目标子树整体迁移, 相对于现有技术中的元数据 分散的迁移方式, 由于目标子树包括的这部分元数据始终以整体方式迁移, 必然能够有效减少跨 MDS的元数据操作,例如当某些涉及到变更的元数据实 际都是该目标子树内部的元数据时, 就仅在该目标子树内部变动即可, 不会 涉及到跨 MDS的操作, 从而节省了跨 MDS时不同 MDS之间信息传输的时 间, 元数据分布管理的效率得到提高。  The metadata management method of the embodiment is implemented to improve the metadata management efficiency of the file system by: setting a subtree flag in the directory attribute, and using all the subtrees having the subtree flag as the root directory as The overall migration of the target subtree of the migration, compared to the migration of the metadata in the prior art, since the metadata included in the target subtree is always migrated in a holistic manner, it is inevitable to effectively reduce the metadata operations across the MDS, for example When some metadata related to the change is actually the metadata inside the target subtree, it only changes within the target subtree, and does not involve operations across the MDS, thereby saving the difference across the MDS. The time of information transmission between MDS, the efficiency of metadata distribution management is improved.
即, 一方面, 元数据的分布是由 MDS自身管理的, MDS负责在负载较 重时进行负载迁移;元数据在各个 MDS之间分布时,会将具有子树标记属性 的根目录所在的子树整体放置在同一个 MDS中,而不会将这种类型的子树中 的各部分分别放置在不同 MDS的, 因此, 在元数据分布时, 就可以根据该子 树标记属性, 将以具有子树标记属性的目录为根目录的子树整体位于同一个 MDS。 另一方面, 在负载均衡的处理中, 即使要迁移包括目标目录的子树, 也是将该子树整体迁移, 而不会仅分割该子树的一部分迁移, 这样就可以保 证该子树的整体总是处于同一个 MDS, 而不会分别位于不同的 MDS。  That is, on the one hand, the distribution of metadata is managed by the MDS itself, and the MDS is responsible for load migration when the load is heavy; when the metadata is distributed among the MDSs, the child with the root directory of the subtree tag attribute is located. The tree is placed in the same MDS as a whole, and the parts in this type of subtree are not placed in different MDSs. Therefore, when the metadata is distributed, it can be based on the subtree tag attributes. The subtree tag attribute is located in the same MDS as the subtree of the root directory. On the other hand, in the process of load balancing, even if the subtree including the target directory is to be migrated, the subtree is migrated as a whole, and only a part of the subtree is migrated, so that the whole of the subtree can be guaranteed. Always in the same MDS, not in different MDS.
再以目标子树包括的元数据是某个应用涉及到的所有元数据为例说明该 效果的体现: 假设某用户应用的访问操作是, 将文件 k— e.avi从目录 k3移动 到目录 k2— 1下, 相应的, 由于该文件的存储路径变化, 对应的元数据(可以 理解为元数据就是表示文件的存储路径的)也要相应变化, 具体到图 1就是, 将图 1中的树状结构中的 k— e.avi连接在目录 k3更改为连接至目录 k2— 1; 如 果子树 k2— 1/k— d.avi是位于 MDS3上, 而子树 k3/k— e.avi位于 MDS2上, 贝 J 元数据分布变更时, MDS2就要将文件 k_e.avi的元数据通过跨 MDS操作发 送到 MDS3 , 由 MDS3来存储更新后的元数据即子树 k2— 1/k— e.avi, 后续文件 k_e.avi的访问时就由 MDS3提供文件存储路径的服务, 该文件的访问实际就 成为了 MDS3的负载。如果子树 k2— 1/k— d.avi和子树 k3/k— e.avi都位于 MDS2, 则上述的元数据分布变更就在 MDS内部操作即可, 省去了跨 MDS时不同 MDS之间信息传输的时间, 元数据分布更新的效率得到提高。 Then, the metadata included in the target subtree is an example of all the metadata involved in an application. The assumption is that the access operation of a user application is to move the file k_e.avi from the directory k3 to the directory k2. - 1 , correspondingly, because the storage path of the file changes, the corresponding metadata (which can be understood as metadata means the storage path of the file) also changes accordingly, as shown in Figure 1, the tree in Figure 1 The k-e.avi connection in the structure is changed to the directory k2-1 in the directory k3; The fruit tree k2—1/k—d.avi is located on MDS3, and the subtree k3/k-e.avi is located on MDS2. When the distribution of the meta-metadata is changed, MDS2 will pass the metadata of the file k_e.avi. The MDS operation is sent to the MDS3, and the updated metadata is stored by the MDS3, that is, the subtree k2-1/k-e.avi, and the file storage path service is provided by the MDS3 when the subsequent file k_e.avi is accessed. Access actually becomes the load of MDS3. If the subtree k2—1/k—d.avi and the subtree k3/k—e.avi are both located in the MDS2, the above metadata distribution change can be performed inside the MDS, eliminating the need for different MDSs across the MDS. The time of information transmission, the efficiency of metadata distribution update is improved.
下面的实施例二和实施例三, 将通过两个可选的具体的例子, 来详细描 述本发明实施例的元数据分布管理方法的实施。  In the following Embodiment 2 and Embodiment 3, the implementation of the metadata distribution management method of the embodiment of the present invention will be described in detail through two optional specific examples.
实施例二  Embodiment 2
图 3为本发明元数据管理方法另一实施例的流程示意图, 本实施例主要 描述如何从某个 MDS中迁移出一定的负载值;图 4为本发明元数据管理方法 另一实施例的文件系统元数据分布图, 该图 4示出的是集群中的其中一个 MDS上的元数据分布结构。 结合图 3和图 4所示, 该方法包括:  3 is a schematic flowchart of another embodiment of a metadata management method according to the present invention. This embodiment mainly describes how to migrate a certain load value from a certain MDS. FIG. 4 is a file of another embodiment of the metadata management method of the present invention. System metadata distribution diagram, which shows the metadata distribution structure on one of the MDSs in the cluster. Referring to Figures 3 and 4, the method includes:
301、 为目录设置子树标志属性;  301. Set a subtree flag attribute for the directory;
其中, 集群中是包括多个 MDS的,统一管理该集群的元数据的集群文件 系统在将集群元数据在多个 MDS进行分布之前,可以首先设置该元数据的属 性, 所述的设置元数据属性的工作是由该集群的元数据控制模块执行; 该元 数据控制模块负责为元数据设置属性并将元数据分布至集群中的多个 MDS。 在完成初始的元数据分布后, 后续的集群运行过程中的元数据分布处理例如 负载均衡等, 就由各 MDS自己执行, 各 MDS分别管理自己存储的元数据, 并根据负载管理所述元数据的分布。  The cluster file system that includes multiple MDSs in the cluster and uniformly manages the metadata of the cluster may first set the attributes of the metadata before the cluster metadata is distributed among the plurality of MDSs, where the metadata is set. The work of the attribute is performed by the cluster's metadata control module; the metadata control module is responsible for setting attributes for the metadata and distributing the metadata to multiple MDSs in the cluster. After the initial metadata distribution is completed, the metadata distribution processing in the subsequent cluster running process, such as load balancing, is performed by each MDS, and each MDS manages the metadata stored by itself, and manages the metadata according to the load. Distribution.
本实施例中, 所述的元数据控制模块为元数据中的目录设置了子树标志 属性; 所述的子树标志属性的设置原则是这样的: 将应用访问所涉及到的元 数据作为一个整体, 将该整体对应的子树的根目录设置子树标志属性, 以保 证应用的访问对应的是以所述目标目录为根目录的子树内部的元数据变更。  In this embodiment, the metadata control module sets a subtree flag attribute for the directory in the metadata; the setting principle of the subtree flag attribute is as follows: the metadata involved in the application access is used as a As a whole, the subtree flag attribute of the subtree corresponding to the whole is set to ensure that the access of the application corresponds to the metadata change inside the subtree whose root directory is the root directory.
举例如下: 用户在启用某个应用程序时, 该应用程序对应的访问操作包 括将文件 k— e.avi从目录 k3下移动到目录 k2— 1下, 或者将文件 k_c.avi从目 录 k2移动到目录 k3 , 或者在目录 k3下新创建一个文件等。 根据该应用程序 的访问特点可以得到, 如果将包括 kl— 1、 k2— 1、 k2、 k3、 k_e.avi、 k— e.avi和 k_d.avi的元数据作为一个整体, 那么就可以使得上述应用的访问对应的是该 整体内部的元数据变更; 该整体为一个子树, 将该整体的根目录 kl— 1设置子 树标志属性,所述的子树标志用于表示该根目录 kl—1对应的子树仅能以整体 方式迁移。 For example: When an application is enabled, the corresponding access operation of the application includes moving the file k_e.avi from the directory k3 to the directory k2-1, or moving the file k_c.avi from the directory k2 to Directory k3, or create a new file under directory k3. According to the access characteristics of the application, if it will include kl-1, k2-1, k2, k3, k_e.avi, k-e.avi and The metadata of k_d.avi as a whole, then the access of the above application corresponds to the internal metadata change of the whole; the whole is a subtree, and the whole root directory kl-1 is set to the subtree flag attribute. The subtree flag is used to indicate that the subtree corresponding to the root directory k1-1 can only be migrated in a holistic manner.
由上述也可以得知,实际上子树标志属性是根据应用的访问特点设置的, 基于此, 本实施例设置了如下两种属性设置方式:  It can also be seen from the above that the subtree flag attribute is actually set according to the access characteristics of the application. Based on this, the following two attribute setting modes are set in this embodiment:
一种方式是, 提供给用户应用程序编程接口 ( Application Programming Interface, 简称: API ) , 由用户根据用户的应用的访问特点, 直接对目录的 属性进行设置; 即如果应用具有上述的访问特点, 则用户就可以据此将目录 的属性设置为子树标志。  One way is to provide a user application programming interface (API), and the user directly sets the attributes of the directory according to the access characteristics of the user's application; that is, if the application has the above access characteristics, The user can then set the properties of the directory to the subtree flag.
另一种方式是, 由上述的元数据控制模块自动执行目录属性的设置; 例 如, 可以由用户为该元数据控制模块设置一属性设置策略, 该策略例如即为 上述的 "将对应应用访问的元数据变更为子树内部变更的子树设置为一个整 体" 等; 在设置好策略后, 元数据控制模块就可以在集群的运行过程中发生 的应用访问操作, 检测该应用访问操作的访问特点, 如果符合上述策略, 贝 J 元数据控制模块可以根据该策略, 将该整体子树的根目录的属性设置为子树 标志。  Another way is that the setting of the directory attribute is automatically performed by the metadata control module; for example, the attribute setting policy can be set by the user for the metadata control module, for example, the above-mentioned "access to the corresponding application" The meta-data is changed to the sub-tree internal sub-tree set to a whole "etc. After the policy is set, the metadata control module can perform the application access operation that occurs during the running of the cluster, and detect the access characteristics of the application access operation. If the above policy is met, the shell J metadata control module can set the attribute of the root directory of the whole subtree to the subtree flag according to the policy.
具体实施中, 参见图 4, 为了方便后续查找哪些目录具有子树标志属性, 可以设置一个子树队列,可以是各 MDS在其内部各自建立对应自身存储元数 据的子树队列, 该子树队列中包括了所有已经设置子树标志属性的目录; 或 者, MDS设置一包括了其所有元数据的子树队列, 并在子树队列插入一个指 针, 该指针指向设置了子树标志属性的目录。 例如, 本实施例中, 目录 kl— 1、 jl和 j2设置了子树标志属性。  In a specific implementation, referring to FIG. 4, in order to facilitate subsequent searching for which directories have sub-tree flag attributes, a sub-tree queue may be set, and each MDS may internally establish a sub-tree queue corresponding to its own storage metadata, and the sub-tree queue All directories that have the subtree flag attribute set are included; or, MDS sets a subtree queue that includes all of its metadata, and inserts a pointer to the subtree queue that points to the directory in which the subtree flag attributes are set. For example, in this embodiment, the directories k1-1, j1, and j2 set the subtree flag attributes.
元数据控制模块还为元数据设置其他属性, 例如, 目录或者文件的创建 时间、 负载值等; 在按照上述规则为集群元数据设置属性后, 元数据控制模 块将元数据分布在各 MDS, 其中, 设置了上述子树标志属性的根目录对应的 子树将整体被分配在同一个 MDS中。  The metadata control module also sets other attributes for the metadata, for example, the creation time of the directory or the file, the load value, etc.; after setting the attributes for the cluster metadata according to the above rules, the metadata control module distributes the metadata in each MDS, wherein The subtree corresponding to the root directory of the above subtree flag attribute is set to be allocated in the same MDS as a whole.
需要说明的是,本实施例仅以在初始时设置子树标记属性为例进行说明; 但是具体实施中并不局限于此, 该元数据属性的设置例如包括该子树标记属 性的设置,其设置时间没有限制,也可以在 MDS系统运行中随时根据应用的 特点设置该子树标记属性。 当在系统运行中设置了该子树标记属性时, 如果 以该子树标记属性的目录为根目录的子树整体是分布在不同的 MDS上,则系 统会根据该子树标记属性,将该子树整体迁移到同一个 MDS上。在系统运行 中设置子树标记属性的方式与前述的方式相同,例如 API方式或者自动设置。 It should be noted that, in this embodiment, the subtree tag attribute is initially set as an example for description; however, the specific implementation is not limited thereto, and the setting of the metadata attribute includes, for example, the setting of the subtree tag attribute. There is no limit to the setup time, and it can also be applied at any time during the operation of the MDS system. Features Set this subtree tag property. When the subtree tag attribute is set in the system running, if the subtree whose root directory is the directory of the subtree tag attribute is distributed on different MDSs, the system will mark the attribute according to the subtree tag attribute. The subtree migrates to the same MDS as a whole. The way to set the subtree tag attribute in the system operation is the same as the previous method, such as API mode or automatic setting.
302、 获取将迁移的负载信息;  302. Obtain load information that will be migrated;
其中, 在集群的运行过程中, 由各 MDS自己管理存储的元数据的分布, 并执行各 MDS之间的负载均衡处理。  In the running process of the cluster, each MDS manages the distribution of the stored metadata and performs load balancing processing between the MDSs.
以图 4中所示的 MDS1为例, 该 MDS1会根据应用的访问更新自己存储 的元数据的负载值属性, 比如, 用户启用的某个应用当前多次访问了文件 k_b.avi, MDS1会为该文件访问提供路径服务, 即根据所存储的文件路径指 引应用访问到文件 k— b.avi, 并且相应的, MDS1会根据上述文件访问, 将该 访问所涉及到的元数据的负载值进行更新,具体是例如更新文件 k_b.avi的负 载值, 由 10增加到 12, 相应的, 该文件 k— b.avi的上级目录, 比如目录 kl、 bucket— 1、 kobe和 /都会进行负载值更新, 增加两个负载值。  Taking the MDS1 shown in FIG. 4 as an example, the MDS1 updates the load value attribute of the metadata stored by the application according to the access of the application. For example, an application enabled by the user currently accesses the file k_b.avi multiple times, and the MDS1 will be The file access provides a path service, that is, the application is accessed to the file k-b.avi according to the stored file path, and correspondingly, the MDS1 accesses the load value of the metadata involved in the access according to the file access. Specifically, for example, the load value of the update file k_b.avi is increased from 10 to 12. Correspondingly, the upper directory of the file k-b.avi, such as the directory kl, bucket-1, kobe, and / will update the load value. Increase the two load values.
在更新负载值之外, MDS1还会定期检测各 MDS之间的负载差值; 在包 括多个 MDS的集群中, 各 MDS之间是相互通信的, 可以交互其各自的负载 信息等, 所以, MDS1是能够获取到其他 MDS的负载信息的, 并将自身的负 载信息与其他 MDS的负载信息进行比较,判断是否达到了执行负载均衡的触 发条件。 例如, 可以设定如果 MDS1的负载与其他某个 MDS之间的负载差 值达到 20个负载值时, 就触发进行负载均衡, 以平衡各 MDS之间的负载分 布。 本实施例中, 假设 MDS1经过检测, 确定自身负载过重, 需要将 8个负 载值迁移到其他 MDS, 即获取到的将迁移的负载信息是 8个负载值。  In addition to updating the load value, MDS1 also periodically detects the load difference between each MDS. In a cluster including multiple MDSs, each MDS communicates with each other, and can exchange their respective load information, etc., MDS1 is able to obtain load information of other MDSs, and compares its own load information with load information of other MDSs to determine whether the trigger condition for performing load balancing is reached. For example, it can be set that if the load difference between the load of MDS1 and another MDS reaches 20 load values, load balancing is triggered to balance the load distribution between the MDSs. In this embodiment, it is assumed that the MDS1 is detected to determine that the load is too heavy, and eight load values need to be migrated to other MDSs, that is, the acquired load information to be migrated is eight load values.
303、 查找是否存在目标目录, 属性包括子树标志且负载属性与负载信息 相匹配;  303. Search for a target directory, the attribute includes a subtree flag, and the load attribute matches the load information.
具体的, 本步骤是查找元数据中是否存在目标目录, 所述目标目录属性 包括子树标志、 且所述目标目录的负载属性与所述负载信息相匹配。  Specifically, the step is to find whether a target directory exists in the metadata, the target directory attribute includes a subtree flag, and the load attribute of the target directory matches the load information.
其中, 仍以图 4中的 MDS1为例, MDS1在确定将迁移的负载信息后, 将优先查找其存储的元数据中的设置了子树标志属性的目录, 并判断以该目 录的负载属性(即负载值)是否与所述的将迁移的负载信息相匹配。 本实施 例中, 将优先查找具有与负载信息相等的负载值的子树。 举例如下: MDS1将优先在目录 kl— 1、 jl和 j2中查找, 因为这三个目录 都设置了子树标志属性; 判断这三个目录中是否有负载属性与所述的将迁移 的负载信息相匹配的目录。 经过判断, 这三个目录的负载值都不是 8, 因此, 没有合适的目录。 The MDS1 in Figure 4 is still taken as an example. After determining the load information to be migrated, the MDS1 will first search for the directory in which the subtree flag attribute is set in the stored metadata, and determine the load attribute of the directory ( That is, the load value) matches the load information to be migrated. In this embodiment, the subtree having the load value equal to the load information will be preferentially searched. For example: MDS1 will look in the directories kl-1, jl and j2 first, because the three directories have the subtree flag attribute set; determine whether there are load attributes and the load information to be migrated in the three directories. Match the directory. After judging, the load values of these three directories are not 8, therefore, there is no suitable directory.
在本步骤中, 如果经过查找, 存在所述的目标目录, 即属性是子树标志 其负载属性与所述负载信息相同, 则继续执行 305 , 将以该目标目录为根目 录的子树整体迁移; 否则, 如果经过查找, 发现不存在所述的目标目录, 则 继续执行 304。  In this step, if the target directory exists after the search, that is, the attribute is a sub-tree flag whose load attribute is the same as the load information, proceed to execute 305, and the entire sub-tree with the target directory as the root directory is migrated. Otherwise, if it is found that it is found that the target directory does not exist, then execution 304 is continued.
304、 从本 MDS的动态子树根开始遍历寻找合适的目录, 进入递归; 其中, 所述的本 MDS的动态子树根, 即指的是 MDS1中的目录 kobe、 目录 james, 从图 4中也可以看到, 这两个目录是 MDS1中的所有元数据的 起始根目录, 其他的目录或文件都是从这两个目录分割延伸的 , 所以可以称 为子树根; 并且, 由于本实施例的子树都是可以分割的, 比如, 将某个目录 分割为两个子目录等, 所以称为动态子树根。  304, starting from the dynamic subtree root of the MDS, searching for a suitable directory, and entering recursion; wherein, the dynamic subtree root of the MDS refers to the directory kobe and the directory james in the MDS1, from FIG. It can also be seen that these two directories are the starting root of all the metadata in MDS1, and other directories or files are extended from the two directories, so it can be called a subtree root; and, because of this The subtrees of the embodiment are all separable. For example, dividing a directory into two subdirectories, etc., is called a dynamic subtree root.
所述的遍历寻找合适的目录, 进入递归, 指的是, 沿着图 4中所示的目 录层次, 逐级寻找是否有与负载信息相匹配的负载值的目录; 当在寻找过程 中遇到带有子树标志属性的目录时, 则停止并返回上一级目录。  The traversal finds a suitable directory, enters recursion, and refers to, along the directory hierarchy shown in FIG. 4, step by step to find whether there is a directory of load values matching the load information; when encountered in the search process When the directory with the subtree flag attribute is stopped, it returns to the previous directory.
举例如下: 当将迁移的负载信息是 8个负载值时, MDS1从目录 kobe开 始逐级向下寻找, 并判断目录的负载值是否是 8, 例如, 按照如下顺序, kobe bucket— 1 kl k_b.avi, kobe bucket— 1 kl— 1 , 等, 其中, 实际上在所述的 kobe—— bucket— 1—— kl—— k_b.avi路径中, 就已经发现目 录 kl的负载值是 8, 则继续执行 305。  For example: When the load information to be migrated is 8 load values, MDS1 starts looking down from the directory kobe and judges whether the load value of the directory is 8, for example, in the following order, kobe bucket-1 kl k_b. Avi, kobe bucket - 1 kl-1, etc., in fact, in the kobe - bucket - 1 - kl - k_b.avi path, it has been found that the load value of the directory kl is 8, then continue Execute 305.
假设 MDS1先搜索 kobe—— bucket— 1—— kl— 1路径,则查找到目录 kl— 1 时, 发现该目录 kl—1具有子树标志属性, 则不会再继续查找该目录 kl—1下 的子目录或者文件 (比如目录 k2、 文件 k_e.avi等), 因为具有子树标志属性 的根目录的子树是一个整体, 没有必要再继续在该整体子树的内部查找了。 则 MDS1将在目录 kl—1处停止,返回上一级目录即 bucket— 1 ,再从该 bucket— 1 沿着 bucket— 1—— kl—— k_b.avi的路径查找。  Suppose MDS1 first searches for the kobe-bucket-1-kl-1 path. When it finds the directory kl-1, it finds that the directory kl-1 has the subtree flag attribute, so it will not continue to search for the directory kl-1. Subdirectories or files (such as directory k2, file k_e.avi, etc.), because the subtree of the root directory with the subtree flag attribute is a whole, there is no need to continue to look inside the whole subtree. Then MDS1 will stop at the directory kl-1, return to the previous directory, bucket-1, and then look up the bucket-1 along the path of bucket-1, kl-k_b.avi.
305、 选中与将迁移的负载信息相匹配的子树, 进行迁移。  305. Select the subtree that matches the migrated load information and perform the migration.
其中, 如上所述的, 目录 kl的负载值是 8, 则确定子树 kl一 k— b.avi为 迁移的子树。 Wherein, as described above, the load value of the directory kl is 8, then determining the subtree kl_k_b.avi is The subtree of the migration.
从上述的流程可以看到,在要从某个 MDS中迁移出一定的负载值时,将 优先查找设置了子树标志属性的目录; 并且, 在具有子树标志属性的根目录 的子树中的子树是不会被选择的, 即具有子树标志属性的根目录的子树是一 个整体, 将整体迁移, 其实相当于 "静态子树" , 因为该子树是不会再被分 割的。 这种方式避免元数据分割的过于零碎, 有利于将对应应用访问操作对 应的元数据包括在同一个子树中, 使得应用访问的元数据变更在一个 MDS 内进行, 不会出现跨 MDS的情况, 有效降低了子树的迁移频率。  As can be seen from the above process, when a certain load value is to be migrated from an MDS, the directory in which the subtree flag attribute is set is preferentially searched; and, in the subtree of the root directory having the subtree flag attribute, The subtree is not selected, that is, the subtree with the root of the subtree flag attribute is a whole, and the whole is migrated, which is equivalent to the "static subtree" because the subtree is no longer split. . In this way, the metadata segmentation is prevented from being too fragmented, and the metadata corresponding to the application access operation is included in the same subtree, so that the metadata change of the application access is performed in one MDS, and there is no case of crossing the MDS. Effectively reduce the frequency of subtree migration.
实施例三  Embodiment 3
本实施例也是描述如何从某个 MDS中迁移出一定的负载值,但是与实施 例二的主要区别是, 本实施例还设置了并发组的概念, 以在提高元数据分布 管理的效率的基础上, 进一步提高负载均衡的效果。  This embodiment also describes how to migrate a certain load value from a certain MDS, but the main difference from the second embodiment is that the embodiment also sets the concept of the concurrent group to improve the efficiency of metadata distribution management. On, further improve the effect of load balancing.
首先说明并发组的概念: 在设置子树标志属性的至少两个子树中, 选择 具有相同负载变化趋势的多个子树作为一个并发组, 并且所述并发组中的每 个子树的根目录都设置并发组属性。 一方面, 并发组中包括多个子树, 并且 每个子树的根目录都是设置了子树标志属性的目录。 另一方面, 并发组中的 这多个子树的特点就是, 具有相同的负载变化趋势。  First, the concept of the concurrent group is explained: among the at least two subtrees in which the subtree flag attribute is set, multiple subtrees having the same load change trend are selected as one concurrent group, and the root directory of each subtree in the concurrent group is set. Concurrent group properties. On the one hand, the concurrency group includes multiple subtrees, and the root directory of each subtree is a directory in which the subtree flag attributes are set. On the other hand, the characteristics of the multiple subtrees in the concurrent group are that they have the same load change trend.
所述的相同的负载变化趋势指的是, 例如, 假设并发组中有两个子树, 这两个子树的负载值总是在某段时间内均大幅上升, 或者在某段时间内均大 幅下降, 比如在某个一小时间隔内, 这两个子树的负载值都上升了 10, 或者 也可以是一个子树上升了 9个负载值, 另一个子树上升了 10个负载值, 即仅 强调该两个子树的负载值均发生上升, 对其上升的具体数值可以有些偏差, 而其他的子树都基本未发生变化; 或者, 在某段时间内这两个子树的负载值 都下降了 8个负载值。  The same load change trend refers to, for example, assuming that there are two subtrees in the concurrent group, and the load values of the two subtrees always rise sharply in a certain period of time, or drop sharply in a certain period of time. For example, in a certain hour interval, the load values of the two subtrees are increased by 10, or a subtree can be increased by 9 load values, and the other subtree is increased by 10 load values, that is, only the emphasis is emphasized. The load values of the two subtrees all rise, and the specific values of the rise can be somewhat deviated, while the other subtrees are basically unchanged. Or, the load values of the two subtrees are reduced by 8 in a certain period of time. Load values.
相同的负载变化趋势通常就表明, 这两个子树对应的文件通常都会同时 访问, 所以才会同时出现负载的变化; 以图 4为例, 对于以目录 kl— 1为根目 录的子树、 以及以目录 jl为根目录的子树, 这两个子树就属于一个并发组, 当用户在启用应用时, 既要访问文件 k-e.avi, 通常也会访问文件 james.avi, 因为这两个文件是有联系的, 所以导致上述的两个子树的负载值总是出现同 步的上升或者下降, 这也就是 "并发" 的意思, 用户应用在同一段时间同时 访问相同组内的多个子树。 The same load change trend usually indicates that the files corresponding to the two subtrees are usually accessed at the same time, so the load changes at the same time. For example, in Figure 4, the subtree with the directory kl-1 as the root directory, and The subtree with the directory jl as the root directory belongs to a concurrent group. When the user enables the application, both the file ke.avi and the file james.avi are usually accessed, because the two files are It is related, so the load values of the above two subtrees always appear synchronously rising or falling, which means "concurrent", the user application is at the same time Access multiple subtrees within the same group.
如果在同一个 MDS内具有并发组, 表明该 MDS的负载的变化会 4艮大, 比如假设该 MDS中存在一个包括 5个子树的并发组,则可能会出现某个时间 段内这 5个子树的负载值均增加,使得该 MDS会很快出现大幅的负载值增加, MDS的负担会 4艮大; 所以, 本实施例设置并发组属性来区分这类子树, 并且 设置的规则是, 如果要迁移子树, 尽量优先选择并发组中的子树进行迁移, 避免并发组中的子树在同一个 MDS内加重 MDS的负担。  If there is a concurrent group in the same MDS, it indicates that the load of the MDS changes by 4, for example, if there is a concurrent group including 5 subtrees in the MDS, the 5 subtrees may appear in a certain period of time. The load value is increased, so that the MDS will quickly appear a large load value increase, and the burden of the MDS will be 4 ;; therefore, this embodiment sets the concurrent group attribute to distinguish such subtrees, and the set rule is, if To migrate subtrees, try to prioritize the subtrees in the concurrent group for migration, so that subtrees in the concurrent group can increase the burden of MDS in the same MDS.
以图 4中要迁移 15个负载值的子树为例,该将迁移的子树的查找过程与 实施例二相同, 不再详细, 仅说明在查找过程中与并发组有关的一些步骤: 比如, 在优先查找设置了子树标志的目录的过程中, 发现目录 kl— 1、 目录 jl 和目录 j2都设置了子树标志属性, 并且, 目录 kl— 1和目录 j2的负载值都是 15, 此时就要判断是选择目录 kl— 1对应的子树还是目录 j2对应的子树。  For example, in the subtree in which the load value of the load is to be migrated in FIG. 4, the search process of the migrated subtree is the same as that in the second embodiment, and is not detailed. Only some steps related to the concurrent group in the search process are described: In the process of preferentially finding the directory in which the subtree flag is set, it is found that the directory kl-1, the directory jl, and the directory j2 are all set with the subtree flag attribute, and the load values of the directory kl-1 and the directory j2 are 15, At this point, it is necessary to determine whether to select the subtree corresponding to the directory kl-1 or the subtree corresponding to the directory j2.
具体的, 判断目录 kl— 1和目录 j2是否具有并发组属性, 如果具有并发 组属性, 则表明以该目录为根目录的子树是并发组中的一个子树, 优先选择 该子树。 例如, 目录 kl— 1是具有并发组属性的, 目录 kl— 1对应的子树与目 录 jl对应的子树是属于同一个并发组的; 则优先选择以目录 kl— 1为根目录 的子树进行迁移, 该目录 kl— 1也称为要查找的目标目录。  Specifically, it is determined whether the directory k1-1 and the directory j2 have a concurrent group attribute. If the concurrent group attribute is present, it indicates that the subtree with the directory as the root directory is a subtree in the concurrent group, and the subtree is preferentially selected. For example, the directory kl-1 has the concurrency group attribute, and the subtree corresponding to the directory k1-1 is the same concurrency group as the subtree corresponding to the directory jl; then the subtree with the directory kl-1 as the root directory is preferentially selected. For migration, the directory kl-1 is also referred to as the target directory to be looked up.
通过为目录设置并发组属性, 优先迁移并发组中的子树, 可以分割 MDS 的负担; 比如上述的图 4中的目录 kl— 1对应的子树与目录 jl对应的子树, 如果将目录 kl—1对应的子树迁出, 即使这两个子树的负载变化趋势相同, 比 如某段时间内负载值均增加,也是在两个 MDS中分别增加,而不会只在 MDS 1 中增加,从而使得负载在各 MDS之前的分配更加均衡。本实施例的并发组属 性的设置方式与子树标志属性的设置方式相同, 不再赘述。  By setting the concurrent group attribute for the directory and preferentially migrating the subtrees in the concurrent group, the burden of the MDS can be divided; for example, the subtree corresponding to the directory k1-1 in FIG. 4 above and the subtree corresponding to the directory j1, if the directory kl The subtree corresponding to -1 is moved out, even if the load trends of the two subtrees are the same, for example, the load value increases during a certain period of time, which is increased in the two MDSs respectively, and is not increased only in MDS 1. The distribution of the load before each MDS is made more balanced. The setting manner of the concurrent group attribute in this embodiment is the same as the setting method of the sub-tree flag attribute, and details are not described herein again.
进一步的, MDS中有可能存在多个并发组, ¾殳有两个并发组中都存在 适合的子树, 即负载属性与将迁移的负载信息相同, 此时如何在两个并发组 中选择子树, 本实施例设定的规则是, 确定所选择的子树所在的并发组, 是 多个并发组中的包括子树数量最多的并发组; 比如, 其中一个并发组中包括 5个子树, 另一个并发组中包括 2个子树, 则优先选择包括 5个子树的并发 组中的子树, 因为包括的子树越多, 在负载均上升时导致的 MDS负担越大。  Further, there may be multiple concurrent groups in the MDS, and there are two sub-groups with suitable sub-trees, that is, the load attribute is the same as the load information to be migrated. How to select the two concurrent groups The rule set in this embodiment is that the concurrent group in which the selected subtree is located is the concurrent group including the largest number of subtrees in the plurality of concurrent groups; for example, one of the concurrent groups includes five subtrees. If another sub-tree includes 2 sub-trees, the sub-trees in the concurrent group including 5 sub-trees are preferred, because the more sub-trees are included, the greater the MDS burden caused when the load increases.
本发明实施例通过为目录设置子树标志属性和并发组属性, 使得元数据 分布的管理效率更高,负载均衡的效果也更好,提高了 MDS集群的整体性能。 例如, 通过设置子树标志属性, 将以子树标志属性的根目录对应的子树 整体设置在同一个 MDS内,可以减少跨 MDS的操作,元数据的变更在 MDS 内部执行, 这样就节省了跨 MDS操作时信息传输的时间, MDS就能够处理 更多的元数据分布管理任务。 The embodiment of the present invention makes metadata by setting a subtree flag attribute and a concurrency group attribute for a directory. The distribution management efficiency is higher, the load balancing effect is better, and the overall performance of the MDS cluster is improved. For example, by setting the subtree flag attribute, the subtree corresponding to the root directory of the subtree flag attribute is set in the same MDS as a whole, and the operation across the MDS can be reduced, and the metadata change is performed inside the MDS, thus saving MDS is able to handle more metadata distribution management tasks when information is transmitted across MDS operations.
参见图 5和图 6, 图 5为本发明元数据管理方法实施例的 MDS集群整体 性能对比图表一,图 6为本发明元数据管理方法实施例的 MDS集群整体性能 对比图表二, 这两个表的纵坐标都表示负载值, 从图中可以看到, 采用本发 明实施例的方案后 (即改进后) , 比实施之前(即改进前)各项指标的负载 值都得到了提高。 比如图中所示的文件创建(file creation ) 负载、 文件删除 ( file removal )负载、 目录创建 ( directory creation )负载、 目录删除 ( directory removal ) 负载、 子树创建 ( tree creation ) 负载和子树删除 ( tree removal ) 负 载, 以及文件启动 (file start ) 负载、 目录启动 ( directory start ) 负载, 这些 所述的负载是 MDS集群接收和处理相关的应用访问操作而对应的负载,比如 处理文件创建操作引起的负载。 改进后比改进前的上述负载增加, 表明改进 后 MDS集群处理的应用访问操作任务比之前增多了,例如某段时间内改进前 仅能处理 2个文件创建操作, 改进后能够处理 5个文件创建操作了, 明显提 升了该 MDS的性能。  5 and FIG. 6, FIG. 5 is a comparison diagram of the overall performance of the MDS cluster according to the embodiment of the metadata management method of the present invention, and FIG. 6 is a comparison chart 2 of the overall performance of the MDS cluster according to the embodiment of the metadata management method of the present invention. The ordinate of the table indicates the load value. It can be seen from the figure that after the scheme of the embodiment of the present invention is adopted (i.e., after the improvement), the load values of the indexes before the implementation (i.e., before the improvement) are improved. For example, the file creation load, file removal load, directory creation load, directory removal load, tree creation load, and subtree deletion (shown in the figure) Tree removal ) load, and file start load, directory start load, these loads are the load corresponding to the MDS cluster receiving and processing related application access operations, such as processing file creation operations. load. After the improvement, the above load increase before the improvement indicates that the application access operation task of the improved MDS cluster processing is increased compared with the previous one. For example, only two file creation operations can be processed before the improvement in a certain period of time, and five file creations can be processed after the improvement. The operation has significantly improved the performance of the MDS.
又例如, 通过设置并发组属性, 优先选择属于同一个并发组内的子树进 行迁移, 以使得并发组中的多个子树能够分布在多个 MDS中,避免集中在同 一个 MDS而带来的 MDS负担过大。 经过这样的负载均衡处理后, 减轻了 MDS的负担, MDS的元数据处理效率就会提高, 就能处理更高的应用访问 操作; 例如, 图 4中的 MDS 1在改进前由于其中存在并发组, 导致该 MDS 1 的负载较重, MDS1的处理效率就会变慢, 而改进后由于进行了负载均衡, 该 MDS1的负担得到减轻, 提高元数据处理效率, 处理的任务量也就更多。  For example, by setting the concurrent group attribute, the sub-trees belonging to the same concurrent group are preferentially selected for migration, so that multiple sub-trees in the concurrent group can be distributed in multiple MDSs to avoid concentration in the same MDS. The MDS burden is too large. After such load balancing processing, the burden of the MDS is alleviated, the metadata processing efficiency of the MDS is improved, and higher application access operations can be handled; for example, the MDS 1 in FIG. 4 has a concurrent group before the improvement. As a result, the load of the MDS 1 is heavy, and the processing efficiency of the MDS1 is slowed down. After the improvement, the load of the MDS1 is reduced due to load balancing, the metadata processing efficiency is improved, and the amount of processing tasks is more.
参见图 7和图 8, 图 7为本发明元数据管理方法实施例的改进前的 MDS 集群负载分布图表, 图 8为本发明元数据管理方法实施例的改进后的 MDS 集群负载分布图表, 这两个表的纵坐标都表示负载值。 从图中可以看到, 改 进前的 MDS0和 MDS1的负载分布很不平衡, 柱状图形参差不齐, 纵坐标显 示的处理负载值也较低, 表明处理任务量较少; 而改进后, MDS0和 MDS1 的负载分布已经得到均衡, 负载均衡效果明显比改进前得到提高, 并且, 纵 坐标显示的处理负载值相对改进前也有了大幅提高, 提升了 MDS的性能。 Referring to FIG. 7 and FIG. 8, FIG. 7 is a diagram showing an improved MDS cluster load distribution chart of the metadata management method embodiment of the present invention, and FIG. 8 is a modified MDS cluster load distribution chart of the metadata management method embodiment of the present invention. The ordinates of both tables represent the load value. It can be seen from the figure that the load distribution of MDS0 and MDS1 before the improvement is very unbalanced, the columnar figure is jagged, the processing load value of the ordinate display is also low, indicating that the processing task is small; and after the improvement, MDS0 and MDS1 The load distribution has been balanced, the load balancing effect is significantly improved compared to before the improvement, and the processing load value displayed on the ordinate is also greatly improved before the relative improvement, which improves the performance of the MDS.
需要说明的是,本发明实施例是以集群文件系统的 MDS为对象,说明元 数据分布管理的方法, 但具体实施中, 并不局限于 MDS场景, 本发明实施例 的方法可用于其他需要管理文件系统元数据服务分布的系统。  It should be noted that the embodiment of the present invention is directed to the MDS of the cluster file system, and the method for managing the distribution of the metadata is described. However, the specific implementation is not limited to the MDS scenario, and the method of the embodiment of the present invention can be used for other management needs. A system for distributing file system metadata services.
实施例四  Embodiment 4
图 9为本发明元数据管理装置一实施例的结构示意图, 该装置可以执行 本发明任意实施例的方法, 如图 9所示, 该装置可以包括: 负载确定单元 91、 子树查找单元 92和子树迁移单元 93; 其中,  FIG. 9 is a schematic structural diagram of an embodiment of a metadata management apparatus according to the present invention. The apparatus may perform the method according to any embodiment of the present invention. As shown in FIG. 9, the apparatus may include: a load determining unit 91, a subtree searching unit 92, and a sub Tree migration unit 93; wherein
负载确定单元 91 , 用于获取将迁移的负载信息;  a load determining unit 91, configured to acquire load information to be migrated;
子树查找单元 92, 用于查找元数据中的目录的目录属性, 选择目录属性 中包括与所述将迁移的负载信息相匹配的负载信息且具有子树标志的目录为 所述子树标志预先设置在被所述子树标志标识出的根目录的目录属性中; 子树迁移单元 93 , 用于将所述目标子树整体迁移。  The subtree searching unit 92 is configured to search for a directory attribute of a directory in the metadata, and select, in the directory attribute, load information that matches the load information to be migrated, and the directory having the subtree flag is the subtree flag in advance. Set in the directory attribute of the root directory identified by the subtree flag; the subtree migration unit 93 is configured to migrate the target subtree as a whole.
进一步的, 所述子树标志标识的根目录的子树中包括业务访问操作范围 的最小单元对应的元数据。  Further, the subtree of the root directory of the subtree identifier identifier includes metadata corresponding to the smallest unit of the service access operation range.
进一步的, 所述子树标志标识的根目录的子树中包括在预设时间段内访 问频度达到预设阈值的元数据。  Further, the subtree of the root directory of the subtree flag identifier includes metadata whose access frequency reaches a preset threshold within a preset time period.
图 10为本发明元数据管理装置另一实施例的结构示意图,本实施例在图 9所示结构的基础上, 元数据管理装置还包括: 属性设置单元 94, 用于在所 述子树查找单元查找元数据中的目录的目录属性之前, 在根目录的目录属性 具有子树标志的至少两个子树中, 选择具有相同负载变化趋势的多个子树作 为一个并发组, 并将所述并发组中的每个子树的根目录的目录属性中设置并 发组标志;  10 is a schematic structural diagram of another embodiment of the metadata management apparatus of the present invention. The present embodiment is based on the structure shown in FIG. 9. The metadata management apparatus further includes: an attribute setting unit 94, configured to search in the subtree. Before the unit searches the directory attribute of the directory in the metadata, in the at least two subtrees of the root directory whose directory attribute has the subtree flag, select multiple subtrees having the same load change trend as one concurrent group, and the concurrent group Set the concurrency group flag in the directory attribute of the root directory of each subtree;
所述子树查找单元 92, 具体用于查找元数据中的目录的目录属性, 选择 目录属性中不仅包括所述负载信息且具有子树标志, 还包括所述并发组标志 移的目标子树; 所述子树标志预先设置在被所述子树标志标识出的根目录的 目录属性中。 进一步的,子树查找单元 92,具体用于从包括子树数量最多的并发组中, 选择目录属性中不仅包括所述负载信息、 以及子树标志, 还包括所述并发组 标志的目录作为所述目标目录。 The subtree searching unit 92 is specifically configured to search for a directory attribute of a directory in the metadata, where the selected directory attribute includes not only the load information but also a subtree flag, and the target subtree of the concurrent group flag shift; The subtree flag is preset in a directory attribute of a root directory identified by the subtree flag. Further, the subtree searching unit 92 is specifically configured to select, from the concurrent group including the largest number of subtrees, the directory attribute to include not only the load information, and the subtree flag, but also the directory of the concurrent group flag. The target directory.
进一步的, 本实施例的元数据管理装置, 还包括: 属性获取单元 95 , 用 于接收用户通过应用程序编程接口 API设置的属性, 所述属性包括所述子树 标志和并发组标志。  Further, the metadata management apparatus of this embodiment further includes: an attribute obtaining unit 95, configured to receive an attribute set by a user through an application programming interface API, where the attribute includes the subtree flag and a concurrent group flag.
实施例五  Embodiment 5
图 11为本发明元数据管理的计算节点实施例的结构示意图, 如图 11 , 本实施例提供了一种计算节点 700的示意图。 该计算节点 700可能是包含计 算能力的主机服务器, 或者是个人计算机( personal computer, 简称: PC ) , 或者是可携带的便携式计算机或终端等等 , 本发明具体实施例并不对计算节 点的具体实现做限定。  FIG. 11 is a schematic structural diagram of an embodiment of a computing node for metadata management according to the present invention. As shown in FIG. 11, this embodiment provides a schematic diagram of a computing node 700. The computing node 700 may be a host server including computing power, or a personal computer (PC), or a portable computer or terminal, etc., and the specific embodiment of the present invention does not implement a computing node. Make a limit.
该计算节点 700包括: 处理器 (processor)710 , 通信接口(Communications Interface)720, 存储器 (memory)730, 总线 740。 处理器 710、 通信接口 720、 存储器 730通过总线 740完成相互间的通信。  The compute node 700 includes a processor 710, a communications interface 720, a memory 730, and a bus 740. The processor 710, the communication interface 720, and the memory 730 complete communication with each other via the bus 740.
通信接口 720, 用于与网元通信接收程序。  The communication interface 720 is configured to receive a program by communicating with the network element.
处理器 710, 用于执行程序 732。 具体地, 程序 732可以包括程序代码, 所述程序代码包括计算机操作指令。  The processor 710 is configured to execute the program 732. In particular, program 732 can include program code, the program code including computer operating instructions.
处理器 710可能是一个中央处理器( Central Processing Unit,简称: CPU ), 或者是特定集成电路(Application Specific Integrated Circuit, 简称: ASIC ) , 或者是被配置成实施本发明实施例的一个或多个集成电路。  The processor 710 may be a central processing unit (CPU), or an Application Specific Integrated Circuit (ASIC), or one or more configured to implement the embodiments of the present invention. integrated circuit.
存储器 730, 用于存放程序 732。 存储器 730可能包含高速随机存储器 ( random access memory, 简称: RAM ) , 也可能还包括非易失性存储器 ( non-volatile memory ) ,例如至少一个磁盘存储器。程序 732具体可以包括: 负载确定单元 91 , 用于获取将迁移的负载信息;  The memory 730 is configured to store the program 732. The memory 730 may include a random access memory (RAM) and may also include a non-volatile memory such as at least one disk storage. The program 732 may specifically include: a load determining unit 91, configured to acquire load information to be migrated;
子树查找单元 92, 用于查找元数据中的目录的目录属性, 选择目录属性 中包括与所述将迁移的负载信息相匹配的负载信息且具有子树标志的目录为 所述子树标志预先设置在被所述子树标志标识出的根目录的目录属性中; 子树迁移单元 93 , 用于将所述目标子树整体迁移。 程序 732中各单元的具体实现参见图 9-图 10所示实施例中的相应单元, 在此不赘述。 The subtree searching unit 92 is configured to search for a directory attribute of a directory in the metadata, and select, in the directory attribute, load information that matches the load information to be migrated, and the directory having the subtree flag is the subtree flag in advance. Set in the directory attribute of the root directory identified by the subtree flag; the subtree migration unit 93 is configured to migrate the target subtree as a whole. For the specific implementation of each unit in the program 732, refer to the corresponding units in the embodiment shown in FIG. 9 to FIG. 10, and details are not described herein.
进一步的, 所述子树标志标识的根目录的子树中包括业务访问操作范围 的最小单元对应的元数据。  Further, the subtree of the root directory of the subtree identifier identifier includes metadata corresponding to the smallest unit of the service access operation range.
进一步的, 所述子树标志标识的根目录的子树中包括在预设时间段内访 问频度达到预设阈值的元数据。  Further, the subtree of the root directory of the subtree flag identifier includes metadata whose access frequency reaches a preset threshold within a preset time period.
进一步的, 所述程序还包括:  Further, the program further includes:
属性设置单元, 用于在所述子树查找单元查找元数据中的目录的目录属 性之前, 在根目录的目录属性具有子树标志的至少两个子树中, 选择具有相 同负载变化趋势的多个子树作为一个并发组, 并将所述并发组中的每个子树 的根目录的目录属性中设置并发组标志;  And an attribute setting unit, configured to: before the sub-tree search unit finds the directory attribute of the directory in the metadata, select at least two sub-trees having the same load change trend in at least two sub-trees of the root directory having the sub-tree flag The tree acts as a concurrent group, and sets the concurrent group flag in the directory attribute of the root directory of each subtree in the concurrent group;
所述子树查找单元, 具体用于查找元数据中的目录的目录属性, 选择目 录属性中不仅包括所述负载信息且具有子树标志, 还包括所述并发组标志的 的目标子树; 所述子树标志预先设置在被所述子树标志标识出的根目录的目 录属性中。  The subtree search unit is specifically configured to search for a directory attribute of a directory in the metadata, and the selected directory attribute includes not only the load information but also a subtree flag, and a target subtree of the concurrent group flag; The subtree flag is preset in the directory attribute of the root directory identified by the subtree flag.
进一步的, 所述子树查找单元, 具体用于从包括子树数量最多的并发组 中, 选择目录属性中不仅包括所述负载信息、 以及子树标志, 还包括所述并 发组标志的目录作为所述目标目录。  Further, the subtree searching unit is specifically configured to select, from the concurrent group that includes the largest number of subtrees, the directory attribute, not only the load information, and the subtree flag, but also the directory of the concurrent group flag. The target directory.
进一步的, 所述程序还包括:  Further, the program further includes:
属性获取单元, 用于接收用户通过应用程序编程接口 API设置的属性, 所述属性包括所述子树标志和并发组标志。  An attribute obtaining unit, configured to receive an attribute set by a user through an application programming interface API, where the attribute includes the subtree flag and a concurrent group flag.
本发明实施例还提供了一种修复数据的计算机程序产品, 包括存储了程 序代码的计算机可读存储介质;  The embodiment of the invention further provides a computer program product for repairing data, comprising a computer readable storage medium storing the program code;
所述程序代码包括的指令, 用于获取将迁移的负载信息; 查找元数据中 的目录的目录属性, 选择目录属性中包括与所述将迁移的负载信息相匹配的 负载信息且具有子树标志的目录为目标目录, 确定以所述目标目录为根目录 的所有子树作为将迁移的目标子树; 所述子树标志预先设置在被所述子树标 志标识出的根目录的目录属性中; 将所述目标子树整体迁移。  The program code includes instructions for acquiring load information to be migrated; searching for a directory attribute of a directory in the metadata, and selecting a directory attribute including load information matching the load information to be migrated and having a subtree flag The directory is the target directory, and all subtrees having the target directory as the root directory are determined as the target subtree to be migrated; the subtree flag is preset in the directory attribute of the root directory identified by the subtree flag. ; migrate the target subtree as a whole.
所属领域的技术人员可以清楚地了解到, 为描述的方便和简洁, 上述描 述的系统、 装置和单元的具体工作过程, 可以参考前述方法实施例中的对应 过程, 在此不再赘述。 It will be apparent to those skilled in the art that the above description is convenient and concise for the description. For a specific working process of the system, the device, and the unit, reference may be made to the corresponding process in the foregoing method embodiment, and details are not described herein again.
在本申请所提供的几个实施例中, 应该理解到, 所揭露的系统、 装置和 方法, 可以通过其它的方式实现。 例如, 以上所描述的装置实施例仅仅是示 意性的, 例如, 所述单元的划分, 仅仅为一种逻辑功能划分, 实际实现时可 以有另外的划分方式, 例如多个单元或组件可以结合或者可以集成到另一个 系统, 或一些特征可以忽略, 或不执行。 另一点, 所显示或讨论的相互之间 的耦合或直接耦合或通信连接可以是通过一些通信接口, 装置或单元的间接 耦合或通信连接, 可以是电性, 机械或其它的形式。  In the several embodiments provided herein, it should be understood that the disclosed systems, devices, and methods may be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the unit is only a logical function division. In actual implementation, there may be another division manner, for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not executed. Alternatively, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some communication interface, device or unit, and may be in electrical, mechanical or other form.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的, 作 为单元显示的部件可以是或者也可以不是物理单元, 即可以位于一个地方, 或者也可以分布到多个网络单元上。 可以根据实际的需要选择其中的部分或 者全部单元来实现本实施例方案的目的。  The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solution of the embodiment.
另夕卜,在本发明各个实施例中的各功能单元可以集成在一个处理单元中, 也可以是各个单元单独物理存在, 也可以两个或两个以上单元集成在一个单 元中。  In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用 时, 可以存储在一个计算机可读取存储介质中。 基于这样的理解, 本发明的 技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可 以以软件产品的形式体现出来, 该计算机软件产品存储在一个存储介质中, 包括若干指令用以使得一台计算机设备(可以是个人计算机, 服务器, 或者 网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。 而前述的 存储介质包括: U盘、 移动硬盘、 只读存储器(Read-Only Memory, 简称: ROM ) 、 随机存取存储器 ( Random Access Memory, 简称: RAM ) 、 磁碟 或者光盘等各种可以存储程序代码的介质。  The functions, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention, which is essential or contributes to the prior art, or a part of the technical solution, may be embodied in the form of a software product, which is stored in a storage medium, including The instructions are used to cause a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The foregoing storage medium includes: a USB flash drive, a removable hard disk, a read-only memory (Read-Only Memory, ROM for short), a random access memory (RAM), a magnetic disk, or an optical disk, and the like. The medium of the program code.
最后应说明的是: 以上各实施例仅用以说明本发明的技术方案, 而非对 其限制; 尽管参照前述各实施例对本发明进行了详细的说明, 本领域的普通 技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改, 或者对其中部分或者全部技术特征进行等同替换; 而这些修改或者替换, 并 不使相应技术方案的本质脱离本发明各实施例技术方案的范围。  Finally, it should be noted that the above embodiments are only for explaining the technical solutions of the present invention, and are not intended to be limiting thereof; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art will understand that The technical solutions described in the foregoing embodiments may be modified, or some or all of the technical features may be equivalently replaced; and the modifications or substitutions do not deviate from the technical solutions of the embodiments of the present invention. range.

Claims

权 利 要 求 书 claims
1、 一种元数据管理方法, 其特征在于, 包括: 1. A metadata management method, characterized by including:
获取将迁移的负载信息; Obtain the load information to be migrated;
查找元数据中的目录的目录属性, 选择目录属性中包括与所述将迁移的 负载信息相匹配的负载信息且具有子树标志的目录为目标目录, 确定以所述 目标目录为根目录的所有子树作为将迁移的目标子树; 所述子树标志预先设 置在被所述子树标志标识出的根目录的目录属性中; Search the directory attributes of the directory in the metadata, select the directory whose directory attributes include load information matching the load information to be migrated and have a subtree flag as the target directory, and determine all directories with the target directory as the root directory. The subtree serves as the target subtree to be migrated; the subtree flag is preset in the directory attribute of the root directory identified by the subtree flag;
将所述目标子树整体迁移。 Migrate the target subtree as a whole.
2、 根据权利要求 1所述的元数据管理方法, 其特征在于, 所述子树标志 标识的根目录的子树中包括业务访问操作范围的最小单元对应的元数据。 2. The metadata management method according to claim 1, wherein the subtree of the root directory identified by the subtree flag includes metadata corresponding to the smallest unit of the business access operation range.
3、 根据权利要求 1所述的元数据管理方法, 其特征在于, 所述子树标志 标识的根目录的子树中包括在预设时间段内访问频度达到预设阈值的元数 据。 3. The metadata management method according to claim 1, wherein the subtree of the root directory identified by the subtree flag includes metadata whose access frequency reaches a preset threshold within a preset time period.
4、 根据权利要求 1所述的元数据管理方法, 其特征在于, 在查找元数据 中的目录的目录属性之前, 还包括: 4. The metadata management method according to claim 1, characterized in that, before searching the directory attributes of the directory in the metadata, it further includes:
在根目录的目录属性具有子树标志的至少两个子树中, 选择具有相同负 载变化趋势的多个子树作为一个并发组, 并将所述并发组中的每个子树的根 目录的目录属性中设置并发组标志; Among at least two subtrees whose directory attribute of the root directory has a subtree flag, select multiple subtrees with the same load change trend as a concurrency group, and add the directory attribute of each subtree in the concurrency group to the directory attribute of the root directory. Set the concurrent group flag;
所述选择目录属性中包括与所述将迁移的负载信息相匹配的负载信息且 具有及子树标志的目录为目标目录, 包括: 选择目录属性中不仅包括所述负 载信息且具有子树标志, 还包括所述并发组标志的目录作为所述目标目录。 The selected directory attribute includes the load information that matches the load information to be migrated and has a subtree flag as the target directory, including: the selected directory attribute not only includes the load information and has a subtree flag, The directory containing the concurrent group flag is also included as the target directory.
5、 根据权利要求 2-4任一所述的元数据管理方法, 其特征在于, 所述选 择目录属性中不仅包括所述负载信息、 以及子树标志, 还包括所述并发组标 志的目录作为所述目标目录, 包括: 5. The metadata management method according to any one of claims 2 to 4, characterized in that the selected directory attribute not only includes the load information and the subtree flag, but also includes the directory of the concurrent group flag as the The target directory includes:
从包括子树数量最多的并发组中, 选择目录属性中不仅包括所述负载信 息、 以及子树标志, 还包括所述并发组标志的目录作为所述目标目录。 From the concurrent group that includes the largest number of subtrees, select a directory whose directory attributes include not only the load information and the subtree flag, but also the concurrent group flag as the target directory.
6、 根据权利要求 4所述的元数据管理方法, 其特征在于, 所述目录属性 是接收用户通过应用程序编程接口 API设置的属性, 所述属性包括所述子树 标志和并发组标志。 6. The metadata management method according to claim 4, wherein the directory attribute is an attribute set by a user through an application programming interface API, and the attribute includes the subtree flag and the concurrent group flag.
7、 一种元数据管理装置, 其特征在于, 包括: 负载确定单元, 用于获取将迁移的负载信息; 7. A metadata management device, characterized by including: Load determination unit, used to obtain load information to be migrated;
子树查找单元, 用于查找元数据中的目录的目录属性, 选择目录属性中 包括与所述将迁移的负载信息相匹配的负载信息且具有子树标志的目录为目 所述子树标志预先设置在被所述子树标志标识出的根目录的目录属性中; 子树迁移单元, 用于将所述目标子树整体迁移。 A subtree search unit, used to search the directory attributes of the directory in the metadata, and select a directory whose directory attributes include load information matching the load information to be migrated and have a subtree flag, and the subtree flag is preset. Set in the directory attribute of the root directory identified by the subtree flag; a subtree migration unit, used to migrate the target subtree as a whole.
8、 根据权利要求 7所述的元数据管理装置, 其特征在于, 所述子树标志 标识的根目录的子树中包括业务访问操作范围的最小单元对应的元数据。 8. The metadata management device according to claim 7, wherein the subtree of the root directory identified by the subtree flag includes metadata corresponding to the smallest unit of the business access operation range.
9、 根据权利要求 7所述的元数据管理装置, 其特征在于, 所述子树标志 标识的根目录的子树中包括在预设时间段内访问频度达到预设阈值的元数 据。 9. The metadata management device according to claim 7, wherein the subtree of the root directory identified by the subtree flag includes metadata whose access frequency reaches a preset threshold within a preset time period.
10、 根据权利要求 7所述的元数据管理装置, 其特征在于, 还包括: 属性设置单元, 用于在所述子树查找单元查找元数据中的目录的目录属 性之前, 在根目录的目录属性具有子树标志的至少两个子树中, 选择具有相 同负载变化趋势的多个子树作为一个并发组, 并将所述并发组中的每个子树 的根目录的目录属性中设置并发组标志; 10. The metadata management device according to claim 7, further comprising: an attribute setting unit, configured to set the directory attribute in the root directory before the subtree search unit searches for the directory attribute of the directory in the metadata. Among at least two subtrees whose attributes have subtree flags, select multiple subtrees with the same load change trend as a concurrent group, and set the concurrent group flag in the directory attribute of the root directory of each subtree in the concurrent group;
所述子树查找单元, 具体用于查找元数据中的目录的目录属性, 选择目 录属性中不仅包括所述负载信息且具有子树标志, 还包括所述并发组标志的 的目标子树; 所述子树标志预先设置在被所述子树标志标识出的根目录的目 录属性中。 The subtree search unit is specifically used to search the directory attributes of the directory in the metadata, and select the directory attributes that not only include the load information and have the subtree flag, but also include the target subtree of the concurrent group flag; so The subtree flag is preset in the directory attribute of the root directory identified by the subtree flag.
11、 根据权利要求 8-10任一所述的元数据管理装置, 其特征在于, 所述子树查找单元, 具体用于从包括子树数量最多的并发组中, 选择目 录属性中不仅包括所述负载信息、 以及子树标志, 还包括所述并发组标志的 目录作为所述目标目录。 11. The metadata management device according to any one of claims 8 to 10, characterized in that the subtree search unit is specifically used to select from the concurrent group including the largest number of subtrees the directory attributes that include not only all The load information, subtree flag, and directory of the concurrent group flag are also included as the target directory.
12、 根据权利要求 10所述的元数据管理装置, 其特征在于, 还包括: 属性获取单元, 用于接收用户通过应用程序编程接口 API设置的属性, 所述属性包括所述子树标志和并发组标志。 12. The metadata management device according to claim 10, further comprising: an attribute acquisition unit, configured to receive attributes set by the user through an application programming interface API, where the attributes include the subtree flag and concurrency Group logo.
13、 一种元数据管理的计算节点, 其特征在于, 所述计算节点包括: 处 理器、 通信接口、 存储器和总线; 其中, 所述处理器、 通信接口和存储器通 过所述总线完成相互间的通信; 13. A computing node for metadata management, characterized in that the computing node includes: a processor, a communication interface, a memory and a bus; wherein the processor, communication interface and memory pass Complete mutual communication through the bus;
所述通信接口, 用于所述元数据管理的计算节点接收程序; The communication interface is a computing node receiving program used for the metadata management;
所述处理器, 用于执行程序; The processor is used to execute programs;
所述存储器, 用于存放程序; The memory is used to store programs;
所述程序包括: 负载确定单元、 子树查找单元和子树迁移单元; 所述负载确定单元, 用于获取将迁移的负载信息; The program includes: a load determination unit, a subtree search unit and a subtree migration unit; the load determination unit is used to obtain load information to be migrated;
所述子树查找单元, 用于查找元数据中的目录的目录属性, 选择目录属 性中包括与所述将迁移的负载信息相匹配的负载信息且具有子树标志的目录 树;所述子树标志预先设置在被所述子树标志标识出的根目录的目录属性中; 所述子树迁移单元, 用于将所述目标子树整体迁移。 The subtree search unit is used to search the directory attributes of the directory in the metadata, and select a directory tree whose directory attributes include load information matching the load information to be migrated and have a subtree mark; the subtree The flag is preset in the directory attribute of the root directory identified by the subtree flag; the subtree migration unit is used to migrate the target subtree as a whole.
14、 根据权利要求 13所述的元数据管理的计算节点, 其特征在于, 所述 子树标志标识的根目录的子树中包括业务访问操作范围的最小单元对应的元 数据。 14. The computing node for metadata management according to claim 13, characterized in that the subtree of the root directory identified by the subtree flag includes metadata corresponding to the smallest unit of the business access operation range.
15、 根据权利要求 13所述的元数据管理的计算节点, 其特征在于, 所述 的元数据。 15. The computing node for metadata management according to claim 13, characterized in that: the metadata.
16、 根据权利要求 13所述的元数据管理的计算节点, 其特征在于, 所述 程序还包括: 16. The computing node for metadata management according to claim 13, characterized in that the program further includes:
属性设置单元, 用于在所述子树查找单元查找元数据中的目录的目录属 性之前, 在根目录的目录属性具有子树标志的至少两个子树中, 选择具有相 同负载变化趋势的多个子树作为一个并发组, 并将所述并发组中的每个子树 的根目录的目录属性中设置并发组标志; The attribute setting unit is configured to select multiple subtrees with the same load change trend among at least two subtrees whose directory attributes of the root directory have subtree flags before the subtree search unit searches for the directory attribute of the directory in the metadata. tree as a concurrent group, and set the concurrent group flag in the directory attribute of the root directory of each subtree in the concurrent group;
所述子树查找单元, 具体用于查找元数据中的目录的目录属性, 选择目 录属性中不仅包括所述负载信息且具有子树标志, 还包括所述并发组标志的 的目标子树; 所述子树标志预先设置在被所述子树标志标识出的根目录的目 录属性中。 The subtree search unit is specifically used to search the directory attributes of the directory in the metadata, and select the directory attributes that not only include the load information and have the subtree flag, but also include the target subtree of the concurrent group flag; so The subtree flag is preset in the directory attribute of the root directory identified by the subtree flag.
17、 根据权利要求 14-16任一所述的元数据管理的计算节点, 其特征在 于, 所述子树查找单元, 具体用于从包括子树数量最多的并发组中, 选择目 录属性中不仅包括所述负载信息、 以及子树标志, 还包括所述并发组标志的 目录作为所述目标目录。 17. The computing node for metadata management according to any one of claims 14-16, characterized in that, The subtree search unit is specifically used to select a directory whose directory attributes include not only the load information and the subtree flag, but also the concurrent group flag from the concurrent group that includes the largest number of subtrees as the target. Table of contents.
18、 根据权利要求 16所述的元数据管理的计算节点, 其特征在于, 所述 程序还包括: 18. The computing node for metadata management according to claim 16, characterized in that the program further includes:
属性获取单元, 用于接收用户通过应用程序编程接口 API设置的属性, 所述属性包括所述子树标志和并发组标志。 An attribute acquisition unit is used to receive attributes set by the user through the application programming interface API, where the attributes include the subtree flag and the concurrent group flag.
19、 一种修复数据的计算机程序产品, 其特征在于, 包括存储了程序代 码的计算机可读存储介质; 19. A computer program product for repairing data, characterized by including a computer-readable storage medium storing program code;
所述程序代码包括的指令, 用于获取将迁移的负载信息; 查找元数据中 的目录的目录属性, 选择目录属性中包括与所述将迁移的负载信息相匹配的 负载信息且具有子树标志的目录为目标目录, 确定以所述目标目录为根目录 的所有子树作为将迁移的目标子树; 所述子树标志预先设置在被所述子树标 志标识出的根目录的目录属性中; 将所述目标子树整体迁移。 The program code includes instructions for obtaining the load information to be migrated; searching for directory attributes of the directory in the metadata; and selecting the directory attributes that include load information that matches the load information to be migrated and has a subtree flag. The directory is the target directory, and all subtrees with the target directory as the root directory are determined as the target subtree to be migrated; the subtree flag is preset in the directory attribute of the root directory identified by the subtree flag. ; Migrate the target subtree as a whole.
PCT/CN2012/085344 2012-11-27 2012-11-27 Metadata management method and device WO2014082203A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201280002998.8A CN103688257B (en) 2012-11-27 2012-11-27 Method and device for managing metadata
PCT/CN2012/085344 WO2014082203A1 (en) 2012-11-27 2012-11-27 Metadata management method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2012/085344 WO2014082203A1 (en) 2012-11-27 2012-11-27 Metadata management method and device

Publications (1)

Publication Number Publication Date
WO2014082203A1 true WO2014082203A1 (en) 2014-06-05

Family

ID=50323329

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2012/085344 WO2014082203A1 (en) 2012-11-27 2012-11-27 Metadata management method and device

Country Status (2)

Country Link
CN (1) CN103688257B (en)
WO (1) WO2014082203A1 (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106326040B (en) * 2016-08-27 2019-12-31 苏州浪潮智能科技有限公司 Snapshot metadata management method and device
CN106446197B (en) * 2016-09-30 2019-11-19 华为数字技术(成都)有限公司 A kind of date storage method, apparatus and system
CN106777062B (en) * 2016-12-12 2020-03-10 郑州云海信息技术有限公司 Method and device for managing metadata
CN107480310B (en) * 2017-09-29 2020-09-04 郑州云海信息技术有限公司 Dynamic load balancing method and system for metadata cluster directory
CN107798104A (en) * 2017-10-31 2018-03-13 郑州云海信息技术有限公司 A kind of catalog management method, device, equipment and computer-readable recording medium
CN112181899A (en) * 2019-07-05 2021-01-05 中兴通讯股份有限公司 Metadata processing method and device and computer readable storage medium
CN110932935A (en) * 2019-11-26 2020-03-27 深圳前海微众银行股份有限公司 Resource control method, device, equipment and computer storage medium
CN113055448B (en) * 2021-02-28 2023-03-28 新华三信息技术有限公司 Metadata management method and device
CN112948354A (en) * 2021-03-01 2021-06-11 北京金山云网络技术有限公司 Method and device for creating copy cluster, electronic device and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101697168A (en) * 2009-10-22 2010-04-21 中国科学技术大学 Method and system for dynamically managing metadata of distributed file system
CN102523158A (en) * 2011-12-15 2012-06-27 杭州电子科技大学 Metadata server cluster load balancing method based on weight
CN102571772A (en) * 2011-12-26 2012-07-11 华中科技大学 Hot spot balancing method for metadata server

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4230673B2 (en) * 2001-02-22 2009-02-25 富士通株式会社 Service management device
CN101697526A (en) * 2009-10-10 2010-04-21 中国科学技术大学 Method and system for load balancing of metadata management in distributed file system
CN102055650B (en) * 2009-10-29 2012-10-17 华为技术有限公司 Load balance method and system and management server

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101697168A (en) * 2009-10-22 2010-04-21 中国科学技术大学 Method and system for dynamically managing metadata of distributed file system
CN102523158A (en) * 2011-12-15 2012-06-27 杭州电子科技大学 Metadata server cluster load balancing method based on weight
CN102571772A (en) * 2011-12-26 2012-07-11 华中科技大学 Hot spot balancing method for metadata server

Also Published As

Publication number Publication date
CN103688257B (en) 2017-04-26
CN103688257A (en) 2014-03-26

Similar Documents

Publication Publication Date Title
WO2014082203A1 (en) Metadata management method and device
US11526476B2 (en) File system permission setting method and apparatus
US11238175B2 (en) File system permission setting method and apparatus
US11797498B2 (en) Systems and methods of database tenant migration
US9052938B1 (en) Correlation and associated display of virtual machine data and storage performance data
US9489443B1 (en) Scheduling of splits and moves of database partitions
CN102917025B (en) Method for business migration based on cloud computing platform
Papadopoulos et al. A-tree: Distributed indexing of multidimensional data for cloud computing environments
EP3226131B1 (en) Scaling method and device for virtual machine (vm)
TWI734744B (en) Method, device and system for synchronizing routing table
US10146814B1 (en) Recommending provisioned throughput capacity for generating a secondary index for an online table
EP2724268A2 (en) System and method for implementing a scalable data storage service
CN104603774A (en) Migration-destination file server and file system migration method
US20160179435A1 (en) Systems and methods for shadow migration progress estimation
CN104081391A (en) Single instantiation method using file clone and file storage system utilizing the same
JP5950267B2 (en) Database management apparatus, database management method, and storage medium
JP5375972B2 (en) Distributed file system, data selection method thereof, and program
JP2014232483A (en) Database system, retrieval method and program
CN110347651A (en) Method of data synchronization, device, equipment and storage medium based on cloud storage
CN105989015B (en) Database capacity expansion method and device and method and device for accessing database
US10855807B2 (en) Systems and methods for semi-automatic workload domain deployments
CN108920105B (en) Community structure-based graph data distributed storage method and device
CN114610680A (en) Method, device and equipment for managing metadata of distributed file system and storage medium
US11645266B2 (en) Automated pinning of file system subtrees
US12007997B2 (en) Metadata search via N-gram index

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: 12889214

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: 12889214

Country of ref document: EP

Kind code of ref document: A1