Design method and device for database centralized backup, electronic equipment and storage medium

By automatically selecting the target data center, backup domain and media server, and generating and executing backup policy strings, the problems of low backup efficiency and high labor costs in the existing technology are solved, and efficient and balanced database backup is achieved.

CN119201550APending Publication Date: 2024-12-27CHINA CONSTRUCTION BANK
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411359223.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-27
Publication Date
2024-12-27

AI Technical Summary

Technical Problem

The existing database backup technology relies on the high experience of operation and maintenance engineers, which leads to low backup efficiency and high labor costs, and has the risk of planning errors, which reduces backup efficiency.

Method used

By obtaining the information of the database to be backed up, automatically selecting the target data center, backup domain and media server, generating backup policy strings, and creating backup policies by calling the script interface to call the backup software to achieve automated backup planning.

Benefits of technology

Improve backup efficiency, balance data distribution, reduce unnecessary resource consumption, and reduce labor costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119201550A_ABST
    Figure CN119201550A_ABST
Patent Text Reader

Abstract

The invention discloses a database centralized backup design method and device, electronic equipment and a storage medium, and the method comprises the steps: automatically planning and selecting a target data center, a target backup domain and a target medium server according to the information of a to-be-backed-up database; generating a backup strategy character string according to the selected target data center, the target backup domain, the target medium server and the backup information; a calling script is created on a main server of a target backup domain according to a backup strategy character string, and the calling script is executed, so that backup software is called through a calling interface to create a backup strategy of a database to be backed up. Therefore, by automatically planning the backup strategy of the database, the backup efficiency and data distribution are more balanced while the backup efficiency is improved, unnecessary resource consumption is effectively reduced, and the labor cost can be effectively reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of database backup, and in particular to a design method and device, electronic equipment, and storage medium for centralized database backup. Background Art

[0002] Data backup refers to copying data on a host or storage device to other storage media in order to prevent data loss due to erroneous operation of the business system or system failure. Therefore, when the data in the business system cannot be used due to failure or loss, these backup data can be used to restore it, thus ensuring data integrity and continuous business operation.

[0003] In existing technologies, operation and maintenance engineers usually select backup domains and media servers based on their own experience and the actual situation of the database, and then create backup strategies and install client software through manual deployment to complete the database backup supply business system.

[0004] However, with the rapid development of data centers, the number of databases has increased dramatically, and the demand for database backup has also increased dramatically. However, the centralized backup deployment of databases is highly dependent on the experience of operation and maintenance engineers, and requires manual operation by operation and maintenance engineers, which will greatly increase the labor cost of operation and maintenance engineers. In addition, manual planning has the risk of planning errors, which may cause unnecessary resource competition and loss, thereby reducing the efficiency of backup. Summary of the invention

[0005] Based on the above-mentioned deficiencies of the prior art, the present application provides a design method and device for centralized database backup, an electronic device, and a storage medium to solve the problem of relatively low backup efficiency brought about by the prior art.

[0006] In order to achieve the above objectives, this application provides the following technical solutions:

[0007] The first aspect of the present application provides a design method for centralized database backup, including:

[0008] Acquire information of the database to be backed up, and select a target data center, a target backup domain, and a target media server according to the information of the database to be backed up;

[0009] Generate a backup strategy character string according to the target data center, the target backup domain, the target media server and the backup information;

[0010] A call script is created on the master server of the target backup domain according to the backup strategy character string, and the call script is executed to call the backup software through a call interface to create a backup strategy for the database to be backed up.

[0011] Optionally, in the above-mentioned method for designing centralized database backup, the step of selecting a target data center according to the information of the database to be backed up includes:

[0012] When receiving an update command for the database to be backed up, updating the information of the data center, backup domain, and media server in the database to be backed up;

[0013] Read the data center list from the updated data center information;

[0014] Determine in sequence whether there is a target data center in the data center list that is deployed together with the host of the database to be backed up;

[0015] If there is a target data center in the data center list that is deployed together with the host of the database to be backed up, the target data center is output.

[0016] Optionally, in the above-mentioned method for designing centralized database backup, the step of selecting a target backup domain according to the information of the database to be backed up includes:

[0017] Reading a list of all backup domains under the target data center from the database to be backed up;

[0018] For each of the backup domain lists, determining in turn whether there is a target backup domain in the backup domain list that is deployed in the same building as the host of the database to be backed up;

[0019] If there is a target backup domain in the backup domain list that is deployed in the same building as the host of the database to be backed up, then acquiring the target backup domain;

[0020] Add the target backup domain to the candidate list, and return to execute the step of determining, for each of the backup domain lists, in turn whether there is a target backup domain in the backup domain list that is deployed in the same building as the host of the database to be backed up, until the backup domains in all the backup domain lists are determined;

[0021] Reading all target backup domains from the candidate list, and counting the total number of backup policies of all target backup domains;

[0022] A backup policy with the minimum total number is selected from the total number of backup policies of all target backup domains, and the target backup domain corresponding to the backup policy with the minimum total number is output.

[0023] Optionally, in the above-mentioned method for designing centralized database backup, the step of selecting a target media server according to information of the database to be backed up includes:

[0024] Reading all media servers under the target backup domain corresponding to the backup strategy with the least total number from the database to be backed up;

[0025] For each of the media servers, determining whether the remaining capacity of the media server meets the backup requirement of the database to be backed up;

[0026] If the remaining capacity of the media server meets the backup requirement of the database to be backed up, the media server is used as the target media server, and the number of backup policies and the remaining space of the target media server are recorded;

[0027] Calculate the scores of all target media servers based on the number of backup policies and remaining space of all target media servers;

[0028] Sorting all the target media servers in descending order of the scores;

[0029] The target media server with the highest ranking is selected and output.

[0030] Optionally, in the above-mentioned design method for centralized database backup, the following is further included:

[0031] Obtaining the operating system type and database type of the client of the database to be backed up;

[0032] According to the operating system type and the database type, obtaining a corresponding backup client software installation package from the host of the database to be backed up;

[0033] Install the backup client software installation package on each node of the host of the database to be backed up, and obtain a configuration file corresponding to the backup client software installation package;

[0034] The configuration file is configured according to the target data center, the target backup domain, and the target media server to complete the backup configuration of the client of the database to be backed up.

[0035] Optionally, in the above-mentioned design method for centralized database backup, the following is further included:

[0036] When receiving a script backup request for a database to be backed up, generating a backup script for the database to be backed up using a script template according to the target data center, the target backup domain, the target media server and the backup information;

[0037] The backup script is placed in a specified path in the host of the database to be backed up to complete the backup configuration of the database to be backed up.

[0038] Optionally, in the above-mentioned design method for centralized database backup, the following is further included:

[0039] According to the backup strategy, a backup request is periodically sent to the database to be backed up, and the client of the database to be backed up backs up data according to the backup request.

[0040] A second aspect of the present application provides a design device for centralized database backup, comprising:

[0041] A planning unit, used to obtain information of a database to be backed up, and select a target data center, a target backup domain, and a target media server according to the information of the database to be backed up;

[0042] A generating unit, configured to generate a backup strategy character string according to the target data center, the target backup domain, the target media server and the backup information;

[0043] The creation unit is used to create a call script according to the backup strategy character string on the primary server of the target backup domain, and execute the call script to call the backup software through a call interface to create a backup strategy for the database to be backed up.

[0044] Optionally, in the above-mentioned design device for centralized database backup, the planning unit includes:

[0045] An updating unit, configured to update the information of the data center, the backup domain, and the media server in the database to be backed up when receiving an update command of the database to be backed up;

[0046] A first reading unit, configured to read a data center list from the updated data center information;

[0047] The first judgment unit is used to judge in sequence whether there is a target data center in the data center list that is deployed together with the host of the database to be backed up;

[0048] The first output unit is configured to output the target data center if there is a target data center deployed together with the host of the database to be backed up in the data center list.

[0049] Optionally, in the above-mentioned design device for centralized database backup, the planning unit includes:

[0050] A second reading unit is used to read a list of all backup domains under the target data center from the database to be backed up;

[0051] The second judgment unit is used to judge, for each of the backup domain lists, in turn whether there is a target backup domain in the backup domain list that is deployed in the same building as the host of the database to be backed up;

[0052] an acquiring unit, configured to acquire the target backup domain if there is a target backup domain in the backup domain list that is deployed in the same building as the host of the database to be backed up;

[0053] an adding unit, configured to add the target backup domain to a candidate list, and return to execute the step of determining, for each of the backup domain lists, in sequence whether there is a target backup domain in the backup domain list that is deployed in the same building as the host of the database to be backed up, until the backup domains in all the backup domain lists are determined;

[0054] A counting unit, configured to read all target backup domains from the candidate list and count the total number of backup policies of all target backup domains;

[0055] The second output unit is used to select the backup policies with the minimum total number from the total number of backup policies of all target backup domains, and output the target backup domains corresponding to the backup policies with the minimum total number.

[0056] Optionally, in the above-mentioned design device for centralized database backup, the planning unit includes:

[0057] A third reading unit is used to read all media servers under the target backup domain corresponding to the backup strategy with the minimum total number from the database to be backed up;

[0058] A third judgment unit is used to judge, for each of the media servers, whether the remaining capacity of the media server meets the backup requirement of the database to be backed up;

[0059] A recording unit, configured to use the media server as a target media server if the remaining capacity of the media server meets the backup requirement of the database to be backed up, and record the number of backup policies and remaining space of the target media server;

[0060] A calculation unit, configured to calculate scores of all target media servers based on the number of backup policies and remaining space of all target media servers;

[0061] A sorting unit, used to sort all the target media servers in descending order of the scores;

[0062] The third output unit is used to select and output the target media server that ranks first.

[0063] Optionally, the above-mentioned design device for centralized database backup further includes:

[0064] A type acquisition unit, used to acquire the operating system type and database type of the client of the database to be backed up;

[0065] An installation package acquisition unit, configured to acquire a corresponding backup client software installation package from a host of the database to be backed up according to the operating system type and the database type;

[0066] An installation unit, configured to install the backup client software installation package on each node of the host of the database to be backed up, and obtain a configuration file corresponding to the backup client software installation package;

[0067] The configuration unit is used to configure the configuration file according to the target data center, the target backup domain, and the target media server to complete the backup configuration of the client of the database to be backed up.

[0068] Optionally, the above-mentioned design device for centralized database backup further includes:

[0069] a script generating unit, configured to generate a backup script for the database to be backed up by using a script template according to the target data center, the target backup domain, the target media server and the backup information when receiving a script backup request for the database to be backed up;

[0070] The placement unit is used to place the backup script in a specified path in the host of the database to be backed up, so as to complete the backup configuration of the database to be backed up.

[0071] Optionally, the above-mentioned design device for centralized database backup further includes:

[0072] The backup unit is used to periodically send a backup request to the database to be backed up according to the backup strategy, and the client of the database to be backed up backs up data according to the backup request.

[0073] A third aspect of the present application provides an electronic device, including:

[0074] Memory and processor;

[0075] Wherein, the memory is used to store programs;

[0076] The processor is used to execute the program, and when the program is executed, it is specifically used to implement a design method for centralized database backup as described in any one of the above items.

[0077] A fourth aspect of the present application provides a computer storage medium for storing a computer program, which, when executed, is used to implement a design method for centralized database backup as described in any one of the above.

[0078] The application provides a design method for centralized database backup, which selects a target data center, a target backup domain, and a target media server, obtains information about the database to be backed up, and selects the target data center, the target backup domain, and the target media server according to the information about the database to be backed up, generates a backup strategy string, and finally creates a call script on the master server of the target backup domain according to the backup strategy string, and executes the call script to call the backup software through a call interface to create a backup strategy for the database to be backed up. Thus, by automatically planning the backup strategy of the database, while providing backup efficiency, the backup efficiency and data distribution are more balanced, which effectively reduces unnecessary resource consumption and can also effectively reduce labor costs. BRIEF DESCRIPTION OF THE DRAWINGS

[0079] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.

[0080] Figure 1 A schematic diagram of a flow chart of a design method for centralized database backup provided in an embodiment of the present application;

[0081] Figure 2 A flowchart of a method for selecting a target data center provided in another embodiment of the present application;

[0082] Figure 3 A flowchart of a method for selecting a target backup domain provided by another embodiment of the present application;

[0083] Figure 4 A flowchart of a method for selecting a target media server provided in another embodiment of the present application;

[0084] Figure 5 A schematic diagram of the structure of a backup strategy string provided in an embodiment of the present application;

[0085] Figure 6 A schematic diagram of a process flow of a database client deployment method provided in another embodiment of the present application;

[0086] Figure 7 A flowchart of a database script deployment method provided in another embodiment of the present application;

[0087] Figure 8 A schematic diagram of the structure of a design device for centralized database backup provided by another embodiment of the present application;

[0088] Fig. 9 A schematic diagram of the structure of an electronic device provided in another embodiment of the present application. DETAILED DESCRIPTION

[0089] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0090] In this application, relational terms such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.

[0091] The present application embodiment provides a design method for centralized database backup, such as Figure 1 As shown, the specific steps include:

[0092] S101. Obtain information of a database to be backed up, and select a target data center, a target backup domain, and a target media server according to the information of the database to be backed up.

[0093] Optionally, the staff can send the information of the database to be backed up through the sending interface provided by the system, so that the system can ensure that the backup data is stored in a safe environment based on the information of the database to be backed up to prevent data loss or damage, and can also select appropriate target resources to improve the efficiency of backup and recovery and reduce downtime. Therefore, selecting the target data center, target backup domain, and target media server based on the information of the database to be backed up can ensure the improvement of the backup efficiency of the database to be backed up.

[0094] It should be noted that the purpose of selecting a target data center is to ensure that the backup data is stored in a safe and reliable location. The target data center usually refers to the physical or virtual data center where the data backup and recovery operations will be performed. The basis for selection includes: Geographic location: Choose a location far away from the source data center to prevent catastrophic events from affecting the backup data. Data security: Ensure that the target data center meets data security and privacy requirements. Storage capacity and performance: The target data center needs to have sufficient storage space and performance to support backup needs.

[0095] Select the target backup domain to specify the area or system where the backup data is stored, ensuring that the data is stored in a suitable storage environment to meet performance and security requirements. A backup domain refers to a collection of a server and several media terminals and clients that it manages.

[0096] The purpose of selecting a target media server is to manage the data backup process, including writing and reading data, and managing backup media, so as to ensure the efficiency and reliability of the backup process. The media server is a device used to manage backup data and is responsible for writing data to backup media (such as disks or tapes). When selecting a target media server, you need to consider: Performance: The media server needs to have sufficient processing power and storage performance. Compatibility: Make sure that the media server is compatible with the backup software and hardware. Reliability: The media server should have high availability and fault recovery capabilities.

[0097] The purpose of obtaining the backup information of the database to be backed up is to ensure the integrity and accuracy of the backup process. Therefore, when backing up a database, it is necessary to pre-select the target data center, target backup domain, and target media server, and obtain the backup information of the database. The backup information may include the expected backup time, backup frequency, retention time, etc.

[0098] Optionally, in another embodiment of the present application, a specific implementation method of selecting a target data center according to information of the database to be backed up in step S101 is as follows: Figure 2 As shown, the following steps are included:

[0099] S201. When an update command of a database to be backed up is received, information of a data center, a backup domain, and a media server in the database to be backed up is updated.

[0100] Optionally, the front end can send an update command for the database to be backed up through the interface provided by the system, which means that the database to be backed up needs to be backed up. Therefore, when the system receives the update command for the database to be backed up, it will instruct the system's host to update the command for the database to be backed up, thereby triggering the update of the database to be backed up. The information of the data center, backup domain and media server in the library.

[0101] S202: Read a data center list from the updated data center information.

[0102] It is understandable that after triggering the update information of the database to be backed up, the next step is to select a data center. Therefore, it is necessary to read the data center list from the updated data center information to ensure that the latest, available and suitable data center is selected, so that when performing backup or recovery operations, the most suitable location can be selected for data storage and management, thereby improving the efficiency of backup operations and data security.

[0103] S203 , determining in sequence whether there is a target data center in the data center list that is deployed together with the host of the database to be backed up.

[0104] Specifically, in order to optimize data transmission efficiency, reduce network bandwidth burden, improve data security, reduce backup time, simplify management, and reduce costs, it is necessary to select a data center deployed together with the host of the database to be backed up from the data center list, so the data center list is read, and it is determined one by one whether there is a target data center deployed together with the database host in the data center list. If there is a target data center deployed together with the host of the database to be backed up in the data center list, step S204 is executed.

[0105] S204: Output the target data center.

[0106] It can be understood that when there is a target data center in the data center list that is deployed together with the host of the database to be backed up, it means that the most suitable location for data storage and management has been selected for the database to be backed up. At this time, the target data center can be output and selected as the implementation center of the database to be backed up this time.

[0107] Optionally, in another embodiment of the present application, a specific implementation method of selecting a target backup domain according to information of the database to be backed up in step S101 is as follows: Figure 3 As shown, the following steps are included:

[0108] S301. Read a list of all backup domains in a target data center from a database to be backed up.

[0109] It should be noted that after determining the selected target data center, the next step is to select a backup domain from the target data center. Since the backup domain is a collection in the data center, it is necessary to read a list of all backup domains under the target data center from the database to be backed up.

[0110] S302 . For each backup domain list, determine in turn whether there is a target backup domain in the backup domain list that is deployed in the same building as the host of the database to be backed up.

[0111] It is understandable that in order to reduce latency, optimize bandwidth usage, enhance data security, improve system reliability and save costs, it is necessary to determine one by one whether there is a target backup domain in the backup domain list that is deployed in the same building as the host of the database to be backed up. If there is a target backup domain in the backup domain list that is deployed in the same building as the host of the database to be backed up, execute step S303.

[0112] Optionally, if there is no target backup domain in the backup domain list that is deployed in the same building as the host of the database to be backed up, the next backup domain list is determined.

[0113] S303: Obtain the target backup domain.

[0114] Specifically, when there is a target backup domain in the backup domain list that is deployed in the same building as the host of the database to be backed up, the target backup domain needs to be extracted from the backup domain list for subsequent flexible processing.

[0115] S304: Add the target backup domain to the candidate list.

[0116] It should be noted that, since there are multiple backup domain lists, there may be multiple target backup domains deployed in the same building as the host with the database to be backed up. Therefore, in order to select the most suitable target backup domain, it is necessary to obtain the target backup domain from the backup domain list, add the target backup domain to the candidate list, and then return to execute step S302 until all the backup domains in the backup domain list are judged to be finished.

[0117] S305: Read all target backup domains from the candidate list, and count the total number of backup policies of all target backup domains.

[0118] It is understandable that after all the backup domains in the backup domain list are judged, it is necessary to select the most suitable backup domain for the database to be backed up. Therefore, it is necessary to read all the target backup domains from the candidate list and then count the total number of backup policies of all the target backup domains, because the backup policy refers to the specific configuration of the backup for a certain data domain (which can be understood as a set of databases), including backup frequency, retention time, etc. If a backup domain has more backup policies, it means that the number of databases backed up by the backup domain is large, so there will be fewer remaining resources. If a backup domain has fewer backup policies, it means that the number of databases backed up by the backup domain is small, so there will be more remaining resources. Therefore, the most suitable backup domain can be selected for the database to be backed up based on the total number of backup policies.

[0119] S306: Select the backup policies with the minimum total number from the total number of backup policies of all target backup domains, and output the target backup domains corresponding to the backup policies with the minimum total number.

[0120] It is understandable that after counting the total number of backup policies of all target backup domains, it is necessary to first select the backup policies with the least total number from the total number of backup policies of all target backup domains, and then output the target backup domains corresponding to the backup policies with the least total number. Thus, selecting the backup domain with the least number of backup policies can simplify backup management and improve operational efficiency. In addition, fewer backup policies usually mean lower storage and maintenance costs, and reducing the number of backup policies means reducing the complexity of configuring and executing backup tasks.

[0121] Optionally, in another embodiment of the present application, a specific implementation method of selecting a target media server according to information of the database to be backed up in step S101 is as follows: Figure 4 As shown, the following steps are included:

[0122] S401. Read all media servers under the target backup domain corresponding to the backup policies with the least total number from the database to be backed up.

[0123] It is understandable that after selecting the target backup domain, you need to select the media server, and the media server is the backup medium in the backup domain. Therefore, you need to read all the media servers under the target backup domain corresponding to the backup policy with the least total number from the database to be backed up.

[0124] S402: for each media server, determine whether the remaining capacity of the media server meets the backup requirement of the database to be backed up.

[0125] Specifically, in order to ensure that the media server has sufficient remaining capacity to accommodate the data of the database to be backed up and avoid backup failure due to insufficient capacity, it is necessary to determine whether the remaining capacity of the media server meets the backup requirements of the database to be backed up. If the remaining capacity of the media server meets the backup requirements of the database to be backed up, execute step S403.

[0126] Optionally, if the remaining capacity of the media server does not meet the backup requirement of the database to be backed up, the next media server is determined.

[0127] S403: Use the media server as the target media server, and record the number of backup policies and remaining space of the target media server.

[0128] It is understandable that when the remaining capacity of the media server meets the backup requirements of the database to be backed up, it means that the media server has sufficient remaining capacity to accommodate the data of the database to be backed up. Therefore, it is necessary to record the backup strategy number and remaining space of the media server for subsequent flexible processing.

[0129] S404: Calculate the scores of all target media servers based on the number of backup policies and remaining space of all target media servers.

[0130] It should be noted that since there are multiple media servers under the target backup domain, the remaining capacity of multiple media servers may not meet the backup requirements of the database to be backed up. Therefore, in order to select the optimal media server, it is necessary to pre-calculate the scores of all target media servers in an embodiment of the present application so that the optimal selection can be made based on the scores of the target media servers later.

[0131] Specifically, the calculation expression of the score of the target media server is: Sk=α*ck-β*pk.

[0132] Among them, α represents the weight coefficient of the remaining space, ck represents the remaining space, β represents the weight coefficient of the number of backup strategies, and pk represents the number of backup strategies.

[0133] S405. Sort all target media servers in descending order of scores.

[0134] It is understandable that in order to select the best media server from all target media servers, all target media servers may be sorted in descending order of scores, thereby facilitating the system to select the best media server.

[0135] S406: Select and output the target media server ranked first.

[0136] Specifically, the target media server ranked first is selected and output from all the ranked target media servers, that is, the target media server with the highest score is selected.

[0137] S102: Generate a backup policy character string according to the target data center, the target backup domain, the target media server, and the backup information.

[0138] Specifically, in order to realize the automation of backup configuration, reduce manual intervention, and dynamically adjust and deploy backup strategies, and make rapid adjustments according to different backup requirements, in the embodiment of the present application, it is necessary to generate a backup strategy string according to the target data center, target backup domain, target media server, and backup information. Specifically, it is necessary to first determine the format of the backup strategy string, which includes necessary fields and separators, such as JSON format, and then assemble it into a backup strategy string according to the target data center, target backup domain, target media server, backup information, and the determined format. Finally, check whether the generated backup strategy string conforms to the expected format and logic to ensure its validity. If the generated backup strategy string conforms to the expected format and logic, it is determined that the backup strategy string is generated successfully. If the generated backup strategy string does not conform to the expected format and logic, redefine the strategy string and execute the subsequent process until the generated backup strategy string conforms to the expected format and logic.

[0139] For details, please refer to the structure diagram of the backup strategy string. Figure 5 The content shown.

[0140] S103: On the master server of the target backup domain, a call script is created according to the backup policy character string, and the call script is executed to call the backup software through the call interface to create a backup policy for the database to be backed up.

[0141] It should be noted that after generating the backup policy string, it is necessary to read the information of the backup policy string on the master server of the target backup domain, and then write a call script based on the read information to call the interface of the backup software. At the same time, it is also necessary to ensure that the call script can generate the correct backup task configuration based on the backup policy string, and then save the created call script to the master server, and ensure that the script has execution permission, and finally run the call script, and call the interface to send the command to create the backup policy to the backup software, so that the backup policy can be created by passing parameters through the interface. Specifically, the backup software refers to the backup software on the master server of the target backup domain.

[0142] Here is an example script call (assuming Python is used):

[0143] Python

[0144] import requests

[0145] #Example: Backup policy string

[0146] backup_strategy="DataCenter1:BackupDomainA:MediaServerX:BackupInfo123"

[0147] #Parse the backup strategy string

[0148] data_center,backup_domain,media_server,backup_info=backup_strategy.split(':')

[0149] #Build the data required to call the interface

[0150] payload = {

[0151] 'data_center':data_center,

[0152] 'backup_domain':backup_domain,

[0153] 'media_server':media_server,

[0154] 'backup_info':backup_info

[0155] }

[0156] #API endpoint of the backup software (hypothetical)

[0157] api_endpoint="http: / / backup-software / api / create_backup_strategy"

[0158] #Call the interface to create a backup strategy

[0159] response=requests.post(api_endpoint,json=payload)

[0160] #Check the interface call result

[0161] ifresponse.status_code==200:

[0162] print("Backup policy created successfully")

[0163] else:

[0164] print(f"Backup policy creation failed: {response.status_code}-{response.text}").

[0165] Optionally, after creating the backup strategy, it is also necessary to perform backup deployment on the client of the database to be backed up to ensure that the database to be backed up can be backed up according to the new backup strategy. Therefore, in another embodiment of the present application, a method for deploying a database client is provided, such as Figure 6 As shown, the specific steps include:

[0166] S601: Obtain the operating system type and database type of the client of the database to be backed up.

[0167] Specifically, in order to ensure the compatibility and effectiveness of the backup strategy on the client, it is necessary to obtain a compatible backup client software installation package for deployment. Therefore, in order to obtain a compatible backup client software installation package, it is necessary to know the operating system type and database type of the client of the database to be backed up in advance.

[0168] S602: According to the operating system type and the database type, obtain the corresponding backup client software installation package from the host of the database to be backed up.

[0169] Specifically, search for the backup client software installation package corresponding to the operating system type and database type on the host of the database to be backed up according to the operating system type and database type, and then select and download the correct installation package: Select the appropriate client installation package according to the operating system and database type, and ensure that the versions match.

[0170] For example, if the server operating system where the database is located is Linux 7.4 and the database is Oracle 19c, you need to obtain an installation package that is compatible with Linux 7.4 and Oracle 19c.

[0171] S603: Install the backup client software installation package on each node of the host of the database to be backed up, and obtain a configuration file corresponding to the backup client software installation package.

[0172] It is understandable that after downloading the backup client software installation package, it needs to be installed on the host of the database to be backed up. However, since the database usually has multiple nodes (that is, a set of databases is often composed of multiple servers), each node needs to deploy the backup client software installation package, and the process of backing up the client software installation package is relatively complicated. Therefore, it may not be necessary to deploy through a script (the script contains a variety of judgment conditions, which automatically judge according to different scenarios). After the deployment is completed, the configuration file corresponding to the client software installation package will be backed up on the host of the database to be backed up, which is used to complete the compatible configuration of the client of the database to be backed up.

[0173] S604: Configure the configuration file according to the target data center, the target backup domain, and the target media server to complete the backup configuration of the client of the database to be backed up.

[0174] It should be noted that after obtaining the configuration file, in order to ensure that the client of the database to be backed up can correctly complete the backup with the database to be backed up, the configuration file is configured according to the target data center, target backup domain, and target media server.

[0175] Specifically, you first need to determine the network architecture, IP address range, and access rights of the target data center. Next, confirm the configuration and requirements of the target backup domain, such as backup strategy, backup time window, etc. Then, understand the network location, storage capacity, and configuration requirements of the target media server. Then, find the configuration file of the backup client software, which is usually located in the configuration folder in the installation directory. The configuration file may be in .conf, .xml, .ini, or other text formats. Then, configure the information of the target backup domain, that is, find the configuration items related to the target backup domain from the configuration file and set the correct backup domain address or name. For example: BackupDomain = backup-domain.example.com or BackupDomainIP = 192.168.1.10.

[0176] When configuring the target media server information: fill in the target media server's IP address, port number, and access credentials. For example: MediaServer = media-server.example.com or MediaServerIP = 192.168.1.20.

[0177] Finally, configure the target data center information: set the network settings or specific requirements related to the data center, such as the network subnet within the data center. For example: DataCenterIPRange = 192.168.2.0 / 24. This completes the backup configuration of the client of the database to be backed up.

[0178] Optionally, in addition to configuring the database to be backed up through the backup client software installation package, the embodiment of the present application can also configure the database to be backed up through a script to complete the backup deployment of the database to be backed up. Therefore, in another implementation of the present application, a script deployment method for a database is also provided, such as Figure 7 As shown, the specific steps include:

[0179] S701. When a script backup request for a database to be backed up is received, a backup script for the database to be backed up is generated using a script template according to a target data center, a target backup domain, a target media server and backup information.

[0180] Specifically, when receiving a script backup request for a database to be backed up, it is first necessary to obtain the network or storage requirements of the target data center, the information of the target backup domain, such as the backup strategy and requirements, as well as the address and configuration information of the target media server and the backup information of the database to be backed up, so as to understand the specific requirements of the database to be backed up, such as the database type, backup frequency, etc. Secondly, select a script template. You can select the corresponding script template according to the database type (such as MySQL, PostgreSQL, Oracle), and then configure the script template, such as filling in the database connection information (IP, port, database name, user credentials), and then specify the location where the backup file is stored, usually the path of the target media server, followed by backup options: configure backup options, such as full backup, incremental backup or differential backup, and finally replace the placeholders in the template, replace the path, user name, password, host name and database name in the template, and thus generate a backup script for the database to be backed up.

[0181] For example, the MySQL backup script template:

[0182] bash

[0183] #! / bin / bash

[0184] TIMESTAMP = $(date+"%F")

[0185] BACKUP_DIR=" / path / to / backup / $TIMESTAMP"

[0186] MYSQL_USER = "username"

[0187] MYSQL_PASSWORD="password"

[0188] MYSQL_HOST="hostname"

[0189] DATABASE_NAME="dbname"

[0190] mkdir -p "$BACKUP_DIR"

[0191] mysqldump -u"$MYSQL_USER"-p"$MYSQL_PASSWORD"-h

[0192] "$MYSQL_HOST""$DATABASE_NAME">

[0193] "$BACKUP_DIR / $DATABASE_NAME.sql".

[0194] S702: Place the backup script in a specified path in the host of the database to be backed up to complete the backup configuration of the database to be backed up.

[0195] It is understandable that in order to complete the backup configuration of the database to be backed up, a backup script is deployed on the host of the database to be backed up, that is, the backup script is placed in a specified path in the host of the database to be backed up, so that the backup configuration of the database to be backed up can be realized.

[0196] Optionally, after creating a backup strategy for the database to be backed up and configuring the client of the database to be backed up, the data in the database to be backed up can be backed up based on the backup strategy. Therefore, in another embodiment of the present application, a database backup method is further provided, which specifically includes the following steps:

[0197] According to the backup strategy, a backup request is periodically sent to the database to be backed up, and the client of the database to be backed up backs up the data according to the backup request.

[0198] Specifically, a backup strategy refers to the specific backup configuration for a certain data domain (which can be understood as a set of databases), including backup frequency, retention time, etc. After the backup strategy is deployed, the subsequent backup software will periodically initiate backup requests to the database to be backed up according to the backup strategy. Then the client of the database to be backed up, that is, the backup software, will back up the data in the database to be backed up according to the backup request.

[0199] The application provides a design method for centralized database backup, which selects a target data center, a target backup domain, and a target media server, and obtains the backup information of the database to be backed up, then generates a backup strategy string according to the target data center, the target backup domain, the target media server, and the backup information, and finally creates a call script on the master server of the target backup domain according to the backup strategy string, and executes the call script to call the backup software through a call interface to create a backup strategy for the database to be backed up. Thus, by automatically planning the backup strategy of the database, while providing backup efficiency, the backup efficiency and data distribution are more balanced, which effectively reduces unnecessary resource consumption and can also effectively reduce labor costs.

[0200] Another embodiment of the present application provides a design device for centralized database backup, such as Figure 8 As shown, it includes the following units:

[0201] The planning unit 801 is used to obtain information about the database to be backed up, and select a target data center, a target backup domain, and a target media server according to the information about the database to be backed up.

[0202] The generating unit 802 is used to generate a backup policy character string according to the target data center, the target backup domain, the target media server and the backup information.

[0203] The creation unit 803 is used to create a call script according to the backup policy character string on the primary server of the target backup domain, and execute the call script to call the backup software through the call interface to create a backup policy for the database to be backed up.

[0204] It should be noted that the specific working process of the above-mentioned units in the embodiment of the present application can refer to steps S101 to S103 in the above-mentioned method embodiment, and will not be repeated here.

[0205] Optionally, in a design device for centralized database backup provided by another embodiment of the present application, the planning unit 801 includes:

[0206] The updating unit is used to update the information of the data center, the backup domain and the media server in the database to be backed up when receiving an update command of the database to be backed up.

[0207] The first reading unit is used to read the data center list from the updated data center information.

[0208] The first determination unit is used to determine in sequence whether there is a target data center in the data center list that is deployed together with the host of the database to be backed up.

[0209] The first output unit is configured to output the target data center if there is a target data center deployed together with the host of the database to be backed up in the data center list.

[0210] Optionally, in a design device for centralized database backup provided by another embodiment of the present application, the planning unit 801 includes:

[0211] The second reading unit is used to read a list of all backup domains under the target data center from the database to be backed up.

[0212] The second judgment unit is used to judge, for each backup domain list respectively, in turn whether there is a target backup domain in the backup domain list that is deployed in the same building as the host of the database to be backed up.

[0213] The acquisition unit is configured to acquire the target backup domain if there is a target backup domain in the backup domain list that is deployed in the same building as the host of the database to be backed up.

[0214] The adding unit is used to add the target backup domain to the candidate list, and return to execute for each backup domain list, and judge in turn whether there is a target backup domain in the backup domain list that is deployed in the same building as the host of the database to be backed up, until the backup domains in all backup domain lists are judged.

[0215] The statistics unit is used to read all target backup domains from the candidate list and count the total number of backup policies of all target backup domains.

[0216] The second output unit is used to select the backup policies with the minimum total number from the total number of backup policies of all target backup domains, and output the target backup domains corresponding to the backup policies with the minimum total number.

[0217] Optionally, in a design device for centralized database backup provided by another embodiment of the present application, the planning unit 801 includes:

[0218] The third reading unit is used to read all media servers under the target backup domain corresponding to the backup policies with the minimum total number from the database to be backed up.

[0219] The third judgment unit is used to judge, for each media server, whether the remaining capacity of the media server meets the backup requirement of the database to be backed up.

[0220] The recording unit is used to use the media server as a target media server if the remaining capacity of the media server meets the backup requirement of the database to be backed up, and record the number of backup policies and remaining space of the target media server.

[0221] A calculation unit is used to calculate scores of all target media servers based on the number of backup policies and remaining spaces of all target media servers.

[0222] The sorting unit is used to sort all target media servers in descending order of scores.

[0223] The third output unit is used to select and output the target media server that ranks first.

[0224] Optionally, a design device for centralized database backup provided in another embodiment of the present application further includes:

[0225] The type acquisition unit is used to acquire the operating system type and database type of the client of the database to be backed up.

[0226] The installation package acquisition unit is used to acquire the corresponding backup client software installation package from the host of the database to be backed up according to the operating system type and the database type.

[0227] The installation unit is used to install the backup client software installation package on each node of the host of the database to be backed up, and obtain the configuration file corresponding to the backup client software installation package.

[0228] The configuration unit is used to configure the configuration file according to the target data center, the target backup domain, and the target media server to complete the backup configuration of the client of the database to be backed up.

[0229] Optionally, a design device for centralized database backup provided in another embodiment of the present application further includes:

[0230] The script generating unit is used to generate a backup script for the database to be backed up by using a script template according to a target data center, a target backup domain, a target media server and backup information when receiving a script backup request for the database to be backed up.

[0231] The placement unit is used to place the backup script in a specified path in the host of the database to be backed up, so as to complete the backup configuration of the database to be backed up.

[0232] Optionally, a design device for centralized database backup provided in another embodiment of the present application further includes:

[0233] The backup unit is used to periodically send a backup request to the database to be backed up according to the backup strategy, and the client of the database to be backed up backs up data according to the backup request.

[0234] It should be noted that the specific working process of each unit provided in the above embodiments of the present application can refer to the corresponding steps in the above method embodiments, and will not be repeated here.

[0235] Another embodiment of the present application provides an electronic device, such as Fig. 9 As shown, including:

[0236] Memory 901 and processor 902 .

[0237] The memory 901 is used to store programs.

[0238] The processor 902 is used to execute a program. When the program is executed, it is specifically used to implement a design method for centralized database backup as provided in any one of the above embodiments.

[0239] Another embodiment of the present application provides a computer storage medium for storing a computer program. When the computer program is executed, it is used to implement a design method for centralized database backup as provided in any of the above embodiments.

[0240] Computer storage media includes permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include temporary computer-readable media (transitory media), such as modulated data signals and carrier waves.

[0241] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0242] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A design method for centralized database backup, characterized in that: include: Acquire information of the database to be backed up, and select a target data center, a target backup domain, and a target media server according to the information of the database to be backed up; Generate a backup strategy character string according to the target data center, the target backup domain, the target media server and the backup information; A call script is created on the master server of the target backup domain according to the backup strategy character string, and the call script is executed to call the backup software through a call interface to create a backup strategy for the database to be backed up.

2. The method according to claim 1, characterized in that The selecting a target data center according to the information of the database to be backed up includes: When receiving an update command for the database to be backed up, updating the information of the data center, backup domain, and media server in the database to be backed up; Read the data center list from the updated data center information; Determine in sequence whether there is a target data center in the data center list that is deployed together with the host of the database to be backed up; If there is a target data center in the data center list that is deployed together with the host of the database to be backed up, the target data center is output.

3. The method according to claim 2, characterized in that The step of selecting a target backup domain according to the information of the database to be backed up includes: Reading a list of all backup domains under the target data center from the database to be backed up; For each of the backup domain lists, determining in turn whether there is a target backup domain in the backup domain list that is deployed in the same building as the host of the database to be backed up; If there is a target backup domain in the backup domain list that is deployed in the same building as the host of the database to be backed up, then acquiring the target backup domain; Add the target backup domain to the candidate list, and return to execute the step of determining, for each of the backup domain lists, in turn whether there is a target backup domain in the backup domain list that is deployed in the same building as the host of the database to be backed up, until the backup domains in all the backup domain lists are determined; Reading all target backup domains from the candidate list, and counting the total number of backup policies of all target backup domains; A backup policy with the minimum total number is selected from the total number of backup policies of all target backup domains, and the target backup domain corresponding to the backup policy with the minimum total number is output.

4. The method according to claim 3, characterized in that The step of selecting a target media server according to the information of the database to be backed up includes: Reading all media servers under the target backup domain corresponding to the backup strategy with the least total number from the database to be backed up; For each of the media servers, determining whether the remaining capacity of the media server meets the backup requirement of the database to be backed up; If the remaining capacity of the media server meets the backup requirement of the database to be backed up, the media server is used as the target media server, and the number of backup policies and the remaining space of the target media server are recorded; Calculate the scores of all target media servers based on the number of backup policies and remaining space of all target media servers; Sorting all the target media servers in descending order of the scores; The target media server with the highest ranking is selected and output.

5. The method according to claim 1, characterized in that Also includes: Obtaining the operating system type and database type of the client of the database to be backed up; According to the operating system type and the database type, obtaining a corresponding backup client software installation package from the host of the database to be backed up; Install the backup client software installation package on each node of the host of the database to be backed up, and obtain a configuration file corresponding to the backup client software installation package; The configuration file is configured according to the target data center, the target backup domain, and the target media server to complete the backup configuration of the client of the database to be backed up.

6. The method according to claim 5, characterized in that Also includes: When receiving a script backup request for a database to be backed up, generating a backup script for the database to be backed up using a script template according to the target data center, the target backup domain, the target media server and the backup information; The backup script is placed in a specified path in the host of the database to be backed up to complete the backup configuration of the database to be backed up.

7. The method according to any one of claims 1 to 6, characterized in that: Also includes: According to the backup strategy, a backup request is periodically sent to the database to be backed up, and the client of the database to be backed up backs up data according to the backup request.

8. A design device for centralized database backup, characterized in that: include: A planning unit, used to obtain information of a database to be backed up, and select a target data center, a target backup domain, and a target media server according to the information of the database to be backed up; A generating unit, configured to generate a backup strategy character string according to the target data center, the target backup domain, the target media server and the backup information; The creation unit is used to create a call script according to the backup strategy character string on the primary server of the target backup domain, and execute the call script to call the backup software through a call interface to create a backup strategy for the database to be backed up.

9. An electronic device, characterized in that: include: Memory and processor; Wherein, the memory is used to store programs; The processor is used to execute the program, and when the program is executed, it is specifically used to implement a design method for centralized database backup as described in any one of claims 1 to 7.

10. A computer storage medium, characterized in that: Used to store a computer program, which, when executed, is used to implement a design method for centralized database backup as described in any one of claims 1 to 7.