CN111638853A - Data storage method and device, storage cluster, gateway equipment and main equipment - Google Patents

Data storage method and device, storage cluster, gateway equipment and main equipment Download PDF

Info

Publication number
CN111638853A
CN111638853A CN202010383019.4A CN202010383019A CN111638853A CN 111638853 A CN111638853 A CN 111638853A CN 202010383019 A CN202010383019 A CN 202010383019A CN 111638853 A CN111638853 A CN 111638853A
Authority
CN
China
Prior art keywords
metadata
target
storage node
file
metadata storage
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010383019.4A
Other languages
Chinese (zh)
Inventor
叶敏
王伟
林起芊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Hikvision System Technology Co Ltd
Original Assignee
Hangzhou Hikvision System Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Hikvision System Technology Co Ltd filed Critical Hangzhou Hikvision System Technology Co Ltd
Priority to CN202010383019.4A priority Critical patent/CN111638853A/en
Publication of CN111638853A publication Critical patent/CN111638853A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0608Saving storage space on storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/061Improving I/O performance
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0643Management of files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/067Distributed or networked storage systems, e.g. storage area networks [SAN], network attached storage [NAS]

Abstract

The application provides a data storage method, a data storage device, a storage cluster, a gateway device and a master device, and the method comprises the following steps: when a file directory creating instruction is received, file directory metadata carried by the file directory creating instruction is sent to a main device in a storage cluster, so that the main device stores the file directory metadata, and a metadata storage node for storing the file metadata is selected from all metadata storage nodes in the storage cluster according to the file directory metadata; acquiring the node identification of the metadata storage node selected by the main equipment, and creating a corresponding relation between the file directory and the node identification of the metadata storage node selected by the main equipment; and when a file writing instruction is received, storing the target file metadata carried by the file writing instruction to the corresponding metadata storage node according to the established corresponding relation, so that the storage of more metadata and the requirement that a client frequently accesses the locally stored metadata are met.

Description

Data storage method and device, storage cluster, gateway equipment and main equipment
Technical Field
The present application relates to the field of storage, and in particular, to a data storage method and apparatus, a storage cluster, a gateway device, and a master device.
Background
The storage cluster includes: cloud storage device, gateway device, and master device. The cloud storage device provides underlying data storage functions. The gateway device interfaces with the client and may provide a protocol access interface for the client. And the main equipment uniformly stores and manages the metadata of the file and the file directory written by the client.
However, the main storage capacity and device performance are limited, failing to satisfy storage of more metadata and failing to satisfy clients frequently accessing locally stored metadata.
Disclosure of Invention
In view of this, the present application provides a data storage method, an apparatus, a storage cluster, a gateway device, and a master device, so as to satisfy storage of more metadata and satisfy that a client frequently accesses locally stored metadata.
Specifically, the method is realized through the following technical scheme:
according to a first aspect of the present application, there is provided a data storage method, which is applied to a gateway device, the gateway device being in a same storage cluster with at least one metadata storage node for storing metadata, the method including:
when a file directory creating instruction is received, file directory metadata carried by the file directory creating instruction is sent to a main device in the storage cluster, so that the main device stores the file directory metadata, and a metadata storage node for storing the file metadata is selected from all metadata storage nodes in the storage cluster according to the file directory metadata, wherein the file metadata are file metadata under a file directory corresponding to the file directory metadata;
acquiring a node identifier of the metadata storage node selected by the main equipment, and creating a corresponding relation between the file directory and the node identifier of the metadata storage node selected by the main equipment;
and when a file writing instruction is received, storing the target file metadata carried by the file writing instruction to a corresponding metadata storage node according to the established corresponding relation.
Optionally, the file writing instruction further includes: a target file directory;
the storing the target file metadata carried by the file writing instruction to the corresponding metadata storage node according to the created corresponding relationship includes:
searching at least one metadata storage node identifier corresponding to the target file directory in the established corresponding relation;
if the target file directory is found, selecting a first target metadata storage node identifier from at least one metadata storage node identifier corresponding to the target file directory, and storing the target file metadata to a first target metadata storage node corresponding to the first target metadata storage node identifier;
and if the target file metadata is not found, requesting the main equipment to allocate a first target metadata storage node for storing the target file metadata, and storing the target file metadata to the allocated first target metadata storage node.
Optionally, after storing the target file metadata to the allocated first target metadata storage node, the method further includes:
creating a correspondence between the target file directory and the node identification of the assigned first target metadata storage node.
Optionally, the selecting a first target metadata storage node identifier from at least one metadata storage node identifier corresponding to the target file directory includes:
if the number of at least one metadata storage node identifier corresponding to the target file directory is 1, taking the metadata storage node identifier corresponding to the target file directory as a first target metadata storage node identifier;
and if the number of the at least one metadata storage node identifier corresponding to the target file directory is greater than 1, selecting the metadata storage node identifier with the minimum storage capacity as a first target metadata storage node identifier from the at least one metadata storage node identifier corresponding to the target file directory.
Optionally, the storing the target file metadata to the first target metadata storage node corresponding to the first target metadata storage node identifier includes:
checking whether the number of file metadata stored by the first target metadata storage node is higher than a preset threshold;
if not, storing the target file metadata to a first target metadata storage node corresponding to the first target metadata storage node identifier;
the method further comprises the following steps:
and if so, requesting the main device to allocate a second target metadata storage node for storing the target file metadata, storing the target file metadata to the second target metadata storage node, and creating a corresponding relation between the target file directory and the node identifier of the second target metadata storage node.
Optionally, the storing the target file metadata to the first target metadata storage node corresponding to the first target metadata storage node identifier includes:
detecting whether metadata stored in the first target metadata storage node is being migrated;
if not, storing the target file metadata to a first target metadata storage node corresponding to the first target metadata storage node identifier;
the method further comprises the following steps:
if the file metadata is migrated, determining a destination metadata storage node corresponding to the first destination metadata storage node, wherein the destination metadata storage node is used for receiving the migrated file metadata in the first destination metadata storage node;
and writing the first target file metadata into the target metadata storage node, and modifying the corresponding relation between the target file directory and the node identifier of the first target metadata storage node into the corresponding relation between the target file directory and the node identifier of the target metadata storage node.
According to a second aspect of the present application, there is provided a data storage method, which is applied to a master device in a storage cluster, where the storage cluster further includes at least one metadata storage node and a gateway device for storing metadata, and the method includes:
when a first request sent by gateway equipment is received, the first request is generated by the gateway equipment based on a file directory creation instruction, file directory metadata carried by the file directory creation instruction is stored, and a metadata storage node used for storing the file metadata is selected from all metadata storage nodes in the storage cluster; the file metadata is file metadata under a file directory corresponding to the file directory metadata;
sending the selected metadata storage node to gateway equipment so that the gateway equipment creates a corresponding relation between the file directory and the node identification of the metadata storage node selected by the main equipment; and when the gateway equipment receives a file writing instruction, storing the target file metadata carried by the file writing instruction to a corresponding metadata storage node according to the established corresponding relation.
Optionally, the method further includes:
when a second request sent by the gateway equipment is received, acquiring target file metadata carried in the second request; the second request is generated when the gateway device does not find the metadata storage node corresponding to the target file directory carried by the file writing instruction in the corresponding relation after receiving the file writing instruction;
selecting a first target metadata storage node for storing the target file metadata from all metadata storage nodes stored by the storage cluster;
and returning the identifier of the selected first target metadata storage node to the gateway device, so that the gateway device stores the target file metadata to the selected first target metadata storage node, and creates a corresponding relation between the target file directory and the selected first target metadata storage identifier.
Optionally, the method further includes:
when a third request sent by the gateway equipment is received, target file metadata carried in the third request is obtained; the third request is generated when the gateway device determines that the number of the file metadata stored in the selected metadata storage node is higher than a preset threshold value; the selected metadata storage node is selected from at least one metadata storage node corresponding to the target file directory by the gateway device;
selecting a second target metadata storage node for storing the target file metadata from all metadata storage nodes stored by the storage cluster;
and returning the identifier of the selected second target metadata storage node to the gateway device, so that the gateway device stores the target file metadata to the selected second target metadata storage node, and creates a corresponding relation between the target file directory and the identifier of the selected second target metadata storage node.
According to a third aspect of the present application, there is provided a data storage apparatus applied to a gateway device in a same storage cluster as at least one metadata storage node for storing metadata, the apparatus comprising:
the sending unit is used for sending file directory metadata carried by a file directory creating instruction to a main device in the storage cluster when the file directory creating instruction is received, so that the main device stores the file directory metadata, and selecting a metadata storage node for storing the file metadata from all metadata storage nodes in the storage cluster according to the file directory metadata, wherein the file metadata are file metadata under a file directory corresponding to the file directory metadata;
an obtaining unit, configured to obtain a node identifier of the metadata storage node selected by the host device, and create a correspondence between the file directory and the node identifier of the metadata storage node selected by the host device;
and the writing unit is used for storing the target file metadata carried by the file writing instruction to a corresponding metadata storage node according to the established corresponding relation when the file writing instruction is received.
Optionally, the file writing instruction further includes: a target file directory;
the writing unit is specifically configured to search for at least one metadata storage node identifier corresponding to the target file directory in the created corresponding relationship;
if the target file directory is found, selecting a first target metadata storage node identifier from at least one metadata storage node identifier corresponding to the target file directory, and storing the target file metadata to a first target metadata storage node corresponding to the first target metadata storage node identifier;
and if the target file metadata is not found, requesting the main equipment to allocate a first target metadata storage node for storing the target file metadata, and storing the target file metadata to the allocated first target metadata storage node.
Optionally, the writing unit is further configured to create a correspondence between the target file directory and the node identifier of the allocated first target metadata storage node after storing the target file metadata in the allocated first target metadata storage node.
Optionally, when a first target metadata storage node identifier is selected from the at least one metadata storage node identifier corresponding to the target file directory, the write-in unit is specifically configured to use the metadata storage node identifier corresponding to the target file directory as the first target metadata storage node identifier if the number of the at least one metadata storage node identifier corresponding to the target file directory is 1; and if the number of the at least one metadata storage node identifier corresponding to the target file directory is greater than 1, selecting the metadata storage node identifier with the minimum storage capacity as a first target metadata storage node identifier from the at least one metadata storage node identifier corresponding to the target file directory.
Optionally, the writing unit is configured to, when storing the target file metadata to a first target metadata storage node corresponding to the first target metadata storage node identifier, check whether the number of file metadata stored by the first target metadata storage node is higher than a preset threshold; if not, storing the target file metadata to a first target metadata storage node corresponding to the first target metadata storage node identifier;
and the writing unit is further configured to, if the target file identifier is higher than the target file identifier, request the master device to allocate a second target metadata storage node for storing the target file metadata, store the target file metadata in the second target metadata storage node, and create a correspondence between the target file directory and the node identifier of the second target metadata storage node.
Optionally, the writing unit is configured to detect whether metadata stored in a first target metadata storage node is being migrated when the target file metadata is stored in the first target metadata storage node corresponding to the first target metadata storage node identifier; if not, storing the target file metadata to a first target metadata storage node corresponding to the first target metadata storage node identifier;
the writing unit is further configured to determine a destination metadata storage node corresponding to the first target metadata storage node if the file is migrated, where the destination metadata storage node is configured to receive the migrated file metadata in the first target metadata storage node; and writing the first target file metadata into the target metadata storage node, and modifying the corresponding relation between the target file directory and the node identifier of the first target metadata storage node into the corresponding relation between the target file directory and the node identifier of the target metadata storage node.
According to a fourth aspect of the present application, there is provided a data storage apparatus applied to a master device in a storage cluster, the storage cluster further comprising at least one metadata storage node and a gateway device for storing metadata, the apparatus comprising:
the device comprises a selecting unit, a storage unit and a processing unit, wherein the selecting unit is used for storing file directory metadata carried by a file directory creating instruction when receiving a first request sent by gateway equipment, and the first request is generated by the gateway equipment based on the file directory creating instruction, and selecting a metadata storage node for storing the file metadata from all metadata storage nodes in a storage cluster; the file metadata is file metadata under a file directory corresponding to the file directory metadata;
a sending unit, configured to send the selected metadata storage node to a gateway device, so that the gateway device creates a correspondence between the file directory and a node identifier of the metadata storage node selected by the host device; and when the gateway equipment receives a file writing instruction, storing the target file metadata carried by the file writing instruction to a corresponding metadata storage node according to the established corresponding relation.
Optionally, the selecting unit is further configured to, when a second request sent by the gateway device is received, obtain target file metadata carried in the second request; the second request is generated when the gateway device does not find the metadata storage node corresponding to the target file directory carried by the file writing instruction in the corresponding relation after receiving the file writing instruction; selecting a first target metadata storage node for storing the target file metadata from all metadata storage nodes stored by the storage cluster;
the sending unit is further configured to return the identifier of the selected first target metadata storage node to the gateway device, so that the gateway device stores the target file metadata to the selected first target metadata storage node, and creates a corresponding relationship between the target file directory and the identifier of the selected first target metadata storage node.
Optionally, the selecting unit is further configured to, when a third request sent by the gateway device is received, obtain target file metadata carried in the third request; the third request is generated when the gateway device determines that the number of the file metadata stored in the selected metadata storage node is higher than a preset threshold value; the selected metadata storage node is selected from at least one metadata storage node corresponding to the target file directory by the gateway device; selecting a second target metadata storage node for storing the target file metadata from all metadata storage nodes stored by the storage cluster;
the sending unit is further configured to return the selected second target metadata storage node identifier to the gateway device, so that the gateway device stores the target file metadata to the selected second target metadata storage node, and creates a corresponding relationship between the target file directory and the selected second target metadata storage node identifier.
According to a fifth aspect of the present application, there is provided a storage cluster comprising: the system comprises a gateway device, a main device and at least one metadata storage node;
the gateway device is used for sending file directory metadata carried by a file directory creation instruction to the main device in the storage cluster when receiving the file directory creation instruction;
the main device is configured to select a metadata storage node for storing file metadata from all metadata storage nodes in the storage cluster according to the file directory metadata, where the file metadata is file metadata in a file directory corresponding to the file directory metadata;
the gateway device is used for acquiring the node identifier of the metadata storage node selected by the main device and creating a corresponding relation between the file directory and the node identifier of the metadata storage node selected by the main device;
and the gateway equipment is used for storing the target file metadata carried by the file writing instruction to a corresponding metadata storage node according to the established corresponding relation when receiving the file writing instruction.
According to a sixth aspect of the present application, there is provided a gateway device, the device comprising a readable storage medium and a processor;
wherein the readable storage medium is configured to store machine executable instructions;
the processor is used for reading the machine executable instructions on the readable storage medium and executing the instructions to realize the data storage method.
According to a seventh aspect of the present application, there is provided a host device, the device comprising a readable storage medium and a processor;
wherein the readable storage medium is configured to store machine executable instructions;
the processor is used for reading the machine executable instructions on the readable storage medium and executing the instructions to realize the data storage method.
As can be seen from the above description, in the embodiment of the present application, by adding a plurality of metadata storage nodes in a storage cluster, a gateway device centrally stores metadata of a file directory that is accessed less frequently in a master device, and dispersedly stores metadata of files that are accessed more frequently in the metadata storage nodes. Because the file metadata with frequent access is dispersedly stored in each metadata storage node, the storage cluster can store more metadata and meet the requirement of frequent file metadata access without influencing the performance of the storage cluster.
Drawings
FIG. 1 is a schematic diagram of an architecture of a prior art storage cluster;
FIG. 2 is a schematic diagram illustrating an architecture of a storage cluster according to an exemplary embodiment of the present application;
FIG. 3 is a flow chart illustrating a method of storing data according to an exemplary embodiment of the present application;
FIG. 4 is a diagram illustrating a correspondence of a file directory to a metadata storage node, according to an illustrative embodiment of the present application;
FIG. 5 is a flow chart illustrating another method of data storage according to an exemplary embodiment of the present application;
FIG. 6 is an architectural diagram illustrating one type of NAS cluster according to an exemplary embodiment of the present application;
FIG. 7 is an interaction diagram illustrating a file directory creation method according to an exemplary embodiment of the present application;
FIG. 8 is a diagram illustrating a file metadata storage method according to an exemplary embodiment of the present application;
fig. 9 is a hardware structure diagram of a gateway device according to an exemplary embodiment of the present application;
FIG. 10 is a block diagram of a data storage device shown in an exemplary embodiment of the present application;
FIG. 11 is a hardware block diagram of a host device shown in an exemplary embodiment of the present application;
fig. 12 is a block diagram of a data storage device shown in an exemplary embodiment of the present application.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this application and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It is to be understood that although the terms first, second, third, etc. may be used herein to describe various information, such information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of the present application. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
Referring to fig. 1, fig. 1 is a schematic diagram of an architecture of a conventional storage cluster.
The storage cluster includes: cloud storage device, gateway device and master device.
The cloud storage device provides an underlying data storage function.
The gateway device interfaces with the client and may provide an interface for protocol access by the client.
And the main equipment uniformly stores and manages the metadata of the file and the file directory written by the client.
However, the host device storage capacity and device performance are limited, failing to satisfy the storage of more metadata and failing to satisfy the client frequently accessing the locally stored metadata.
In view of this, the present application provides a data storage method, which can satisfy the storage of more metadata by a storage cluster and satisfy frequent access of a client to the metadata stored by the storage cluster.
Referring to fig. 2, fig. 2 is a schematic diagram illustrating an architecture of a storage cluster according to an exemplary embodiment of the present application.
The storage cluster of the present application includes: the system comprises a cloud storage device, a gateway device, a master device and a metadata storage cluster.
1) Cloud storage device
The cloud storage device provides a bottom-layer data storage function and is used for storing files written by the client.
2) Gateway device
The gateway device interfaces with the client and may provide an interface for protocol access for the client.
The gateway device may be built by one gateway device or may be built by a gateway cluster composed of a plurality of gateway devices, and here, the building method of the gateway device is only described as an example, and is not particularly limited.
3) Master device
The main device is used for storing and managing the metadata of the file directory, and allocating a metadata storage node for storing the file metadata under the file directory for the file directory. Here, the main device function is merely exemplified and not particularly limited.
The main device can be built by one electronic device and a database, or can be built by a plurality of electronic devices and a plurality of databases. Here, the manner of building the master device is merely described as an example, and is not particularly limited.
4) Metadata storage cluster
A metadata storage cluster includes at least one metadata storage node. The metadata storage node is used for storing file metadata.
The metadata storage node can be built by one storage device. Of course, the metadata storage node may also be built up from a plurality of storage devices.
For example, one metadata storage node is constructed by a plurality of storage devices, one of which is a main storage device, and the other storage devices are standby storage devices. The gateway device writes the file metadata into the metadata storage node, namely, the gateway device writes the file metadata into a main storage device of the metadata storage node, and then the main storage device can back up the written file metadata to other standby storage devices, so that the robustness of the data stored by the metadata storage node is enhanced.
Here, the construction of the metadata storage node is merely exemplary, and is not particularly limited.
In the embodiment of the application, by additionally arranging a plurality of metadata storage nodes in the storage cluster, the gateway device centrally stores the metadata of the file directory which is accessed less frequently in the main device, and dispersedly stores the metadata of the file which is accessed more frequently in the metadata storage nodes. Because the file metadata with frequent access is dispersedly stored in each metadata storage node, the storage cluster can store more metadata and meet the requirement of frequent file metadata access without influencing the performance of the storage cluster.
The Storage cluster may be a Network Attached Storage (NAS) cluster, and when the cluster is a NAS cluster, the cloud Storage device is a cloud Storage device in the NAS cluster, the gateway device is a NAS gateway (NAS GATEWAY), the master device is a NAS MASTER (NAS manager) device, and the client is a NAS client.
Of course, the storage cluster may also be another storage cluster having the network structure, and the storage cluster is not specifically limited herein.
Referring to fig. 3, fig. 3 is a flowchart illustrating a data storage method according to an exemplary embodiment of the present application, where the method is applicable to a gateway device and may include the following steps.
Step 301: when receiving a file directory creating instruction, the gateway device sends file directory metadata carried by the file directory creating instruction to a main device in the storage cluster, so that the main device stores the file directory metadata, and selects a metadata storage node for storing the file metadata from all metadata storage nodes in the storage cluster according to the file directory metadata, wherein the file metadata is file metadata in a file directory corresponding to the file directory metadata.
In implementation, the gateway device may receive a file directory creation instruction sent by the client, where the file directory creation instruction carries file directory metadata.
Then, the gateway device may generate a first request based on the file directory creation instruction, where the file directory metadata is carried in the first request. The gateway device may send the first request to the master device.
When receiving the first request, the master device may obtain file directory metadata carried in the first request. Then, on the one hand, the master device may store the file directory metadata, and on the other hand, the master device selects a metadata storage node for storing the file metadata from all metadata storage nodes in the storage cluster according to the file directory metadata.
During selection, the master device may select a metadata storage node that is the turn of this time from all metadata storage nodes in a polling manner.
Of course, the master device may also select a metadata storage node by the load of the respective metadata storage node. For example, the master device may select a metadata storage node with a load lower than a preset threshold from all metadata storage nodes in the storage cluster.
Step 302: and the gateway equipment acquires the node identification of the metadata storage node selected by the main equipment and creates the corresponding relation between the file directory and the node identification of the metadata storage node selected by the main equipment.
In implementation, the gateway device may send an acquisition message to the master device, and the master device returns the selected metadata storage node identifier to the gateway device after receiving the acquisition message.
Or after the main device selects the metadata storage node, the main device returns the identifier of the selected metadata storage node to the gateway device.
Of course, the gateway device may also obtain the node identifier of the metadata storage node selected by the master device in other manners, which are only exemplary and not specifically limited herein.
After acquiring the node identifier of the metadata storage node selected by the host device, the gateway device may create a correspondence between the file directory and the node identifier of the metadata storage node selected by the host device.
Based on the method, the gateway device establishes the corresponding relation between the created file directory and the metadata storage node. It should be noted that one file directory may correspond to one metadata storage node, and one file directory may also correspond to a plurality of metadata storage nodes, which is not specifically limited herein.
The correspondence stored on the gateway device may be as shown in fig. 4.
In fig. 4, for the other blocks except the first block, the first column of the block represents a file directory. The identifier following the "Position" in the second column of the box represents a metadata storage node.
The description will be given by taking the block 401 as an example. "/hik _ nas/bucket 1" in the first column of block 401 is a file directory, and "STORE _ MDS 0" in the second column of block 402 is a metadata storage node.
Step 303: and when the gateway equipment receives a file writing instruction, storing the target file metadata carried by the file writing instruction to a corresponding metadata storage node according to the established corresponding relation.
When the method is implemented, when the client writes the file into the storage cluster, the client can send a file writing instruction to the gateway device. The file writing instruction at least comprises: target file metadata to be written, and a target file directory of the target file. Of course, in practical applications, the file writing instruction further includes a target file to be written. The file write command is merely exemplary and is not particularly limited.
For the target file included in the file writing instruction, the gateway device may write the target file into the cloud storage device in the storage cluster for storage.
And for the target file metadata contained in the file writing instruction, the gateway equipment stores the target file metadata carried by the file writing instruction to a corresponding metadata storage node according to the established corresponding relation.
The storage of the target file metadata is explained in detail through steps 3031 to 3032.
Step 3031: the gateway device may search for at least one metadata storage node identifier corresponding to the target file directory in the created correspondence between the file directory and the metadata storage node.
Step 3032: if at least one metadata storage node identifier corresponding to the target file directory is not found, the gateway device requests the main device to allocate a first target metadata storage node for storing the target file metadata, and stores the target file metadata to the allocated first target metadata storage node.
When requesting, the gateway device may generate a second request carrying the metadata of the target file, and send the second request to the host device.
When receiving the second request, the master device selects a first target metadata storage node for storing the target file metadata from all metadata storage nodes included in the storage cluster, and returns the identifier of the first target metadata storage node to the gateway device.
The gateway device stores the target file metadata to the first target metadata storage node. After storing the target file metadata to the first target metadata storage node, the gateway device creates a corresponding relationship between the target file directory and the node identifier of the first target metadata storage node.
Step 3033: if at least one metadata storage node corresponding to the target file directory is found, the gateway device selects a first target metadata storage node identifier from at least one metadata storage node identifier corresponding to the target file directory, and stores the target file metadata to the first target metadata storage node corresponding to the first target metadata storage node identifier.
1) The detailed description of "selecting a first target metadata storage node identifier from the at least one metadata storage node identifier corresponding to the target file directory" in step 3032 is described below.
When the target file directory is realized, if the number of at least one metadata storage node identifier corresponding to the target file directory is 1, the gateway device takes the metadata storage node identifier corresponding to the target file directory as a first target metadata storage node identifier.
For example, if the target file directory corresponds to only one metadata storage node (assumed to be metadata storage node 1), the metadata storage node 1 is used as the first target metadata storage node.
If the number of the at least one metadata storage node identifier corresponding to the target file directory is greater than 1, the gateway device selects the metadata storage node identifier with the minimum storage capacity as a first target metadata storage node identifier from the at least one metadata storage node identifier corresponding to the target file directory.
For example, the gateway device may detect the capacities of a plurality of metadata storage nodes corresponding to the target file directory, and then select the metadata storage node identifier with the smallest storage capacity as the first target metadata storage node identifier.
For another example, the way for the gateway device to record the metadata node identifier corresponding to the target file directory is as follows: the gateway device records a metadata node identifier allocated by the host device for the target file directory, and when the amount of metadata stored by the metadata node exceeds a preset threshold, the gateway device applies a new metadata storage node identifier to the host device for storing file metadata of a file in the target file directory, and then records a corresponding relationship between the target file directory and the new metadata storage node identifier. Therefore, the metadata storage node corresponding to the target file directory recorded recently on the gateway device is the metadata storage node with the minimum capacity.
Therefore, when searching for the metadata storage node with the minimum capacity, the gateway device may search for the metadata storage node corresponding to the target file directory recorded most recently.
In the search, for example, each time the gateway device creates a corresponding relationship between a file directory and a metadata storage node, a creation timestamp is marked for the created metadata storage node.
Assuming that the file directory of the target file is directory 1, in the above correspondence, directory 1 corresponds to three storage node devices, and the three storage node devices corresponding to directory 1 are shown in table 301.
File directory Metadata storage node Creating timestamps
Catalog 1 Metadata storage node 1 2019.10.30
Catalog 1 Metadata storage node 2 2019.11.31
Catalog 1 Metadata storage node 3 2020.12.9
Table 301
In this example, since the metadata storage node 3 is closest to the current time stamp, the metadata storage node 3 is the most recently recorded metadata storage node, so the gateway apparatus can treat the metadata storage node 3 as the storage node with the smallest storage capacity and the metadata storage node 3 as the first target metadata storage node.
Of course, the gateway device may randomly select one metadata storage node from the at least one metadata storage node corresponding to the target file directory as the first target metadata storage node.
Here, the selection manner of the first target metadata storage node is only exemplarily described, and is not particularly limited.
2) The following describes in detail the step 3032 of storing the target file metadata to the first target metadata storage node corresponding to the first target metadata storage node identifier.
Since the capacity of the meta-storage node device is limited, a write failure of the file metadata may be caused when the unused capacity of the meta-storage node device is insufficient to support the newly written file metadata. Thus, upon storing the target file metadata to a first target metadata storage node corresponding to the first target metadata storage node identification, the gateway device may check whether the amount of file metadata stored by the first target metadata storage node is above a preset threshold.
And if the quantity of the file metadata stored by the first target metadata storage node is not higher than a preset threshold value, storing the target file metadata to a first target metadata storage node corresponding to the first target metadata storage node identification.
If the number of the file metadata stored by the first target metadata storage node is higher than a preset threshold, the gateway device requests the main device to allocate a second target metadata storage node for storing the target file metadata, stores the target file metadata to the second target metadata storage node, and creates a corresponding relationship between the target file directory and a node identifier of the second target metadata storage node.
When requesting, the gateway device may generate a third request carrying the metadata of the target file, and send the third request to the host device.
And when receiving the third request, the master device selects a second target metadata storage node for storing the metadata of the target file from all metadata storage nodes included in the storage cluster, and returns the identifier of the second target metadata storage node to the gateway device.
The gateway device stores the target file metadata to the second target metadata storage node, and creates a correspondence between the target file directory and the node identifier of the second target metadata storage node.
In addition, the metadata of the storage files in the metadata storage nodes in the storage cluster is not always unchanged, and in order to ensure load balance of the metadata storage nodes, the storage nodes trigger metadata migration among the metadata storage nodes, so that the metadata of the files in the metadata storage nodes with large metadata storage amount are migrated to the metadata storage nodes with small metadata storage amount.
When migrating, the gateway device marks the metadata storage node being migrated and records a destination metadata storage node corresponding to the metadata storage node being migrated, wherein the destination metadata storage node is used for receiving the migrated metadata.
For example, if the metadata storage node 1 migrates the locally stored file metadata to the metadata storage node 2, the metadata storage node 1 is the metadata storage node being migrated, and the metadata storage node 2 is the destination metadata storage node.
Therefore, when the gateway device stores the target file metadata to the first target metadata storage node corresponding to the first target metadata storage node identifier, the gateway device may detect whether the metadata stored in the target metadata storage node is being migrated.
Upon detection, the gateway device may detect whether the first metadata storage node is marked as a migrating metadata storage node. If the first metadata storage node is marked as a migrating metadata storage node, it is determined that metadata stored in the first metadata storage node is being migrated. If the first metadata storage node is not marked as a migrating metadata storage node, it is determined that metadata stored in the first metadata storage node is not being migrated.
If the metadata stored in the target metadata storage node is not being migrated, the gateway device stores the target file metadata to a first target metadata storage node corresponding to the first target metadata storage node identifier.
If the metadata stored in the target metadata storage node is being migrated, the gateway device may determine a target metadata storage node corresponding to the first target metadata storage node, write the first target file metadata into the target metadata storage node, and modify the correspondence between the target file directory and the identifier of the first target metadata storage node into the correspondence between the target file directory and the target metadata storage node.
For example, assuming that the first target metadata storage node selected by the gateway device is the metadata storage node 1, the file metadata of the metadata storage node 1 is being migrated to the metadata storage node 2.
At this time, the gateway device may write the target file metadata into the metadata storage node 2, and modify the recorded correspondence between the target file directory and the metadata storage node 1 into the correspondence between the target file directory and the metadata storage node 2.
As can be seen from the above description, by adding a plurality of metadata storage nodes in the storage cluster, the gateway device centrally stores the metadata of the file directory that is accessed less frequently in the host device, and dispersedly stores the metadata of the file that is accessed more frequently in the metadata storage nodes. Because the file metadata with frequent access is dispersedly stored in each metadata storage node, the storage cluster can store more metadata and meet the requirement of frequent metadata access without influencing the performance of the storage cluster.
Referring to fig. 5, fig. 5 is a flowchart illustrating a metadata storage method, which may be applied to a host device and may include the following steps, according to an exemplary embodiment of the present application.
Step 501: when the main device receives a first request sent by the gateway device, the first request is generated by the gateway device based on a file directory creation instruction, file directory metadata carried by the file directory creation instruction is stored, and a metadata storage node used for storing the file metadata is selected from all metadata storage nodes in the storage cluster; and the file metadata is the file metadata in the file directory corresponding to the file directory metadata.
Referring specifically to step 301, further description is omitted here.
Step 502: the master device sends the selected metadata storage node to the gateway device, so that the gateway device creates a corresponding relation between the file directory and the node identifier of the metadata storage node selected by the master device; and when the gateway equipment receives a file writing instruction, storing the target file metadata carried by the file writing instruction to a corresponding metadata storage node according to the established corresponding relation.
For details, refer to the above step 302 to step 303, which are not described herein again.
In addition, in the embodiment of the application, when the primary device receives a second request sent by the gateway device, the primary device obtains the metadata of the target file carried in the second request; the second request is generated when the gateway device does not find the metadata storage node corresponding to the target file directory carried by the file writing instruction in the corresponding relationship after receiving the file writing instruction.
The master device may select a first target metadata storage node for storing the target file metadata from all metadata storage nodes stored in the storage cluster, and return the selected first target metadata storage node identifier to the gateway device, so that the gateway device stores the target file metadata to the selected first target metadata storage node, and creates a corresponding relationship between the target file directory and the selected first target metadata storage identifier.
In addition, in the embodiment of the application, when the primary device receives a third request sent by the gateway device, the target file metadata carried in the third request is obtained; the third request is generated when the gateway device determines that the number of the file metadata stored in the selected metadata storage node is higher than a preset threshold value; the selected metadata storage node is selected by the gateway device from at least one metadata storage node corresponding to the target file directory.
The main device selects a second target metadata storage node for storing the target file metadata from all metadata storage nodes stored in the storage cluster, and returns the identifier of the selected second target metadata storage node to the gateway device, so that the gateway device stores the target file metadata to the selected second target metadata storage node, and creates a corresponding relation between the target file directory and the identifier of the selected second target metadata storage node.
As can be seen from the above description, by adding a plurality of metadata storage nodes in the storage cluster, the gateway device centrally stores the metadata of the file directory that is accessed less frequently in the host device, and dispersedly stores the metadata of the file that is accessed more frequently in the metadata storage nodes. Because the file metadata with frequent access is dispersedly stored in each metadata storage node, the storage cluster can store more metadata and meet the requirement of frequent metadata access without influencing the performance of the storage cluster.
The following describes in detail the metadata storage method provided in the present application, with reference to fig. 7 and 8, by taking the storage cluster as the storage cluster and taking it as the NAS cluster (as shown in fig. 6), and when the cluster is the NAS cluster, the cloud storage device is a cloud storage device in the NAS cluster, the gateway device is a NAS gateway, the master device is NAS MASTER, and the client is a NAS client.
Referring to fig. 7, fig. 7 is an interaction diagram illustrating a file directory creation method according to an exemplary embodiment of the present application.
Step 701: the NAS client sends a file directory creating instruction to the NAS gateway, wherein the file directory creating instruction at least carries file directory metadata.
Step 702: the NAS gateway sends NAS MASTER the file directory metadata.
Step 703: NAS MASTER locally stores the file directory metadata and selects, among all metadata storage nodes of the NAS cluster, the metadata storage node MDS1 for storing the file metadata under the directory.
Step 704: NAS MASTER returns the identification of MDS1 to the NAS gateway.
Step 705: the NAS gateway creates a correspondence of the file directory with the identification of MDS 1.
Step 706: the NAS gateway returns a message that the file directory creation is successful to the NAS client.
Referring to fig. 8, fig. 8 is a schematic diagram illustrating a file metadata storage method according to an exemplary embodiment of the present application, which may be applied to a gateway device and may include the following steps.
Step 801: the NAS gateway receives a file writing instruction sent by the NAS client, wherein the file writing instruction at least carries target file metadata to be written and a target file directory of a target file.
Step 802: and the NAS gateway searches whether at least one MDS corresponding to the target file directory exists in the created corresponding relation between the file directory and the identification of the MDS.
If at least one MDS corresponding to the target file directory is not found, the NAS gateway performs step 803 to step 804.
If at least one MDS corresponding to the target file directory is found, the NAS gateway performs step 805.
Step 803: if at least one MDS corresponding to the file directory of the target file is not found, the NAS gateway generates a second request carrying the metadata of the target file, and sends the second request to NAS MASTER, so that NASMASTER selects MDS1 used for storing the metadata of the target file from all MDS included in the NAS cluster, and returns an identifier of MDS1 to the NAS gateway.
Step 804: and the NAS gateway receives the identification of the MDS1 returned by the NAS MASTER, writes the metadata of the target file into the MDS1 and creates the corresponding relation between the directory of the target file and the identification of the MDS 1.
Step 805: if the NAS gateway finds at least one MDS corresponding to the target file directory, the MDS1 with the minimum capacity is selected from the at least one MDS.
Step 806: the NAS gateway checks whether the selected number of MDSs 1 stored file metadata is above a preset threshold.
If the number of file metadata stored by the MDS1 is higher than the preset threshold, the NAS gateway performs step 809.
If the amount of file metadata stored by the MDS1 is not greater than the preset threshold, the NAS gateway performs step 807.
Step 807: the NAS gateway detects whether the metadata stored in MDS1 is being migrated.
If the metadata stored in MDS1 is being migrated, the NAS gateway performs step 810
If the metadata stored in MDS1 is not being migrated, the NAS gateway performs step 808.
Step 808: the NAS gateway writes the target file metadata to MDS 1.
Step 809: the NAS gateway generates a third request carrying the metadata of the target file, sends the third request to NAS MASTER, selects MDS2 used for storing the metadata of the target file from all MDS NAS MASTER, and returns MDS2 to the NAS gateway, and the NAS gateway writes the metadata of the target file into MDS2 and creates a corresponding relation between a target file directory and MDS 2.
Step 810: the NAS gateway determines a target metadata storage node MDS3 corresponding to the MDS1, writes the target file metadata into the MDS3, and modifies the corresponding relation between the target file directory and the MDS1 into the corresponding relation between the target file directory and the MDS 3.
As can be seen from the above description, by adding a plurality of metadata storage nodes in the NAS cluster, the NAS gateway device centrally stores NAS MASTER the metadata of the file directory that is accessed less frequently, and dispersedly stores the metadata of the file that is accessed more frequently in the metadata storage nodes. Because the file metadata with frequent access is dispersedly stored in each metadata storage node, the storage cluster can store more metadata and meet the requirement of frequent metadata access without influencing the performance of the storage cluster.
Referring to fig. 9, fig. 9 is a hardware structure diagram of a gateway device according to an exemplary embodiment of the present application.
The gateway apparatus includes: a communication interface 901, a processor 902, a machine-readable storage medium 903, and a bus 904; wherein the communication interface 901, the processor 902, and the machine-readable storage medium 903 communicate with one another over a bus 904. The processor 902 may perform the data storage methods described above by reading and executing machine-executable instructions in the machine-readable storage medium 903 corresponding to the data storage control logic.
The machine-readable storage medium 903 referred to herein may be any electronic, magnetic, optical, or other physical storage device that can contain or store information such as executable instructions, data, and the like. For example, the machine-readable storage medium may be: volatile memory, non-volatile memory, or similar storage media. In particular, the machine-readable storage medium 903 may be a RAM (random Access Memory), a flash Memory, a storage drive (e.g., a hard drive), a solid state drive, any type of storage disk (e.g., a compact disk, a DVD, etc.), or similar storage medium, or a combination thereof.
Referring to fig. 10, fig. 10 is a block diagram of a data storage device shown in an exemplary embodiment of the present application; the apparatus is applied to a gateway device, the gateway device and at least one metadata storage node for storing metadata are in the same storage cluster, and the apparatus comprises:
a sending unit 1001, configured to send, when receiving a file directory creation instruction, file directory metadata carried by the file directory creation instruction to a master device in the storage cluster, so that the master device stores the file directory metadata, and select, according to the file directory metadata, a metadata storage node for storing the file metadata from all metadata storage nodes in the storage cluster, where the file metadata is file metadata in a file directory corresponding to the file directory metadata;
an obtaining unit 1002, configured to obtain a node identifier of the metadata storage node selected by the master device, and create a correspondence between the file directory and the node identifier of the metadata storage node selected by the master device;
and the writing unit 1003 is configured to, when a file writing instruction is received, store the target file metadata carried by the file writing instruction to a corresponding metadata storage node according to the created correspondence.
Optionally, the file writing instruction further includes: a target file directory;
the writing unit 1003 is specifically configured to search at least one metadata storage node identifier corresponding to the target file directory in the created corresponding relationship;
if the target file directory is found, selecting a first target metadata storage node identifier from at least one metadata storage node identifier corresponding to the target file directory, and storing the target file metadata to a first target metadata storage node corresponding to the first target metadata storage node identifier;
and if the target file metadata is not found, requesting the main equipment to allocate a first target metadata storage node for storing the target file metadata, and storing the target file metadata to the allocated first target metadata storage node.
Optionally, the writing unit 1003 is further configured to create a corresponding relationship between the target file directory and the node identifier of the allocated first target metadata storage node after storing the target file metadata in the allocated first target metadata storage node.
Optionally, the writing unit 1003, when selecting a first target metadata storage node identifier from the at least one metadata storage node identifier corresponding to the target file directory, is specifically configured to use the metadata storage node identifier corresponding to the target file directory as the first target metadata storage node identifier if the number of the at least one metadata storage node identifier corresponding to the target file directory is 1; and if the number of the at least one metadata storage node identifier corresponding to the target file directory is greater than 1, selecting the metadata storage node identifier with the minimum storage capacity as a first target metadata storage node identifier from the at least one metadata storage node identifier corresponding to the target file directory.
Optionally, the writing unit 1003, when storing the target file metadata to a first target metadata storage node corresponding to the first target metadata storage node identifier, is configured to check whether the number of file metadata stored by the first target metadata storage node is higher than a preset threshold; if not, storing the target file metadata to a first target metadata storage node corresponding to the first target metadata storage node identifier;
the writing unit 1003 is further configured to, if the target file identifier is higher than the target file identifier, request the master device to allocate a second target metadata storage node for storing the target file metadata, store the target file metadata to the second target metadata storage node, and create a corresponding relationship between the target file directory and the node identifier of the second target metadata storage node.
Optionally, the writing unit 1003, when storing the target file metadata to a first target metadata storage node corresponding to the first target metadata storage node identifier, is configured to detect whether metadata stored in the first target metadata storage node is being migrated; if not, storing the target file metadata to a first target metadata storage node corresponding to the first target metadata storage node identifier;
the writing unit 1003 is further configured to determine, if the file is migrated, a destination metadata storage node corresponding to the first target metadata storage node, where the destination metadata storage node is configured to receive the migrated file metadata in the first target metadata storage node; and writing the first target file metadata into the target metadata storage node, and modifying the corresponding relation between the target file directory and the node identifier of the first target metadata storage node into the corresponding relation between the target file directory and the node identifier of the target metadata storage node.
Referring to fig. 11, fig. 11 is a hardware structure diagram of a host device according to an exemplary embodiment of the present application.
The gateway apparatus includes: a communication interface 1101, a processor 1102, a machine-readable storage medium 1103, and a bus 1104; the communication interface 1101, the processor 1102 and the machine-readable storage medium 1103 are in communication with each other via a bus 1104. The processor 902 may perform the data storage methods described above by reading and executing machine-executable instructions in the machine-readable storage medium 1103 corresponding to the data storage control logic.
The machine-readable storage medium 1103 referred to herein may be any electronic, magnetic, optical, or other physical storage device that can contain or store information such as executable instructions, data, and the like. For example, the machine-readable storage medium may be: volatile memory, non-volatile memory, or similar storage media. In particular, the machine-readable storage medium 1103 may be a RAM (random Access Memory), a flash Memory, a storage drive (e.g., a hard drive), a solid state drive, any type of storage disk (e.g., a compact disk, a DVD, etc.), or similar storage medium, or a combination thereof.
Referring to fig. 12, fig. 12 is a block diagram illustrating a data storage device according to an exemplary embodiment of the present application. The device is applied to a master device in a storage cluster, the storage cluster further comprises at least one metadata storage node and a gateway device, and the metadata storage node and the gateway device are used for storing metadata, and the device comprises:
a selecting unit 1201, configured to, when receiving a first request sent by a gateway device, where the first request is generated by the gateway device based on a file directory creation instruction, store file directory metadata carried by the file directory creation instruction, and select a metadata storage node for storing the file metadata from all metadata storage nodes in the storage cluster; the file metadata is file metadata under a file directory corresponding to the file directory metadata;
a sending unit 1202, configured to send the selected metadata storage node to a gateway device, so that the gateway device creates a correspondence between the file directory and a node identifier of the metadata storage node selected by the master device; and when the gateway equipment receives a file writing instruction, storing the target file metadata carried by the file writing instruction to a corresponding metadata storage node according to the established corresponding relation.
Optionally, the selecting unit 1201 is further configured to, when a second request sent by the gateway device is received, obtain target file metadata carried in the second request; the second request is generated when the gateway device does not find the metadata storage node corresponding to the target file directory carried by the file writing instruction in the corresponding relation after receiving the file writing instruction; selecting a first target metadata storage node for storing the target file metadata from all metadata storage nodes stored by the storage cluster;
the sending unit 1202 is further configured to return the identifier of the selected first target metadata storage node to the gateway device, so that the gateway device stores the target file metadata to the selected first target metadata storage node, and creates a corresponding relationship between the target file directory and the identifier of the selected first target metadata storage node.
Optionally, the selecting unit 1201 is further configured to, when a third request sent by the gateway device is received, obtain target file metadata carried in the third request; the third request is generated when the gateway device determines that the number of the file metadata stored in the selected metadata storage node is higher than a preset threshold value; the selected metadata storage node is selected from at least one metadata storage node corresponding to the target file directory by the gateway device; selecting a second target metadata storage node for storing the target file metadata from all metadata storage nodes stored by the storage cluster;
the sending unit 1202 is further configured to return the selected second target metadata storage node identifier to the gateway device, so that the gateway device stores the target file metadata to the selected second target metadata storage node, and creates a corresponding relationship between the target file directory and the selected second target metadata storage node identifier.
In addition, the present application also provides a storage cluster, which includes: the system comprises a gateway device, a main device and at least one metadata storage node;
the gateway device is used for sending file directory metadata carried by a file directory creation instruction to the main device in the storage cluster when receiving the file directory creation instruction;
the main device is configured to select a metadata storage node for storing file metadata from all metadata storage nodes in the storage cluster according to the file directory metadata, where the file metadata is file metadata in a file directory corresponding to the file directory metadata;
the gateway device is used for acquiring the node identifier of the metadata storage node selected by the main device and creating a corresponding relation between the file directory and the node identifier of the metadata storage node selected by the main device;
and the gateway equipment is used for storing the target file metadata carried by the file writing instruction to a corresponding metadata storage node according to the established corresponding relation when receiving the file writing instruction.
Optionally, the file writing instruction further includes: a target file directory;
the gateway device is used for searching at least one metadata storage node identifier corresponding to the target file directory in the established corresponding relation when the target file metadata carried by the file writing instruction is stored to the corresponding metadata storage node according to the established corresponding relation; if the target file directory is found, selecting a first target metadata storage node identifier from at least one metadata storage node identifier corresponding to the target file directory, and storing the target file metadata to a first target metadata storage node corresponding to the first target metadata storage node identifier;
the gateway equipment is used for requesting the main equipment to distribute a first target metadata storage node for storing the target file metadata if the target file metadata is not found;
the main device is used for selecting a first target metadata storage node for storing the target file metadata from all metadata storage nodes stored in the storage cluster; and returning the selected first target metadata storage node identification to the gateway device.
And the gateway equipment is used for storing the target file metadata to the selected first target metadata storage node and creating a corresponding relation between the target file directory and the selected first target metadata storage identifier.
Optionally, after storing the target file metadata in the allocated first target metadata storage node, the gateway device is further configured to create a correspondence between the target file directory and the node identifier of the allocated first target metadata storage node.
Optionally, when a first target metadata storage node identifier is selected from the at least one metadata storage node identifier corresponding to the target file directory, the gateway device is configured to use the metadata storage node identifier corresponding to the target file directory as the first target metadata storage node identifier if the number of the at least one metadata storage node identifier corresponding to the target file directory is 1; and if the number of the at least one metadata storage node identifier corresponding to the target file directory is greater than 1, selecting the metadata storage node identifier with the minimum storage capacity as a first target metadata storage node identifier from the at least one metadata storage node identifier corresponding to the target file directory.
Optionally, when the target file metadata is stored in a first target metadata storage node corresponding to the first target metadata storage node identifier, the gateway device is configured to check whether the amount of file metadata stored in the first target metadata storage node is higher than a preset threshold; if not, storing the target file metadata to a first target metadata storage node corresponding to the first target metadata storage node identifier;
the gateway device is further configured to request the primary device to allocate a second target metadata storage node for storing the target file metadata if the target file metadata is higher than the target file metadata;
the master device is configured to select a second target metadata storage node for storing the target file metadata from all metadata storage nodes stored in the storage cluster; returning the selected second target metadata storage node identification to the gateway device;
the gateway device is configured to store the target file metadata to the selected second target metadata storage node, and create a corresponding relationship between the target file directory and the selected second target metadata storage node identifier.
Optionally, when the target file metadata is stored in a first target metadata storage node corresponding to the first target metadata storage node identifier, the gateway device is configured to detect whether metadata stored in the first target metadata storage node is being migrated; if not, storing the target file metadata to a first target metadata storage node corresponding to the first target metadata storage node identifier;
the gateway device is further configured to determine a destination metadata storage node corresponding to the first target metadata storage node if the file is migrated, where the destination metadata storage node is configured to receive the migrated file metadata in the first target metadata storage node; and writing the first target file metadata into the target metadata storage node, and modifying the corresponding relation between the target file directory and the node identifier of the first target metadata storage node into the corresponding relation between the target file directory and the node identifier of the target metadata storage node.
The implementation process of the functions and actions of each unit in the above device is specifically described in the implementation process of the corresponding step in the above method, and is not described herein again.
For the device embodiments, since they substantially correspond to the method embodiments, reference may be made to the partial description of the method embodiments for relevant points. The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of the application. One of ordinary skill in the art can understand and implement it without inventive effort.
The above description is only exemplary of the present application and should not be taken as limiting the present application, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the scope of protection of the present application.

Claims (13)

1. A data storage method applied to a gateway device, the gateway device being in a same storage cluster as at least one metadata storage node for storing metadata, the method comprising:
when a file directory creating instruction is received, file directory metadata carried by the file directory creating instruction is sent to a main device in the storage cluster, so that the main device stores the file directory metadata, and a metadata storage node for storing the file metadata is selected from all metadata storage nodes in the storage cluster according to the file directory metadata, wherein the file metadata are file metadata under a file directory corresponding to the file directory metadata;
acquiring a node identifier of the metadata storage node selected by the main equipment, and creating a corresponding relation between the file directory and the node identifier of the metadata storage node selected by the main equipment;
and when a file writing instruction is received, storing the target file metadata carried by the file writing instruction to a corresponding metadata storage node according to the established corresponding relation.
2. The method of claim 1, wherein the file write instruction further comprises: a target file directory;
the storing the target file metadata carried by the file writing instruction to the corresponding metadata storage node according to the created corresponding relationship includes:
searching at least one metadata storage node identifier corresponding to the target file directory in the established corresponding relation;
if the target file directory is found, selecting a first target metadata storage node identifier from at least one metadata storage node identifier corresponding to the target file directory, and storing the target file metadata to a first target metadata storage node corresponding to the first target metadata storage node identifier;
and if the target file metadata is not found, requesting the main equipment to allocate a first target metadata storage node for storing the target file metadata, and storing the target file metadata to the allocated first target metadata storage node.
3. The method of claim 2, wherein after storing the target file metadata to the assigned first target metadata storage node, the method further comprises:
creating a correspondence between the target file directory and the node identification of the assigned first target metadata storage node.
4. The method of claim 2, wherein selecting a first target metadata storage node identifier from the at least one metadata storage node identifier corresponding to the target file directory comprises:
if the number of at least one metadata storage node identifier corresponding to the target file directory is 1, taking the metadata storage node identifier corresponding to the target file directory as a first target metadata storage node identifier;
and if the number of the at least one metadata storage node identifier corresponding to the target file directory is greater than 1, selecting the metadata storage node identifier with the minimum storage capacity as a first target metadata storage node identifier from the at least one metadata storage node identifier corresponding to the target file directory.
5. The method of claim 4, wherein storing the target file metadata to the first target metadata storage node identifies a corresponding first target metadata storage node, comprising:
checking whether the number of file metadata stored by the first target metadata storage node is higher than a preset threshold;
if not, storing the target file metadata to a first target metadata storage node corresponding to the first target metadata storage node identifier;
the method further comprises the following steps:
and if so, requesting the main device to allocate a second target metadata storage node for storing the target file metadata, storing the target file metadata to the second target metadata storage node, and creating a corresponding relation between the target file directory and the node identifier of the second target metadata storage node.
6. The method of claim 2, wherein storing the target file metadata to the first target metadata storage node identifies a corresponding first target metadata storage node, comprising:
detecting whether metadata stored in the first target metadata storage node is being migrated;
if not, storing the target file metadata to a first target metadata storage node corresponding to the first target metadata storage node identifier;
the method further comprises the following steps:
if the file metadata is migrated, determining a destination metadata storage node corresponding to the first destination metadata storage node, wherein the destination metadata storage node is used for receiving the migrated file metadata in the first destination metadata storage node;
and writing the first target file metadata into the target metadata storage node, and modifying the corresponding relation between the target file directory and the node identifier of the first target metadata storage node into the corresponding relation between the target file directory and the node identifier of the target metadata storage node.
7. A data storage method is applied to a master device in a storage cluster, wherein the storage cluster further comprises at least one metadata storage node and a gateway device for storing metadata, and the method comprises the following steps:
when a first request sent by gateway equipment is received, the first request is generated by the gateway equipment based on a file directory creation instruction, file directory metadata carried by the file directory creation instruction is stored, and a metadata storage node used for storing the file metadata is selected from all metadata storage nodes in the storage cluster; the file metadata is file metadata under a file directory corresponding to the file directory metadata;
sending the selected metadata storage node to gateway equipment so that the gateway equipment creates a corresponding relation between the file directory and the node identification of the metadata storage node selected by the main equipment; and when the gateway equipment receives a file writing instruction, storing the target file metadata carried by the file writing instruction to a corresponding metadata storage node according to the established corresponding relation.
8. The method of claim 7, further comprising:
when a second request sent by the gateway equipment is received, acquiring target file metadata carried in the second request; the second request is generated when the gateway device does not find the metadata storage node corresponding to the target file directory carried by the file writing instruction in the corresponding relation after receiving the file writing instruction;
selecting a first target metadata storage node for storing the target file metadata from all metadata storage nodes stored by the storage cluster;
and returning the identifier of the selected first target metadata storage node to the gateway device, so that the gateway device stores the target file metadata to the selected first target metadata storage node, and creates a corresponding relation between the target file directory and the selected first target metadata storage identifier.
9. The method of claim 7, further comprising:
when a third request sent by the gateway equipment is received, target file metadata carried in the third request is obtained; the third request is generated when the gateway device determines that the number of the file metadata stored in the selected metadata storage node is higher than a preset threshold value; the selected metadata storage node is selected from at least one metadata storage node corresponding to the target file directory by the gateway device;
selecting a second target metadata storage node for storing the target file metadata from all metadata storage nodes stored by the storage cluster;
and returning the identifier of the selected second target metadata storage node to the gateway device, so that the gateway device stores the target file metadata to the selected second target metadata storage node, and creates a corresponding relation between the target file directory and the identifier of the selected second target metadata storage node.
10. A data storage apparatus, applied to a gateway device in the same storage cluster as at least one metadata storage node for storing metadata, the apparatus comprising:
the sending unit is used for sending file directory metadata carried by a file directory creating instruction to a main device in the storage cluster when the file directory creating instruction is received, so that the main device stores the file directory metadata, and selecting a metadata storage node for storing the file metadata from all metadata storage nodes in the storage cluster according to the file directory metadata, wherein the file metadata are file metadata under a file directory corresponding to the file directory metadata;
an obtaining unit, configured to obtain a node identifier of the metadata storage node selected by the host device, and create a correspondence between the file directory and the node identifier of the metadata storage node selected by the host device;
and the writing unit is used for storing the target file metadata carried by the file writing instruction to a corresponding metadata storage node according to the established corresponding relation when the file writing instruction is received.
11. A storage cluster, the storage cluster comprising: the system comprises a gateway device, a main device and at least one metadata storage node;
the gateway device is used for sending file directory metadata carried by a file directory creation instruction to the main device in the storage cluster when receiving the file directory creation instruction;
the main device is configured to select a metadata storage node for storing file metadata from all metadata storage nodes in the storage cluster according to the file directory metadata, where the file metadata is file metadata in a file directory corresponding to the file directory metadata;
the gateway device is used for acquiring the node identifier of the metadata storage node selected by the main device and creating a corresponding relation between the file directory and the node identifier of the metadata storage node selected by the main device;
and the gateway equipment is used for storing the target file metadata carried by the file writing instruction to a corresponding metadata storage node according to the established corresponding relation when receiving the file writing instruction.
12. A gateway device, characterized in that the device comprises a readable storage medium and a processor;
wherein the readable storage medium is configured to store machine executable instructions;
the processor configured to read the machine executable instructions on the readable storage medium and execute the instructions to implement the steps of the method of any one of claims 1-6.
13. A master device, the device comprising a readable storage medium and a processor;
wherein the readable storage medium is configured to store machine executable instructions;
the processor configured to read the machine executable instructions on the readable storage medium and execute the instructions to implement the steps of the method of any one of claims 7-9.
CN202010383019.4A 2020-05-08 2020-05-08 Data storage method and device, storage cluster, gateway equipment and main equipment Pending CN111638853A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010383019.4A CN111638853A (en) 2020-05-08 2020-05-08 Data storage method and device, storage cluster, gateway equipment and main equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010383019.4A CN111638853A (en) 2020-05-08 2020-05-08 Data storage method and device, storage cluster, gateway equipment and main equipment

Publications (1)

Publication Number Publication Date
CN111638853A true CN111638853A (en) 2020-09-08

Family

ID=72330035

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010383019.4A Pending CN111638853A (en) 2020-05-08 2020-05-08 Data storage method and device, storage cluster, gateway equipment and main equipment

Country Status (1)

Country Link
CN (1) CN111638853A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112632010A (en) * 2020-12-29 2021-04-09 深圳市天朗时代科技有限公司 File storage method, device and equipment of ISLI (Integrated services digital interface) metadata and readable storage medium
CN113055448A (en) * 2021-02-28 2021-06-29 新华三信息技术有限公司 Metadata management method and device
CN115118779A (en) * 2022-06-24 2022-09-27 济南浪潮数据技术有限公司 Method, system, device and medium for building cluster based on centralized storage

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110153606A1 (en) * 2009-12-18 2011-06-23 Electronics And Telecommunications Research Institute Apparatus and method of managing metadata in asymmetric distributed file system
CN102158546A (en) * 2011-02-28 2011-08-17 中国科学院计算技术研究所 Cluster file system and file service method thereof
CN103150394A (en) * 2013-03-25 2013-06-12 中国人民解放军国防科学技术大学 Distributed file system metadata management method facing to high-performance calculation
US20130339406A1 (en) * 2012-06-19 2013-12-19 Infinidat Ltd. System and method for managing filesystem objects
US9015123B1 (en) * 2013-01-16 2015-04-21 Netapp, Inc. Methods and systems for identifying changed data in an expandable storage volume
CN107315547A (en) * 2017-07-18 2017-11-03 郑州云海信息技术有限公司 A kind of method and device for reading distributed meta data file

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110153606A1 (en) * 2009-12-18 2011-06-23 Electronics And Telecommunications Research Institute Apparatus and method of managing metadata in asymmetric distributed file system
CN102158546A (en) * 2011-02-28 2011-08-17 中国科学院计算技术研究所 Cluster file system and file service method thereof
US20130339406A1 (en) * 2012-06-19 2013-12-19 Infinidat Ltd. System and method for managing filesystem objects
US9015123B1 (en) * 2013-01-16 2015-04-21 Netapp, Inc. Methods and systems for identifying changed data in an expandable storage volume
CN103150394A (en) * 2013-03-25 2013-06-12 中国人民解放军国防科学技术大学 Distributed file system metadata management method facing to high-performance calculation
CN107315547A (en) * 2017-07-18 2017-11-03 郑州云海信息技术有限公司 A kind of method and device for reading distributed meta data file

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112632010A (en) * 2020-12-29 2021-04-09 深圳市天朗时代科技有限公司 File storage method, device and equipment of ISLI (Integrated services digital interface) metadata and readable storage medium
CN112632010B (en) * 2020-12-29 2024-03-19 深圳市天朗时代科技有限公司 File storage method, device and equipment of ISLI metadata and readable storage medium
CN113055448A (en) * 2021-02-28 2021-06-29 新华三信息技术有限公司 Metadata management method and device
CN115118779A (en) * 2022-06-24 2022-09-27 济南浪潮数据技术有限公司 Method, system, device and medium for building cluster based on centralized storage

Similar Documents

Publication Publication Date Title
US11461027B2 (en) Deduplication-aware load balancing in distributed storage systems
US8909887B1 (en) Selective defragmentation based on IO hot spots
US8510508B2 (en) Storage subsystem and storage system architecture performing storage virtualization and method thereof
CN111638853A (en) Data storage method and device, storage cluster, gateway equipment and main equipment
US20090210464A1 (en) Storage management system and method thereof
EP3076307A1 (en) Method and device for responding to a request, and distributed file system
US8001324B2 (en) Information processing apparatus and informaiton processing method
CN110858162B (en) Memory management method and device and server
CN109542861B (en) File management method, device and system
CN108604165A (en) Storage device
US10712974B2 (en) Virtual disk processing method and apparatus
CN113568582B (en) Data management method, device and storage equipment
CN103324533A (en) distributed data processing method, device and system
JP2005512232A (en) Managing storage resources attached to a data network
CN111638995A (en) Metadata backup method, device and equipment and storage medium
CN111399761B (en) Storage resource allocation method, device and equipment, and storage medium
CN111399760B (en) NAS cluster metadata processing method and device, NAS gateway and medium
CN113434470B (en) Data distribution method and device and electronic equipment
CN110955488A (en) Virtualization method and system for persistent memory
CN111782135A (en) Data storage method, system, data node and computer readable storage medium
CN109582235B (en) Management metadata storage method and device
CN109508140B (en) Storage resource management method and device, electronic equipment and system
CN111338569A (en) Object storage back-end optimization method based on direct mapping
CN107168645B (en) Storage control method and system of distributed system
CN107066206B (en) Storage control method and system for distributed physical disk

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20200908