Data backup method and device, storage medium and computer equipment
By flexibly configuring data export parameters according to the query information and parameter configuration mode of the database table, the problems of low database data backup efficiency and large transaction risk in the existing technology are solved, and efficient data export and import are achieved.
Patent Information
- Application Number
- CN202410721639.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-05
- Publication Date
- 2024-08-23
AI Technical Summary
Existing database data backup methods have low export efficiency and are prone to large transaction risks when faced with large amounts of data and multi-database scenarios, and cannot meet the efficient data export needs of financial institutions.
By obtaining the data backup request, determine the data export parameters based on the query information of the database table to be backed up and the data export parameter configuration mode, use custom or server adaptation mode to configure the export parameters, and flexibly adjust the number of data rows exported by each insert statement to avoid Large transaction risk and improve export efficiency.
It achieves flexible configuration of data export parameters and is suitable for different scenarios, avoiding the problems of low export efficiency and large transaction risks, and significantly improving data backup efficiency.
Smart Images

Figure CN118535388A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of database management technology and financial technology, and in particular to a data backup method and device, a storage medium, and a computer device. Background Art
[0002] Database management is the technology related to establishing, storing, modifying and accessing information in a database. It refers to the technical management work that relevant personnel must perform to ensure the normal operation and service quality of the database system. In the daily work of database management, it is often necessary to export and back up the tables storing data from one database instance, and import the backup data into another database instance to achieve data migration, recovery, and aggregation and analysis of financial business data. For example, in the process of aggregating financial business data, the bank reconciliation system needs to export the data from the various branch business databases such as credit business, mortgage business, and online banking business into one database for data analysis and processing.
[0003] The existing method for backing up database data is mainly to use the logical tool mysql dump. This tool has two ways to export and import data. One is to merge multiple rows of data in a table and export them in batches. Although the export efficiency is high under normal operation, due to too much data locked by large transactions, it is easy to cause problems such as long rollback time and master-slave delay. Once a problem occurs, it affects the normal export of data. The other is to export one by one. Although it avoids large transaction risks, the data export efficiency is low. Especially in the application scenarios such as banks or other financial institutions with huge data volumes and involving many databases, the existing data export method cannot meet the requirements for data export efficiency. Therefore, there is an urgent need for a database data backup method that improves data export efficiency while avoiding large transaction risks. Summary of the invention
[0004] In view of this, the present invention provides a data backup method and device, a storage medium, and a computer device. The main purpose is to solve the problem that the existing database data export method has low data export efficiency, especially when facing application scenarios such as banks or other financial institutions with huge data volumes and involving many databases, the existing data export method is even more unable to meet the requirements for data export efficiency.
[0005] According to one aspect of the present invention, there is provided a data backup method, comprising:
[0006] Obtaining a data backup request, wherein the data backup request carries query information of a database table to be backed up and a data export parameter configuration mode;
[0007] The database table to be backed up is queried according to the query information of the database table to be backed up, and the data export parameters are determined according to the parameter configuration strategy corresponding to the data export parameter configuration mode;
[0008] The data in the database table to be backed up is backed up to the target database according to the data export parameters.
[0009] Further, the data export parameter configuration mode includes a custom mode and a server adaptation mode, the parameter configuration strategy includes a first parameter configuration strategy and a second parameter configuration strategy, and the determining of the data export parameters according to the parameter configuration strategy corresponding to the data export parameter configuration mode includes:
[0010] If the data export parameter configuration mode is a custom mode, obtaining custom data export parameter configuration information, and determining the data export parameters according to the custom data export parameter configuration information and the first parameter configuration strategy;
[0011] If the data export parameter configuration mode is the server adaptation mode, the server performance parameters of the server where the initial database is located are obtained, and the data export parameters are determined according to the server performance parameters and the second parameter configuration strategy. The initial database is the database where the database table to be backed up is located.
[0012] Further, the determining of the data export parameter according to the server performance parameter and the second parameter configuration strategy includes:
[0013] Obtain target export parameters from an export parameter mapping relationship set according to the server performance parameters, wherein the export parameter mapping relationship set includes mapping relationships between different server performance parameter ranges and different preset export parameters;
[0014] The target export parameter is determined as a data export parameter.
[0015] Further, the server performance parameter is a disk interface usage rate, and obtaining the target export parameter by matching from the export parameter mapping relationship set according to the server performance parameter includes:
[0016] If the server performance parameter satisfies the first usage rate range, determining the first preset export parameter as the target export parameter;
[0017] If the server performance parameter satisfies the second usage rate range, determining the second preset export parameter as the target export parameter;
[0018] If the server performance parameter satisfies a third usage rate range, determining the third preset export parameter as a target export parameter;
[0019] If the server performance parameter satisfies a fourth usage rate range, determining the fourth preset export parameter as the target export parameter;
[0020] If the server performance parameter satisfies the fifth usage rate range, determining the fifth preset export parameter as the target export parameter;
[0021] Among them, the first usage rate range is greater than the second usage rate range, the second usage rate range is greater than the third usage rate range, the third usage rate range is greater than the fourth usage rate range, the fourth usage rate range is greater than the fifth usage rate range, the first preset export parameter is less than the second preset export parameter, the second preset export parameter is less than the third preset export parameter, the third preset export parameter is less than the fourth preset export parameter, and the fourth preset export parameter is less than the fifth preset export parameter.
[0022] Further, the data export parameter configuration mode also includes a network adaptation mode, and the determining of the data export parameters according to the parameter configuration strategy corresponding to the data export parameter configuration mode includes:
[0023] Obtaining current network transmission parameters and the occupied space value of the database table to be backed up;
[0024] A data export parameter is determined according to a quotient of the occupied space value and the current network transmission parameter.
[0025] Further, the determining the data export parameters according to the custom data export parameter configuration information and the first parameter configuration strategy includes:
[0026] Parsing the custom data export parameter configuration information to obtain custom parameters;
[0027] If the custom parameter is not empty, determining the custom parameter as a data export parameter;
[0028] If the custom parameter is empty, the default parameter is obtained and the default parameter is determined as the data export parameter.
[0029] Further, after determining the data export parameters according to the parameter configuration strategy corresponding to the data export parameter configuration mode, the method further includes:
[0030] The order of viewing candidate parameters in the custom mode is updated based on the data-oriented parameters, and the candidate parameters are parameters in the drop-down menu of the custom parameter selection control.
[0031] According to another aspect of the present invention, a data backup method and device is provided, comprising:
[0032] An acquisition module, used to acquire a data backup request, wherein the data backup request carries query information of a database table to be backed up and a data export parameter configuration mode;
[0033] A determination module, configured to query the database table to be backed up according to the query information of the database table to be backed up, and determine the data export parameters according to the parameter configuration strategy corresponding to the data export parameter configuration mode;
[0034] The backup module is used to back up the data in the database table to be backed up to the target database according to the data export parameters.
[0035] Furthermore, the determination module includes:
[0036] a first determining unit, configured to obtain custom data export parameter configuration information if the data export parameter configuration mode is a custom mode, and determine the data export parameters according to the custom data export parameter configuration information and a first parameter configuration strategy;
[0037] The second determination unit is used to obtain the server performance parameters of the server where the initial database is located if the data export parameter configuration mode is the server adaptation mode, and determine the data export parameters according to the server performance parameters and the second parameter configuration strategy. The initial database is the database where the database table to be backed up is located.
[0038] Furthermore, in a specific application scenario, the second determination unit is specifically used to obtain a target export parameter by matching it from an export parameter mapping relationship set according to the server performance parameter, wherein the export parameter mapping relationship set includes a mapping relationship between different server performance parameter ranges and different preset export parameters; and the target export parameter is determined as a data export parameter.
[0039] Further, in a specific application scenario, the second determination unit is specifically configured to determine the first preset export parameter as the target export parameter if the server performance parameter satisfies the first usage rate range;
[0040] If the server performance parameter satisfies the second usage rate range, determining the second preset export parameter as the target export parameter;
[0041] If the server performance parameter satisfies a third usage rate range, determining the third preset export parameter as a target export parameter;
[0042] If the server performance parameter satisfies a fourth usage rate range, determining the fourth preset export parameter as the target export parameter;
[0043] If the server performance parameter satisfies the fifth usage rate range, determining the fifth preset export parameter as the target export parameter;
[0044] Among them, the first usage rate range is greater than the second usage rate range, the second usage rate range is greater than the third usage rate range, the third usage rate range is greater than the fourth usage rate range, the fourth usage rate range is greater than the fifth usage rate range, the first preset export parameter is less than the second preset export parameter, the second preset export parameter is less than the third preset export parameter, the third preset export parameter is less than the fourth preset export parameter, and the fourth preset export parameter is less than the fifth preset export parameter.
[0045] Furthermore, the determination module includes:
[0046] An acquisition unit, used to acquire current network transmission parameters and the occupied space value of the database table to be backed up;
[0047] The third determining unit is used to determine the data export parameter according to the quotient value of the occupied space value and the current network transmission parameter.
[0048] Furthermore, in an application scenario, the first determination unit is specifically used to parse the custom data export parameter configuration information to obtain custom parameters;
[0049] If the custom parameter is not empty, determining the custom parameter as a data export parameter;
[0050] If the custom parameter is empty, the default parameter is obtained and the default parameter is determined as the data export parameter.
[0051] Furthermore, the device also includes:
[0052] An update module is used to update the order of viewing candidate parameters in the custom mode based on the data guide parameters, and the candidate parameters are parameters in the drop-down menu of the custom parameter selection control.
[0053] According to another aspect of the present invention, a storage medium is provided, wherein at least one executable instruction is stored in the storage medium, and the executable instruction enables a processor to execute operations corresponding to the above-mentioned data backup method.
[0054] According to another aspect of the present invention, there is provided a computer device, comprising: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus;
[0055] The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute operations corresponding to the above-mentioned data backup method.
[0056] By means of the above technical solution, the technical solution provided by the embodiment of the present invention has at least the following advantages:
[0057] The present invention provides a data backup method and device, a storage medium, and a computer device. First, a data backup request is obtained, and the data backup request carries query information of a database table to be backed up and a data export parameter configuration mode; the database table to be backed up is queried according to the query information of the database table to be backed up, and data export parameters are determined according to a parameter configuration strategy corresponding to the data export parameter configuration mode; and the data in the database table to be backed up is backed up to a target database according to the data export parameters. Compared with the prior art, the embodiment of the present invention configures data export parameters based on different parameter configuration modes, realizes flexible configuration of data export parameters, and at the same time, enables data export parameters to be applicable to different data export scenarios, avoids the problem of large transaction risks or low export efficiency due to unreasonable data export parameter configuration, greatly improves the efficiency of data export and import, and thus improves data backup efficiency.
[0058] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0060] Figure 1 A flow chart of a data backup method provided by an embodiment of the present invention is shown;
[0061] Figure 2 Another data backup method flow chart provided by an embodiment of the present invention is shown;
[0062] Figure 3 A block diagram of a data backup method and device provided by an embodiment of the present invention is shown;
[0063] Figure 4 A schematic structural diagram of a computer device provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0064] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0065] The existing method for backing up database data is mainly to use the logical tool mysqldump. This tool has two ways to export and import data. One is to merge multiple rows of data in the table and export them in batches. Although the export efficiency is high under normal operation, due to excessive data locking in large transactions, it is easy to cause problems such as long rollback time and master-slave delay. Once a problem occurs, it affects the normal export of data. The other is to export one by one. Although it avoids large transaction risks, the data export efficiency is low. Especially when facing application scenarios such as banks or other financial institutions with huge amounts of data and involving many databases, the existing data export methods are even more unable to meet the requirements for data export efficiency. Therefore, there is an urgent need for a database data backup method that improves data export efficiency while avoiding large transaction risks. An embodiment of the present invention provides a data backup method, such as Figure 1 As shown, the method includes:
[0066] 101. Obtain data backup request.
[0067] In the embodiment of the present invention, the data backup requirement of exporting one or more database tables in the database as a whole is mainly targeted. The data export process is implemented based on the secondary developed data backup tool mysqldump. Among them, the secondary development is mainly for mysqldump, and the parameter "insert_rows" is developed. This parameter can realize the segmentation of insert SQL, indicating a single SQL insert row record. The number of rows of data exported by each insert statement can be configured and adjusted based on this parameter. When the user needs to export and back up the database table in the database as a whole, a data backup request can be issued based on the relevant operation page. This operation page can be a web browsing page, an enterprise internal management system page, or a database management page, etc., which is not specifically limited in the embodiment of the present invention. Among them, the data backup request carries the query information of the database table to be backed up and the data export parameter configuration mode. For example, when data analysts at a financial institution need to migrate financial data in different financial business databases, they can configure the name of the database table to be exported, the database instance name corresponding to the database table, the database query interface, and other information used to query the database table to be backed up, i.e., the query information of the database table to be backed up, through the financial business data analysis interface. At the same time, they can configure the parameters for the number of rows of data exported by each insert statement during the data export process. They can directly customize the number of rows exported by each insert statement, or they can choose based on which data to adaptively configure the parameters for the number of rows exported.
[0068] 102. Query the database table to be backed up according to the query information of the database table to be backed up, and determine the data export parameters according to the parameter configuration strategy corresponding to the data export parameter configuration mode.
[0069] In the embodiment of the present invention, after searching the query information of the database table to be backed up and finding the database table to be backed up that needs to be backed up, it is necessary to determine how to export the data in the table, for example, whether to export 100 rows of data per insert statement or 500 rows of data per insert statement. The data backup request carries a data export parameter configuration mode, that is, how to configure how many rows of data to export per insert statement. Different strategies are called to configure the data export parameters according to different data export parameter configuration modes. For example, if the current financial data analyst has a better understanding of the performance of the A server where the database table to be backed up is located and has rich experience in configuring how many rows of financial business data to export per insert statement, he can choose a custom mode and configure a data export parameter based on his experience. When it is identified that the data export parameter configuration mode is a custom mode, the custom parameter value configured in the custom mode is obtained as the data export parameter. For another example, the current financial data analyst is backing up the database table in server B for the first time, and lacks experience on how many rows of financial business data to export for each insert statement applicable to the server, or the current server is in a special business peak state or business trough state, and is unable to accurately determine the current appropriate data export parameters. In this case, the server adaptation mode is selected, and the system calculates the number of rows suitable for exporting data from the current database table to be backed up based on the server's operating performance data.
[0070] It should be noted that by configuring the number of data rows exported by each insert statement during the data backup process based on different data export parameter configuration modes, the traditional situation of only merging the entire table data into one insert statement for export, or exporting one row of data for each insert, is avoided. The data export process can be based on different application scenarios. The user can define the parameter configuration method by himself, and the number of data export rows can be accurately and flexibly configured. This can improve the data export efficiency and avoid the risk of large transactions. Data export parameters are obtained, thereby effectively improving the efficiency of the entire table data backup.
[0071] 103. Back up the data in the database table to be backed up to a target database according to the data export parameters.
[0072] In an embodiment of the present invention, after obtaining the data export parameter, the data in the database table to be backed up is segmented into multiple segments according to this parameter, and the exported data of each segment is an insert statement. Among them, in the segmentation result of the data in the database table to be backed up, it is very likely that the number of rows in the last segment of data is less than the number of rows indicated by the data export parameter. In this case, the last segment of data is also exported as a separate insert statement. The method of exporting using mysqldump is: mysqldump --insert_rows=m -u root -p root -S mysql3306.sock test t>t.sql, where m is the data export parameter, indicating that m rows of data are placed in one insert statement and exported at one time. After exporting several insert statements, the data pointed to by the insert statements is inserted into the target database table in the target database "mysql -u root -p root -S mysql3306.sock <t.sql". Among them, the target database is the database to which the data in the database table to be backed up needs to be backed up. This database can be the same database as the database where the current database table to be backed up is located, or it can be a database different from the database where the current database table to be backed up is located. The embodiments of the present invention do not make specific limitations. The database table to be backed up can be one or more database tables, and the number of target databases can also be one or more. For example, one database table to be backed up is backed up to one or more target databases, or multiple database tables are backed up to one or more target databases. The embodiments of the present invention do not make specific limitations.
[0073] It should be noted that in the stage of inserting into the target database by insert, the more insert times, the more interaction times, and the lower the server performance. If the table data volume is large, it will seriously affect the import efficiency. Therefore, by flexibly configuring the number of rows included in the insert, the number of insert statements can be greatly reduced, thereby effectively improving the efficiency of importing the exported data into the target database.
[0074] In an embodiment of the present invention, for further illustration and limitation, as Figure 2 shown, the step of determining the data export parameter according to the parameter configuration strategy corresponding to the data export parameter configuration mode includes:
[0075] 201. If the data export parameter configuration mode is the custom mode, obtain the custom data export parameter configuration information, and determine the data export parameter according to the custom data export parameter configuration information and the first parameter configuration strategy.
[0076] 202. If the data export parameter configuration mode is the server adaptation mode, obtain the server performance parameters of the server where the initial database is located, and determine the data export parameters according to the server performance parameters and the second parameter configuration strategy.
[0077] In the embodiment of the present invention, in order to determine the data export parameters, it is necessary to determine what the data export parameter configuration mode carried by the data backup request is. Among them, the data export parameter configuration mode includes a custom mode and a server adaptation mode. Each mode is configured with a corresponding parameter configuration strategy. The custom mode configures the data export parameters according to the first parameter configuration strategy, and the server adaptation mode configures the data export parameters according to the second parameter configuration strategy. Among them, when there are multiple database tables to be backed up, all the database tables to be backed up can use the same data export parameter configuration mode, and use the same custom parameters in the custom mode, or different database tables to be backed up can correspond to different data export parameter configuration modes respectively, or use different custom parameters in the same data export parameter configuration mode when all are custom modes, which is not specifically limited in the embodiment of the present invention. For example, a financial data analyst needs to aggregate multiple business database tables to be backed up distributed in multiple servers such as a payment server, a bill server, and a credit server, and selects a server adaptation mode, then the number of data rows contained in each insert statement exported by each business database table to be backed up will be determined according to the corresponding server performance parameters. Among them, the server performance parameters can be server interface disk performance parameters, or other performance parameters that affect the speed of data import and export, which are not specifically limited in the embodiment of the present invention.
[0078] It should be noted that based on the server adaptation mode, different data export parameters can be configured for different situations of the server where each database table to be backed up is located. This can avoid the situation where too much data is exported in a single insert statement, resulting in too much data being locked by a large transaction, causing a large amount of data blocking and lock timeout, and a long time required for rollback, which affects the data export efficiency. At the same time, the data export volume of a single insert statement can be maximized, thereby effectively improving the data export efficiency.
[0079] In an embodiment of the present invention, for further explanation and limitation, determining the data export parameter according to the server performance parameter and the second parameter configuration strategy includes:
[0080] Obtain target export parameters by matching from the export parameter mapping relationship set according to the server performance parameters;
[0081] The target export parameter is determined as a data export parameter.
[0082] In the embodiment of the present invention, the export parameter mapping relationship set is pre-constructed according to the corresponding relationship between different server performance parameters and data export parameters, including the mapping relationship between different server performance parameter ranges and different preset export parameters. When the server performance parameter satisfies one of the server performance parameter ranges, the preset export parameter corresponding to the server performance parameter range is used as the data export parameter. Among them, the server performance parameter range can be divided into multiple ranges according to the specific application scenario. For example, the server performance parameter is the server disk interface utilization rate, and the range is 0-100%. Then the server disk interface utilization rate can be divided into two, three, and four ranges with equal or unequal spans, such as 0-25% (excluding 25%) as a range, (including 25%) 25%-75% (excluding 75%) as a range, (including 75%) 75%-100% (including 100%) as a range. The embodiment of the present invention does not specifically limit the span and number of the server performance parameter range. Different server performance parameter ranges correspond to different preset export parameters. The stronger the operating capability represented by the server performance parameters, the larger the corresponding preset export parameter value is in order to fully utilize the server performance and improve data export efficiency. Similarly, the weaker the operating capability represented by the server performance parameters, the smaller the corresponding preset export parameter value is in order to avoid large transaction risks in the export process and cause data accumulation.
[0083] In one embodiment of the present invention, for further explanation and limitation, obtaining target export parameters by matching from the export parameter mapping relationship set according to the server performance parameters includes:
[0084] If the server performance parameter satisfies the first usage rate range, the first preset export parameter is determined as the target export parameter.
[0085] If the server performance parameter satisfies the second usage rate range, the second preset export parameter is determined as the target export parameter.
[0086] If the server performance parameter satisfies the third usage rate range, the third preset export parameter is determined as the target export parameter.
[0087] If the server performance parameter satisfies a fourth usage rate range, the fourth preset export parameter is determined as the target export parameter.
[0088] If the server performance parameter satisfies the fifth usage rate range, the fifth preset export parameter is determined as the target export parameter.
[0089] In an embodiment of the present invention, the server performance parameter is the disk interface utilization rate. In order to accurately divide the data to be exported, the disk interface utilization rate is divided into 5 range intervals, and each range interval corresponds to a preset export parameter. Among them, the first utilization rate range is greater than the second utilization rate range, the second utilization rate range is greater than the third utilization rate range, the third utilization rate range is greater than the fourth utilization rate range, the fourth utilization rate range is greater than the fifth utilization rate range, the first preset export parameter is less than the second preset export parameter, the second preset export parameter is less than the third preset export parameter, the third preset export parameter is less than the fourth preset export parameter, and the fourth preset export parameter is less than the fifth preset export parameter. Among them, the interval values of each utilization rate range and the magnitudes of each preset export parameter can be customized according to actual application requirements, and the embodiments of the present invention do not make specific limitations. For example, if 80 < IO%util and the specific parameter value is not specified, then --insert_rows = 10; if 60 < IO%util <= 80 and the specific parameter value is not specified, then --insert_rows = 100; if 40 < IO%util <= 60 and the specific parameter value is not specified, then --insert_rows = 500; if 20 < IO%util <= 40 and the specific parameter value is not specified, then --insert_rows = 1000; if 00 < IO%util <= 20 and the specific parameter value is not specified, then --insert_rows = 10000, where IO%util is the disk interface utilization rate and insert_rows is the data export parameter. Among them, the disk interface utilization rate of the server where the database of the database table to be backed up is located can be obtained through the "iostat" command or other acquisition methods, and the embodiments of the present invention do not make specific limitations.
[0090] In an embodiment of the present invention, for further illustration and limitation, determining the data export parameter according to the parameter configuration strategy corresponding to the data export parameter configuration mode includes:
[0091] Obtain the current network transmission parameter and the occupied space value of the database table to be backed up;
[0092] Determine the data export parameter according to the quotient of the occupied space value and the current network transmission parameter.
[0093] In an embodiment of the present invention, the data export parameter configuration mode further includes a network adaptation mode. In this mode, the occupied space value of the database table to be backed up currently is queried from the metadata, that is, the table size is identified as table_size, and the unit of the table size is MB. For example: Select sum(DATA_LENGTH+INDEX_LENGTH) / 1024 / 1024 from information_schema.tables where table_schema='database name' and table_name='table name'. The network transmission parameter net-buffer-length is obtained, and the data export parameter is calculated based on the mysql network transmission parameter and the table size. insert_rows = table_size / net-buffer-length, where (the range of net-buffer-length belongs to 1M-16M). By calculating how many rows of data are placed in each insert statement based on the size of the network transmission parameter and the size of the database table to be backed up, the data export parameter can be adjusted with the network transmission parameter, and the network transmission parameter can also be reversely set according to how many rows of data are placed in each insert statement as required, so that the data export adapts to the network transmission parameter, avoiding slow data export speed caused by the mismatch between the data export parameter and the network transmission parameter, thereby ensuring the data export efficiency.
[0094] In an embodiment of the present invention, for further illustration and limitation, the determining the data export parameter according to the custom data export parameter configuration information and the first parameter configuration strategy includes:
[0095] Parse the custom data export parameter configuration information to obtain custom parameters;
[0096] If the custom parameter is not empty, determine the custom parameter as the data export parameter;
[0097] If the custom parameter is empty, obtain the default parameter and determine the default parameter as the data export parameter.
[0098] In an embodiment of the present invention, when the data export parameter configuration mode is a custom mode, it is necessary to parse the custom parameters defined after the user selects the custom mode. Sometimes, although the operator selects custom, he does not enter a specific custom parameter value, or enters an invalid custom parameter value. In order to avoid the lack of clear data export parameters to guide the data export process, a default parameter is pre-set. When it is parsed that the custom data export parameter entered by the operator is empty, the default parameter can be obtained as the custom parameter. Among them, the operator's configuration of the custom parameter can be based on directly entering a numerical value through an input control, or can be based on a selection control to select the data export parameter from the following options, or can be a combination of the two, which is not specifically limited in the embodiment of the present invention.
[0099] In one embodiment of the present invention, for further explanation and limitation, after determining the data export parameters according to the parameter configuration policy corresponding to the data export parameter configuration mode, the method further includes:
[0100] The order of viewing candidate parameters in the custom mode is updated based on the data-guided parameters.
[0101] In an embodiment of the present invention, the parameter configuration method in the custom mode includes a selection configuration method for a drop-down menu in a selection control, and the drop-down menu of the custom parameter selection control includes multiple candidate parameters. After obtaining the data export parameters, in order to facilitate the operator's selection of custom parameters, the parameters with higher frequency of use are found as soon as possible, and the candidate parameter viewing order is updated based on the data export parameters. For example, the candidate parameter with the smallest absolute difference with the current data export parameter can be placed at the top, or the candidate parameter with the largest absolute difference with the current data export parameter can be moved down in the viewing order. The embodiment of the present invention does not make specific limitations.
[0102] The present invention provides a data backup method, firstly, by obtaining a data backup request, the data backup request carries query information of a database table to be backed up and a data export parameter configuration mode; querying the database table to be backed up according to the query information of the database table to be backed up, and determining the data export parameters according to the parameter configuration strategy corresponding to the data export parameter configuration mode; backing up the data in the database table to be backed up to a target database according to the data export parameters. Compared with the prior art, the embodiment of the present invention configures the data export parameters based on different parameter configuration modes, realizes the flexible configuration of the data export parameters, and at the same time, enables the data export parameters to be applicable to different data export scenarios, avoids the problem of large transaction risks or too low export efficiency due to unreasonable data export parameter configuration, greatly improves the efficiency of data export and import, and thus improves the data backup efficiency.
[0103] Furthermore, as a response to the above Figure 1 The implementation of the method shown in the figure, the embodiment of the present invention provides a data backup device, such as Figure 3 As shown, the device comprises:
[0104] An acquisition module 31 is used to acquire a data backup request, wherein the data backup request carries query information of a database table to be backed up and a data export parameter configuration mode;
[0105] A determination module 32, configured to query the database table to be backed up according to the query information of the database table to be backed up, and determine the data export parameters according to the parameter configuration strategy corresponding to the data export parameter configuration mode;
[0106] The backup module 33 is used to back up the data in the database table to be backed up to the target database according to the data export parameters.
[0107] Further, the determination module 32 includes:
[0108] a first determining unit, configured to obtain custom data export parameter configuration information if the data export parameter configuration mode is a custom mode, and determine the data export parameters according to the custom data export parameter configuration information and a first parameter configuration strategy;
[0109] The second determination unit is used to obtain the server performance parameters of the server where the initial database is located if the data export parameter configuration mode is the server adaptation mode, and determine the data export parameters according to the server performance parameters and the second parameter configuration strategy. The initial database is the database where the database table to be backed up is located.
[0110] Furthermore, in a specific application scenario, the second determination unit is specifically used to obtain a target export parameter by matching it from an export parameter mapping relationship set according to the server performance parameter, wherein the export parameter mapping relationship set includes a mapping relationship between different server performance parameter ranges and different preset export parameters; and the target export parameter is determined as a data export parameter.
[0111] Further, in a specific application scenario, the second determination unit is specifically configured to determine the first preset export parameter as the target export parameter if the server performance parameter satisfies the first usage rate range;
[0112] If the server performance parameter satisfies the second usage rate range, determining the second preset export parameter as the target export parameter;
[0113] If the server performance parameter satisfies a third usage rate range, determining the third preset export parameter as a target export parameter;
[0114] If the server performance parameter satisfies a fourth usage rate range, determining the fourth preset export parameter as the target export parameter;
[0115] If the server performance parameter satisfies the fifth usage rate range, determining the fifth preset export parameter as the target export parameter;
[0116] Among them, the first usage rate range is greater than the second usage rate range, the second usage rate range is greater than the third usage rate range, the third usage rate range is greater than the fourth usage rate range, the fourth usage rate range is greater than the fifth usage rate range, the first preset export parameter is less than the second preset export parameter, the second preset export parameter is less than the third preset export parameter, the third preset export parameter is less than the fourth preset export parameter, and the fourth preset export parameter is less than the fifth preset export parameter.
[0117] Further, the determination module 32 includes:
[0118] An acquisition unit, used to acquire current network transmission parameters and the occupied space value of the database table to be backed up;
[0119] The third determining unit is used to determine the data export parameter according to the quotient value of the occupied space value and the current network transmission parameter.
[0120] Furthermore, in an application scenario, the first determination unit is specifically used to parse the custom data export parameter configuration information to obtain custom parameters;
[0121] If the custom parameter is not empty, determining the custom parameter as a data export parameter;
[0122] If the custom parameter is empty, the default parameter is obtained and the default parameter is determined as the data export parameter.
[0123] Furthermore, the device also includes:
[0124] An update module is used to update the order of viewing candidate parameters in the custom mode based on the data guide parameters, and the candidate parameters are parameters in the drop-down menu of the custom parameter selection control.
[0125] The present invention provides a data backup device, which first obtains a data backup request, wherein the data backup request carries query information of a database table to be backed up and a data export parameter configuration mode; queries the database table to be backed up according to the query information of the database table to be backed up, and determines data export parameters according to a parameter configuration strategy corresponding to the data export parameter configuration mode; and backs up the data in the database table to be backed up to a target database according to the data export parameters. Compared with the prior art, the embodiment of the present invention configures data export parameters based on different parameter configuration modes, thereby realizing flexible configuration of data export parameters. At the same time, the data export parameters can be made applicable to different data export scenarios, thereby avoiding the problem of large transaction risks or low export efficiency due to unreasonable data export parameter configuration, greatly improving the efficiency of data export and import, and thus improving data backup efficiency.
[0126] According to an embodiment of the present invention, a storage medium is provided, wherein the storage medium stores at least one executable instruction, and the computer executable instruction can execute the data backup method in any of the above method embodiments.
[0127] Figure 4 A schematic diagram of the structure of a computer device provided according to an embodiment of the present invention is shown. The specific embodiment of the present invention does not limit the specific implementation of the computer device.
[0128] like Figure 4 As shown, the computer device may include: a processor 402 , a communication interface 404 , a memory 406 , and a communication bus 408 .
[0129] The processor 402 , the communication interface 404 , and the memory 406 communicate with each other via a communication bus 408 .
[0130] The communication interface 404 is used to communicate with other devices such as clients or other servers.
[0131] The processor 402 is used to execute the program 410, and specifically can execute the relevant steps in the above data backup method embodiment.
[0132] Specifically, the program 410 may include program codes, which include computer operation instructions.
[0133] The processor 402 may be a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention. The one or more processors included in the computer device may be processors of the same type, such as one or more CPUs; or may be processors of different types, such as one or more CPUs and one or more ASICs.
[0134] The memory 406 is used to store the program 410. The memory 406 may include a high-speed RAM memory, and may also include a non-volatile memory, such as at least one disk memory.
[0135] The program 410 may be specifically configured to enable the processor 402 to perform the following operations:
[0136] Obtaining a data backup request, wherein the data backup request carries query information of a database table to be backed up and a data export parameter configuration mode;
[0137] The database table to be backed up is queried according to the query information of the database table to be backed up, and the data export parameters are determined according to the parameter configuration strategy corresponding to the data export parameter configuration mode;
[0138] The data in the database table to be backed up is backed up to the target database according to the data export parameters.
[0139] Obviously, it should be understood by those skilled in the art that the above-mentioned modules or steps of the present invention can be implemented by a general-purpose computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
[0140] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A data backup method, characterized in that: include: Obtaining a data backup request, wherein the data backup request carries query information of a database table to be backed up and a data export parameter configuration mode; The database table to be backed up is queried according to the query information of the database table to be backed up, and the data export parameters are determined according to the parameter configuration strategy corresponding to the data export parameter configuration mode; The data in the database table to be backed up is backed up to the target database according to the data export parameters.
2. The method according to claim 1, characterized in that: The data export parameter configuration mode includes a custom mode and a server adaptation mode, the parameter configuration strategy includes a first parameter configuration strategy and a second parameter configuration strategy, and the determining of the data export parameters according to the parameter configuration strategy corresponding to the data export parameter configuration mode includes: If the data export parameter configuration mode is a custom mode, obtaining custom data export parameter configuration information, and determining the data export parameters according to the custom data export parameter configuration information and the first parameter configuration strategy; If the data export parameter configuration mode is the server adaptation mode, the server performance parameters of the server where the initial database is located are obtained, and the data export parameters are determined according to the server performance parameters and the second parameter configuration strategy. The initial database is the database where the database table to be backed up is located.
3. The method according to claim 2, characterized in that Determining the data export parameter according to the server performance parameter and the second parameter configuration strategy includes: Obtain target export parameters from an export parameter mapping relationship set according to the server performance parameters, wherein the export parameter mapping relationship set includes mapping relationships between different server performance parameter ranges and different preset export parameters; The target export parameter is determined as a data export parameter.
4. The method according to claim 3, characterized in that The server performance parameter is a disk interface usage rate, and obtaining the target export parameter by matching from the export parameter mapping relationship set according to the server performance parameter includes: If the server performance parameter satisfies the first usage rate range, determining the first preset export parameter as the target export parameter; If the server performance parameter satisfies the second usage rate range, determining the second preset export parameter as the target export parameter; If the server performance parameter satisfies a third usage rate range, determining the third preset export parameter as a target export parameter; If the server performance parameter satisfies a fourth usage rate range, determining the fourth preset export parameter as the target export parameter; If the server performance parameter satisfies the fifth usage rate range, determining the fifth preset export parameter as the target export parameter; Among them, the first usage rate range is greater than the second usage rate range, the second usage rate range is greater than the third usage rate range, the third usage rate range is greater than the fourth usage rate range, the fourth usage rate range is greater than the fifth usage rate range, the first preset export parameter is less than the second preset export parameter, the second preset export parameter is less than the third preset export parameter, the third preset export parameter is less than the fourth preset export parameter, and the fourth preset export parameter is less than the fifth preset export parameter.
5. The method according to claim 1, characterized in that The data export parameter configuration mode also includes a network adaptation mode, and determining the data export parameters according to the parameter configuration strategy corresponding to the data export parameter configuration mode includes: Obtaining current network transmission parameters and the occupied space value of the database table to be backed up; A data export parameter is determined according to a quotient of the occupied space value and the current network transmission parameter.
6. The method according to claim 2, characterized in that Determining the data export parameters according to the custom data export parameter configuration information and the first parameter configuration strategy includes: Parsing the custom data export parameter configuration information to obtain custom parameters; If the custom parameter is not empty, determining the custom parameter as a data export parameter; If the custom parameter is empty, the default parameter is obtained and the default parameter is determined as the data export parameter.
7. The method according to any one of claims 2 to 4, characterized in that: After determining the data export parameters according to the parameter configuration strategy corresponding to the data export parameter configuration mode, the method further includes: The order of viewing candidate parameters in the custom mode is updated based on the data-oriented parameters, and the candidate parameters are parameters in the drop-down menu of the custom parameter selection control.
8. A data backup method and device, characterized in that: include: An acquisition module, used to acquire a data backup request, wherein the data backup request carries query information of a database table to be backed up and a data export parameter configuration mode; A determination module, configured to query the database table to be backed up according to the query information of the database table to be backed up, and determine the data export parameters according to the parameter configuration strategy corresponding to the data export parameter configuration mode; The backup module is used to back up the data in the database table to be backed up to the target database according to the data export parameters.
9. A storage medium, wherein at least one executable instruction is stored in the storage medium, and the executable instruction enables a processor to execute an operation corresponding to the data backup method according to any one of claims 1 to 7.
10. A computer device comprising: A processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform an operation corresponding to the data backup method according to any one of claims 1 to 7.
