CN113467994A - Data backup method and system, electronic equipment and storage medium - Google Patents

Data backup method and system, electronic equipment and storage medium Download PDF

Info

Publication number
CN113467994A
CN113467994A CN202110746537.2A CN202110746537A CN113467994A CN 113467994 A CN113467994 A CN 113467994A CN 202110746537 A CN202110746537 A CN 202110746537A CN 113467994 A CN113467994 A CN 113467994A
Authority
CN
China
Prior art keywords
backup
evaluation result
data backup
generating
evaluation
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110746537.2A
Other languages
Chinese (zh)
Other versions
CN113467994B (en
Inventor
黄玲
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
CCB Finetech Co Ltd
Original Assignee
CCB Finetech Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by CCB Finetech Co Ltd filed Critical CCB Finetech Co Ltd
Priority to CN202110746537.2A priority Critical patent/CN113467994B/en
Publication of CN113467994A publication Critical patent/CN113467994A/en
Application granted granted Critical
Publication of CN113467994B publication Critical patent/CN113467994B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the application provides a data backup method and system, electronic equipment and a storage medium. The method comprises the following steps: acquiring MySQL operation information by adopting a SHELL command; and generating an evaluation result according to the operation information and a preset evaluation parameter, and judging whether to perform data backup according to the evaluation result. The embodiment of the invention adopts a SHELL command to automatically collect and obtain MySQL operation information, and selects the current backup or other appropriate time to trigger a backup task according to the input evaluation parameters; the method not only can be used as a timing task to perform batch backup at a fixed time every day, but also can be used for manually executing a corresponding burst backup scene. Therefore, the technical scheme of the invention not only improves the backup efficiency, reduces the cost of manual backup, avoids the risk of manual backup, but also improves the success rate of data backup and ensures the data safety.

Description

Data backup method and system, electronic equipment and storage medium
Technical Field
The present invention relates to database technologies, and in particular, to a data backup method and system, an electronic device, and a storage medium.
Background
Data security is becoming more and more important today with larger data magnitude and higher data value, so data backup is becoming more and more important. Daily full backup and incremental backup are available; data migration and routine backup before service change are carried out; production failures cause the failure recovery backup of the master library or the slave library, such as machine restart, user misoperation and the like. Generally, before backup, it is necessary to evaluate whether a current backup affects the industrial business and whether the backup can be executed smoothly, and the backup needs are frequent, and it takes a lot of time to evaluate whether a current database instance is suitable for backup, the backup affecting time, and the risk possibly caused by backup.
The Percona Toolkit provides a hot backup method of MySQL, is a free, online, open-source and complete database solution, and is suitable for MySQL of all versions. Innextrabackup performs online non-blocking, tightly packed, highly secure full backups on transactional systems so that applications remain fully available during the scheduled maintenance window. However, FTWRL and other conditions exist in the innoxtrackup backup process, which may affect the service, and the service may also affect the backup.
At present, in the Innox backing-up process, routine batch backup is an Innox backing-up command scheduled to schedule in a timed manner, backup failure conditions can exist for a large number of instances, while the adopted burst backup is manual backup for manual analysis, the current instance service state is judged to be suitable for unsuitable backup through manual multi-angle, command parameters required by executing the Innox backing-up are analyzed manually, a large amount of time is required to evaluate whether the current time is suitable for backup, and the risk of data backup is increased.
Disclosure of Invention
The invention provides a data backup method and system, electronic equipment and a storage medium, and aims to solve the problems that manual misjudgment is generated by manual backup and a large amount of time is needed for evaluation before backup in the prior art.
In a first aspect, an embodiment of the present invention provides a data backup method, including: acquiring MySQL operation information by adopting a SHELL command; and generating an evaluation result according to the operation information and a preset evaluation parameter, and judging whether to perform data backup according to the evaluation result.
In a second aspect, an embodiment of the present invention provides a data backup system, including: the information acquisition device is used for acquiring MySQL operation information by adopting a SHELL command; and the backup evaluation device is used for generating an evaluation result according to the operation information and preset evaluation parameters and judging whether to perform data backup according to the evaluation result.
In a third aspect, an embodiment of the present invention provides an electronic device, where the electronic device includes a processor and a memory, and the processor is configured to execute a computer program stored in the memory to implement the data backup method according to the embodiment of the present invention.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, where at least one instruction is stored, and when executed by a processor, the at least one instruction implements a data backup method according to an embodiment of the present invention.
According to the data backup method, the data backup system, the electronic equipment and the storage medium, provided by the embodiment of the invention, the SHELL command is adopted to automatically collect and obtain MySQL operation information, and the current backup or other appropriate time trigger backup tasks are selected according to the input evaluation parameters; the method not only can be used as a timing task to perform batch backup at a fixed time every day, but also can be used for manually executing a corresponding burst backup scene. Therefore, the technical scheme of the invention not only improves the backup efficiency, reduces the cost of manual backup, avoids the risk of manual backup, but also improves the success rate of data backup and ensures the data safety.
Drawings
FIG. 1 is a process flow diagram of a data backup method according to an embodiment of the invention;
FIG. 2 is a flow chart of InnodB disk-brushing processing according to an embodiment of the present invention;
FIG. 3 is a schematic structural diagram of a data backup system according to an embodiment of the present invention;
FIG. 4 is a schematic structural diagram of a backup evaluation device according to an embodiment of the present invention;
fig. 5 is a schematic block diagram of a system configuration of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The terms to which the present invention relates are as follows:
1) physical backup: the data files and the logs are copied to complete backup, the speed is high, and more production and use are realized;
2) innox trabackup: the physical backup tool is a layer of packaging for the xtrackup, and the inoxtrackup script is used for backing up the non-inoDB table and calling the xtrackup command to back up the inoDB table;
3) hot backup: the hot backup is that the database is backed up in an archivelog mode under the condition that the database is operated, the hot backup is relative to the cold backup, and the innoxtrabackup backup belongs to the hot backup;
4) percona Toolkit: the pt tool is a tool set developed by Percona company and used for managing MySQL;
5) FTWRL MySQL: a global lock.
6) LSN: log sequence number, which in the indidb engine takes 8 bytes in length and gradually increases as the log is written. LSN is a part of the InnoDb engine that is used to resolve data consistency.
At present, FTWRL and other conditions exist in the innoxtrackup backup process and can affect the service, and the service can also affect the backup. The inventors have appreciated that when performing MySQL inxtramackup backups, the main problems that lead to backup failures are as follows:
1. DDL operations conflict with inoxtrabeckup backup: when MySQL uses inoxtrackup for backup, if DDL is executed for table modification, the inoxtrackup backup will fail;
2. disk performance is too poor to cause inoxtrackup backup failure: the speed of generating the logs by Innodb is far higher than the speed of copying the inoxtrabeckup, and part of Innodb logs are cut off, so that the backup fails;
3. if a large object exists, a backup hang can be caused, and backup failure is caused;
4. the Myisam table which needs to be backed up, and the inxtrabackup needs to lock the table, which affects the service time.
If the Innox backing up is carried out, manual analysis and manual backup are adopted, namely the current instance service state is judged to be suitable for unsuitable backup through manual multi-angle, and command parameters required by the Innox backing up are manually analyzed and executed, so that a large amount of time is required to evaluate whether the current time is suitable for backup, and the risk of data backup is increased. The invention provides a method for carrying out automatic backup risk analysis to solve the technical problem, which adopts SHELL script to automatically collect and obtain MySQL operation information and selects current backup or other appropriate time to trigger backup task according to input evaluation parameters; the method not only can be used as a timing task to perform batch backup at a fixed time every day, but also can be used for manually executing a corresponding burst backup scene. Therefore, the problems of manual misjudgment caused by manual backup and the need of spending a large amount of manpower for evaluation before backup are solved, and the influence on industrial business is avoided during backup. And if the backup is found to be failed, the backup log can be automatically detected, the running state of the instance at the time of the failure is printed, the follow-up optimization basis is rapidly provided, and the backup timing task is analyzed and scheduled again at intervals.
Fig. 1 is a processing flow chart of a data backup method according to an embodiment of the present invention. As shown in the figure, the data backup method of the present embodiment includes: step S101, acquiring MySQL operation information by adopting a SHELL command; and S102, generating an evaluation result according to the operation information and a preset evaluation parameter, and judging whether to perform data backup according to the evaluation result.
In specific implementation, in step S101, the MySQL running information obtained by using the SHELL command includes, but is not limited to: the backup path residual disk space condition, the approximate values of the number of rows and the size of the current backup object, the approximate values of the number of rows and the size of the non-inoDB table of the current backup object, whether a DDL operation exists, whether a big thing exists, the speed of the InonoDB disk refreshing, and whether a row lock, a table lock and a global lock exist. It should be understood that these parameters are the parameters closely related to the inxtrabackup backup failure, however, other database operation parameters may be used in the data backup evaluation, and are not limited to the above seven parameters in the embodiment of the present invention.
In step S102, an evaluation result is generated according to the operation information and a preset evaluation parameter, mainly by the following method:
1) obtaining spare disk space condition of backup path
When data backup is performed, the disk space condition of the backup path is the first condition to be considered, that is, the data backup must be performed only when there is enough disk space. In the embodiment of the invention, the condition of the residual disk space of the backup path can be checked by executing the df-h and lsblk commands. In an embodiment, a preset value of the disk space, that is, an evaluation parameter, may be manually set in advance, and when the condition of the remaining disk space in the backup path is obtained through the df-h and lsblk commands, the condition is compared with the preset value, and if the condition is greater than the preset value, the evaluation may be considered to be passed. It is understood that the evaluation parameter can be adjusted by a person according to the experience value of the data backup at ordinary times.
2) Obtaining the approximate value of the line number and size of the current object to be backed up
In this embodiment, the shell script is further required to obtain the approximate values of the number of rows and the size of the object that needs to be backed up currently, and further, the approximate values of the number of rows and the size of the object that needs to be backed up currently are used to estimate the time that needs to be backed up. In some embodiments, the script is as follows:
select round(sum(DATA_LENGTH+INDEX_LENGTH)/1024/1024/1024,3)as size_GB from information_schema.tables where table_schema in(‘database1’,‘database2',…)and table_name in(‘table1’,’table2’,…);
in an embodiment, a preset value of time required for backup, that is, an evaluation parameter, may be manually set in advance, the size of the current object to be backed up and the time required for backup, which are obtained through the shell script, are compared with the preset value, and if the size is smaller than the preset value, the evaluation may be considered to be passed.
By combining the items, the size of the current object needing to be backed up and the time needed by the backup can be judged, and if the load of the current MySQL instance is high and the time needed by the data backup is long, the current MySQL instance is suitable for being backed up in a time slot.
3) Obtaining approximate values of line number and size of non-inbb table of current object to be backed up
In this embodiment, the shell script is further used to obtain an approximate value of the number of rows and the size of the non-inbb table of the current object to be backed up, so as to evaluate the time required by locking the table. In some embodiments, the script is as follows:
select round(sum(DATA_LENGTH+INDEX_LENGTH)/1024/1024/1024,3)as size_GB from information_schema.tables where table_schema in(‘database1’,‘database2',…)and table_name in(‘table1’,’table2’,…)and engine=’MyISAM’;
in an embodiment, a preset value of time spent on locking the table, that is, an evaluation parameter, may be manually set in advance, an approximate value of the size of the non-inbb table of the current object to be backed up obtained through the shell script and the time spent on locking the table are compared with the preset value, and if the approximate value is smaller than the preset value, the evaluation may be considered to be passed.
The load condition of the current database instance can be judged by combining the items, and if the load of the current MySQL instance is high and the number of the myisam engine table lines to be backed up is large, the current MySQL instance is suitable for being backed up in a time slot.
4) Determining if a DDL operation exists
When MySQL is backed up using innoxtrackup, performing DDL for table modification will cause the inoxtrackup backup to fail, and therefore wait for a re-backup if there is a DDL operation. In some embodiments, the script is as follows:
mysql–-login-path=$path–e“show processlist;”|grep–Ei“Alter”|grep–v grep|wc-l;
5) determining whether something is currently in existence
When MySQL uses innoxtrackup for backup, if there is something big, it will cause the backup hang, causing the backup to fail, and therefore, if there is something big, it will wait for the backup again. In some embodiments, the script is as follows:
mysql-path ═ path-e "select from information _ schema. innodb _ trx; "find out things whose execution time is greater than $ time according to trx _ started column;
6) judging whether a row lock, a table lock and a global lock exist at present
When MySQL uses inoxtrabeckup for backup, if there is a row lock, a table lock, a global lock, etc., it will affect the service, and therefore, if there is a row lock, a table lock, a global lock, etc., it waits for backup again. In some embodiments, the scripts are respectively as follows:
1、mysql--login-path=$path-e"show processlist;"|grep"global read lock"|wc-l
if the value is greater than 0, indicating that the global lock exists and the Flush Table With read lock is executed; instructions;
2、mysql--login-path=$path-e"show processlist;"|grep"metadata lock"|wc-l
if the value is greater than 0, the table lock exists, and a command of executing the full table query SQL or lock tables $ table exists;
7) determining the InnodB disk-brushing rate
Fig. 2 is a flowchart of the InnoDB disk brushing process according to the embodiment of the present invention. As shown in fig. 2, the system records 4 log-related information corresponding to 4 stages of the log life cycle (log creation, log disk refreshing, data disk refreshing, CKP writing), as follows:
log sequence number (LSN 1): current system LSN maximum, on which a new transaction log LSN will be generated (LSN1+ size of new log);
log flushhed up to (LSN 2): the LSN to which the log file has currently been written;
oldest modified data log (LSN 3): writing the LSN corresponding to the oldest dirty page data into a log file when the Checkpoint is written;
last checkpoint at (LSN 4): the LSN that has currently been written to checkpoint, the script is as follows:
mysql–-login-path=$path–e“show engine innodb status;”|grep“$Log sequence number”
in the embodiment of the invention, the LSN1 value of the redo log is acquired once every 30 seconds and four times, and the printing result of the speed of writing the redo log into the magnetic disk every 30 seconds is obtained and is used as the speed of brushing the disk by the InNODB.
In an embodiment, a preset value of the disk brushing rate, that is, an evaluation parameter, may be manually set in advance, and when the disk brushing rate obtained through the shell script is compared with the preset value, if the disk brushing rate is greater than the preset value, the evaluation may be considered to be passed.
After the seven evaluation results of the MySQL database are obtained according to the methods 1) to 7) of the above embodiment, whether to perform data backup can be determined according to the evaluation results. It should be noted that the seven pieces of running information of MySQL obtained according to the shell script may be executed in series or in parallel. When executed serially, when the evaluation of the first run information is not passed, no subsequent evaluation determination is needed, so that a preferred embodiment puts a simpler method of determining to the first execution, e.g., determining if something is big. And when the parallel execution is carried out, obtaining seven operation information of MySQL according to the shell script, obtaining seven evaluation results, and finally judging the seven evaluation results together, wherein if any one evaluation result fails, the judgment result is that the current backup is not suitable.
And if the current is not suitable for backup, analyzing again after waiting for the input time; if the current system is suitable for backup, the backup is carried out, whether the backup is normally finished or not is judged after the backup is carried out, if the backup is failed, the running result of the current system comprising the seven MySQL running information is printed, and the failure reason is judged so as to facilitate subsequent analysis. And if the final backup fails, initiating a timing task, and analyzing the backup again according to the set time.
It is to be understood that, in the above embodiment, the evaluation parameters required for determination may be adjusted by a person according to the experience value of data backup at ordinary times.
According to the data backup method for improving the backup efficiency and avoiding the backup risk, the SHELL script is adopted to automatically collect and obtain MySQL running information, and the current backup or other appropriate time is selected to trigger the backup task according to the input evaluation parameters; the method not only can be used as a timing task to perform batch backup at a fixed time every day, but also can be used for manually executing a corresponding burst backup scene. Therefore, the problems of manual misjudgment caused by manual backup and the need of spending a large amount of manpower for evaluation before backup are solved, the influence on the industrial business is avoided during backup, the cost of manual backup is reduced, the risk of manual backup is avoided, the success rate of backup is improved, and the data safety is ensured. And if the backup is found to be failed, the backup log can be automatically detected, the running state of the instance at the time of the failure is printed, the follow-up optimization basis is rapidly provided, and the backup timing task is analyzed and scheduled again at intervals.
Based on the same inventive concept, the embodiments of the present application further provide a data backup system, which can be used to implement the methods described in the above embodiments, as described in the following embodiments. Because the principle of the data backup system for solving the problem is similar to the data backup method of the above embodiment, the implementation of the data backup system may refer to the implementation of the software performance reference determination method, and repeated details are not repeated. As used hereinafter, the terms "device," "unit," or "module" may refer to a combination of software and/or hardware that implements a predetermined function. While the system described in the embodiments below is preferably implemented in software, implementations in hardware, or a combination of software and hardware are also possible and contemplated.
Referring to fig. 3, an embodiment of the present application provides a data backup system, including: the information acquisition device 31 is used for acquiring MySQL operation information by adopting a SHELL command; and the backup evaluation device 32 is used for generating an evaluation result according to the operation information and preset evaluation parameters, and judging whether to perform data backup according to the evaluation result.
In some embodiments, the MySQL running information acquired by the information acquisition device by using the SHELL command includes: backup path remnant disk space conditions, approximate values of the number and size of rows of the current backup object and non-inodb table, whether there are DDL operations, whether there are something big, the rate at which the inodb is flushed, and whether there are row locks, table locks, global locks.
Referring to fig. 4, the backup evaluation apparatus 32 according to the embodiment of the present application includes a first evaluation module 321, configured to obtain the situation of the remaining disk space of the backup path by executing df-h and lsblk commands, and generate a first evaluation result according to a preset disk space remaining parameter.
Referring to fig. 4, the backup evaluation device 32 of the embodiment of the present application includes a second evaluation module 322, configured to: and obtaining approximate values of the line number and the size of the current backup object, evaluating the time spent on the backup, and generating a second evaluation result.
Referring to fig. 4, the backup evaluation device 32 of the embodiment of the present application includes a third evaluation module 323 configured to: and obtaining approximate values of the line number and the size of the non-InNODB table of the current backup object, evaluating the time needed by the lock table, and generating a third evaluation result.
Referring to fig. 4, the backup evaluating apparatus 32 according to the embodiment of the present application includes a fourth evaluating module 324, configured to determine whether a DDL operation exists by using a SHELL command, and generate a fourth evaluating result.
Referring to fig. 4, the backup evaluation device 32 of the embodiment of the present application includes a fifth evaluation module 325, which is configured to determine whether there is something big using the SHELL command, and generate a fifth evaluation result.
Referring to fig. 4, the backup evaluation apparatus 32 according to the embodiment of the present application includes a sixth evaluation module 326, configured to determine whether a row lock, a table lock, or a global lock exists by using a SHELL command, and generate a sixth evaluation result.
Referring to fig. 4, the backup evaluation device 32 of the embodiment of the present application includes a seventh evaluation module 327, configured to determine a speed of the inbound db disk refreshing by using the SHELL command, and generate a seventh evaluation result according to a preset disk refreshing speed parameter.
Referring to fig. 4, the backup evaluation apparatus 32 according to the embodiment of the present application further includes a determining module 328, configured to determine whether to perform data backup according to the evaluation result, and if the data backup is not currently performed, evaluate the data backup again after a set waiting time; if the current backup is suitable, performing backup, judging whether the backup is normally finished or not after the backup, and if the backup is not normally finished, printing the evaluation result for analysis.
In terms of hardware, the present application further provides an embodiment of an electronic device for implementing all or part of contents in the data backup system, where the electronic device specifically includes the following contents:
a Processor (Processor), a Memory (Memory), a communication Interface (Communications Interface) and a bus; the processor, the memory and the communication interface complete mutual communication through the bus; the communication interface is used for realizing information transmission between the data backup system and relevant equipment such as a core service system, a user terminal and a relevant database; the logic controller may be a desktop computer, a tablet computer, a mobile terminal, and the like, but the embodiment is not limited thereto. In this embodiment, the logic controller may be implemented with reference to the embodiment of the data backup method and the embodiment of the data backup system in the embodiment, and the contents thereof are incorporated herein, and repeated descriptions are omitted.
In practical applications, part of the data backup method may be executed on the electronic device side as described above, or all operations may be completed in the client device. The selection may be specifically performed according to the processing capability of the client device, the limitation of the user usage scenario, and the like. This is not a limitation of the present application. The client device may further include a processor if all operations are performed in the client device.
Fig. 5 is a schematic block diagram of a system configuration of an electronic device according to an embodiment of the present application. As shown in fig. 5, the electronic device may include a central processor 51 and a memory 52; the memory 52 is coupled to the central processor 51. Notably, this FIG. 5 is exemplary; other types of structures may also be used in addition to or in place of the structure to implement telecommunications or other functions.
In another embodiment, the data backup system may be configured separately from the central processor 51, for example, the data backup system may be configured as a chip connected to the central processor 51, and the function of the data backup system is realized by the control of the central processor 51.
The memory 52 may be, for example, one or more of a buffer, a flash memory, a hard drive, a removable media, a volatile memory, a non-volatile memory, or other suitable device. The information relating to the failure may be stored, and a program for executing the information may be stored. And the central processor 51 may execute the program stored in the memory 52 to realize information storage or processing, or the like.
According to the data backup method, the data backup system, the electronic equipment and the storage medium disclosed by the embodiment of the invention, the SHELL script can be adopted to automatically collect and obtain MySQL operation information, and the current backup or other appropriate time trigger backup tasks are selected according to the input evaluation parameters; the method not only can be used as a timing task to perform batch backup at a fixed time every day, but also can be used for manually executing a corresponding burst backup scene. Therefore, the problems of manual misjudgment caused by manual backup and the need of spending a large amount of manpower for evaluation before backup are solved, the influence on the industrial business is avoided during backup, the cost of manual backup is reduced, the risk of manual backup is avoided, the success rate of backup is improved, and the data safety is ensured. And if the backup is found to be failed, the backup log can be automatically detected, the running state of the instance at the time of the failure is printed, the follow-up optimization basis is rapidly provided, and the backup timing task is analyzed and scheduled again at intervals.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (devices), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The principle and the implementation mode of the invention are explained by applying specific embodiments in the invention, and the description of the embodiments is only used for helping to understand the method and the core idea of the invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (14)

1. A method for data backup, comprising:
acquiring MySQL operation information by adopting a SHELL command;
and generating an evaluation result according to the operation information and a preset evaluation parameter, and judging whether to perform data backup according to the evaluation result.
2. The data backup method according to claim 1, wherein the MySQL running information obtained by adopting the SHELL command comprises:
the backup path residual disk space condition, the approximate values of the number of rows and the size of the current backup object, the approximate values of the number of rows and the size of the non-inoDB table of the current backup object, whether a DDL operation exists, whether a big thing exists, the speed of the InonoDB disk refreshing, and whether a row lock, a table lock and a global lock exist.
3. The data backup method according to claim 2, wherein the generating an evaluation result according to the operation information and a preset evaluation parameter comprises:
and obtaining the condition of the residual disk space of the backup path by executing the df-h and lsblk commands, and generating a first evaluation result according to preset disk space residual parameters.
4. The data backup method according to claim 2, wherein the generating an evaluation result according to the operation information and a preset evaluation parameter comprises:
and obtaining approximate values of the line number and the size of the current backup object, evaluating the time spent on the backup, and generating a second evaluation result.
5. The data backup method according to claim 2, wherein the generating an evaluation result according to the operation information and a preset evaluation parameter comprises:
and obtaining approximate values of the line number and the size of the non-InNODB table of the current backup object, evaluating the time needed by the lock table, and generating a third evaluation result.
6. The data backup method according to claim 2, wherein the generating an evaluation result according to the operation information and a preset evaluation parameter comprises:
and judging whether the DDL operation exists or not by adopting a SHELL command, and generating a fourth evaluation result.
7. The data backup method according to claim 2, wherein the generating an evaluation result according to the operation information and a preset evaluation parameter comprises:
and judging whether a large object exists or not by adopting a SHELL command, and generating a fifth evaluation result.
8. The data backup method according to claim 2, wherein the generating an evaluation result according to the operation information and a preset evaluation parameter comprises:
and judging whether a row lock, a table lock and a global lock exist by adopting a SHELL command, and generating a sixth evaluation result.
9. The data backup method according to claim 2, wherein the generating an evaluation result according to the operation information and a preset evaluation parameter comprises:
and judging the InNODB disk brushing rate by adopting a SHELL command, and generating a seventh evaluation result according to a preset disk brushing rate parameter.
10. The data backup method according to any one of claims 1 to 9, wherein determining whether to perform data backup according to the evaluation result includes:
if the data is not suitable for data backup at present, evaluating again after the set waiting time;
if the current backup is suitable, performing backup, judging whether the backup is normally finished or not after the backup, and if the backup is not normally finished, printing the evaluation result for analysis.
11. A data backup system, comprising:
the information acquisition device is used for acquiring MySQL operation information by adopting a SHELL command;
and the backup evaluation device is used for generating an evaluation result according to the operation information and preset evaluation parameters and judging whether to perform data backup according to the evaluation result.
12. The data backup system of claim 11, wherein the MySQL running information acquired by the information acquisition device using the SHELL command comprises:
the backup path residual disk space condition, the approximate values of the number of rows and the size of the current backup object, the approximate values of the number of rows and the size of the non-inoDB table of the current backup object, whether a DDL operation exists, whether a big thing exists, the speed of the InonoDB disk refreshing, and whether a row lock, a table lock and a global lock exist.
13. An electronic device, characterized in that the electronic device comprises a processor and a memory, the processor being configured to execute a computer program stored in the memory to implement the data backup method according to any one of claims 1 to 10.
14. A computer-readable storage medium storing at least one instruction which, when executed by a processor, implements a data backup method as claimed in any one of claims 1 to 10.
CN202110746537.2A 2021-07-01 2021-07-01 Data backup method and system, electronic equipment and storage medium Active CN113467994B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110746537.2A CN113467994B (en) 2021-07-01 2021-07-01 Data backup method and system, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110746537.2A CN113467994B (en) 2021-07-01 2021-07-01 Data backup method and system, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113467994A true CN113467994A (en) 2021-10-01
CN113467994B CN113467994B (en) 2022-12-23

Family

ID=77877199

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110746537.2A Active CN113467994B (en) 2021-07-01 2021-07-01 Data backup method and system, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113467994B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103888287A (en) * 2013-12-18 2014-06-25 北京首都国际机场股份有限公司 Information system integrated operation and maintenance monitoring service early warning platform and realization method thereof
CN104765652A (en) * 2014-01-08 2015-07-08 中国移动通信集团浙江有限公司 Data backup and data recovery method and device
CN105373450A (en) * 2015-11-30 2016-03-02 国网北京市电力公司 Data backup method and apparatus
CN110795420A (en) * 2019-10-30 2020-02-14 浪潮云信息技术有限公司 Automatic MySQL database backup method based on infrastructure
US20200133784A1 (en) * 2018-10-25 2020-04-30 EMC IP Holding Company LLC Systems and methods for performing backups of a server database
CN111625339A (en) * 2020-05-28 2020-09-04 网易有道信息技术(北京)有限公司 Cluster resource scheduling method, device, medium and computing equipment
CN112685170A (en) * 2019-10-18 2021-04-20 伊姆西Ip控股有限责任公司 Dynamic optimization of backup strategies

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103888287A (en) * 2013-12-18 2014-06-25 北京首都国际机场股份有限公司 Information system integrated operation and maintenance monitoring service early warning platform and realization method thereof
CN104765652A (en) * 2014-01-08 2015-07-08 中国移动通信集团浙江有限公司 Data backup and data recovery method and device
CN105373450A (en) * 2015-11-30 2016-03-02 国网北京市电力公司 Data backup method and apparatus
US20200133784A1 (en) * 2018-10-25 2020-04-30 EMC IP Holding Company LLC Systems and methods for performing backups of a server database
CN112685170A (en) * 2019-10-18 2021-04-20 伊姆西Ip控股有限责任公司 Dynamic optimization of backup strategies
CN110795420A (en) * 2019-10-30 2020-02-14 浪潮云信息技术有限公司 Automatic MySQL database backup method based on infrastructure
CN111625339A (en) * 2020-05-28 2020-09-04 网易有道信息技术(北京)有限公司 Cluster resource scheduling method, device, medium and computing equipment

Also Published As

Publication number Publication date
CN113467994B (en) 2022-12-23

Similar Documents

Publication Publication Date Title
CN107391628B (en) Data synchronization method and device
CN105718570B (en) Data migration method and device for database
US7386752B1 (en) Using asset dependencies to identify the recovery set and optionally automate and/or optimize the recovery
CN106445738B (en) Database backup method and device
EP3722973B1 (en) Data processing method and device for distributed database, storage medium, and electronic device
CN107391634B (en) Data migration method and device
CN105573859A (en) Data recovery method and device of database
CN110515795B (en) Big data component monitoring method and device and electronic equipment
CN109063005B (en) Data migration method and system, storage medium and electronic device
CN110008129B (en) Reliability test method, device and equipment for storage timing snapshot
CN108573019B (en) Data migration method and device, electronic equipment and readable storage medium
CN107153609B (en) Automatic testing method and device
US8935207B2 (en) Inspecting replicated data
CN110569142A (en) ORACLE data increment synchronization system and method
CN108121774B (en) Data table backup method and terminal equipment
CN107179982B (en) Cross-process debugging method and device
CN106649000B (en) Fault recovery method of real-time processing engine and corresponding server
CN109063040B (en) Client program data acquisition method and system
CA2950689C (en) System and method for the production of job level pre-processed backup of critical data and/or datasets in a mainframe computing environment
CN113467994B (en) Data backup method and system, electronic equipment and storage medium
CN111198920B (en) Method and device for determining comparison table snapshot based on database synchronization
CN116089518A (en) Data model extraction method and system, terminal and medium
CN111240891A (en) Data recovery method and device based on data consistency among multiple tables of database
CN111221801A (en) Database migration method, system and related device
CN117931514A (en) Backup method, recovery method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant