CN114647536A - Database backup method and device - Google Patents

Database backup method and device Download PDF

Info

Publication number
CN114647536A
CN114647536A CN202011497348.8A CN202011497348A CN114647536A CN 114647536 A CN114647536 A CN 114647536A CN 202011497348 A CN202011497348 A CN 202011497348A CN 114647536 A CN114647536 A CN 114647536A
Authority
CN
China
Prior art keywords
database
backup
address
asynchronous
script
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.)
Pending
Application number
CN202011497348.8A
Other languages
Chinese (zh)
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.)
NetsUnion Clearing Corp
Original Assignee
NetsUnion Clearing Corp
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 NetsUnion Clearing Corp filed Critical NetsUnion Clearing Corp
Priority to CN202011497348.8A priority Critical patent/CN114647536A/en
Publication of CN114647536A publication Critical patent/CN114647536A/en
Pending legal-status Critical Current

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
    • G06F11/1458Management of the backup or restore process
    • G06F11/1464Management of the backup or restore process for networked environments
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • G06F16/273Asynchronous replication or reconciliation

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Quality & Reliability (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application provides a database backup method and a device, wherein the method comprises the following steps: obtaining database configuration information, wherein the database configuration information comprises: an asynchronous backup library IP address and a backup script IP address; judging whether the backup script IP address is the same as the asynchronous backup library IP address or not according to the database configuration information; under the condition that the backup script IP address is different from the asynchronous standby library IP address, replacing the backup script IP address with the asynchronous standby library IP address; and running a backup script to perform database backup. Before the database after the switching of the main database and the standby database is finished is backed up, the database type judgment is firstly carried out on the database corresponding to the execution script, and the database backup is carried out under the condition that the database is determined to be the asynchronous standby database. The condition of database backup of the main database is effectively avoided, so that service blockage caused by database backup of the main database is avoided, safe operation of the main database service is guaranteed, and the safety of the database is improved.

Description

Database backup method and device
Technical Field
The invention relates to the field of databases, in particular to a database backup method and a database backup device.
Background
With the development of network technology, databases have been widely applied to various industries. For example: the database applied to the financial industry is generally deployed by adopting a one-master two-slave architecture because the complexity of the business of the financial industry is high and the requirement on the business continuity is also high. The one-master-two-slave architecture is composed of a master library and two standby libraries, wherein a semi-synchronous strategy is adopted between one standby library and the master library for data synchronization, the semi-synchronous standby library is short, and an asynchronous strategy is adopted between the other standby library and the master library for data synchronization, the asynchronous standby library is short.
In the prior art, a backup script for implementing a database backup function is usually deployed on an asynchronous backup library, and the database is locked when the backup script is run, so that after the asynchronous backup library is switched with a main library, a service of the main library may be blocked, which causes a risk to the security of the database.
Disclosure of Invention
Therefore, the technical problem to be solved by the present invention is to overcome the defect of low security of the database backup method in the prior art, so as to provide a database backup method and apparatus.
A first aspect of the present application provides a database backup method, including:
obtaining database configuration information, wherein the database configuration information comprises: an asynchronous backup library IP address and a backup script IP address;
judging whether the backup script IP address is the same as the asynchronous standby library IP address or not according to the database configuration information;
under the condition that the backup script IP address is different from the asynchronous standby library IP address, replacing the backup script IP address with the asynchronous standby library IP address;
and running the backup script to perform database backup.
Optionally, before obtaining the database configuration information, the method further includes:
acquiring monitoring information of the database; judging whether the database completes the switching operation of the main database and the standby database according to the monitoring information;
and executing the step of acquiring the configuration information of the database under the condition that the database completes the switching operation of the main database and the standby database.
Optionally, before the backup script is executed, the method further includes:
acquiring a database state of a main database, and judging whether the database state is a survival state or not;
and executing the step of running the backup script under the condition that the database state is the survival state.
Optionally, before the backup script is executed, the method further includes:
acquiring the read-write state of the asynchronous standby library, and judging whether the read-write state is a read-only state;
and executing the step of running the backup script under the condition that the read-write state is a read-only state.
Optionally, before the backup script is executed, the method further includes:
acquiring resource pool information corresponding to the IP address of the asynchronous standby library;
judging whether the type of the database corresponding to the IP address of the asynchronous standby library is the asynchronous standby library or not according to the resource pool information; and executing the step of running the backup script under the condition that the type of the database corresponding to the IP address of the asynchronous standby library is the asynchronous standby library.
Optionally, before the backup script is executed, the method further includes:
judging whether the backup script meets a preset operation condition or not;
and executing the step of running the backup script under the condition that the backup script accords with the preset running condition.
Optionally, when the switching operation of the main library and the standby library is not completed, or when the read-write state is not a read-only state, or when the type of the database corresponding to the IP address of the asynchronous standby library is not an asynchronous standby library, or when the backup script does not meet the preset operating condition, an alarm is given.
A second aspect of the present application provides a database backup apparatus, including: the device comprises an acquisition module, a judgment module, a configuration module and a backup module;
the obtaining module is configured to obtain database configuration information, where the database configuration information includes: an asynchronous backup library IP address and a backup script IP address;
the judging module is used for judging whether the backup script IP address is the same as the asynchronous backup library IP address according to the database configuration information;
the configuration module is used for replacing the backup script IP address with the asynchronous standby library IP address under the condition that the backup script IP address is different from the asynchronous standby library IP address;
and the backup module is used for operating the backup script and carrying out database backup.
Optionally, the obtaining module is further configured to: acquiring monitoring information of the database; judging whether the database completes the switching operation of the main database and the standby database according to the monitoring information;
and executing the step of acquiring the configuration information of the database under the condition that the database completes the switching operation of the main database and the standby database.
Optionally, the determining module is further configured to: acquiring a database state of a main database, and judging whether the database state is a survival state or not;
and executing the step of running the backup script under the condition that the database state is the survival state.
Optionally, the determining module is further configured to: acquiring the read-write state of the asynchronous standby library, and judging whether the read-write state is a read-only state;
and executing the step of running the backup script under the condition that the read-write state is a read-only state.
Optionally, the determining module is further configured to: acquiring resource pool information corresponding to the IP address of the asynchronous standby library;
judging whether the type of the database corresponding to the IP address of the asynchronous standby library is the asynchronous standby library or not according to the resource pool information; and executing the step of running the backup script under the condition that the type of the database corresponding to the IP address of the asynchronous standby library is the asynchronous standby library.
Optionally, the determining module is further configured to: judging whether the backup script meets a preset operation condition or not;
and executing the step of running the backup script under the condition that the backup script accords with the preset running condition.
Optionally, the determining module is further configured to: and under the condition that the switching operation of the main database and the standby database is not completed, or under the condition that the read-write state is not a read-only state, or under the condition that the type of the database corresponding to the IP address of the asynchronous standby database is not the asynchronous standby database, or under the condition that the backup script does not accord with the preset operation condition, alarming.
A third aspect of the present application provides an electronic device, comprising: at least one processor and a memory;
the memory stores computer-executable instructions;
the at least one processor executes computer-executable instructions stored by the memory to cause the at least one processor to perform the method as set forth in the first aspect above and in various possible designs of the first aspect.
A fourth aspect of the present application provides a storage medium containing computer-executable instructions for performing a method as set forth in the first aspect above and in various possible designs of the first aspect when executed by a computer processor.
The technical scheme of the invention has the following advantages:
according to the database backup method and device provided by the application, the database configuration information is acquired, wherein the database configuration information comprises: an asynchronous backup library IP address and a backup script IP address; judging whether the backup script IP address is the same as the asynchronous backup library IP address or not according to the database configuration information; under the condition that the backup script IP address is different from the asynchronous standby library IP address, replacing the backup script IP address with the asynchronous standby library IP address; and running a backup script to perform database backup. According to the database backup method provided by the scheme, before the database after the switching of the main database and the standby database is completed is backed up, the database type corresponding to the execution backup script is judged, and the database backup is performed only under the condition that the database is determined to be the asynchronous standby database, so that the condition that the database is backed up on the main database is avoided, thereby avoiding service blockage caused by database backup on the main database, ensuring the normal operation of the main database service, and improving the safety of the database.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art according to the drawings.
Fig. 1 is a schematic structural diagram of a database backup system according to an embodiment of the present application;
fig. 2 is a schematic flowchart of a database backup method according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of a database system according to an embodiment of the present application;
fig. 4 is a schematic flowchart of another database backup method according to an embodiment of the present application;
fig. 5 is a schematic flowchart of another database backup method according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of a database backup device according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions of the present invention will be described clearly and completely with reference to the accompanying drawings, and it should be understood that the described embodiments are some, but not all embodiments of the present invention. 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 invention.
The database backup method and the database backup device provided by the embodiment of the application are suitable for avoiding database backup operation on the main database, so that the service of the main database is prevented from being blocked, the normal operation of the service of the main database is guaranteed, and the safety of the database is improved. Fig. 1 is a schematic structural diagram of a database backup system according to an embodiment of the present invention, where the system may include a database system and a database backup apparatus for backing up a database, where the database system includes: the system comprises a main library, a semi-synchronous standby library and an asynchronous standby library. And under the condition that the switching of the main database and the standby database is completed in the database system, the database backup device judges the database type of the database corresponding to the execution script before the database backup is carried out, and carries out the database backup under the condition that the database is determined to be an asynchronous standby database, otherwise, does not carry out the database backup.
However, in the prior art, the backup scripts for implementing the database backup function are usually deployed according to the IP address, and the backup scripts are deployed on the asynchronous backup library. When the database is switched between the main database and the standby database, namely the original asynchronous standby database is switched to the main database, and the original main database is switched to the asynchronous standby database, because the IP address of the asynchronous standby database is changed, if the backup script is still deployed according to the original IP address, the backup script can be deployed on the original main database or the original semi-synchronous standby database. When the backup script is executed on the original master library, the backup tool can generate a lock in the backup process, which can block the service of the original master library, thereby affecting the normal operation of the service.
Therefore, according to the database backup method and device provided by the embodiment of the application, the database configuration information is acquired, wherein the database configuration information includes: an asynchronous backup library IP address and a backup script IP address; judging whether the backup script IP address is the same as the asynchronous backup library IP address or not according to the database configuration information; under the condition that the backup script IP address is different from the asynchronous standby library IP address, replacing the backup script IP address with the asynchronous standby library IP address; and running a backup script to perform database backup. According to the database backup method provided by the scheme, before the database after the switching of the main database and the standby database is completed is backed up, the database type judgment is firstly carried out on the database corresponding to the execution script, and the database backup is carried out under the condition that the database is determined to be the asynchronous standby database. The condition of database backup of the main database is effectively avoided, so that service blockage caused by database backup of the main database is avoided, normal operation of main database services is guaranteed, the condition of failure in service data storage is avoided, and the safety of the database is improved.
The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments. Embodiments of the present invention will be described below with reference to the accompanying drawings.
The embodiment of the application provides a database backup method, which is used for overcoming the defect that the database backup method in the prior art is low in safety. The execution subject of the embodiment of the present application is an electronic device, such as a server, a desktop computer, a notebook computer, a tablet computer, and other electronic devices that can be used for database backup.
As shown in fig. 2, a schematic flowchart of a database backup method provided in an embodiment of the present application is shown, where the method includes:
step 101, obtaining database configuration information;
wherein the database configuration information includes: an asynchronous backup library IP address and a backup script IP address.
It should be noted that the master library, the semi-synchronous standby library and the asynchronous standby library in the database system can be used as the master library to perform interaction of service data, wherein the service data is interacted with the database based on the VIP connection. And when the main library is determined to have a fault, the database switching tool switches the VIP connection port to the corresponding standby library so as to carry out normal interaction of the service data.
For example, if the database system is applied to the financial field, in the case of maintaining and upgrading the main library, since a large amount of extra preparation work is required for the main library replacement operation, in order to avoid unnecessary database switching, each spare library can be used as the main library to perform business data interaction based on VIP connection.
Specifically, a VIP viewing tool is adopted to obtain a main architecture of the database system, and an asynchronous backup library IP address and a backup script IP address in the database system are obtained.
Specifically, in an embodiment, before acquiring the configuration information of the database, monitoring information of the database needs to be acquired; judging whether the database completes the switching operation of the main database and the standby database according to the monitoring information; and executing the step of acquiring the configuration information of the database under the condition that the database completes the switching operation of the main database and the standby database.
Step 102, judging whether the backup script IP address is the same as the asynchronous backup library IP address according to the database configuration information;
it should be noted that, in the process of data backup, in order to ensure the consistency of data, a lock is generated on the backed-up database, that is, the backup of the database may affect the interactive performance of the database. Therefore, the asynchronous standby library is usually used for data backup, and the backup script IP address is deployed according to the IP address of the original asynchronous standby library, that is, the backup script IP address is the same as the IP address of the asynchronous standby library before database switching.
However, since the IP address of the asynchronous standby library may change during the database switching process, the database corresponding to the IP address of the original asynchronous standby library may have been switched to the primary library.
Exemplarily, as shown in fig. 3, a schematic structural diagram of a database system provided in the embodiment of the present application is shown, where a first database system on the left side is a schematic structural diagram of a database system before database switching is performed, and a second database system on the right side is a schematic structural diagram of a database system after database switching is performed. Therefore, in the database system after database switching, the database corresponding to the backup script is not necessarily an asynchronous backup database, and may also be a main database. The database is switched based on an HA switching tool, and the HA is mainly responsible for switching the VIP to the semi-synchronous standby library to perform normal business data interaction after the main library fails. And when the semi-synchronous standby library fails, the HA is automatically built for the main library and the asynchronous standby library so as to improve the usability of the database architecture.
Specifically, in order to avoid database backup by using a database other than the asynchronous standby database, before database backup, whether the asynchronous standby database IP address and the backup script IP address correspond to each other is judged according to the acquired asynchronous standby database IP address and the backup script IP address, that is, whether the asynchronous standby database IP address and the backup script IP address are the same is determined.
103, replacing the backup script IP address with the asynchronous standby library IP address under the condition that the backup script IP address is different from the asynchronous standby library IP address;
specifically, if it is determined that the database corresponding to the backup script IP address is not the asynchronous backup library, the backup script IP address needs to be replaced according to the obtained asynchronous backup library IP address, so that the two are corresponding to each other.
And step 104, running a backup script to perform database backup.
Specifically, when the backup script IP address is determined to be the same as the asynchronous standby library IP address, the database backup is determined to be performed by the asynchronous standby library, and the influence on the interaction performance of the database is avoided.
Specifically, in an embodiment, before running the backup script, the database state of the master library needs to be acquired, and whether the database state is a live state is determined; and executing the step of running the backup script under the condition that the database state is the survival state.
If the database state of the main database is not a survival state, the failure of the main database is proved to be not relieved, at the moment, alarm processing is carried out to remind relevant operators to repair the database, and database backup is not carried out in the database repair process.
On the basis of the foregoing embodiment, in order to further determine the database type of the database corresponding to the backup script to avoid performing database backup on databases other than the asynchronous backup database, fig. 4 is a flowchart of another database backup method provided in the embodiment of the present application, and as an implementable manner, on the basis of the foregoing embodiment, in an embodiment, before the backup script is executed, the database backup method provided in the embodiment of the present application further includes:
step 401, acquiring a read-write state of an asynchronous standby library, and judging whether the read-write state is a read-only state;
and step 402, executing the step of running the backup script under the condition that the read-write state is the read-only state.
It should be noted that the read-write state of the master library is usually a readable writable state or a writable state, and the read-write state of the asynchronous standby library is a read-only state.
For example, when the read-write state of the database corresponding to the IP address of the backup script is determined, a "show variables like"% read _ only% "database instruction may be executed according to the IP address of the backup script to determine the read-write state of the database corresponding to the IP address, and if the read-write state of the database is determined to be the read-only state, the backup script is run, and the database is backed up. If the read-write state of the database is determined to be a writable state, the step is proved to have errors, and/or the database type judgment step before the step has errors, and at the moment, alarm processing is carried out to remind an operator to diagnose and repair related faults.
On the basis of the foregoing embodiment, in order to further determine the database type of the database corresponding to the backup script to avoid database backup for the databases other than the asynchronous backup script, fig. 5 is a schematic flowchart of another database backup method provided in the embodiment of the present application, and as an implementable manner, on the basis of the foregoing embodiment, in an embodiment, before the backup script is run, the database backup method provided in the embodiment of the present application further includes:
step 501, acquiring resource pool information corresponding to an IP address of an asynchronous standby library;
step 502, judging whether the type of the database corresponding to the IP address of the asynchronous standby library is the asynchronous standby library according to the resource pool information; and executing the step of running the backup script under the condition that the type of the database corresponding to the IP address of the asynchronous standby library is the asynchronous standby library.
It should be noted that the resource pool includes a failure condition of the database and a database switching condition, where the IP address of each database recorded by the resource pool is updated according to the switching condition of each database, so as to ensure consistency between the resource pool information and the actual environment. That is, the database type of the database corresponding to each IP address may be determined according to the resource pool information.
Illustratively, based on the resource pool interface, resource pool information corresponding to the IP address of the asynchronous standby library corresponding to the backup script is obtained, and if it is determined that the database type recorded in the resource pool information is the asynchronous standby library, the backup script is run, and the database is backed up. On the contrary, if the database type recorded in the resource pool information is not the asynchronous standby database, it is proved that an error occurs in the step, and/or an error occurs in the database type judgment step before the step, and at this time, an alarm is given to remind an operator to diagnose and repair the related fault.
On the basis of the above embodiment, in order to avoid the database from failing in the database backup process, the performance of the database needs to be diagnosed before the database backup is performed, so as to avoid the database backup failure caused by the performance defect of the database, thereby improving the security of the database.
As a practical manner, on the basis of the foregoing embodiment, in an embodiment, before the running the backup script, the database backup method provided in the embodiment of the present application further includes: judging whether the backup script meets preset operation conditions or not; and executing the backup script under the condition that the backup script meets the preset operation condition.
Specifically, according to the logic information of the backup script, the performance data of the database corresponding to the backup script may be determined, where the performance data of the database includes: database system load, disk space, database thread number, and the like. And judging whether the performance data of the database meets preset operation conditions, namely judging whether the database can meet the requirement of database backup.
And if the database performance of the asynchronous standby database does not meet the preset operation condition, performing alarm processing to remind an operator to diagnose and repair the related fault.
Illustratively, in order to improve the management capability of database backup and count the switching and backup conditions of each database of a database system, a database backup platform may be developed by python based on a django frame, and used for counting the backup conditions of each day, scheduling the execution time of a backup script based on the database backup platform, and controlling the backup work to be performed at the end of business peak at night, so as to avoid a large amount of load generated by the backup of the database under the condition of high load of the database.
Specifically, in an embodiment, the alarm is performed when the switching operation of the main and standby databases is not completed, or when the read-write state is not the read-only state, or when the type of the database corresponding to the IP address of the asynchronous standby database is not the asynchronous standby database, or when the asynchronous standby database does not meet the preset operating condition.
The alarming mainly refers to reporting fault prompt information, wherein the fault prompt information can be sent to relevant operators in a short message mode, and can also be reported in other modes such as a prompt lamp or a prompt tone, and the embodiment of the application is not limited.
In the present embodiment, each implementable mode may be implemented alone, or may be implemented in combination in any combination without conflict, and the present embodiment is not limited.
The database backup method provided by the embodiment of the application obtains the configuration information of the database, wherein the configuration information of the database comprises the following steps: an asynchronous backup library IP address and a backup script IP address; judging whether the backup script IP address is the same as the asynchronous backup library IP address or not according to the database configuration information; under the condition that the backup script IP address is different from the asynchronous standby library IP address, replacing the backup script IP address with the asynchronous standby library IP address; and running a backup script to perform database backup. According to the database backup method provided by the scheme, before the database after the switching of the main database and the standby database is completed is backed up, the database type judgment is firstly carried out on the database corresponding to the execution script, and the database backup is carried out under the condition that the database is determined to be the asynchronous standby database. The condition of database backup of the main database is effectively avoided, so that service blockage caused by database backup of the main database is avoided, normal operation of main database services is guaranteed, and the safety of the database is improved.
The embodiment of the application provides a database backup device, which is used for overcoming the defect that a database backup method in the prior art is low in safety. As shown in fig. 6, which is a schematic structural diagram of a database backup apparatus provided in the embodiment of the present application, the apparatus 60 includes: an obtaining module 601, a judging module 602, a configuring module 603 and a backup module 604.
The obtaining module 601 is configured to obtain database configuration information, where the database configuration information includes: an asynchronous backup library IP address and a backup script IP address; a judging module 602, configured to judge whether the backup script IP address is the same as the asynchronous backup library IP address according to the database configuration information; the configuration module 603 is configured to replace the backup script IP address with the asynchronous standby library IP address when the backup script IP address is different from the asynchronous standby library IP address; and the backup module 604 is used for running a backup script to perform database backup.
Specifically, in an embodiment, the obtaining module 601 is further configured to: acquiring monitoring information of a database; judging whether the database completes the switching operation of the main database and the standby database according to the monitoring information;
and executing the step of acquiring the configuration information of the database under the condition that the database completes the switching operation of the main database and the standby database.
Specifically, in an embodiment, the determining module 602 is further configured to: acquiring the database state of a main database, and judging whether the database state is a survival state or not;
and executing the step of running the backup script under the condition that the database state is the survival state.
Specifically, in an embodiment, the determining module 602 is further configured to: acquiring the read-write state of the asynchronous standby library, and judging whether the read-write state is a read-only state;
and executing the step of running the backup script under the condition that the read-write state is the read-only state.
Specifically, in an embodiment, the determining module 602 is further configured to: acquiring resource pool information corresponding to the IP address of the asynchronous standby library;
judging whether the type of the database corresponding to the IP address of the asynchronous standby library is the asynchronous standby library or not according to the resource pool information; and executing the step of running the backup script under the condition that the type of the database corresponding to the IP address of the asynchronous standby library is the asynchronous standby library.
Specifically, in an embodiment, the determining module 602 is further configured to: judging whether the backup script meets preset operation conditions or not;
and executing the step of running the backup script under the condition that the backup script accords with the preset running condition.
Specifically, in an embodiment, the determining module 602 is further configured to: and under the condition that the switching operation of the main and standby databases is not completed, or under the condition that the read-write state is not the read-only state, or under the condition that the type of the database corresponding to the IP address of the asynchronous standby database is not the asynchronous standby database, or under the condition that the backup script does not accord with the preset operation condition, alarming.
The database backup device provided in the embodiment of the present application is used for executing the database backup method provided in the above embodiment, and the implementation manner and principle thereof are the same and are not described again.
The embodiment of the application further provides electronic equipment for executing the method provided by the embodiment.
Fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present application. The electronic device 70 includes: at least one processor 71 and memory 72;
wherein execution of the memory-stored computer-executable instructions by the at least one processor causes the at least one processor to perform the instructions of the method as in any one of the preceding embodiments.
The electronic device provided in the embodiment of the present application is configured to execute the database backup method provided in the foregoing embodiment, and an implementation manner and a principle of the electronic device are the same, which are not described again.
The embodiment of the present application provides a storage medium containing computer executable instructions, where the storage medium stores computer processor execution instructions, and when the processor executes the computer execution instructions, the method provided in any one of the above embodiments is implemented.
The storage medium including the computer-executable instructions of the embodiment of the present application may be used to store the computer-executable instructions of the database backup method provided in the foregoing embodiment, and the implementation manner and the principle thereof are the same and are not described again.
It should be understood that the above examples are only for clarity of illustration and are not intended to limit the embodiments. Other variations and modifications will be apparent to persons skilled in the art in light of the above description. And are neither required nor exhaustive of all embodiments. And obvious variations or modifications therefrom are within the scope of the invention.

Claims (10)

1. A method for database backup, comprising:
obtaining database configuration information, wherein the database configuration information comprises: an asynchronous backup library IP address and a backup script IP address;
judging whether the backup script IP address is the same as the asynchronous backup library IP address or not according to the database configuration information;
under the condition that the backup script IP address is different from the asynchronous standby library IP address, replacing the backup script IP address with the asynchronous standby library IP address;
and running the backup script to perform database backup.
2. The method of claim 1, wherein prior to obtaining database configuration information, the method further comprises:
acquiring monitoring information of the database; judging whether the database completes the switching operation of the main database and the standby database according to the monitoring information;
and executing the step of acquiring the configuration information of the database under the condition that the database completes the switching operation of the main database and the standby database.
3. The method of claim 1, wherein prior to running the backup script, the method further comprises:
acquiring a database state of a main database, and judging whether the database state is a survival state or not;
and executing the step of running the backup script under the condition that the database state is the survival state.
4. The method of claim 1, wherein prior to running the backup script, the method further comprises:
acquiring the read-write state of the asynchronous standby library, and judging whether the read-write state is a read-only state;
and executing the step of running the backup script under the condition that the read-write state is a read-only state.
5. The method of claim 1, wherein prior to running the backup script, the method further comprises:
acquiring resource pool information corresponding to the IP address of the asynchronous standby library;
judging whether the type of the database corresponding to the IP address of the asynchronous standby library is the asynchronous standby library or not according to the resource pool information; and executing the step of running the backup script under the condition that the type of the database corresponding to the IP address of the asynchronous standby library is the asynchronous standby library.
6. The method of claim 1, wherein prior to running the backup script, the method further comprises:
judging whether the backup script meets a preset operation condition or not;
and executing the step of running the backup script under the condition that the backup script accords with the preset running condition.
7. The method according to any one of claims 2 to 6, wherein an alarm is given when the switching operation of the main and standby databases is not completed, or when the read-write state is not a read-only state, or when the type of the database corresponding to the IP address of the asynchronous standby database is not an asynchronous standby database, or when the backup script does not meet the preset operating condition.
8. A database backup apparatus, comprising: the device comprises an acquisition module, a judgment module, a configuration module and a backup module;
the obtaining module is configured to obtain database configuration information, where the database configuration information includes: an asynchronous backup library IP address and a backup script IP address;
the judging module is used for judging whether the backup script IP address is the same as the asynchronous backup library IP address according to the database configuration information;
the configuration module is used for replacing the backup script IP address with the asynchronous standby library IP address under the condition that the backup script IP address is different from the asynchronous standby library IP address;
and the backup module is used for operating the backup script and carrying out database backup.
9. An electronic device, comprising: at least one processor and memory;
the memory stores computer execution instructions;
the at least one processor executing the computer-executable instructions stored by the memory causes the at least one processor to perform the method of any one of claims 1-7.
10. A storage medium containing computer-executable instructions for performing the method of any one of claims 1-7 when executed by a computer processor.
CN202011497348.8A 2020-12-17 2020-12-17 Database backup method and device Pending CN114647536A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011497348.8A CN114647536A (en) 2020-12-17 2020-12-17 Database backup method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011497348.8A CN114647536A (en) 2020-12-17 2020-12-17 Database backup method and device

Publications (1)

Publication Number Publication Date
CN114647536A true CN114647536A (en) 2022-06-21

Family

ID=81990885

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011497348.8A Pending CN114647536A (en) 2020-12-17 2020-12-17 Database backup method and device

Country Status (1)

Country Link
CN (1) CN114647536A (en)

Similar Documents

Publication Publication Date Title
CN108710673B (en) Method, system, computer device and storage medium for realizing high availability of database
US20200073761A1 (en) Hot backup system, hot backup method, and computer device
CN109144789B (en) Method, device and system for restarting OSD
CN113726553A (en) Node fault recovery method and device, electronic equipment and readable storage medium
CN106911802B (en) The dispositions method and device of the management platform of distributed block storage system
CN104036043A (en) High availability method of MYSQL and managing node
CN112395050B (en) Virtual machine backup method and device, electronic equipment and readable storage medium
CN109697078B (en) Repairing method of non-high-availability component, big data cluster and container service platform
US7373542B2 (en) Automatic startup of a cluster system after occurrence of a recoverable error
CN105354102B (en) A kind of method and apparatus of file system maintenance and reparation
CN114840495A (en) Database cluster split-brain prevention method, storage medium and device
US20140201566A1 (en) Automatic computer storage medium diagnostics
CN114020509A (en) Method, device and equipment for repairing work load cluster and readable storage medium
CN115686951A (en) Fault processing method and device for database server
CN111966520A (en) Database high-availability switching method, device and system
CN112596371A (en) Control card switching method and device, electronic equipment and storage medium
CN109104314B (en) Method and device for modifying log configuration file
CN114647536A (en) Database backup method and device
CN110287066B (en) Server partition migration method and related device
CN114201393A (en) Software test processing method, device, equipment, medium and program product
CN112612652A (en) Distributed storage system abnormal node restarting method and system
CN107783855B (en) Fault self-healing control device and method for virtual network element
CN115484267B (en) Multi-cluster deployment processing method and device, electronic equipment and storage medium
CN116737396B (en) Method, device, electronic equipment and storage medium for configuring maintainability of server
CN107102887B (en) The dispositions method and device of the management platform of distributed block storage system

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