CN114968560A - Data backup method and device, computer equipment and storage medium - Google Patents
Data backup method and device, computer equipment and storage medium Download PDFInfo
- Publication number
- CN114968560A CN114968560A CN202210507743.2A CN202210507743A CN114968560A CN 114968560 A CN114968560 A CN 114968560A CN 202210507743 A CN202210507743 A CN 202210507743A CN 114968560 A CN114968560 A CN 114968560A
- Authority
- CN
- China
- Prior art keywords
- target
- character
- metadata
- data
- matching
- 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
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5027—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
- G06F9/5044—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering hardware capabilities
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/14—Error detection or correction of the data by redundancy in operation
- G06F11/1402—Saving, restoring, recovering or retrying
- G06F11/1446—Point-in-time backing up or restoration of persistent data
- G06F11/1458—Management of the backup or restore process
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/903—Querying
- G06F16/90335—Query processing
- G06F16/90344—Query processing by using string matching techniques
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- Databases & Information Systems (AREA)
- Quality & Reliability (AREA)
- Computational Linguistics (AREA)
- Data Mining & Analysis (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The application relates to a data backup method, a data backup device, a computer device, a storage medium and a computer program product, wherein the method comprises the following steps: after receiving target metadata corresponding to target data backed up on a target server and sent by the target server, the server performs character matching on the target metadata to obtain a matching result; since character matching is performed to search for a storage address of target data recorded in target metadata, if a target character for the storage address is matched, the storage address of the target data can be determined; the server may further obtain the occupied space information of the target data from the corresponding storage address in the target server according to the matched storage address of the target data. According to the method and the device, the size of the residual storage space of the target server can be obtained more accurately.
Description
Technical Field
The present application relates to the field of big data processing technologies, and in particular, to a data backup method, apparatus, computer device, storage medium, and computer program product.
Background
Before backing up data to be backed up, an enterprise needs to count the size of the remaining storage space on a server and allocate a storage space for the data to be backed up according to the size of the remaining storage space.
However, the size of the backup data recorded in the metadata file stored in the server is different from the actual occupied space of the backup data, so that the method for determining the size of the remaining storage space of the server through the metadata file stored in the server has the problem that the determination of the size of the remaining storage space of the server is not accurate, and further, the data to be backed up distributed to the server by an enterprise is unreasonable.
Disclosure of Invention
The application provides a data backup method, a data backup device, computer equipment, a computer readable storage medium and a computer program product, which can accurately determine the size of the residual storage space of a server so as to provide a reliable basis for an enterprise to distribute data to be backed up.
In a first aspect, the present application provides a data backup method, including:
performing character matching based on received target metadata to obtain a matching result, wherein the target metadata is metadata corresponding to target data backed up on a target server;
determining a storage address of the target data based on the matching result;
determining occupied space information of the target data according to the storage address of the target data;
and determining the size of the residual storage space of the target server based on the occupied space information of the target data and the occupied space information of the target metadata, and performing data backup on the data to be backed up according to the size of the residual storage space of the target server.
In a second aspect, the present application further provides a data backup apparatus, including:
the character matching module is used for carrying out character matching based on received target metadata to obtain a matching result, wherein the target metadata are metadata corresponding to the target data backed up on the target server;
a first determination module for determining a storage address of the target data based on the matching result;
the second determining module is used for determining the occupied space information of the target data according to the storage address of the target data;
and the determining backup module is used for determining the size of the residual storage space of the target server based on the occupied space information of the target data and the occupied space information of the target metadata, and performing data backup on the data to be backed up according to the size of the residual storage space of the target server.
In a third aspect, the present application further provides a computer device, including a memory and a processor, where the memory stores a computer program, and the processor implements the steps of the method of any one of the above when executing the computer program:
in a fourth aspect, the present application also provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, carries out the steps of the method of any one of the above.
In a fifth aspect, the present application also provides a computer program product comprising a computer program which, when executed by a processor, performs the steps of the method of any one of the above.
The application provides a data backup method, a data backup device, a computer device, a storage medium and a computer program product, wherein the method comprises the following steps: after receiving target metadata corresponding to target data backed up on a target server and sent by the target server, the server performs character matching on the target metadata to obtain a matching result; since character matching is performed to search for a storage address of target data recorded in target metadata, if a target character for the storage address is matched, the storage address of the target data can be determined; the server may further obtain the occupied space information of the target data from the corresponding storage address in the target server according to the matched storage address of the target data. The method and the device for determining the residual storage space of the target server based on the size of the occupied space of the target data stored on the target server instead of the size of the data in the metadata of the target data have the advantages that the residual storage space of the target server can be more accurately obtained, data backup is carried out on the data to be backed up according to the residual storage space of the target server, and unreasonable distribution of the data to be backed up for the target server is avoided.
Drawings
FIG. 1 is a diagram of an application environment of a data backup method in one embodiment;
FIG. 2 is a flowchart illustrating a data backup method according to an embodiment;
FIG. 3 is a schematic flow chart diagram illustrating the data backup step in one embodiment;
FIG. 4 is a flowchart illustrating a data backup method according to another embodiment;
FIG. 5 is a block diagram of a data backup apparatus according to an embodiment;
FIG. 6 is a diagram of the internal structure of a computer device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The data backup method provided by the embodiment of the application can be applied to the application environment shown in fig. 1. Wherein the first server 102 communicates with the target server 104 over a network. Both the first server 102 and the target server 104 are provided with a data storage system, the data storage system on the first server 102 is used for storing metadata of backup data, and the data storage system on the target server 104 is used for storing the backup data and the metadata of the backup data. When the first server 102 needs to determine the size of the remaining storage space of the target server 104, a request may be first sent to the target server 104 to obtain a target metadata packet sent by the target server 104, then character matching is performed on target metadata in the target metadata packet, a storage address of the target data is determined based on a matching result, so as to search for the target data from a corresponding storage location of the target server 104 and obtain occupied space information of the target data, the first server 102 finally determines the size of the remaining storage space of the target server 104 according to the obtained occupied space information of the target data and the occupied space information of the metadata sent by the target server 104, and performs data backup on data to be backed up according to the size of the remaining storage space of the target server 104. The data storage system may be integrated on the first server 102 and the target server 104, or may be placed on a cloud or other network server. The first server 102 may be implemented by a stand-alone server or a server cluster composed of a plurality of servers, and the target server 104 may also be implemented by a stand-alone server or a server cluster composed of a plurality of servers.
Before the specific technical solutions of the present application are introduced, the main reasons for generating the technical solutions of the present application are described below:
at present, most enterprises can perform data backup on data generated in production practice, and potential safety hazards caused by the fact that the data are only stored in a unique server are prevented. In the data backup process, the size of the remaining storage space needs to be determined for the server storing the backup data, so that the backup data is more accurately allocated to the server storing the backup data. It should be noted that, in the process of data backup, metadata of all backup data may be stored in a predetermined location of the server for easy searching, but the backup data may be dispersedly stored in different memory addresses of the server, and searching needs to be performed based on the metadata to a corresponding address.
In the prior art, the size of the remaining storage space of the server is usually determined according to a metadata file stored in the server, specifically, the size of data already stored in the server is determined according to the size of data recorded in each metadata type, and finally, the size of the remaining storage space of the server is obtained. However, the size of the data recorded in the metadata is different from the size of the space actually occupied by the data in the server, for example, the size of the data recorded in the metadata is 16.8MB, but the space actually occupied by the data in the server is 16.9 MB. Therefore, the phenomenon that the residual space size of the server is determined only according to the metadata is inaccurate, so that scattered data need to be searched from different storage addresses of the server based on the storage address of the data recorded in the metadata in the server to obtain accurate occupied space information of the data on the server, and finally the determined residual storage space size of the server is more accurate.
In view of the above, in an embodiment, as shown in fig. 2, a data backup method is provided, which is described by taking the method as an example applied to the first server in fig. 1, and includes the following steps:
step S202, character matching is carried out based on the received target metadata to obtain a matching result, and the target metadata is metadata corresponding to the target data backed up on the target server.
The target metadata can be data sent to the first server by the target server based on the request of the first server; the target server may also be actively sent to the first server, which is not limited in this application. The target metadata is metadata corresponding to data backed up on a target server, and the target metadata is also called intermediate data and relay data, is mainly used for describing attribute information of the corresponding target data, and is used for supporting functions such as indicating a storage address, a data size, resource searching, file recording and the like of the target data. The target metadata corresponds to an electronic catalog, and is data provided for creating a catalog, and can assist in data retrieval. It should be noted that, when the target server sends the target metadata (the target metadata may include a plurality of metadata) to the first server, the target server may transmit the metadata file based on a transmission protocol (only a data packet with a data size corresponding to the data size is sent to the first server for each transmission) achieved by both parties, so that the first server receives only the metadata with the data size at a time to perform character matching with the data size, thereby achieving the effects of reducing the character matching pressure of the first server and improving the character matching efficiency.
The purpose of character matching the target metadata is to obtain the storage address of the record data in the target metadata in the target server. Since the storage address of the data in the target service has a fixed expression, for example, the expression is < ChunkPrefix >0x00002050 [ (ChunkPrefix > ],
<ChunkPrefix>http://127.0.0.1/phpmyadmin</ChunkPrefix>、
<ChunkPrefix>E:\oracle\product\10.2.0\client_1\NETWORK\ADMIN\tnsname.ora</ChunkPrefix>
It can be seen that < ChunkPrefix > </ChunkPrefix > can be used as a basis for obtaining the data storage address from the metadata. Then, after receiving the target metadata, it is necessary to match < ChunkPrefix > </ChunkPrefix > from the target metadata, that is, to sequentially match the characters in the target metadata with < ChunkPrefix > </ChunkPrefix >, specifically: matching the first character received by the first server with < is carried out, if the matching fails, the second character received by the first server is continuously matched with < is carried out, if the matching fails, the third character received by the first server is continuously matched with < until <, then C is carried out again until all < ChunkPrefix > </ChunkPrefix > are matched, and then the storage address of target data can be obtained.
The target server based on the above description may only transmit a data packet corresponding to the data size to the first server each time, so that the first server can only receive a part of metadata of the target metadata each time, where the part of metadata may be metadata corresponding to one data, may be partial metadata corresponding to one data, may be metadata corresponding to multiple data, may also be metadata corresponding to one data and partial metadata corresponding to another data, and the like.
Therefore, if < ChunkPrefix > </ChunkPrefix > is defined as the target preset character, the primary matching result of the first server may be, for example: successfully matching with partial target preset characters, successfully matching with all target preset characters for multiple times, failing to match with target preset characters and the like. Illustratively, the matching result is, for example: match to < Chunk, < Chunk prefix > </Chunk, no match to < Chunk prefix > </Chunk, match to < Chunk prefix > </Chunk prefix >, match to 3 < Chunk prefix > </Chunk prefix >, etc.
Then, if the first server wants to obtain the target metadata corresponding to all the data stored on the target server, the first server may perform the above-mentioned character matching a plurality of times to obtain the address matching result of all the data. It should be noted that, the first server may also determine the size of the remaining storage space of the target server once after the target server performs data backup each time, so that the target metadata here may not be metadata of all data stored in the target server, may be metadata corresponding to the backup data of this time after the target server performs data backup once, and may determine the size of the remaining storage space of the target server based on the space occupation information of the backup data of this time and the space occupation information of the historical data determined by the above method when determining the size of the remaining storage space of the target server subsequently, which is not linear in this application.
Step S204, the storage address of the target data is determined based on the matching result.
Based on the above description, taking the target metadata as metadata of all data stored on the target server as an example, the primary matching result of the first server may be, for example: matching with part of target preset characters successfully, matching with all of the target preset characters successfully for multiple times, matching with the target preset characters unsuccessfully and the like, so that the first server can obtain a storage address of one data based on one matching result; the storage addresses of a plurality of data can be obtained based on one matching result; a partial memory address of one data may be obtained based on a result of one matching; there may be a case where a memory address of one data is not obtained based on a result of one matching, and the like, which are not exemplified here.
Finally, a storage address for obtaining all data stored on the target server may be determined from a plurality of matching results obtained by character matching of the target metadata by the first server.
Step S206, determining the occupation space information of the target data according to the storage address of the target data.
According to the storage address of the target data obtained in the above step, the first server may find the corresponding target data from the target server according to the storage address, and then read the attribute information of the target data, so as to obtain the occupied space information of the target data.
Step S208, determining the size of the residual storage space of the target server based on the occupied space information of the target data and the occupied space information of the target metadata, and performing data backup on the data to be backed up according to the size of the residual storage space of the target server.
The first server can easily read the occupied space information of the metadata file because the metadata file has a fixed storage position in the target server; and the target server sends the metadata file to the first server, so that the first server can easily confirm the occupied space information of the received metadata file. The first server may continue to determine the occupied space size of the target server based on the obtained occupied space information of the target data and the occupied space information of the target metadata, and then may subtract the occupied space size from the total storage space size of the target server to obtain the remaining storage space size of the target server.
Finally, for example, the size of the remaining space of the target server is 50G, when the enterprise has 60G of data to be backed up, only 50G of data can be allocated to the target server, and the remaining 10G of data can be allocated to other servers with the size of the remaining storage space greater than or equal to 10G for storage, so as to achieve the purpose of reasonably allocating storage resources.
The application provides a data backup method, which comprises the following steps: after receiving target metadata corresponding to target data backed up on a target server and sent by the target server, the server performs character matching on the target metadata to obtain a matching result; since character matching is performed to search for a storage address of target data recorded in target metadata, if a target character for the storage address is matched, the storage address of the target data can be determined; the server may further obtain the occupied space information of the target data from the corresponding storage address in the target server according to the matched storage address of the target data. The method and the device for determining the residual storage space of the target server based on the size of the occupied space of the target data stored on the target server instead of the size of the data in the metadata of the target data have the advantages that the residual storage space of the target server can be more accurately obtained, data backup is carried out on the data to be backed up according to the residual storage space of the target server, and unreasonable distribution of the data to be backed up for the target server is avoided.
Optionally, the method may perform character matching on the target metadata according to a predetermined matching policy based on a character receiving order of the target metadata to obtain a matching result.
The matching policy may be, for example, a corresponding match, a complete match, a partial match, or the like. The correspondence match may be, for example: the first server starts matching with the character when receiving a character; a perfect match may be, for example: after the first server receives a data packet sent by the target server every time, matching the metadata in the data packet with < ChunkPrefix > </ChunkPrefix > at one time; a perfect match may also be, for example: after receiving all data packets sent by a target server, a first server matches metadata in all the data packets with < ChunkPrefix > </ChunkPrefix > at one time; the partial matching may be, for example, that the first server starts matching with < ChunkPrefix > </ChunkPrefix > once after receiving the partial target metadata; for example, the partial matching may be that the first server starts to match with a partial character in < ChunkPrefix > </ChunkPrefix > at a time after receiving part or all of the target metadata, and the like, which is not limited in this application. It is mainly stated here that whether it is a corresponding match, a complete match, or a partial match, the matching manner is unique, that is, a character-by-character match with < ChunkPrefix > </ChunkPrefix > in the receiving order, with the difference that the matching time is different.
Further, according to the method and the device, based on the character receiving sequence of the target metadata, character matching is performed on the characters of the target metadata in sequence from the first character in the target metadata to the last character in the target metadata, and a matching result is obtained.
Illustratively, the first server receives that the target metadata sent by the target server is abcdefg < ChunkPrefix >0x00002050</ChunkPrefix > hijklmn, then the first server may match a with < ChunkPrefix > </ChunkPrefix >, then match b with < ChunkPrefix > </ChunkPrefix >, then match c with < ChunkPrefix > </ChunkPrefix >, and so on until n is matched, so as to obtain a matching result of < ChunkPrefix >0x00002050</ChunkPrefix >.
In one embodiment, as shown in fig. 3, fig. 3 is a character matching method provided in an embodiment of the present application, where the method includes the following steps:
step S302, if a first target character exists in the target metadata, determining a starting position offset according to position information of the first target character, and sequentially carrying out corresponding matching on the residual characters in the target metadata and a first preset character; the first target character is a first character in the first target character string, and the first character is successfully matched with a first character in each first preset character.
Step S304, if the matching of the residual characters and the first preset character is successful, updating the initial position offset to obtain a middle position offset according to the position information of the residual characters, wherein the residual characters comprise other characters except the first target character in the first target character string and all characters in the second target character string;
in step S306, if the middle position offset is equal to the target position offset, the first target character string, the second target character string, and the character between the first target character string and the second target character string are used as the matching result.
Here, this technical solution is exemplified: exemplarily, continuing to take the example that the target metadata is abcdefg < ChunkPrefix >0x00002050</ChunkPrefix > hijklmn, where < ChunkPrefix > in the target metadata is a first target character string, </ChunkPrefix > is a second target character string, the first preset character is < ChunkPrefix > </ChunkPrefix >, and the first server matches a with < and fails to match in sequence; matching b with < and failing to match; matching c with < and failing matching; … … until matching < and < succeeds, the first target character is <. Then the offset of < is determined as the starting position offset, which may be setting the starting position offset to any one of values of 0, 1, 2, 3, etc., and then matching C in the target metadata with C in the first preset character, where the matching is successful, and the offset is increased by 1, for example, to 2; matching h in the target metadata with h in the first preset character, wherein the matching is successful, and the offset is added by 1, for example, 3; matching n in the target metadata with n in the first preset character, wherein the matching is successful, and the offset is added by 1, for example, 4; … …; when the < ChunkPrefix > … … </ChunkPrefix > in the target metadata and the first preset character < ChunkPrefix > </ChunkPrefix > are all matched successfully, the obtained intermediate position offset is 25, and since the offset of the first preset character is 25 and all the matching is successful, the first server may use < ChunkPrefix >0x00002050</ChunkPrefix > as the matching result.
It should be noted that, if the target metadata is abcdefg < chunkbcdPrefix lmn < chunkPrefix >0x00002050</chunkPrefix > hijklmn, when the first server is matched to < b >, it is determined that the first target character exists, but when the first server is continuously matched downwards, it is found that the character below the target character k should be P, or the target metadata may be a, and if the matching between a and P in the first preset character fails, at this time, the offset of a needs to be set to null, that is, the first target character needs to be matched again to determine the start position offset. Therefore, when the first server matches again, the starting position offset of < is set to 1, and the above steps are repeatedly executed, and finally the matching result of < ChunkPrefix >0x00002050</ChunkPrefix > is obtained.
According to the data backup method, according to the character receiving sequence of the target metadata, corresponding matching is carried out from the first character to the last first character, the first character is matched with the first preset character, the phenomenon of missing matching can be avoided, meanwhile, whether the target character is matched or not is represented by setting the offset in the matching process, follow-up matching determination is facilitated, the efficiency of obtaining a matching result can be improved, and mistakes are avoided.
Based on a situation occurring in the above character matching process, the situation is ideal, and when the first server receives the metadata sent by the target server once, the metadata includes a storage address of the data. There is also a case where the metadata sent by the target server to the first server contains only a partial storage address of the data, and this case requires the first server to combine the result of the history matching with the current matching result to obtain a complete data storage address.
It should be noted here that, based on the above situation, two cache spaces may be provided in the first server, where one cache space is used to store metadata with a predetermined data size sent by the current target server, and the other cache space is used to store metadata with a predetermined data size that is matched, where the storage spaces of the two cache spaces are the same. Illustratively, a first cache space and a second cache space are arranged in a first server, a target server sends a data packet to the first server at 12:00, and the first server stores the data in the first cache space, where the data packet includes the following metadata: abcdefg < Chunk. After the character matching in the above process, the obtained matching result is that the matching is successful to < Chunk, the intermediate offset is 7, and then the first server removes abcdefg < Chunk from the first cache space and moves the abcdefg < Chunk into the second cache space; when the target server sends another data packet to the first server in 12:01, the first server stores the data packet into the first cache space, for example, the data packet includes Prefix0x00002050 ChunkPrefix >, the matching result obtained through the character matching in the above process is successfully matched with Prefix0x00002050 ChunkPrefix, and the intermediate offset continues to be increased by 7, so that the final intermediate offset is 25. And the first server also obtains a matching result of data < ChunkPrefix >0x00002050</ChunkPrefix >.
An embodiment as shown in fig. 4 is thus produced, which method embodiment comprises the following steps:
step S402, if a first target character exists in the target metadata, determining a starting position offset according to the position information of the first target character, and sequentially carrying out corresponding matching on a first residual character in the target metadata and a first preset character; the first target character is a first character in the first target character string, which is successfully matched with a first character in each first preset character;
step S404, if the first residual character is successfully matched with the first part of characters in the first preset character, updating the initial position offset according to the position information of the first residual character to obtain a first intermediate position offset, wherein the first residual character is one of other part characters except the first target character in the first target character string, other characters except the first target character in the first target character string and other characters except the first target character in the first target character string or part characters in the second target character string;
step S406, if a second residual character exists in the next metadata of the target metadata, updating the first intermediate position offset according to the position information of the second residual character to obtain a second intermediate position offset, wherein the second residual character comprises other characters except the first residual character in all characters of the first target character string and the second target character string;
in step S408, if the second intermediate position offset is equal to the target position offset, the first target character string, the second target character string, and the character between the first target character string and the second target character string are used as the matching result.
For the description of the embodiment, the above-mentioned words have been described by way of example, and are not described herein again.
Meanwhile, as can be seen from the above description, the first server may include a first cache space and a second cache space, where a size of a storage space of the first cache space is greater than or equal to a data size of the target metadata, and a size of the storage space of the first cache space is equal to a size of a storage space of the second cache space, so that the first server may further perform the following operations:
and under the condition that the target metadata match is completed, moving the target metadata from the first cache space to the second cache space for storage, and storing the next metadata of the target metadata into the first cache space.
Further, according to the above steps, after the first server obtains the character matching for the character of the metadata sent by the target server, a matching result is obtained, for example, < ChunkPrefix >0x00002050</ChunkPrefix >, then 0x00002050 may be used as the storage address of one data stored in the target server, and so on, after the first server performs multiple matching for the target metadata sent by the target server, the storage address of all data matched with the target metadata on the target server may be obtained. That is, the storage address of the target data is the character between the first target character string and the second target character string.
To this end, the above description mostly takes the example of sending metadata of a predetermined data size to the first server by the target server every time, and thus the overall technical solution is explained. The present application describes the target metadata as a whole schema of metadata corresponding to all data stored on the target server, there occurs a result based on character matching of the target metadata, a matching result is obtained, the matching result is a storage address character string corresponding to all data stored on the target server, and further, determining the storage addresses of all the data stored on the target server according to the storage address character strings corresponding to all the data stored on the target server, and finally, the first server can search the occupied space information of the target data from the target server according to the storage addresses of all the data stored on the target server, the target data refers to all data stored on the target server, and the size of the residual storage space of the target server is determined according to the occupied space information of the target data and the occupied space information of the target metadata. According to the technical scheme, accurate occupied space information of all data stored on the target server can be obtained, so that the size of the residual storage space of the target server can be more accurately determined based on the occupied space information of all the data stored on the target server, and reasonable distribution of storage resources is achieved.
It should be understood that, although the steps in the flowcharts related to the embodiments as described above are sequentially displayed as indicated by arrows, the steps are not necessarily performed sequentially as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a part of the steps in the flowcharts related to the embodiments described above may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the execution order of the steps or stages is not necessarily sequential, but may be rotated or alternated with other steps or at least a part of the steps or stages in other steps.
Based on the same inventive concept, the embodiment of the present application further provides a data backup device for implementing the above-mentioned data backup method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme described in the method, so specific limitations in one or more embodiments of the data backup device provided below may refer to the limitations on the data backup method in the foregoing, and details are not described here.
In one embodiment, as shown in fig. 5, there is provided a data backup apparatus including: a character matching module 502, a first determination module 504, a second determination module 506, and a determination backup module 508, wherein:
a character matching module 502, configured to perform character matching based on the received target metadata to obtain a matching result, where the target metadata is metadata corresponding to target data backed up on a target server;
a first determining module 504, configured to determine a storage address of the target data based on the matching result;
a second determining module 506, configured to determine, according to the storage address of the target data, occupied space information of the target data;
and the determining and backup module 508 is configured to determine the size of the remaining storage space of the target server based on the occupied space information of the target data and the occupied space information of the target metadata, and perform data backup on the data to be backed up according to the size of the remaining storage space of the target server.
In an embodiment, the character matching module 502 is specifically configured to perform character matching on the target metadata according to a predetermined matching policy based on a character receiving order of the target metadata, so as to obtain a matching result.
In an embodiment, the character matching module 502 is further specifically configured to perform character matching on characters of the target metadata in sequence from a first character in the target metadata to a last character in the target metadata based on a character receiving sequence of the target metadata, so as to obtain a matching result.
In an embodiment, the character matching module 502 is further configured to, if a first target character exists in the target metadata, determine a starting position offset according to position information of the first target character, and sequentially perform corresponding matching on remaining characters in the target metadata and a first preset character; the first target character is a first character in the first target character string, which is successfully matched with a first character in each first preset character;
if the matching of the residual characters and the first preset character is successful, updating the initial position offset to obtain a middle position offset according to the position information of the residual characters, wherein the residual characters comprise other characters except the first target character in the first target character string and all characters in the second target character string;
and if the intermediate position offset is equal to the target position offset, taking the first target character string, the second target character string and the characters between the first target character string and the second target character string as matching results.
In an embodiment, the character matching module 502 is further configured to, if a first target character exists in the target metadata, determine a starting position offset according to position information of the first target character, and sequentially perform corresponding matching on a first remaining character in the target metadata and a first preset character; the first target character is a first character in the first target character string, which is successfully matched with a first character in each first preset character;
if the first residual character is successfully matched with the first part of characters in the first preset character, updating the initial position offset to obtain a first intermediate position offset according to the position information of the first residual character, wherein the first residual character is one of other part characters except the first target character in the first target character string, other characters except the first target character in the first target character string and other characters except the first target character in the first target character string or part characters in the second target character string;
if a second residual character exists in the next metadata of the target metadata, updating the first intermediate position offset according to the position information of the second residual character to obtain a second intermediate position offset, wherein the second residual character comprises other characters except the first residual character in all characters of the first target character string and the second target character string;
and if the second intermediate position offset is equal to the target position offset, taking the first target character string, the second target character string and the characters between the first target character string and the second target character string as matching results.
In an embodiment, the target server includes a first cache space and a second cache space, a size of a storage space of the first cache space is greater than or equal to a data size of the target metadata, and a size of the storage space of the first cache space is equal to a size of a storage space of the second cache space.
In one embodiment, the first determining module 504 is specifically configured to use a character between the first target character string and the second target character string as a storage address of the target data.
The modules in the data backup apparatus may be implemented in whole or in part by software, hardware, and a combination thereof. The modules can be embedded in a hardware form or independent of a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as shown in fig. 6. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer device is used for storing metadata and data ontology. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a data backup method.
Those skilled in the art will appreciate that the architecture shown in fig. 6 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the following steps when executing the computer program:
performing character matching based on the received target metadata to obtain a matching result, wherein the target metadata is metadata corresponding to the target data backed up on a target server;
determining a storage address of the target data based on the matching result;
determining occupied space information of the target data according to the storage address of the target data;
and determining the size of the residual storage space of the target server based on the occupied space information of the target data and the occupied space information of the target metadata, and performing data backup on the data to be backed up according to the size of the residual storage space of the target server.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
and carrying out character matching on the target metadata according to a preset matching strategy based on the character receiving sequence of the target metadata to obtain a matching result.
In one embodiment, the processor when executing the computer program further performs the steps of:
and performing character matching on the characters of the target metadata in sequence from the first character in the target metadata to the last character in the target metadata based on the character receiving sequence of the target metadata to obtain a matching result.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
if the first target character exists in the target metadata, determining the offset of the starting position according to the position information of the first target character, and sequentially carrying out corresponding matching on the residual characters in the target metadata and the first preset character; the first target character is a first character in the first target character string, which is successfully matched with a first character in each first preset character;
if the matching of the residual characters and the first preset character is successful, updating the initial position offset to obtain a middle position offset according to the position information of the residual characters, wherein the residual characters comprise other characters except the first target character in the first target character string and all characters in the second target character string;
and if the intermediate position offset is equal to the target position offset, taking the first target character string, the second target character string and the characters between the first target character string and the second target character string as matching results.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
if the first target character exists in the target metadata, determining the starting position offset according to the position information of the first target character, and sequentially carrying out corresponding matching on the first residual character in the target metadata and the first preset character; the first target character is a first character in the first target character string, which is successfully matched with a first character in each first preset character;
if the first residual character is successfully matched with the first part of characters in the first preset character, updating the initial position offset to obtain a first intermediate position offset according to the position information of the first residual character, wherein the first residual character is one of other part characters except the first target character in the first target character string, other characters except the first target character in the first target character string and other characters except the first target character in the first target character string or part characters in the second target character string;
if a second residual character exists in the next metadata of the target metadata, updating the first intermediate position offset according to the position information of the second residual character to obtain a second intermediate position offset, wherein the second residual character comprises other characters except the first residual character in all characters of the first target character string and the second target character string;
and if the second intermediate position offset is equal to the target position offset, taking the first target character string, the second target character string and the characters between the first target character string and the second target character string as matching results.
In one embodiment, the target server includes a first cache space and a second cache space, a size of a storage space of the first cache space is greater than or equal to a data size of the target metadata, and a size of the storage space of the first cache space is equal to a size of a storage space of the second cache space, and the processor further implements the following steps when executing the computer program:
and if the target metadata are matched, moving the target metadata from the first cache space to the second cache space for storage, and storing the next metadata of the target metadata into the first cache space.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
and taking the character between the first target character string and the second target character string as a storage address of the target data.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of:
performing character matching based on the received target metadata to obtain a matching result, wherein the target metadata is metadata corresponding to the target data backed up on a target server;
determining a storage address of the target data based on the matching result;
determining occupied space information of the target data according to the storage address of the target data;
and determining the size of the residual storage space of the target server based on the occupied space information of the target data and the occupied space information of the target metadata, and performing data backup on the data to be backed up according to the size of the residual storage space of the target server.
In one embodiment, the computer program when executed by the processor further performs the steps of:
and carrying out character matching on the target metadata according to a preset matching strategy based on the character receiving sequence of the target metadata to obtain a matching result.
In one embodiment, the computer program when executed by the processor further performs the steps of:
and performing character matching on the characters of the target metadata in sequence from the first character in the target metadata to the last character in the target metadata based on the character receiving sequence of the target metadata to obtain a matching result.
In one embodiment, the computer program when executed by the processor further performs the steps of:
if the first target character exists in the target metadata, determining the offset of the starting position according to the position information of the first target character, and sequentially carrying out corresponding matching on the residual characters in the target metadata and the first preset character; the first target character is a first character in the first target character string, which is successfully matched with a first character in each first preset character;
if the matching of the residual characters and the first preset character is successful, updating the initial position offset to obtain a middle position offset according to the position information of the residual characters, wherein the residual characters comprise other characters except the first target character in the first target character string and all characters in the second target character string;
and if the intermediate position offset is equal to the target position offset, taking the first target character string, the second target character string and the characters between the first target character string and the second target character string as matching results.
In one embodiment, the computer program when executed by the processor further performs the steps of:
if the first target character exists in the target metadata, determining the starting position offset according to the position information of the first target character, and sequentially carrying out corresponding matching on the first residual character in the target metadata and the first preset character; the first target character is a first character in the first target character string, which is successfully matched with a first character in each first preset character;
if the first residual character is successfully matched with the first part of characters in the first preset character, updating the initial position offset to obtain a first intermediate position offset according to the position information of the first residual character, wherein the first residual character is one of the other part characters except the first target character in the first target character string, the other characters except the first target character in the first target character string and the other characters except the first target character in the first target character string or the part characters in the second target character string;
if a second residual character exists in the next metadata of the target metadata, updating the first intermediate position offset according to the position information of the second residual character to obtain a second intermediate position offset, wherein the second residual character comprises other characters except the first residual character in all characters of the first target character string and the second target character string;
and if the second intermediate position offset is equal to the target position offset, taking the first target character string, the second target character string and the characters between the first target character string and the second target character string as matching results.
In one embodiment, the target server includes a first cache space and a second cache space, a size of a storage space of the first cache space is greater than or equal to a data size of the target metadata, and a size of the storage space of the first cache space is equal to a size of a storage space of the second cache space, and the processor further implements the following steps when executing the computer program:
and if the target metadata are matched, moving the target metadata from the first cache space to the second cache space for storage, and storing the next metadata of the target metadata into the first cache space.
In one embodiment, the computer program when executed by the processor further performs the steps of:
and taking characters between the first target character string and the second target character string as storage addresses of target data.
Performing character matching based on the received target metadata to obtain a matching result, wherein the target metadata is metadata corresponding to the target data backed up on a target server;
determining a storage address of the target data based on the matching result;
determining occupied space information of the target data according to the storage address of the target data;
and determining the size of the residual storage space of the target server based on the occupied space information of the target data and the occupied space information of the target metadata, and performing data backup on the data to be backed up according to the size of the residual storage space of the target server.
In one embodiment, the computer program when executed by the processor further performs the steps of:
and carrying out character matching on the target metadata according to a preset matching strategy based on the character receiving sequence of the target metadata to obtain a matching result.
In one embodiment, the computer program when executed by the processor further performs the steps of:
and performing character matching on the characters of the target metadata in sequence from the first character in the target metadata to the last character in the target metadata based on the character receiving sequence of the target metadata to obtain a matching result.
In one embodiment, the computer program when executed by the processor further performs the steps of:
if the first target character exists in the target metadata, determining the offset of the starting position according to the position information of the first target character, and sequentially carrying out corresponding matching on the residual characters in the target metadata and the first preset character; the first target character is a first character in the first target character string, which is successfully matched with a first character in each first preset character;
if the matching of the residual characters and the first preset character is successful, updating the initial position offset to obtain a middle position offset according to the position information of the residual characters, wherein the residual characters comprise other characters except the first target character in the first target character string and all characters in the second target character string;
and if the intermediate position offset is equal to the target position offset, taking the first target character string, the second target character string and the characters between the first target character string and the second target character string as matching results.
In one embodiment, the computer program when executed by the processor further performs the steps of:
if the first target character exists in the target metadata, determining the starting position offset according to the position information of the first target character, and sequentially carrying out corresponding matching on the first residual character in the target metadata and the first preset character; the first target character is a first character in the first target character string, which is successfully matched with a first character in each first preset character;
if the first residual character is successfully matched with the first part of characters in the first preset character, updating the initial position offset to obtain a first intermediate position offset according to the position information of the first residual character, wherein the first residual character is one of other part characters except the first target character in the first target character string, other characters except the first target character in the first target character string and other characters except the first target character in the first target character string or part characters in the second target character string;
if a second residual character exists in the next metadata of the target metadata, updating the first intermediate position offset according to the position information of the second residual character to obtain a second intermediate position offset, wherein the second residual character comprises other characters except the first residual character in all characters of the first target character string and the second target character string;
and if the second intermediate position offset is equal to the target position offset, taking the first target character string, the second target character string and the characters between the first target character string and the second target character string as matching results.
In one embodiment, the target server includes a first cache space and a second cache space, a size of a storage space of the first cache space is greater than or equal to a data size of the target metadata, and a size of the storage space of the first cache space is equal to a size of a storage space of the second cache space, and the processor further implements the following steps when executing the computer program:
and if the target metadata are matched, moving the target metadata from the first cache space to the second cache space for storage, and storing the next metadata of the target metadata into the first cache space.
In one embodiment, the computer program when executed by the processor further performs the steps of:
and taking the character between the first target character string and the second target character string as a storage address of the target data.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high-density embedded nonvolatile Memory, resistive Random Access Memory (ReRAM), Magnetic Random Access Memory (MRAM), Ferroelectric Random Access Memory (FRAM), Phase Change Memory (PCM), graphene Memory, and the like. Volatile Memory can include Random Access Memory (RAM), external cache Memory, and the like. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others. The databases referred to in various embodiments provided herein may include at least one of relational and non-relational databases. The non-relational database may include, but is not limited to, a block chain based distributed database, and the like. The processors referred to in the embodiments provided herein may be general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic devices, quantum computing based data processing logic devices, etc., without limitation.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present application. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.
Claims (10)
1. A method for data backup, the method comprising:
performing character matching based on received target metadata to obtain a matching result, wherein the target metadata is metadata corresponding to target data backed up on a target server;
determining a storage address of the target data based on the matching result;
determining occupied space information of the target data according to the storage address of the target data;
and determining the size of the residual storage space of the target server based on the occupied space information of the target data and the occupied space information of the target metadata, and performing data backup on the data to be backed up according to the size of the residual storage space of the target server.
2. The method of claim 1, wherein the character matching the target metadata to obtain a matching result comprises:
and performing character matching on the target metadata according to a preset matching strategy based on the character receiving sequence of the target metadata to obtain the matching result.
3. The method according to claim 2, wherein the character matching the target metadata according to a predetermined matching policy based on the character receiving order of the target metadata to obtain the matching result comprises:
and performing character matching on the characters of the target metadata in sequence from the first character in the target metadata to the last character in the target metadata based on the character receiving sequence of the target metadata to obtain the matching result.
4. The method according to claim 3, wherein said performing character matching on characters of the target metadata in sequence starting from a first character in the target metadata until a last character in the target metadata based on a character receiving order of the target metadata to obtain the matching result comprises:
if the target metadata contains a first target character, determining a starting position offset according to position information of the first target character, and sequentially carrying out corresponding matching on the residual characters in the target metadata and a first preset character; the first target character is a first character in a first target character string, and the first character is successfully matched with a first character in each first preset character;
if the matching of the residual characters and the first preset character is successful, updating the initial position offset to obtain a middle position offset according to the position information of the residual characters, wherein the residual characters comprise other characters except the first target character in the first target character string and all characters in a second target character string;
and if the intermediate position offset amount is equal to a target position offset amount, taking the first target character string, the second target character string and characters between the first target character string and the second target character string as the matching result.
5. The method according to claim 3, wherein said performing character matching on characters of the target metadata in sequence starting from a first character in the target metadata until a last character in the target metadata based on a character receiving order of the target metadata to obtain the matching result comprises:
if the target metadata has a first target character, determining a starting position offset according to position information of the first target character, and sequentially carrying out corresponding matching on a first residual character in the target metadata and a first preset character; the first target character is a first character in a first target character string, and the first character is successfully matched with a first character in each first preset character;
if the first residual character is successfully matched with a first part of characters in the first preset character, updating the initial position offset to obtain a first intermediate position offset according to the position information of the first residual character, wherein the first residual character is one of other part characters except the first target character in the first target character string, other characters except the first target character in the first target character string, and other characters except the first target character in the first target character string or part characters in a second target character string;
if a second residual character exists in the next metadata of the target metadata, updating the first intermediate position offset according to the position information of the second residual character to obtain a second intermediate position offset, wherein the second residual character comprises other characters except the first residual character in all characters of the first target character string and the second target character string;
and if the second intermediate position offset is equal to a target position offset, taking the first target character string, the second target character string and characters between the first target character string and the second target character string as the matching result.
6. The method of claim 5, wherein the target server comprises a first cache space and a second cache space, wherein a size of a storage space of the first cache space is equal to or larger than a data size of the target metadata, and wherein a size of a storage space of the first cache space is equal to a size of a storage space of the second cache space, the method further comprising:
and if the target metadata is matched, moving the target metadata from the first cache space to the second cache space for storage, and storing the next metadata of the target metadata into the first cache space.
7. The method according to claim 4 or 5, wherein the determining the storage address of the target data based on the matching result comprises:
and taking characters between the first target character string and the second target character string as storage addresses of the target data.
8. A data backup apparatus, characterized in that the apparatus comprises:
the character matching module is used for carrying out character matching based on received target metadata to obtain a matching result, wherein the target metadata are metadata corresponding to the target data backed up on the target server;
a first determination module for determining a storage address of the target data based on the matching result;
the second determining module is used for determining the occupied space information of the target data according to the storage address of the target data;
and the determining backup module is used for determining the size of the residual storage space of the target server based on the occupied space information of the target data and the occupied space information of the target metadata, and performing data backup on the data to be backed up according to the size of the residual storage space of the target server.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, implements the steps of the method of any of claims 1 to 7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210507743.2A CN114968560A (en) | 2022-05-11 | 2022-05-11 | Data backup method and device, computer equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210507743.2A CN114968560A (en) | 2022-05-11 | 2022-05-11 | Data backup method and device, computer equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114968560A true CN114968560A (en) | 2022-08-30 |
Family
ID=82981049
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210507743.2A Pending CN114968560A (en) | 2022-05-11 | 2022-05-11 | Data backup method and device, computer equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114968560A (en) |
-
2022
- 2022-05-11 CN CN202210507743.2A patent/CN114968560A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20100312749A1 (en) | Scalable lookup service for distributed database | |
CN106407207B (en) | Real-time newly-added data updating method and device | |
US11294875B2 (en) | Data storage on tree nodes | |
CN106682215B (en) | Data processing method and management node | |
CN111177143B (en) | Key value data storage method and device, storage medium and electronic equipment | |
US11288274B1 (en) | System and method for storing data for, and providing, rapid database join functions and aggregation statistics | |
CN106776795B (en) | Data writing method and device based on Hbase database | |
CN109325026B (en) | Data processing method, device, equipment and medium based on big data platform | |
CN113901395B (en) | Data processing method, data processing device, computer equipment and storage medium | |
US8271500B2 (en) | Minimal perfect hash functions using double hashing | |
CN115756955A (en) | Data backup and data recovery method and device and computer equipment | |
CN115470156A (en) | RDMA-based memory use method, system, electronic device and storage medium | |
CN114089921A (en) | Power system data storage method and device, computer equipment and storage medium | |
CN112527479A (en) | Task execution method and device, computer equipment and storage medium | |
CN115168499B (en) | Database table fragmentation method and device, computer equipment and storage medium | |
CN114968560A (en) | Data backup method and device, computer equipment and storage medium | |
CN114416689A (en) | Data migration method and device, computer equipment and storage medium | |
CN114816751A (en) | Data processing method and server | |
CN110162542B (en) | Data page turning method and device based on cassandra, computer equipment and storage medium | |
CN114064806A (en) | Distributed serial number generation method and device, computer equipment and storage medium | |
CN117290354A (en) | Data processing method, device, computer equipment and storage medium | |
CN117194729A (en) | Power data storage method, apparatus, device, storage medium, and program product | |
CN117743299A (en) | Database migration method, device, equipment, medium and product | |
CN117931825A (en) | Sequence number generation method, system, device, computer equipment and storage medium | |
CN115438074A (en) | Information presentation method, information presentation device, computer equipment, storage medium and program product |
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 |