Metadata backup method, device, equipment and storage medium
By constructing the keywords of metadata in the backup system and storing them to the key-value data storage system, the problem of low backup and recovery efficiency in the prior art is solved, and the effect of quickly obtaining the metadata of the specified backup object is achieved.
Patent Information
- Application Number
- CN202411825875.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-12
- Publication Date
- 2025-04-01
AI Technical Summary
When the prior art backup and recovery of large-scale files, it is necessary to browse all metadata information in the relational database, resulting in less efficiency in restoring specified files or specified directories.
By obtaining the backup object and its directory structure path in the target directory, determining the parent directory path, and determining the prefix string based on the number of separators, constructing keywords to be stored in the key-value data storage system to avoid browsing all metadata.
It realizes the rapid acquisition of metadata of the specified backup object, improves the recovery efficiency of the backup object, and avoids full browsing of relational databases.
Smart Images

Figure CN119739563A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of disaster recovery and backup, and in particular to a metadata backup method, device, equipment and storage medium. Background Art
[0002] At present, in the field of disaster recovery and backup, there are often scenarios of backing up and restoring large-scale files. In the process of backing up large-scale files, not only the file content but also the file metadata information needs to be saved to the backup server.
[0003] In the prior art, a relational database is usually used to store metadata information of a file.
[0004] However, when the user only wants to restore a certain file in the backup data, or all files under a certain directory, the prior art needs to browse all metadata information in the relational database, resulting in low efficiency in restoring the specified file or directory. Summary of the invention
[0005] The present invention provides a metadata backup method, device, equipment and storage medium, which are convenient for quickly acquiring metadata of a specified backup object and improve the recovery efficiency of the backup object.
[0006] In a first aspect, an embodiment of the present invention provides a metadata backup method, comprising:
[0007] Obtain the backup objects under the target directory and the directory structure path corresponding to each backup object, and determine the parent directory path in each directory structure path;
[0008] According to the number of separators in each parent directory path, determine the prefix string corresponding to each parent directory path;
[0009] Based on the prefix string corresponding to the parent directory path and the directory structure path where the parent directory path is located, a keyword for searching the metadata of the backup object is constructed, and the keyword and metadata of the backup object are associated and stored in the key-value data storage system.
[0010] Optionally, obtaining the backup objects under the target directory includes: obtaining subdirectories and files under the target directory, and taking the subdirectories and files as the backup objects.
[0011] Optionally, a prefix string corresponding to each parent directory path is determined based on the number of separators in each parent directory path, including: determining a prefix character corresponding to each parent directory path based on the number of separators in each parent directory path, and determining a prefix string corresponding to each parent directory path based on the prefix character, a set number of preset characters and the separator.
[0012] Optionally, the keywords and metadata of the backup object are associated and stored in the key-value data storage system, including: obtaining a prefix character string in each keyword, and determining the relative storage position of each keyword in the key-value data storage system based on the prefix characters in the prefix character string; according to the relative storage position of each keyword in the key-value data storage system, the keywords and metadata of the backup object are associated and stored in the key-value data storage system.
[0013] Optionally, based on the prefix string corresponding to the parent directory path and the directory structure path where the parent directory path is located, construct keywords for searching the metadata of the backup object, including: combining the prefix string corresponding to the parent directory path and the directory structure path where the parent directory path is located to obtain keywords for searching the metadata of the backup object.
[0014] In a second aspect, an embodiment of the present invention provides a metadata query method, including:
[0015] Get the target parent directory path to be searched and the target prefix string corresponding to the target parent directory path;
[0016] Determine a starting search string and an ending search string according to the target parent directory path and the target prefix string, and query each keyword in the key-value data storage system constructed by the metadata backup method provided by any embodiment of the present invention according to the starting search string and the ending search string to obtain a target keyword corresponding to the target parent directory path;
[0017] According to the target keyword, metadata of each target backup object under the target parent directory path is obtained in the key-value data storage system.
[0018] Optionally, the starting search string and the ending search string are determined according to the target parent directory path and the target prefix string, including: combining the target parent directory path and the target prefix string to obtain the starting search string; replacing the last character in the starting search string with a preset character to obtain the ending search string.
[0019] In a third aspect, an embodiment of the present invention further provides a metadata backup device, including:
[0020] The parent directory path determination module is used to obtain the backup objects under the target directory and the directory structure path corresponding to each backup object, and determine the parent directory path in each directory structure path;
[0021] A prefix string determination module, used to determine the prefix string corresponding to each parent directory path according to the number of separators in each parent directory path;
[0022] The metadata storage module is used to construct keywords for searching the metadata of the backup object based on the prefix string corresponding to the parent directory path and the directory structure path where the parent directory path is located, and store the keywords and metadata of the backup object in a key-value data storage system in an associated manner.
[0023] In a fourth aspect, an embodiment of the present invention further provides an electronic device, the electronic device comprising:
[0024] at least one processor; and
[0025] a memory communicatively connected to at least one processor; wherein,
[0026] The memory stores a computer program executable by at least one processor, and the computer program is executed by at least one processor so that the at least one processor can execute the metadata backup method or metadata query method provided by any embodiment of the present invention.
[0027] In a fifth aspect, an embodiment of the present invention further provides a computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable a processor to implement the metadata backup method or metadata query method provided by any embodiment of the present invention when executed.
[0028] The technical solution of the embodiment of the present invention constructs keywords for searching the metadata of the backup object through a prefix character string corresponding to the parent directory path and the directory structure path where the parent directory path is located, and stores the keywords and metadata of the backup object in association in a key-value data storage system, thereby avoiding the situation in the prior art where the metadata of the backup object is stored in a relational database, resulting in the need to browse all the metadata in the relational database when restoring the specified backup object, facilitating rapid acquisition of the metadata of the specified backup object and improving the recovery efficiency of the backup object.
[0029] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0031] Figure 1is a flowchart of a metadata backup method provided according to Embodiment 1 of the present invention;
[0032] Figure 2 is a flowchart of another metadata backup method provided according to Embodiment 2 of the present invention;
[0033] Figure 3 is a schematic diagram of a target directory structure provided according to an embodiment of the present invention;
[0034] Figure 4 is a flowchart of a metadata query method provided according to Embodiment 3 of the present invention;
[0035] Figure 5 is a schematic diagram of the structure of a metadata backup device provided according to Embodiment 4 of the present invention;
[0036] Figure 6 Schematic diagram of a metadata query device according to Embodiment 5 of the present invention
[0037] Figure 7 It is a structural diagram of an electronic device provided by Embodiment 6 of the present invention. DETAILED DESCRIPTION
[0038] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0039] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0040] Embodiment 1
[0041] Figure 1This is a flowchart of a metadata backup method provided according to Embodiment 1 of the present invention. This embodiment is applicable to the case of backing up metadata of a backup object. The method can be executed by a metadata backup device. The metadata backup device can be implemented in the form of hardware and / or software. The metadata backup device can be configured in an electronic device such as a computer.
[0042] like Figure 1 As shown, a metadata backup method disclosed in this embodiment includes:
[0043] S110: Acquire the backup objects under the target directory and the directory structure path corresponding to each backup object, and determine the parent directory path in each directory structure path.
[0044] In this embodiment, the backup object may be a subdirectory and / or file under the target directory. The number of subdirectories in the directory structure path and the parent directory path may be 0, 1, or more. The directory structure path may be expressed in a variety of forms, such as / root directory / subdirectory / file, / root directory / subdirectory, and / root directory / file. The parent directory path may be expressed in a variety of forms, such as / root directory / subdirectory / , and / root directory / .
[0045] In this step, specifically, after obtaining the backup objects under the target directory and the directory structure paths respectively corresponding to each backup object from the backup server, the parent directory path in each directory structure path can be determined.
[0046] For example, assuming that the backup object is a file, the directory structure path corresponding to the file is / root directory / subdirectory / file, and the parent directory path in the directory structure path is / root directory / subdirectory / .
[0047] S120: Determine a prefix character string corresponding to each parent directory path according to the number of separators in each parent directory path.
[0048] In this embodiment, the separator can be used to separate the root directory, subdirectory and file. Preferably, the separator can be " / ".
[0049] In this step, specifically, the prefix characters corresponding to each parent directory path may be determined according to the number of separators in each parent directory path, and the prefix character string corresponding to each parent directory path may be determined according to the prefix characters.
[0050] Exemplarily, the prefix string corresponding to each parent directory path may be determined based on the prefix character and the separator, or the prefix string corresponding to each parent directory path may be determined based on the prefix character, a set number of preset characters and the separator.
[0051] S130. Construct keywords for searching metadata of the backup object according to the prefix character string corresponding to the parent directory path and the directory structure path where the parent directory path is located, and store the keywords and metadata of the backup object in a key-value data storage system in an associated manner.
[0052] In this embodiment, the metadata of the backup object may include information such as the directory structure, name, size, backup time, and storage location of the backup object.
[0053] In this step, specifically, the prefix string corresponding to the parent directory path and the directory structure path where the parent directory path is located can be combined to obtain a keyword for searching the metadata of the backup object. Alternatively, the directory structure path where the parent directory path is located can be modified according to the prefix string corresponding to the parent directory path to obtain a keyword for searching the metadata of the backup object.
[0054] The technical solution of this embodiment obtains the backup objects under the target directory and the directory structure paths corresponding to each backup object, and determines the parent directory path in each directory structure path; determines the prefix character string corresponding to each parent directory path according to the number of separators in each parent directory path; constructs keywords for searching the metadata of the backup objects according to the prefix character string corresponding to the parent directory path and the directory structure path where the parent directory path is located, and stores the keywords and metadata of the backup objects in a key-value data storage system in association with each other. This technical solution solves the problem that the metadata of the backup objects is stored in a relational database in the prior art, resulting in the need to browse all the metadata in the relational database when restoring the specified backup objects. This facilitates the rapid acquisition of the metadata of the specified backup objects and improves the recovery efficiency of the backup objects.
[0055] Embodiment 2
[0056] Figure 2 It is a flowchart of another metadata backup method provided according to the second embodiment of the present invention. This embodiment is a further optimization and expansion based on the above embodiments, and can be combined with various optional technical solutions in the above implementation methods.
[0057] like Figure 2 As shown, a metadata backup method disclosed in this embodiment includes:
[0058] S210: After obtaining subdirectories and files under the target directory and taking the subdirectories and files as backup objects, obtain directory structure paths corresponding to each backup object, and determine the parent directory path in each directory structure path.
[0059] by Figure 3Take the / testfile / directory in the example, the subdirectories under the / testfile / directory include libjson and json, and the files include get_pool_list.cpp, config.h, features.h, version.h, JSONUtil.cpp, JSONUtil.h, and Makefile. The directory structure path corresponding to libjson is / testfile / libjson, and the parent directory path is / testfile / ; the directory structure path corresponding to json is / testfile / libjson / json, and the parent directory path is / testfile / libjson / . The directory structure path corresponding to get_pool_list.cpp is / testfile / get_pool_list.cpp, and the parent directory path is / testfile / ; the directory structure path corresponding to config.h is / testfile / libjson / json / config.h, and the parent directory path is / testfile / libjson / json / ; the directory structure path corresponding to features.h is / testfile / libjson / json / features.h, and the parent directory path is / testfile / libjson / json / ; the directory structure path corresponding to versionh is / testfile / libjson / json / version.h, and the parent directory path is / testfile / libjson / json / ; the directory structure path corresponding to JSONUtil.cpp is / testfile / libjson / JSONUtil.cpp, and the parent directory path is / testfile / libjson / ; the directory structure path corresponding to JSONUtil.h is / testfile / libjson / JSONUtil.h, and the parent directory path is / testfile / libjson / .
[0060] The directory structure paths corresponding to Makefile are / testfile / libjson / Makefile and / testfile / Makefile. The parent directory path in / testfile / libjson / Makefile is / testfile / libjson / , and the parent directory path in / testfile / Makefile is / testfile / .
[0061] S220. Determine the prefix characters corresponding to each parent directory path according to the number of separators in each parent directory path, and determine the prefix character string corresponding to each parent directory path according to the prefix character, a set number of preset characters and the separator.
[0062] In this embodiment, the prefix character, the set number of preset characters and the separator can be combined according to the positional relationship between the prefix character, the set number of preset characters and the separator to obtain a prefix string corresponding to each parent directory path. Specifically, the prefix string can be obtained by setting the set number of preset characters between the separator and the prefix character. Alternatively, the prefix string can be obtained by setting the prefix character between the separator and the set number of preset characters. Alternatively, the prefix string can be obtained by inserting the separator and the prefix character into any position among the set number of preset characters.
[0063] Taking the directory structure path / testfile / libjson as an example, the parent directory path of / testfile / libjson is / testfile / , and the number of separators in / testfile / is 2, then it can be determined that the prefix character corresponding to / testfile / is 2. Assuming the set number is 4 and the preset character is 0, it can be determined that the prefix string corresponding to / testfile / is / 00002.
[0064] S230: Combine the prefix character string corresponding to the parent directory path and the directory structure path where the parent directory path is located to obtain a keyword for searching the metadata of the backup object.
[0065] In this step, specifically, based on the positional relationship between the prefix string and the directory structure path, the prefix string corresponding to the parent directory path can be set before the directory structure path where the parent directory path is located to obtain keywords for searching the metadata of the backup object.
[0066] Exemplarily, the keyword for searching the metadata of libjson is / 00002 / testfile / libjson; the keyword for searching the metadata of json is / 00003 / testfile / libjson / json. The keyword for searching the metadata of get_pool_list.cpp is / 00002 / testfile / get_pool_list.cpp; the keyword for searching the metadata of config.h is / 00004 / testfile / libjson / json / config.h; the keyword for searching the metadata of features.h is / 00004 / testfile / libjson / json / features.h; the keyword for searching the metadata of versionh is / 00004 / testfile / libjson / json / version.h; the keyword for searching the metadata of JSONUtil.cpp is / 00003 / testfile / libjson / JSONUtil.cpp; the keyword for searching the metadata of JSONUtil.h is / 00003 / testfile / libjson / JSONUtil.h; the keywords for searching the metadata of Makefile are / 00002 / testfile / Makefile and / 00003 / testfile / libjson / Makefile.
[0067] S240: Obtain a prefix character string in each keyword, and determine a relative storage position of each keyword in the key-value data storage system according to the prefix characters in the prefix character string.
[0068] In this step, specifically, the relative storage position of each keyword in the key-value data storage system can be determined according to the size of the prefix characters. Exemplarily, the keywords with smaller prefix characters can be stored before the keywords with larger prefix characters. Optionally, for keywords with the same prefix characters, the relative storage position of the keywords can be determined according to the position of each backup object in the target directory.
[0069] S250 . According to the relative storage position of each keyword in the key-value data storage system, the keyword and metadata of the backup object are associated and stored in the key-value data storage system.
[0070] For example, / 00002 / testfile / get_pool_list.cpp, / 00002 / testfile / libjson, / 00002 / testfile / Makefile, / 00003 / testfile / libjson / json, / 00003 / testfile / libjson / JSONUtil.cpp, / 00003 / testfile / libjson / JSONUtil.h, / 00003 / testfile / libjson / Makefile, / 00004 / testfile / libjson / json / config.h, / 00004 / testfile / libjson / json / features.h, and / 00004 / testfile / libjson / json / version.h can be stored in the key-value data storage system in sequence.
[0071] Optionally, the root directory may also be stored in the key-value data storage system as the starting directory when browsing directories. Exemplarily, / testfile / may be stored in the key-value data storage system.
[0072] The technical solution of this embodiment determines the prefix character of the parent directory path by the number of separators in the parent directory path, determines the prefix string according to the prefix character, and determines the relative storage position of each keyword in the key-value data storage system according to the prefix character in the prefix string, so that when restoring the target directory, starting from the first-level directory, all files and subdirectories under the target directory are returned layer by layer, avoiding the situation of determining the storage relationship of each file and subdirectory again, and improving the efficiency of restoring the files under the entire target directory. Secondly, since the prefix strings of the files under the same parent directory path are the same, the keywords and metadata corresponding to the same parent directory path will be centrally stored in the same data file in the key-value data storage system, which improves the efficiency of obtaining the metadata of each file under the same parent directory path, and further improves the efficiency of restoring each file under the same parent directory path. Finally, the prefix character of the parent directory path is determined by the number of separators in the parent directory path, and the prefix string is determined according to the prefix character, so as to facilitate the rapid recovery of all files under the specified directory.
[0073] Embodiment 3
[0074] Figure 4This is a flowchart of a metadata query method provided according to Embodiment 3 of the present invention. This embodiment can be applied to querying backed-up metadata in a key-value data storage system constructed by the metadata backup method provided in any embodiment of the present invention. The method can be executed by a metadata query device, which can be implemented in the form of hardware and / or software, and can be configured in an electronic device such as a computer.
[0075] like Figure 4 As shown, a metadata query method disclosed in this embodiment includes:
[0076] S310: Obtain a target parent directory path to be searched and a target prefix character string corresponding to the target parent directory path.
[0077] In this step, specifically, the prefix character corresponding to the target parent directory path can be determined according to the number of separators in the target parent directory path, and the target prefix string corresponding to the target parent directory path can be determined according to the prefix character, a set number of preset characters and separators.
[0078] Exemplarily, assuming that the target parent directory path is / testfile / , the prefix character corresponding to / testfile / can be determined to be 2 according to the number of separators in / testfile / , and then the target prefix character string corresponding to / testfile / can be determined to be / 00002.
[0079] S320. Determine the starting search string and the ending search string according to the target parent directory path and the target prefix string, and query each keyword in the key-value data storage system constructed by the metadata backup method provided by any embodiment of the present invention according to the starting search string and the ending search string to obtain the target keyword corresponding to the target parent directory path.
[0080] In this step, specifically, the target parent directory path and the target prefix string can be combined to obtain a starting search string, and the last character in the starting search string is replaced with a preset character to obtain an ending search string. The preset character can be determined based on user needs and historical experience. Then, the keyword search range can be determined based on the starting search string and the ending search string, and the keywords within the keyword search range are used as target keywords.
[0081] Exemplary, assuming that the target parent directory path is / testfile / , it can be determined that the starting search string is / 00002 / testfile / . Then, since "0" is the next character of " / ", it means that the string starting with the starting search string meets the search condition, so the preset character can be set to "0", and then the end search string is determined to be / 00002 / testfile0. Afterwards, it can be determined that the keyword search range is ( / 00002 / testfile / , / 00002 / testfile0) according to the starting search string and the end search string. Finally, each keyword in the key-value data storage system can be queried according to ( / 00002 / testfile / , / 00002 / testfile0), and the target keyword corresponding to the target parent directory path is / 00002 / testfile / get_pool_list.cpp, / 00002 / testfile / libjson, and / 00002 / testfile / Makefile.
[0082] S330. According to the target keyword, metadata of each target backup object under the target parent directory path is obtained in the key-value data storage system.
[0083] In this step, specifically, each target backup object under the target parent directory path and metadata of each target backup object can be obtained in the key-value data storage system according to the target keyword.
[0084] Continuing with the previous example, based on / 00002 / testfile / get_pool_list.cpp, / 00002 / testfile / libjson, and / 00002 / testfile / Makefile, it can be determined that each target backup object under / testfile / is get_pool_list.cpp, libjson, and Makefile, as well as the metadata corresponding to get_pool_list.cpp, libjson, and Makefile, respectively.
[0085] The technical solution of this embodiment is to obtain the target parent directory path to be searched, and the target prefix string corresponding to the target parent directory path; determine the starting search string and the ending search string according to the target parent directory path and the target prefix string, and query each keyword in the key-value data storage system constructed by the metadata backup method provided by any embodiment of the present invention according to the starting search string and the ending search string to obtain the target keyword corresponding to the target parent directory path; and obtain the metadata of each target backup object under the target parent directory path in the key-value data storage system according to the target keyword. This technical means solves the problem that the prior art stores the metadata of the backup object in a relational database, resulting in the need to browse all the metadata in the relational database when restoring the specified backup object, thereby improving the efficiency of obtaining the metadata of the target backup object, thereby improving the recovery efficiency of the target backup object.
[0086] Embodiment 4
[0087] Figure 5 It is a structural diagram of a metadata backup device provided according to Embodiment 4 of the present invention. This embodiment can be applied to the situation of backing up the metadata of the backup object. The metadata backup device can be implemented in the form of hardware and / or software and can be configured in an electronic device such as a computer.
[0088] like Figure 5 As shown, the metadata backup device disclosed in this embodiment includes:
[0089] The parent directory path determination module 51 is used to obtain the backup objects under the target directory and the directory structure path corresponding to each backup object, and determine the parent directory path in each directory structure path;
[0090] The prefix string determination module 52 is used to determine the prefix string corresponding to each parent directory path according to the number of separators in each parent directory path;
[0091] The metadata storage module 53 is used to construct keywords for searching the metadata of the backup object based on the prefix string corresponding to the parent directory path and the directory structure path where the parent directory path is located, and store the keywords and metadata of the backup object in a key-value data storage system in an associated manner.
[0092] The technical solution in this embodiment, through the mutual cooperation of the parent directory path determination module, the prefix string determination module and the metadata storage module, solves the problem that the prior art stores the metadata of the backup object in a relational database, resulting in the need to browse all the metadata in the relational database when restoring the specified backup object. This facilitates the rapid acquisition of the metadata of the specified backup object and improves the recovery efficiency of the backup object.
[0093] Optionally, the parent directory path determination module 51 is specifically used to obtain subdirectories and files under the target directory, and use the subdirectories and files as backup objects.
[0094] Optionally, the prefix string determination module 52 is specifically used to: determine the prefix characters corresponding to each parent directory path according to the number of separators in each parent directory path, and determine the prefix strings corresponding to each parent directory path according to the prefix characters, a set number of preset characters and separators.
[0095] Optionally, the metadata storage module 53 is specifically used to combine the prefix character string corresponding to the parent directory path and the directory structure path where the parent directory path is located to obtain a keyword for searching the metadata of the backup object.
[0096] Optionally, the metadata storage module 53 is also specifically used to: obtain the prefix character string in each keyword, and determine the relative storage position of each keyword in the key-value data storage system based on the prefix characters in the prefix character string; and store the keywords and metadata of the backup object in the key-value data storage system in an associated manner according to the relative storage position of each keyword in the key-value data storage system.
[0097] The metadata backup device provided in the embodiment of the present invention can execute the metadata backup method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method. For the contents not described in detail in this embodiment, reference can be made to the description in any method embodiment of the present application.
[0098] Embodiment 5
[0099] Figure 6 1 is a schematic diagram of the structure of a metadata query device provided according to Embodiment 5 of the present invention. This embodiment can be applied to querying backed-up metadata in a key-value data storage system constructed by the metadata backup method provided in any embodiment of the present invention. The metadata query device can be implemented in the form of hardware and / or software and can be configured in an electronic device such as a computer.
[0100] like Figure 6 As shown, the metadata query device disclosed in this embodiment includes:
[0101] The target string acquisition module 61 is used to acquire the target parent directory path to be searched and the target prefix string corresponding to the target parent directory path;
[0102] A target keyword query module 62 is used to determine a start search string and an end search string according to a target parent directory path and a target prefix string, and query each keyword in the key-value data storage system constructed by the metadata backup method provided by any embodiment of the present invention according to the start search string and the end search string to obtain a target keyword corresponding to the target parent directory path;
[0103] The metadata query module 63 is used to obtain metadata of each target backup object under the target parent directory path in the key-value data storage system according to the target keyword.
[0104] The technical solution in this embodiment, through the mutual cooperation of the target string acquisition module, the target keyword query module and the metadata query module, solves the problem that the prior art stores the metadata of the backup object in a relational database, resulting in the need to browse all the metadata in the relational database when restoring the specified backup object, thereby improving the efficiency of acquiring the metadata of the target backup object and further improving the recovery efficiency of the target backup object.
[0105] Optionally, the target keyword query module 62 is specifically used to: combine the target parent directory path and the target prefix string to obtain a starting search string; replace the last character in the starting search string with a preset character to obtain an ending search string.
[0106] The metadata query device provided in the embodiment of the present invention can execute the metadata query method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method. For the contents not described in detail in this embodiment, please refer to the description in any method embodiment of this application.
[0107] Embodiment 6
[0108] Figure 7 FIG. 1 is a schematic diagram showing the structure of an electronic device 10 that can be used to implement an embodiment of the present invention. Figure 7 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0109] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0110] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the metadata backup method or the metadata query method.
[0111] In some embodiments, the metadata backup method or the metadata query method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the metadata backup method or the metadata query method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the metadata backup method or the metadata query method in any other appropriate manner (e.g., by means of firmware).
[0112] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0113] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0114] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0115] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0116] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0117] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0118] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0119] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A metadata backup method, characterized in that: The method comprises: Obtain the backup objects under the target directory and the directory structure path corresponding to each backup object, and determine the parent directory path in each directory structure path; According to the number of separators in each parent directory path, determine the prefix string corresponding to each parent directory path; Based on the prefix string corresponding to the parent directory path and the directory structure path where the parent directory path is located, a keyword for searching the metadata of the backup object is constructed, and the keyword and metadata of the backup object are associated and stored in the key-value data storage system.
2. The method according to claim 1, characterized in that: Get the backup objects in the target directory, including: Obtain subdirectories and files under the target directory, and use the subdirectories and files as backup objects.
3. The method according to claim 1, characterized in that: According to the number of separators in each parent directory path, determine the prefix string corresponding to each parent directory path, including: According to the number of separators in each parent directory path, the prefix characters corresponding to each parent directory path are determined, and according to the prefix characters, a set number of preset characters and the separators, the prefix character strings corresponding to each parent directory path are determined.
4. The method according to claim 3, characterized in that The keywords and metadata of the backup objects are stored in a key-value data storage system, including: Obtaining a prefix string in each keyword, and determining a relative storage position of each keyword in the key-value data storage system according to the prefix characters in the prefix string; According to the relative storage position of each keyword in the key-value data storage system, the keyword and metadata of the backup object are associated and stored in the key-value data storage system.
5. The method according to claim 1, characterized in that Based on the prefix string corresponding to the parent directory path and the directory structure path where the parent directory path is located, construct keywords for searching the metadata of the backup object, including: The prefix character string corresponding to the parent directory path and the directory structure path where the parent directory path is located are combined to obtain a keyword for searching the metadata of the backup object.
6. A metadata query method, characterized in that: The method comprises: Get the target parent directory path to be searched and the target prefix string corresponding to the target parent directory path; Determine a starting search string and an ending search string according to the target parent directory path and the target prefix string, and query each keyword in the key-value data storage system constructed by the method described in any one of claims 1 to 5 according to the starting search string and the ending search string to obtain a target keyword corresponding to the target parent directory path; According to the target keyword, metadata of each target backup object under the target parent directory path is obtained in the key-value data storage system.
7. The method according to claim 6, characterized in that According to the target parent directory path and the target prefix string, determine the starting search string and the ending search string, including: Combine the target parent directory path and the target prefix string to get the starting search string; Replace the last character in the start search string with the preset character to get the end search string.
8. A metadata backup device, characterized in that: The device comprises: The parent directory path determination module is used to obtain the backup objects under the target directory and the directory structure path corresponding to each backup object, and determine the parent directory path in each directory structure path; A prefix string determination module, used to determine the prefix string corresponding to each parent directory path according to the number of separators in each parent directory path; The metadata storage module is used to construct keywords for searching the metadata of the backup object based on the prefix string corresponding to the parent directory path and the directory structure path where the parent directory path is located, and store the keywords and metadata of the backup object in a key-value data storage system in an associated manner.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the metadata backup method described in any one of claims 1-5, or the metadata query method described in any one of claims 6-7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the metadata backup method described in any one of claims 1 to 5, or the metadata query method described in any one of claims 6 to 7 when executed.