Data backup method, system and device, medium and program product
By determining the weight and sorting of the backup nodes in the data backup system, grouping and determining the master backup node and slave backup node, realizing proportionally distributed data backup, solving the problem of long and low efficiency in the existing technology, and improving the efficiency of data backup.
Patent Information
- Application Number
- CN202411982774.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-05-02
AI Technical Summary
When existing data backup methods backup data on multiple backup nodes, they are longer and less efficient.
By determining the weight of the backup node, and sorting from high to low based on the weights, grouping the master backup node and slave backup node to achieve proportionally distributed backup of the data.
Reduces the amount of backup data for each backup node, shortens data backup time, and improves backup efficiency.
Smart Images

Figure CN119917343A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data management technology, and in particular to a data backup method, system, device, medium and program product. Background Art
[0002] Data backup refers to the process of copying and storing data to other locations. For example, data can be copied and stored on a backup node so that when the data is lost, damaged, or suffers other problems, it can be restored through the backed-up data on the backup node.
[0003] At present, the method of backing up data is mainly to back up on multiple backup nodes separately to avoid the problem that a single backup node fails and all backup data is lost, thereby losing data protection. However, the above backup method takes a long time and has low backup efficiency. Summary of the invention
[0004] The embodiments of the present application provide a data backup method, system, device, medium and program product to improve the efficiency of data backup.
[0005] In a first aspect, an embodiment of the present application provides a data backup method, including:
[0006] Determine multiple backup nodes corresponding to the database to be backed up in the primary node;
[0007] Determine the weight of the backup node, where the weight of the backup node is positively correlated with the data backup efficiency of the backup node;
[0008] Based on the weights of the backup nodes, at least two master backup nodes and a first slave backup node corresponding to the master backup node are determined from the backup nodes; the at least two master backup nodes are used to respectively store data in different data backup ranges in the database, and the first slave backup node is used to back up the data in the database stored in the corresponding master backup node;
[0009] Determine the data backup range of the primary backup node based on the data range stored in the database;
[0010] Based on the data backup range of the master backup node, a backup task is issued to the master backup node to trigger the master backup node to obtain data of the corresponding data backup range from the database in parallel and synchronize it to the corresponding first slave backup node.
[0011] In a possible implementation manner, determining the weight of the backup node includes:
[0012] The weight of the backup node is determined based on the distance between the backup node and the primary node, and / or the storage efficiency of the storage medium of the backup node; the distance is negatively correlated with the weight, and the storage efficiency is positively correlated with the weight.
[0013] In a possible implementation, the determining at least two primary backup nodes from the backup nodes based on the weights of the backup nodes, and the first secondary backup node corresponding to the primary backup nodes, includes:
[0014] Sort the backup nodes according to the weights of the backup nodes from high to low;
[0015] The sorted backup nodes are grouped to obtain a master backup node group and at least one first slave backup node group; a master backup node in the master backup node group corresponds to a first slave backup node in the first slave backup node group, and the weights of the master backup nodes in the master backup node group are higher than the weights of the first slave backup nodes in the corresponding first slave backup node group.
[0016] In a possible implementation manner, grouping the sorted backup nodes to obtain a primary backup node group and at least one first secondary backup node group includes:
[0017] The sorted backup nodes are grouped to obtain the primary backup node group, at least one of the first secondary backup node groups, and at least one second secondary backup node group; the second secondary backup node group includes at least one second secondary backup node; the weight of the second secondary backup node is less than that of any of the first secondary backup nodes, and the second secondary backup nodes are used to back up the data in the database stored in all the primary backup nodes;
[0018] The backup task is used to instruct the master backup node to obtain corresponding data from the database and synchronize the data to the corresponding first slave backup node and the second slave backup node.
[0019] In a possible implementation, the method further includes:
[0020] Send synchronization information to the backup node, where the synchronization information is used to synchronize the data backup range of other backup nodes.
[0021] In a second aspect, an embodiment of the present application provides a data backup method, wherein a database to be backed up in a master node corresponds to multiple backup nodes, and the multiple backup nodes include: at least two master backup nodes, and a first slave backup node corresponding to the master backup node; the at least two master backup nodes are used to respectively store data in different data backup ranges in the database, and the first slave backup node is used to back up the data in the database stored in the corresponding master backup node; the weight of the backup node is positively correlated with the data backup efficiency of the backup node; the method is applied to the master backup node, and the method includes:
[0022] Receive backup tasks;
[0023] Based on the backup task, acquiring and storing data corresponding to the data backup range from the database in the master node;
[0024] The stored data is synchronized to the corresponding first slave backup node.
[0025] In a possible implementation manner, the backup node further includes at least one second slave backup node; the weight of the second slave backup node is smaller than that of any of the first slave backup nodes, and is used to back up the data in the database stored in all the master backup nodes;
[0026] The method further comprises:
[0027] The stored data is synchronized to the corresponding second slave backup node.
[0028] In a possible implementation, the method further includes:
[0029] Synchronization information is received, where the synchronization information is used to synchronize the data backup range of other backup nodes.
[0030] In a third aspect, an embodiment of the present application provides a database system, the database system comprising: a master node, multiple backup nodes corresponding to a database to be backed up in the master node, and a control node; the multiple backup nodes include: at least two master backup nodes, and a first slave backup node corresponding to the master backup node;
[0031] The control node is used to execute the method according to any one of the first aspects;
[0032] The master backup node is used to execute the method as described in any one of the second aspects;
[0033] The first slave backup node is used to receive data in the database stored therein that is synchronized with the corresponding master backup node.
[0034] In a fourth aspect, an embodiment of the present application provides a data backup device, the device comprising:
[0035] A first determination module is used to determine multiple backup nodes corresponding to the database to be backed up in the master node;
[0036] A second determination module is used to determine the weight of the backup node, where the weight of the backup node is positively correlated with the data backup efficiency of the backup node;
[0037] A third determination module is used to determine at least two master backup nodes from the backup nodes based on the weights of the backup nodes, and a first slave backup node corresponding to the master backup node; the at least two master backup nodes are used to respectively store data in different data backup ranges in the database, and the first slave backup node is used to back up the data in the database stored in the corresponding master backup node;
[0038] A fourth determination module, determining a data backup range of the primary backup node based on a data range stored in the database;
[0039] The sending module is used to send backup tasks to the master backup node based on the data backup range of the master backup node, so as to trigger the master backup node to obtain data of the corresponding data backup range from the database in parallel and synchronize it to the corresponding first slave backup node.
[0040] In a fifth aspect, an embodiment of the present application provides a data backup device, which is applied to a primary backup node, including:
[0041] A receiving module, used for receiving backup tasks;
[0042] A storage module, used for acquiring and storing data corresponding to a data backup range from a database in the master node based on the backup task;
[0043] The synchronization module is used to synchronize the stored data to the corresponding first slave backup node.
[0044] In a sixth aspect, an embodiment of the present application provides an electronic device, including: a memory, a processor;
[0045] The memory stores computer-executable instructions;
[0046] The processor executes the computer-executable instructions stored in the memory, so that the processor performs the method as described in any one of the first aspect or the second aspect.
[0047] In a seventh aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the method described in any one of the first aspect or the second aspect above.
[0048] In an eighth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the method described in any one of the first aspect or the second aspect above.
[0049] The embodiments of the present application provide a data backup method, system, device, medium and program product, which can back up the data to be backed up in a proportional and distributed manner on different backup nodes based on the backup efficiency of the backup nodes. This method can reduce the amount of backup data of each backup node, thereby reducing the time spent on data backup and the storage space occupied, thereby improving the efficiency of data backup. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0051] Figure 1 A schematic diagram of a database system provided in an embodiment of the present application;
[0052] Figure 2 A flowchart of a data backup method provided in an embodiment of the present application;
[0053] Figure 3 A schematic diagram of a master backup node synchronizing data with a first slave backup node provided in an embodiment of the present application;
[0054] Figure 4 A schematic diagram of the structure of a data backup device provided by this application;
[0055] Figure 5 A schematic diagram of the structure of a data backup device provided by this application;
[0056] Figure 6 A schematic diagram of the structure of an electronic device provided in this application.
[0057] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0058] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0059] In the present application, the term "include" and its variations may refer to non-restrictive inclusion; the term "or" and its variations may refer to "and / or". The terms "first", "second", etc. in the present application are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. In the present application, "plurality" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B may mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the previously associated objects are in an "or" relationship.
[0060] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0061] Figure 1 Schematic diagram of the database system provided in the embodiment of the present application. Figure 1 As shown, the database system includes: a master node, multiple backup nodes corresponding to the database to be backed up in the master node, and a control node.
[0062] The master node is a node storing data to be backed up, and the backup node is a node used to back up data. The control node is a node that performs data backup control. The control node, the master node, and the backup node can be servers.
[0063] Data backup refers to the process of copying and storing the data to be backed up to another location. Through data backup, when the database is lost, damaged, or suffers other problems, it can be restored through the data backed up on the backup node.
[0064] At present, in order to prevent a single backup node from failing, such as hardware damage, natural disasters or human errors, which may cause the data of the primary node to be unable to be restored, the control node usually controls multiple backup nodes to back up the data of the primary node. The backup node is only effective during the backup and is idle at other times.
[0065] However, the above backup method requires a large amount of storage space for each backup node to back up the data of the primary node, and the backup takes a long time.
[0066] In view of this, the present application proposes a data backup method, system, device, medium and program product, which can back up the data to be backed up in a proportional and distributed manner on different backup nodes based on the backup efficiency of the backup nodes. This method can reduce the amount of backup data of each backup node, thereby reducing the time spent on data backup and the storage space occupied, thereby improving the efficiency of data backup.
[0067] It should be understood that the method of the embodiment of the present application can be applied to Figure 1 The database system shown can also be applied to other application systems with backup requirements, etc., without limitation. The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0068] Figure 2 A flowchart of a data backup method provided in an embodiment of the present application is shown in FIG. Figure 2 As shown, the method includes:
[0069] S101. A control node determines a plurality of backup nodes corresponding to a database to be backed up in a master node.
[0070] Optionally, the multiple backup nodes corresponding to the database to be backed up in the master node may be pre-stored in the database management system. The backup node may also be determined by the database management system based on whether the backup node meets the backup conditions, for example, determining that the backup node with a storage space larger than the database to be backed up in the master node is the backup node corresponding to the database to be backed up in the master node, determining that the backup node with a stable network connection with the master node and sufficient bandwidth is the backup node corresponding to the database to be backed up in the master node, and any one or more of the above, which are not limited in this application.
[0071] S102: The control node determines the weight of the backup node. The weight of the backup node is positively correlated with the data backup efficiency of the backup node.
[0072] The data backup efficiency of the backup node can represent the speed at which the backup node completes the backup task. The higher the weight of the backup node, the higher the data backup efficiency of the backup node, which means the backup speed is faster. Conversely, the lower the weight of the backup node, the lower the data backup efficiency of the backup node, which means the backup speed is slower.
[0073] The data backup efficiency of the backup node may be affected by one or more of the following factors, for example: the distance between the backup node and the primary node, the storage efficiency of the storage medium of the backup node, the network bandwidth of the backup node, and the like.
[0074] Taking the distance between the backup node and the primary node as an example, the farther the distance between the backup node and the primary node, the longer the network transmission time is, and the lower the data backup efficiency of the backup node is, so the weight of the backup node is lower.
[0075] Taking the storage efficiency of the storage medium of the backup node as an example, the higher the storage efficiency of the storage medium of the backup node, the shorter the time required for data backup, and the higher the data backup efficiency of the backup node, so the weight of the backup node is higher.
[0076] The present application may also determine the weight by combining multiple factors that affect the backup efficiency of the backup node. Taking the distance between the backup node and the primary node, and the storage efficiency of the storage medium of the backup node as an example, optionally, the control node may first calculate the first initial weight of the backup node based on the distance between the backup node and the primary node, and then calculate the second initial weight of the backup node based on the storage efficiency of the storage medium of the backup node, and finally perform weighted summation of the first initial weight and the second initial weight to obtain the weight of the backup node.
[0077] The control node may also directly add the twice calculated weights as the weight of the backup node, or use the maximum or minimum of the two weights as the weight of the backup node, etc. This application does not impose any limitation on this.
[0078] By determining the weight of the backup node, it is convenient to use the backup node with a higher weight to prioritize data backup in the future, thereby speeding up the backup speed and improving the efficiency of data backup.
[0079] S103: The control node determines at least two master backup nodes and a first slave backup node corresponding to the master backup node from the backup nodes based on the weights of the backup nodes.
[0080] At least two master backup nodes are used to store data in different data backup ranges in the database respectively, and the first slave backup node is used to back up the data in the database stored in the corresponding master backup node.
[0081] This embodiment does not limit how to determine the primary backup node and the secondary backup node based on the weight. For example, they can be determined based on backup requirements. The backup requirements mentioned here can be, for example, backup efficiency, or backup time.
[0082] Exemplarily, taking backup efficiency as priority, a node with a higher weight may be selected as the primary backup node, and a node with a lower weight may be selected as the first secondary backup node to improve the efficiency of data backup with the primary node.
[0083] Taking backup time as an example, when the backup time is a period of heavy business volume, you can select a node with a higher weight as the primary backup node, and a node with a lower weight as the first slave backup node. When the backup time is a period of light business volume or an idle period, you can select a node with a lower weight as the primary backup node, and a node with a higher weight as the first slave backup node, and so on.
[0084] The master backup node and the first slave backup node may correspond one to one, or one master backup node may correspond to multiple first slave backup nodes, or multiple master backup nodes may correspond to one first slave backup node. When one master backup node corresponds to multiple first slave backup nodes, the first slave backup nodes corresponding to different master backup nodes may be different or overlapped.
[0085] S104: Determine the data backup range of the primary backup node based on the data range stored in the database.
[0086] Optionally, the data range stored in the database may be represented in the form of a file directory list of the backup data, or in the form of a start address to an end address of the backup data file.
[0087] The data backup ranges between the primary and backup nodes can be the same or different. That is, the data to be backed up can be evenly distributed on each primary and backup node, or the data to be backed up can be proportionally distributed on different primary and backup nodes with reference to the weight ratio of the primary and backup nodes, or it can be determined by one or more of the remaining storage space, storage efficiency, etc.
[0088] For example, the control node can evenly distribute the data to be backed up on each primary backup node based on the data range stored in the database. Exemplarily, for ease of description, taking the primary backup node as backup node 1 and 2 as an example, the data backup range of backup nodes 1 and 2 can respectively store 50% of the data range stored in the database. For example, according to the file directory of the backup data, backup nodes 1 and 2 can respectively store 50% of the backup data corresponding to the file directory of the backup data.
[0089] The control node can also distribute the data to be backed up on different primary and backup nodes in proportion based on the data range stored in the database and the weight ratio of the primary and backup nodes. For example, if the weight ratio of backup nodes 1 and 2 is 3:2, backup nodes 1 and 2 can store 60% of the backup data corresponding to the file directory of the backup data according to the file directory of the backup data, and backup node 2 stores 40% of the backup data corresponding to the file directory of the backup data.
[0090] S105. The control node sends a backup task to the primary backup node based on the data backup range of the primary backup node to trigger the primary backup node to obtain data of the corresponding data backup range from the database in parallel and synchronize it to the corresponding first secondary backup node.
[0091] Optionally, the backup task may include the data backup scope of the primary backup node. This application does not limit whether the backup task also includes other content.
[0092] The control node may issue backup tasks to at least two master backup nodes in parallel through the network, triggering at least two master backup nodes to obtain data of the corresponding data backup range from the database in parallel, and synchronize to the corresponding first slave backup node. The control node may also carry the backup start time in the issued backup tasks, trigger at least two master backup nodes to obtain data of the corresponding data backup range from the database in parallel through the backup start time, and synchronize to the corresponding first slave backup node.
[0093] Correspondingly, the primary backup node receives the backup task.
[0094] S106. Based on the backup task, the primary backup node obtains and stores data corresponding to the data backup range from the database in the primary node.
[0095] Optionally, the primary backup node obtains data of the corresponding data backup range from the database, which may include: the primary backup node initiates a request to the master node to read the data of the corresponding data backup range in the database, the master node receives the request to allow the primary backup node to read the data, and the primary backup node reads and stores the backup data.
[0096] S107: The primary backup node synchronizes the stored data to the corresponding first secondary backup node.
[0097] Optionally, the master backup node synchronizing the acquired data to the corresponding first slave backup node may include: the master backup node actively initiating a request for data synchronization to the first slave backup node, and the first slave backup node receiving the request and backing up the data on the master backup node. Optionally, the master backup node may also directly send the stored data to the first slave backup node, and the first slave backup node stores the backup data. Figure 3A schematic diagram of a primary backup node synchronizing data with a first secondary backup node provided in an embodiment of the present application. Figure 3 As shown, the primary backup nodes 1, 2 synchronize the stored data to the corresponding first secondary backup nodes 3, 4.
[0098] The embodiment of the present application can back up the data to be backed up on different backup nodes in a proportional and distributed manner based on the backup efficiency of the backup nodes. This method can reduce the amount of backup data of each backup node, thereby reducing the time spent on data backup and the storage space occupied, thereby improving the efficiency of data backup.
[0099] The following describes how the control node determines at least two master backup nodes from the backup nodes based on the weights of the backup nodes, and the first slave backup node corresponding to the master backup node:
[0100] The control node may sort the backup nodes in descending order of the weights of the backup nodes. Then, the sorted backup nodes are grouped to obtain a primary backup node group and at least one first secondary backup node group. The primary backup node in the primary backup node group corresponds to a first secondary backup node in the first secondary backup node group, and the weights of the primary backup nodes in the primary backup node group are all higher than the weights of the first secondary backup nodes in the corresponding first secondary backup node group.
[0101] For example, if there are 4 backup nodes after sorting, for the convenience of description, backup nodes 1, 2, 3, and 4 respectively represent the 4 backup nodes after sorting. The first 2 backup nodes in the front order can be used as the main backup node group, that is, backup nodes 1 and 2 can be used as the main backup node group, and the last two backup nodes in the back order can be used as the first slave backup node group, that is, backup nodes 3 and 4 can be used as the first slave backup node group.
[0102] The backup node 1 in the primary backup node group corresponds to the backup node 3 in the first secondary backup node group, and the backup node 2 in the primary backup node group corresponds to the backup node 4 in the first secondary backup node group.
[0103] It should be noted that the present application does not limit the division of the primary backup node group and the first secondary backup node group. Exemplarily, the first three backup nodes in the front ranking can also be used as the primary backup node group, that is, backup nodes 1, 2, and 3 can be used as the primary backup node group, and a backup node in the back ranking can be used as the first secondary backup node group, that is, backup node 4 can be used as the first secondary backup node group. Backup nodes 1, 2, and 3 in the primary backup node group all correspond to backup node 4 in the first secondary backup node group.
[0104] When performing data backup in some database systems, the master node may be in a suspended service state. By using the above method of dividing the master backup node and the first backup node, the master backup node with high backup efficiency is used to perform data backup first, which can reduce the data backup time, thereby reducing the duration of the master node suspension of service, and further reducing the impact on the database system.
[0105] Optionally, based on the above embodiment, when the embodiment of the present application groups the sorted backup nodes, in addition to obtaining the primary backup node group and at least one first secondary backup node group, at least one second secondary backup node group can also be obtained.
[0106] The second slave backup node group includes at least one second slave backup node. The weight of the second slave backup node is less than that of any first slave backup node, and is used to back up the data in the database stored in all master backup nodes. In this implementation, the backup task is used to instruct the master backup node to obtain the corresponding data from the database and synchronize it to the corresponding first slave backup node and the second slave backup node.
[0107] For example, if there are five backup nodes after sorting, for the convenience of description, backup nodes 1, 2, 3, 4, and 5 represent the five backup nodes after sorting, respectively. Consistent with the above, backup nodes 1 and 2 can be used as the primary backup node group, and backup nodes 3 and 4 can be used as the first secondary backup node group. Backup node 1 in the primary backup node group corresponds to backup node 3 in the first secondary backup node group, and backup node 2 in the primary backup node group corresponds to backup node 4 in the first secondary backup node group.
[0108] The backup node 5 may be used as the second slave backup node in the second slave backup node group. The backup node 5 is used to back up the data in the database stored in the backup nodes 1 and 2 .
[0109] Optionally, backup node 1 may be used as the primary backup node, backup node 2 may be used as the first secondary backup node, and backup nodes 3, 4, and 5 may be used as the second secondary backup nodes. This application does not limit the division of the primary backup node group, the first secondary backup node group, and the second secondary backup node group.
[0110] In the embodiment of the present application, backup nodes are grouped based on weights to obtain a primary backup node and a first secondary backup node. A second secondary backup node can also be obtained based on weights, and the second secondary backup node is used to back up data in the database stored in all primary backup nodes, thereby improving the flexibility of data backup.
[0111] Optionally, the control node can group the backup nodes according to the user's settings, or can group them according to the parity of the number of backup nodes. For example, when the number of backup nodes is an even number, the backup nodes are divided into a primary backup node group and a first secondary backup node group; when the number of backup nodes is an odd number, the backup nodes are divided into a primary backup node group, a first secondary backup node group, and a second secondary backup node group.
[0112] After the backup node completes the backup task, the control node can send synchronization information to the backup node, and the synchronization information is used to synchronize the data backup range of other backup nodes. Correspondingly, the main backup node receives the synchronization information.
[0113] Exemplarily, consistent with the above, backup nodes 1, 2, 3, 4, and 5 respectively represent the five backup nodes after sorting. After the five backup nodes complete the backup task, the control node can send the data backup range of other backup nodes to each backup node. Taking the file directory list of the backup data as an example, the control node can synchronize the file directory list of the backup data backed up on backup nodes 2-5 to backup node 1, synchronize backup node 1 to backup node 2, and the file directory list of the backup data backed up on backup nodes 3-5, and so on, which will not be repeated here.
[0114] Compared with the method in the prior art where there is no information communication between multiple backup nodes, the embodiment of the present application sends synchronization information to the backup node to synchronize the data backup range of other backup nodes. When a backup node fails, any other backup node can deploy the backup data of the backup node for data recovery, thereby improving the efficiency of restoring backup data. Secondly, since there is information communication between multiple backup nodes, each backup node does not need to back up all the information of the master node, thus avoiding unnecessary repeated backups.
[0115] The above is a method implementation example using the control node as the execution subject. In some embodiments, the control node can determine at least two master backup nodes from the backup nodes based on the weights of the backup nodes, and the first slave backup node corresponding to the master backup node, and then initiate a backup command to the target master backup node to trigger the target master backup node to guide other backup nodes to complete the backup task.
[0116] The target primary backup node can be the node with the highest weight among the primary backup nodes, or can be any one of multiple primary backup nodes.
[0117] After receiving the backup command, the target master backup node can obtain at least two master backup nodes and the first slave backup node corresponding to the master backup node, and then execute the subsequent actions of the control node in the aforementioned method embodiment.
[0118] The target master backup node can determine the data backup range of the master backup node based on the data range stored in the database. Based on the data backup range of the master backup node, a backup task is issued to the master backup node to trigger the master backup node to obtain the data of the corresponding data backup range from the database in parallel and synchronize it to the corresponding first slave backup node. In addition, the target master backup node can send synchronization information to the backup node, and the synchronization information is used to synchronize the data backup range of other backup nodes.
[0119] The above is an embodiment of the method provided by the present application. The following is a description of the device provided by the present application.
[0120] Figure 4 A schematic diagram of the structure of a data backup device provided in this application, such as Figure 4 As shown, the data backup device 400 provided in this embodiment includes: a first determination module 401, a second determination module 402, a third determination module 403, a fourth determination module 404, and a sending module 405. Optionally, the data backup device 400 may further include a synchronization module 406.
[0121] The first determining module 401 is used to determine a plurality of backup nodes corresponding to the database to be backed up in the primary node.
[0122] The second determination module 402 is used to determine the weight of the backup node. The weight of the backup node is positively correlated with the data backup efficiency of the backup node.
[0123] The third determination module 403 is used to determine at least two master backup nodes and a first slave backup node corresponding to the master backup node from the backup nodes based on the weights of the backup nodes. The at least two master backup nodes are used to store data in different data backup ranges in the database respectively, and the first slave backup node is used to back up the data in the database stored in the corresponding master backup node.
[0124] The fourth determination module 404 determines the data backup range of the primary backup node based on the data range stored in the database.
[0125] The sending module 405 is used to send the backup task to the primary backup node based on the data backup range of the primary backup node, so as to trigger the primary backup node to obtain the data of the corresponding data backup range from the database in parallel and synchronize it to the corresponding first secondary backup node.
[0126] Optionally, the second determination module 402 is specifically configured to determine the weight of the backup node based on the distance between the backup node and the primary node and / or the storage efficiency of the storage medium of the backup node. The distance is negatively correlated with the weight, and the storage efficiency is positively correlated with the weight.
[0127] Optionally, the third determination module 403 is specifically used to sort the backup nodes in descending order of the weight of the backup nodes. The sorted backup nodes are grouped to obtain a primary backup node group and at least one first secondary backup node group. The primary backup node in the primary backup node group corresponds to a first secondary backup node in the first secondary backup node group, and the weight of the primary backup node in the primary backup node group is higher than the weight of the first secondary backup node in the corresponding first secondary backup node group.
[0128] For example, the third determination module 403 is specifically used to group the sorted backup nodes to obtain a master backup node group, at least one first slave backup node group, and at least one second slave backup node group. The second slave backup node group includes at least one second slave backup node. The weight of the second slave backup node is less than that of any first slave backup node, and is used to back up the data in the database stored in all master backup nodes. The backup task is used to instruct the master backup node to obtain the corresponding data from the database and synchronize it to the corresponding first slave backup node and the second slave backup node.
[0129] Optionally, the synchronization module 406 is used to send synchronization information to the backup node, where the synchronization information is used to synchronize the data backup range of other backup nodes.
[0130] The data backup device provided in this embodiment can execute the actions of the control node in any of the above method embodiments. Its implementation principles and technical effects are similar, and are not described in detail in this embodiment.
[0131] Figure 5 A structural diagram of a data backup device provided in the present application, wherein the database to be backed up in the master node corresponds to multiple backup nodes, and the multiple backup nodes include: at least two master backup nodes, and a first slave backup node corresponding to the master backup node; the at least two master backup nodes are used to respectively store data in different data backup ranges in the database, and the first slave backup node is used to back up the data in the database stored in the corresponding master backup node; the weight of the backup node is positively correlated with the data backup efficiency of the backup node. The device is applied to the master backup node. Figure 5 As shown, the data backup device 500 provided in this embodiment includes: a receiving module 501 , a storage module 502 , and a synchronization module 503 .
[0132] The receiving module 501 is used to receive a backup task.
[0133] The storage module 502 is used to obtain and store data corresponding to the data backup range from the database in the master node based on the backup task.
[0134] The synchronization module 503 is used to synchronize the stored data to the corresponding first slave backup node.
[0135] Optionally, the backup node also includes at least one second slave backup node; the weight of the second slave backup node is smaller than any of the first slave backup nodes, and is used to back up the data in the database stored in all master backup nodes; the synchronization module 503 is also used to synchronize the stored data to the corresponding second slave backup node.
[0136] Optionally, the receiving module 501 is further used to receive synchronization information, where the synchronization information is used to synchronize the data backup range of other backup nodes.
[0137] The data backup device provided in this embodiment can execute the method provided in any of the above method embodiments, and its implementation principles and technical effects are similar, which will not be described in detail in this embodiment.
[0138] Figure 6 This is a schematic diagram of the structure of an electronic device provided in this application. Figure 6 As shown, the electronic device 600 provided in this embodiment includes: at least one processor 601 and a memory 602. Optionally, the device 600 also includes a communication component 603. The processor 601, the memory 602 and the communication component 603 are connected via a bus 604.
[0139] In a specific implementation process, at least one processor 601 executes the computer execution instructions stored in the memory 602, so that at least one processor 601 executes the above method.
[0140] The specific implementation process of the processor 601 can be found in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.
[0141] In the above embodiments, it should be understood that the processor can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the invention can be directly implemented as a hardware processor, or can be implemented by a combination of hardware and software modules in the processor.
[0142] The memory may include a high-speed memory (Random Access Memory, RAM), and may also include a non-volatile memory (NVM), such as at least one disk storage.
[0143] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of this application is not limited to only one bus or one type of bus.
[0144] The present application also provides a Figure 1 The database system shown in the figure comprises: a master node, multiple backup nodes corresponding to the database to be backed up in the master node, and a control node; the multiple backup nodes comprise: at least two master backup nodes, and a first slave backup node corresponding to the master backup node;
[0145] The control node is used to execute the method steps of the control node described in the above method embodiment;
[0146] The master backup node is used to execute the method steps of the master backup node as described in the above method embodiment;
[0147] The first slave backup node is used to receive data in the database stored therein that is synchronized with the corresponding master backup node.
[0148] Optionally, in some embodiments, the multiple backup nodes further include at least one second slave backup node; the weight of the second slave backup node is smaller than that of any of the first slave backup nodes, and is used to back up the data in the database stored in all the master backup nodes.
[0149] The present application also provides a computer program product, including a computer program, which implements the above method when executed by a processor.
[0150] The present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the above method is implemented.
[0151] The above-mentioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special-purpose computer.
[0152] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (Application Specific Integrated Circuits, referred to as: ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.
[0153] The division of units is only a logical function division, and there may be other divisions in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other forms.
[0154] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0155] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0156] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0157] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.
[0158] Finally, it should be noted that those skilled in the art will readily conceive of other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. The present invention is intended to cover any variations, uses or adaptations of the present invention, which follow the general principles of the present invention and include common knowledge or customary technical means in the art not disclosed by the present invention, are not limited to the precise structure described above and shown in the drawings, and may be modified and changed in various ways without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.
Claims
1. A data backup method, characterized in that: include: Determine multiple backup nodes corresponding to the database to be backed up in the primary node; Determine the weight of the backup node, where the weight of the backup node is positively correlated with the data backup efficiency of the backup node; Based on the weights of the backup nodes, determining at least two primary backup nodes from the backup nodes, and a first secondary backup node corresponding to the primary backup node; The at least two master backup nodes are used to respectively store data in different data backup ranges in the database, and the first slave backup node is used to back up the data in the database stored in the corresponding master backup node; Determine the data backup range of the primary backup node based on the data range stored in the database; Based on the data backup range of the master backup node, a backup task is issued to the master backup node to trigger the master backup node to obtain data of the corresponding data backup range from the database in parallel and synchronize it to the corresponding first slave backup node.
2. The method according to claim 1, characterized in that The determining the weight of the backup node includes: The weight of the backup node is determined based on the distance between the backup node and the primary node, and / or the storage efficiency of the storage medium of the backup node; the distance is negatively correlated with the weight, and the storage efficiency is positively correlated with the weight.
3. The method according to claim 2, characterized in that The step of determining at least two primary backup nodes from the backup nodes based on the weights of the backup nodes, and a first secondary backup node corresponding to the primary backup nodes, comprises: Sort the backup nodes according to the weights of the backup nodes from high to low; The sorted backup nodes are grouped to obtain a master backup node group and at least one first slave backup node group; a master backup node in the master backup node group corresponds to a first slave backup node in the first slave backup node group, and the weights of the master backup nodes in the master backup node group are higher than the weights of the first slave backup nodes in the corresponding first slave backup node group.
4. The method according to claim 3, characterized in that The step of grouping the sorted backup nodes to obtain a primary backup node group and at least one first secondary backup node group includes: The sorted backup nodes are grouped to obtain the primary backup node group, at least one of the first secondary backup node groups, and at least one second secondary backup node group; the second secondary backup node group includes at least one second secondary backup node; the weight of the second secondary backup node is less than that of any of the first secondary backup nodes, and is used to back up the data in the database stored in all primary backup nodes; The backup task is used to instruct the master backup node to obtain corresponding data from the database and synchronize the data to the corresponding first slave backup node and the second slave backup node.
5. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: Send synchronization information to the backup node, where the synchronization information is used to synchronize the data backup range of other backup nodes.
6. A data backup method, characterized in that: The database to be backed up in the master node corresponds to multiple backup nodes, and the multiple backup nodes include: at least two master backup nodes, and a first slave backup node corresponding to the master backup node; the at least two master backup nodes are used to store data in different data backup ranges in the database respectively, and the first slave backup node is used to back up the data in the database stored in the corresponding master backup node; the weight of the backup node is positively correlated with the data backup efficiency of the backup node; the method is applied to the master backup node, and the method includes: Receive backup tasks; Based on the backup task, acquiring and storing data corresponding to the data backup range from the database in the master node; The stored data is synchronized to the corresponding first slave backup node.
7. The method according to claim 6, characterized in that The backup node also includes at least one second slave backup node; the weight of the second slave backup node is less than that of any of the first slave backup nodes, and is used to back up the data in the database stored in all the master backup nodes; The method further comprises: The stored data is synchronized to the corresponding second slave backup node.
8. The method according to claim 6 or 7, characterized in that: The method further comprises: Synchronization information is received, where the synchronization information is used to synchronize the data backup range of other backup nodes.
9. A database system, characterized in that: The database system comprises: a master node, a plurality of backup nodes corresponding to the database to be backed up in the master node, and a control node; the plurality of backup nodes comprises: at least two master backup nodes, and a first slave backup node corresponding to the master backup node; The control node is used to execute the method according to any one of claims 1 to 5; The primary backup node is used to execute the method according to any one of claims 6 to 8; The first slave backup node is used to receive data in the database stored therein that is synchronized with the corresponding master backup node.
10. An electronic device, characterized in that: include: Memory, processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor performs the method according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 8 when executed by a processor.
12. A computer program product, characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 8 when being executed by a processor.
Citation Information
Cited By
Implementation method, system and device of multi-copy survivability backup medium pool and medium
CN120523654A