Backup method and device applied to auxiliary copy in cluster, computer equipment, readable storage medium and program product
By automatically identifying and allocating backup tasks to multiple secondary copies in the database cluster, it solves the problems of complex configuration and low resource utilization in traditional backup methods, achieving efficient resource allocation and high database availability.
Patent Information
- Application Number
- CN202411436027.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-15
- Publication Date
- 2025-01-21
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
When performing data backup, traditional database clusters have complex configurations and low resource utilization. Especially when there are multiple auxiliary replicas in the cluster, users need to manually select auxiliary replicas, resulting in the backup task being only performed by a single auxiliary replica.
Provides a backup method that responds to data backup instructions, determines the database to be backed up and backup tasks, traverses the availability copies in the cluster, determines the primary copy and secondary copy, and obtains the backup priority. Based on the preset filtering conditions and status information, current replicas that do not perform backup tasks are excluded, the target auxiliary replica is determined, and the backup tasks are delivered to the target replica according to priority.
It realizes the allocation and execution of backup tasks for multiple auxiliary copies, improves resource utilization, reduces single-machine pressure, enables the primary copy to concentrate resources on core business, improves system performance and response speed, and maintains high availability of the database.
Smart Images

Figure CN119336544A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data backup, and in particular to a backup method, apparatus, computer equipment, computer-readable storage medium, and computer program product for an auxiliary copy in a cluster. Background Art
[0002] With the development of data storage technology, enterprises need to use database service technology to store massive data when facing the layout of Internet applications and data storage of the Internet or the Internet of Things. Therefore, the application of database clusters has emerged. Database clusters can realize real-time replication of databases, automatic fault switching, and read-write load separation.
[0003] In traditional technology, when a database cluster is backing up data and there are multiple auxiliary replicas in the cluster, the user must select a specified auxiliary replica, and only a single auxiliary replica is supported to perform the backup task, resulting in complex configuration and low resource utilization in the current backup method. Summary of the invention
[0004] Based on this, it is necessary to provide a backup method, apparatus, computer device, computer-readable storage medium and computer program product for auxiliary replicas in a cluster in order to solve the above technical problems.
[0005] In a first aspect, the present application provides a backup method for a secondary replica in a cluster, comprising:
[0006] In response to the data backup instruction, determining a database to be backed up in the cluster corresponding to the data backup instruction and a backup task corresponding to the database to be backed up;
[0007] Traversing each availability replica included in the cluster, determining a primary replica and a secondary replica in each availability replica, and obtaining a backup priority of each availability replica;
[0008] Acquire the first status information of the primary replica, and use the primary replica to query the second status information of each of the secondary replicas;
[0009] According to the preset screening condition, the first status information and the second status information, in each of the availability replicas, the current replica that does not execute the backup task is excluded to obtain the target auxiliary replica to execute the backup task;
[0010] The backup task is sent to the target auxiliary replica according to the backup priority, so that the target auxiliary replica can back up the database to be backed up at the same time according to the backup task.
[0011] In one embodiment, the step of excluding the current replica that does not perform the backup task from the availability replicas according to the preset screening condition, the first status information, and the second status information to obtain the target auxiliary replica to perform the backup task includes:
[0012] According to the preset filtering conditions, the target state information corresponding to the current replica is obtained; the target state information is compared with the first state information and the second state information respectively, and the current replica is identified in each of the availability replicas according to the comparison result; the current replica is excluded from the availability replicas, and the remaining availability replicas are used as the target auxiliary replicas.
[0013] In one of the embodiments, sending the backup task to the target auxiliary replica according to the backup priority includes:
[0014] The sending order of the backup tasks is obtained according to the task quantity of the backup tasks, the copy quantity of the target auxiliary copy and the backup priority; and the backup tasks are sent to the target auxiliary copy based on the sending order.
[0015] In one embodiment, before determining, in response to the data backup instruction, a database to be backed up in a cluster corresponding to the data backup instruction and a backup task corresponding to the database to be backed up, the method further includes:
[0016] Based on each availability replica corresponding to the database cluster, determine a database list of the database cluster, wherein the database list is used to enable the client to determine the database to be backed up; obtain identification information of the database to be backed up, and generate the backup instruction containing the identification information according to the identification information.
[0017] In one of the embodiments, traversing each availability replica included in the cluster to determine a primary replica and a secondary replica in each availability replica includes:
[0018] Traverse each of the availability replicas to obtain a type value of each of the availability replicas, and judge the type value; when the type value is a primary type, determine the availability replica as the primary replica; and when the type value is a secondary type, determine the availability replica as the secondary replica.
[0019] In one embodiment, the method further comprises:
[0020] In response to the deployment instruction, the backup software to be deployed is obtained; the backup software is used to back up the database to be backed up; the backup software is deployed to each of the availability replicas included in the cluster, and instruction completion information is generated after the deployment is completed.
[0021] In a second aspect, the present application further provides a backup device for an auxiliary replica in a cluster, comprising:
[0022] An information determination module, configured to determine, in response to a data backup instruction, a database to be backed up in a cluster corresponding to the data backup instruction and a backup task corresponding to the database to be backed up;
[0023] A replica traversal module, used to traverse each availability replica contained in the cluster, determine the primary replica and the secondary replica in each availability replica, and obtain the backup priority of each availability replica;
[0024] A status query module, used to obtain the first status information of the primary replica, and use the primary replica to query the second status information of each of the secondary replicas;
[0025] A replica screening module, configured to exclude the current replica that does not perform the backup task from the availability replicas according to the preset screening condition, the first status information and the second status information, and obtain the target auxiliary replica for the backup task to be performed;
[0026] The task issuing module is used to issue the backup task to the target auxiliary replica according to the backup priority, so that the target auxiliary replica can back up the database to be backed up at the same time according to the backup task.
[0027] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0028] In response to a data backup instruction, determine a database to be backed up in a cluster corresponding to the data backup instruction and a backup task corresponding to the database to be backed up; traverse each availability replica contained in the cluster, determine a primary replica and a secondary replica in each availability replica, and obtain a backup priority of each availability replica; obtain first status information of the primary replica, and use the primary replica to query second status information of each secondary replica; according to preset filtering conditions, the first status information and the second status information, exclude the current replica that does not execute the backup task in each availability replica, and obtain the target secondary replica for the backup task to be executed; send the backup task to the target secondary replica according to the backup priority, so that the target secondary replica can simultaneously back up the database to be backed up according to the backup task.
[0029] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:
[0030] In response to a data backup instruction, determine a database to be backed up in a cluster corresponding to the data backup instruction and a backup task corresponding to the database to be backed up; traverse each availability replica contained in the cluster, determine a primary replica and a secondary replica in each availability replica, and obtain a backup priority of each availability replica; obtain first status information of the primary replica, and use the primary replica to query second status information of each secondary replica; according to preset filtering conditions, the first status information and the second status information, exclude the current replica that does not execute the backup task in each availability replica, and obtain the target secondary replica for the backup task to be executed; send the backup task to the target secondary replica according to the backup priority, so that the target secondary replica can simultaneously back up the database to be backed up according to the backup task.
[0031] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:
[0032] In response to a data backup instruction, determine a database to be backed up in a cluster corresponding to the data backup instruction and a backup task corresponding to the database to be backed up; traverse each availability replica contained in the cluster, determine a primary replica and a secondary replica in each availability replica, and obtain a backup priority of each availability replica; obtain first status information of the primary replica, and use the primary replica to query second status information of each secondary replica; according to preset filtering conditions, the first status information and the second status information, exclude the current replica that does not execute the backup task in each availability replica, and obtain the target secondary replica for the backup task to be executed; send the backup task to the target secondary replica according to the backup priority, so that the target secondary replica can simultaneously back up the database to be backed up according to the backup task.
[0033] The backup method, device, computer equipment, computer-readable storage medium and computer program product applied to the auxiliary replica in the cluster, by excluding the current replica that does not perform the backup task in each availability replica according to the preset screening conditions, the first status information and the second status information, obtains the target auxiliary replica for the backup task to be performed, and then sends the backup task to the target auxiliary replica according to the backup priority, so that the target auxiliary replica can back up the database to be backed up at the same time according to the backup task. The backup tasks in this scheme can be assigned to multiple auxiliary replicas and support the simultaneous backup of multiple auxiliary replicas. The configuration is simple, which helps to reasonably allocate the resources of the cluster and reduce the pressure of a single machine, so that the primary replica can concentrate resources to process core business requests, improve the overall performance, response speed and resource utilization of the system, and the backup tasks will not have a direct impact on the read and write operations of the primary replica, which helps to maintain the high availability of the database. Even during the backup process, the primary replica can still serve normally. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0035] FIG1 is an application environment diagram of a backup method for an auxiliary replica in a cluster in one embodiment;
[0036] Figure 2 A schematic diagram of a process flow of a backup method applied to an auxiliary replica in a cluster in one embodiment;
[0037] Figure 3 A schematic diagram of a process flow of a copy screening step in an embodiment;
[0038] Figure 4 It is a flowchart of a backup method applied to an auxiliary replica in a cluster in a specific embodiment;
[0039] Figure 5 It is a structural block diagram of a backup device applied to an auxiliary copy in a cluster in one embodiment;
[0040] FIG. 6 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0041] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0042] The backup method for the auxiliary replica in the cluster provided in the embodiment of the present application can be applied in the application environment shown in FIG1 . The client communicates with the server through the network. The data storage system can store the data that the server needs to process. The data storage system can be integrated on the server, or placed on the cloud or other network servers.
[0043] Specifically, the backup method for the auxiliary replica in the cluster provided in the embodiment of the present application can be executed by the client.
[0044] Exemplarily, in response to a data backup instruction, the client determines a database to be backed up in a cluster corresponding to the data backup instruction and a backup task corresponding to the database to be backed up; the client traverses each availability replica contained in the cluster, determines a primary replica and a secondary replica in each availability replica, and obtains a backup priority of each availability replica; the client obtains first status information of the primary replica, and uses the primary replica to query second status information of each secondary replica; the client excludes the current replica that does not execute the backup task in each availability replica according to preset filtering conditions, the first status information, and the second status information, to obtain a target secondary replica for the backup task to be executed; the client sends the backup task to the target secondary replica according to the backup priority, so that the target secondary replica can simultaneously back up the database to be backed up according to the backup task.
[0045] In the application environment shown in FIG1 , the client may be, but is not limited to, various personal computers, laptops, smart phones, and tablet computers. The server may be implemented as an independent server or a server cluster consisting of multiple servers.
[0046] In one embodiment, Figure 2 As shown, a backup method for an auxiliary replica in a cluster is provided, and the method is applied to the client in FIG. 1 as an example for description, including the following steps:
[0047] Step S201 , in response to a data backup instruction, determining a database to be backed up in a cluster corresponding to the data backup instruction and a backup task corresponding to the database to be backed up.
[0048] The data backup instruction can be used to enable the backup software to copy the database to be backed up and store the copied content in a preset storage medium. The database to be backed up is each database selected by the client and needs to be backed up.
[0049] Specifically, the client can determine the database to be backed up according to the client's selection operation on the target database, and encapsulate the identification information of the target database to obtain the data backup instruction. The client can parse the pre-generated data backup instruction, obtain the identification information of the database to be backed up in the data backup instruction, and determine the storage medium for storing the data of the target database.
[0050] Step S202, traverse each availability replica included in the cluster, determine the primary replica and the secondary replica in each availability replica, and obtain the backup priority of each availability replica.
[0051] Among them, the availability replica is identified based on the replica identification rule, which can identify each replica contained in the database cluster. The availability replica includes the primary replica and the secondary replica. The primary replica is a replica that can read and write data. The client can back up the target database corresponding to the primary replica by reading and writing data on the target database; the secondary replica can be used for read-only queries and backup tasks to reduce the load on the primary replica.
[0052] Specifically, the client traverses each availability replica included in the cluster in a preset traversal order to determine the availability replica that contains the target database. When it is determined that the current availability replica contains the target database, the client can determine the replica type of the current availability replica, which includes a primary replica type and a secondary replica type, and obtain the backup priority of each availability replica.
[0053] Step S203: Acquire the first status information of the primary replica, and use the primary replica to query the second status information of each secondary replica.
[0054] Among them, the first status information includes but is not limited to the backup permission, replica role information, connection status information and health status information of the primary replica, and the second status information includes but is not limited to the backup permission, replica role information, connection status information and health status information of the secondary replica.
[0055] Specifically, the client obtains the first state information of the primary replica, and uses the primary replica to execute a preset structured query language to query the second state information of each secondary replica.
[0056] Step S204: According to the preset screening condition, the first status information and the second status information, the current replica that does not execute the backup task is excluded from each availability replica, and the target auxiliary replica to execute the backup task is obtained.
[0057] Among them, the preset filtering conditions can be set by the user according to the actual situation, such as "the copy role information is the primary copy" or "the connection status information is disconnected" or "the health status information is faulty".
[0058] Specifically, the client compares the first state information and the second state information respectively according to preset filtering conditions, and according to the comparison result, excludes the current replica that does not execute the backup task in each availability replica to obtain the target auxiliary replica for the backup task to be executed.
[0059] Step S205: Send the backup task to the target auxiliary replica according to the backup priority, so that the target auxiliary replica can back up the database to be backed up at the same time according to the backup task.
[0060] The backup priority refers to the importance and priority ranking of backups of different data or systems when performing data backup, and can be represented by a value between 1 and 100. The larger the value, the higher the backup priority.
[0061] Specifically, the client sends the backup task to the target auxiliary replica according to the backup priority, so that the target auxiliary replica can back up the database to be backed up at the same time according to the backup task.
[0062] In the backup method applied to the auxiliary replica in the cluster, the current replica that does not perform the backup task is excluded from each availability replica according to the preset screening conditions, the first status information and the second status information, so as to obtain the target auxiliary replica for the backup task to be performed, and then the backup task is sent to the target auxiliary replica according to the backup priority, so that the target auxiliary replica can back up the database to be backed up at the same time according to the backup task. The backup tasks in this solution can be assigned to multiple auxiliary replicas and support the simultaneous backup of multiple auxiliary replicas. The configuration is simple, which helps to reasonably allocate the resources of the cluster and reduce the pressure of a single machine, so that the primary replica can concentrate resources to process core business requests, improving the overall performance, response speed and resource utilization of the system. In addition, the backup tasks will not have a direct impact on the read and write operations of the primary replica, which helps to maintain the high availability of the database. Even during the backup process, the primary replica can still serve normally.
[0063] In one embodiment, if Figure 3 As shown, in the above step S204, according to the preset screening condition, the first state information and the second state information, the current replica that does not perform the backup task is excluded from each availability replica, and the target auxiliary replica to perform the backup task is obtained, which specifically includes the following steps:
[0064] Step S301, obtaining target status information corresponding to the current copy according to preset screening conditions.
[0065] Step S302, compare the target state information with the first state information and the second state information respectively, and identify the current replica in each availability replica according to the comparison result.
[0066] Step S303: exclude the current replica from the availability replicas, and use the remaining availability replicas as target secondary replicas.
[0067] Among them, the target status information can be "the copy role information is the primary copy" or "the connection status information is disconnected" or "the health status information is faulty".
[0068] Specifically, the client extracts the target state information corresponding to the current replica according to preset filtering conditions; compares the target state information with the first state information and the second state information respectively, and identifies the current replica in each availability replica according to the comparison result; excludes the current replica from the availability replicas, and uses the remaining availability replicas as target auxiliary replicas.
[0069] In this embodiment, each availability replica is screened according to preset screening conditions, first status information and second status information, thereby quickly and accurately identifying the current replica, thereby efficiently determining the target secondary replica.
[0070] In one embodiment, in the above step S205, sending the backup task to the target auxiliary replica according to the backup priority specifically includes the following steps:
[0071] The issuing order of the backup tasks is obtained according to the task quantity of the backup tasks, the copy quantity of the target auxiliary copy, and the backup priority; and the backup tasks are issued to the target auxiliary copy based on the issuing order.
[0072] Specifically, the client traverses all the databases to be backed up on the primary replica, and sends the backup tasks to the target auxiliary replicas that are not excluded according to the backup priority. The Python implementation is as follows. The three databases to be backed up execute the backup tasks on server3, server2, and server3 in sequence, achieving the goal of load balancing and improving the resource utilization in the cluster.
[0073] In one embodiment, in response to the data backup instruction, before determining the database to be backed up in the cluster corresponding to the data backup instruction and the backup task corresponding to the database to be backed up, the method of the present application further includes the following steps:
[0074] Based on each availability replica corresponding to the database cluster, a database list of the database cluster is determined, and the database list is used to enable the client to determine the database to be backed up; identification information of the database to be backed up is obtained, and a backup instruction containing the identification information is generated according to the identification information.
[0075] The database list is used to enable the client to determine the database to be backed up. The database cluster contains multiple availability groups, the availability group contains multiple availability replicas, the availability replica contains multiple database groups, and the database group contains a database list consisting of multiple databases.
[0076] The identification information of the database to be backed up may be a unique identifier of the database to be backed up.
[0077] Specifically, the client can traverse the database cluster according to the preset traversal order of the database cluster, obtain each availability replica of multiple availability groups in the database cluster, determine the database group of each availability replica for each availability replica, and obtain multiple databases contained in each database group. The client merges multiple databases to obtain a database list corresponding to each database group. The client obtains a database list of multiple availability replicas by merging the database list of each database group, and finally obtains a database list of the database cluster. Then, the client obtains the identification information of the database to be backed up, uses the identification information of the database to be backed up as a unique identifier representing the database to be backed up, and encapsulates the identification information of the database to be backed up to obtain a data backup instruction. The client can parse the data backup instruction to obtain the identification information of the database to be backed up in the data backup instruction, and the storage medium storing the data of the database to be backed up, so that the data backup instruction only backs up the database to be backed up.
[0078] In this embodiment, by determining the list of all databases in the database cluster and screening them for the user, the database to be backed up is obtained, and then the identification information of the database to be backed up is encapsulated into the backup instruction, so that the backup software can automatically back up the database to be backed up dynamically determined by the user, thereby improving the flexibility of backup.
[0079] In one embodiment, in the above step S202, traversing each availability replica included in the cluster to determine the primary replica and the secondary replica in each availability replica specifically includes the following steps:
[0080] Each availability replica is traversed to obtain the type value of each availability replica, and the type value is judged; when the type value is the primary type, the availability replica is determined as the primary replica; and when the type value is the secondary type, the availability replica is determined as the secondary replica.
[0081] The type value of the availability replica may be type identification information of the availability replica, and the type identification information may indicate that the availability replica is a primary replica type, or may indicate that the availability replica is a secondary replica type.
[0082] Specifically, the client traverses each availability replica contained in the cluster according to the preset traversal order of the cluster, and can query the type value of the current availability replica, thereby obtaining the type values of all availability replicas in the cluster. If the client determines that the type value of the current availability replica is the primary type, the availability replica is determined to be the primary replica; if the client determines that the type value of the current availability replica is the secondary type, the availability replica is determined to be the secondary replica. The client can determine the type of each availability replica by traversing the corresponding availability replicas in the cluster.
[0083] In this embodiment, the type value of the availability replica is obtained by traversal to determine whether the availability replica is a primary replica or a secondary replica, thereby improving the efficiency of determining the replica type.
[0084] In one embodiment, the method of the present application further includes the following steps:
[0085] In response to the deployment instruction, the backup software to be deployed is obtained; the backup software is used to back up the database to be backed up; the backup software is deployed to each availability replica included in the cluster, and instruction completion information is generated after the deployment is completed.
[0086] The backup software is used to back up the database to be backed up, and the deployment instruction includes software information of the backup software.
[0087] Specifically, before performing a backup operation, the client generates a deployment instruction based on the software information of the backup software and the availability replica of the backup software to be deployed. The client sends the deployment instruction to each availability replica included in the cluster, so that each availability replica deploys the backup software based on the deployment instruction, and generates instruction completion information after the deployment is completed.
[0088] In this embodiment, the backup software is installed for each availability replica through deployment instructions, which can ensure that when any availability replica fails, the backup software can still operate normally, thereby improving the stability of the backup.
[0089] In one embodiment, Figure 4 As shown, a backup method for an auxiliary replica in a cluster in a specific embodiment is provided, which specifically includes the following steps:
[0090] Step S401, based on each availability replica corresponding to the database cluster, determine a database list of the database cluster, the database list is used to enable the client to determine the database to be backed up; obtain identification information of the database to be backed up, and generate a backup instruction containing the identification information according to the identification information.
[0091] Step S402 , in response to the data backup instruction, determining the database to be backed up in the cluster corresponding to the data backup instruction and the backup task corresponding to the database to be backed up.
[0092] Step S403, traverse each availability replica, obtain the type value of each availability replica, and judge the type value; when the type value is the primary type, determine the availability replica as the primary replica; and when the type value is the secondary type, determine the availability replica as the secondary replica.
[0093] Step S404, obtaining the backup priority of each availability replica, and obtaining the first status information of the primary replica, and using the primary replica to query the second status information of each secondary replica.
[0094] Step S405, according to the preset filtering conditions, obtain the target state information corresponding to the current replica; compare the target state information with the first state information and the second state information respectively, and identify the current replica in each availability replica according to the comparison result; exclude the current replica from the availability replicas, and use the remaining availability replicas as target auxiliary replicas.
[0095] Step S406, obtain the order of issuing backup tasks according to the task quantity of the backup tasks, the copy quantity of the target auxiliary copy and the backup priority; based on the issuing order, issue the backup tasks to the target auxiliary copy so that the target auxiliary copy can back up the database to be backed up at the same time according to the backup tasks.
[0096] The beneficial effects brought by the above embodiments are as follows:
[0097] The backup tasks in this solution can be assigned to multiple auxiliary replicas and support simultaneous backup of multiple auxiliary replicas. The configuration is simple, which helps to reasonably allocate cluster resources and reduce the pressure on a single machine, so that the primary replica can concentrate resources to process core business requests, improving the overall performance, response speed and resource utilization of the system. In addition, the backup tasks will not have a direct impact on the read and write operations of the primary replica, which helps to maintain the high availability of the database. Even during the backup process, the primary replica can still provide normal services.
[0098] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0099] Based on the same inventive concept, the embodiment of the present application also provides a backup device for an auxiliary replica in a cluster for implementing the backup method for an auxiliary replica in a cluster. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in one or more embodiments of the backup device for an auxiliary replica in a cluster provided below can refer to the limitations of the backup method for an auxiliary replica in a cluster above, and will not be repeated here.
[0100] In an exemplary embodiment, Figure 5 As shown, a backup device applied to an auxiliary copy in a cluster is provided, comprising:
[0101] An information determination module 501 is used to determine, in response to a data backup instruction, a database to be backed up in a cluster corresponding to the data backup instruction and a backup task corresponding to the database to be backed up;
[0102] The replica traversal module 502 is used to traverse each availability replica included in the cluster, determine the primary replica and the secondary replica in each availability replica, and obtain the backup priority of each availability replica;
[0103] A status query module 503 is used to obtain the first status information of the primary replica and query the second status information of each secondary replica using the primary replica;
[0104] The replica screening module 504 is used to exclude the current replica that does not perform the backup task from each availability replica according to the preset screening condition, the first state information and the second state information, and obtain the target auxiliary replica for the backup task to be performed;
[0105] The task issuing module 505 is used to issue the backup task to the target auxiliary replica according to the backup priority, so that the target auxiliary replica can back up the database to be backed up at the same time according to the backup task.
[0106] In one embodiment, the replica filtering module 504 is also used to obtain target status information corresponding to the current replica according to preset filtering conditions; compare the target status information with the first status information and the second status information respectively, and identify the current replica in each availability replica according to the comparison result; exclude the current replica from the availability replicas, and use the remaining availability replicas as target auxiliary replicas.
[0107] In one embodiment, the task sending module 505 is also used to obtain the sending order of the backup tasks according to the task quantity of the backup tasks, the number of copies of the target auxiliary copy and the backup priority; based on the sending order, the backup tasks are sent to the target auxiliary copy.
[0108] In one embodiment, the backup device applied to the auxiliary replica in the cluster also includes an instruction generation module, which is used to determine a database list of the database cluster based on the availability replicas corresponding to the database cluster, and the database list is used to enable the client to determine the database to be backed up; obtain the identification information of the database to be backed up, and generate a backup instruction containing the identification information based on the identification information.
[0109] In one embodiment, the replica traversal module 502 is also used to traverse each availability replica, obtain the type value of each availability replica, and judge the type value; when the type value is the primary type, the availability replica is determined as the primary replica; and when the type value is the secondary type, the availability replica is determined as the secondary replica.
[0110] In one embodiment, the backup device applied to the auxiliary replica in the cluster also includes a software deployment module, which is used to obtain the backup software to be deployed in response to the deployment instruction; the backup software is used to back up the database to be backed up; the backup software is deployed to each availability replica included in the cluster, and instruction completion information is generated after the deployment is completed.
[0111] Each module in the backup device for the auxiliary replica in the cluster can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0112] In an exemplary embodiment, a computer device is provided, which may be a client, and its internal structure diagram may be shown in FIG6. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit, and an input device. The processor, the memory, and the input / output interface are connected via a system bus, and the communication interface is connected to the system bus via the input / output interface. The processor of the computer device is used 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 and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external client in a wired or wireless manner, and the wireless manner may be implemented through WIFI, a mobile cellular network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a backup method for an auxiliary copy in a cluster is implemented. The display unit of the computer device is used to form a visually visible picture, which may be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0113] Those skilled in the art will understand that the structure shown in FIG. 6 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0114] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0115] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0116] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0117] 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 relevant regulations.
[0118] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0119] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0120] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A backup method for an auxiliary replica in a cluster, characterized in that: The method comprises: In response to the data backup instruction, determining a database to be backed up in the cluster corresponding to the data backup instruction and a backup task corresponding to the database to be backed up; Traversing each availability replica included in the cluster, determining a primary replica and a secondary replica in each availability replica, and obtaining a backup priority of each availability replica; Acquire the first status information of the primary replica, and use the primary replica to query the second status information of each of the secondary replicas; According to the preset screening condition, the first status information and the second status information, in each of the availability replicas, the current replica that does not execute the backup task is excluded to obtain the target auxiliary replica to execute the backup task; The backup task is sent to the target auxiliary replica according to the backup priority, so that the target auxiliary replica can back up the database to be backed up at the same time according to the backup task.
2. The method according to claim 1, characterized in that The step of excluding the current replica that does not perform the backup task from the availability replicas according to the preset screening condition, the first status information, and the second status information to obtain the target auxiliary replica to perform the backup task includes: According to the preset screening condition, obtaining the target state information corresponding to the current copy; Comparing the target state information with the first state information and the second state information respectively, and identifying the current replica in each of the availability replicas according to the comparison result; The current replica is excluded from the availability replicas, and the remaining availability replicas are used as the target secondary replicas.
3. The method according to claim 1, characterized in that The sending the backup task to the target auxiliary replica according to the backup priority includes: Obtaining a dispatching order of the backup tasks according to the task quantity of the backup tasks, the copy quantity of the target auxiliary copy, and the backup priority; Based on the sending order, the backup task is sent to the target auxiliary replica.
4. The method according to claim 1, characterized in that: Before determining, in response to the data backup instruction, a database to be backed up in the cluster corresponding to the data backup instruction and a backup task corresponding to the database to be backed up, the method further includes: Based on each availability replica corresponding to the database cluster, determine a database list of the database cluster, wherein the database list is used to enable the client to determine the database to be backed up; The identification information of the database to be backed up is obtained, and according to the identification information, the backup instruction including the identification information is generated.
5. The method according to claim 1, characterized in that The traversing each availability replica included in the cluster to determine a primary replica and a secondary replica in each availability replica includes: Traversing each of the availability replicas, obtaining a type value of each of the availability replicas, and judging the type value; In a case where the type value is a primary type, the availability replica is determined as the primary replica; and in a case where the type value is a secondary type, the availability replica is determined as the secondary replica.
6. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: In response to the deployment instruction, obtaining backup software to be deployed; the backup software is used to back up the database to be backed up; The backup software is deployed to each of the availability replicas included in the cluster, and instruction completion information is generated after the deployment is completed.
7. A backup device for an auxiliary replica in a cluster, characterized in that: The device comprises: An information determination module, configured to determine, in response to a data backup instruction, a database to be backed up in a cluster corresponding to the data backup instruction and a backup task corresponding to the database to be backed up; A replica traversal module, used to traverse each availability replica contained in the cluster, determine the primary replica and the secondary replica in each availability replica, and obtain the backup priority of each availability replica; A status query module, used to obtain the first status information of the primary replica, and use the primary replica to query the second status information of each of the secondary replicas; A replica screening module, configured to exclude the current replica that does not perform the backup task from the availability replicas according to the preset screening condition, the first status information and the second status information, and obtain the target auxiliary replica for the backup task to be performed; The task issuing module is used to issue the backup task to the target auxiliary replica according to the backup priority, so that the target auxiliary replica can back up the database to be backed up at the same time according to the backup task.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Database backup management method and device, computer equipment and storage medium
CN117370078A
Federated back up of availability groups
US9405634B1
Designating backup nodes and backing up in parallel in a high-availability environment
US9934107B1
Cited By
Data synchronization method and device, equipment and medium
CN120929535A