CN117271206A - Database recovery method and device based on time point and distributed database system - Google Patents

Database recovery method and device based on time point and distributed database system Download PDF

Info

Publication number
CN117271206A
CN117271206A CN202311014010.6A CN202311014010A CN117271206A CN 117271206 A CN117271206 A CN 117271206A CN 202311014010 A CN202311014010 A CN 202311014010A CN 117271206 A CN117271206 A CN 117271206A
Authority
CN
China
Prior art keywords
recovery
time
recoverable
data
database
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
CN202311014010.6A
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.)
Guoneng Information Technology Co ltd
Original Assignee
Guoneng Information Technology 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 Guoneng Information Technology Co ltd filed Critical Guoneng Information Technology Co ltd
Priority to CN202311014010.6A priority Critical patent/CN117271206A/en
Publication of CN117271206A publication Critical patent/CN117271206A/en
Pending legal-status Critical Current

Links

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
    • 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
    • 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/466Transaction processing
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

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

Abstract

The invention provides a database recovery method and device based on a time point and a distributed database system, and belongs to the field of databases. The database recovery method based on the time point comprises the following steps: receiving a recovery data instruction, and extracting recovery time in the recovery data instruction; determining a plurality of recoverable times matched with the recovery time in the data recovery instruction, wherein the recoverable times are corresponding times of backup data in the distributed backup medium; determining a recoverable time from the plurality of recoverable times as a global coherence time; obtaining a transaction identifier corresponding to the global consistency time from the distributed backup media; downloading a transaction log file corresponding to a transaction identifier corresponding to the global consistency time from a distributed backup medium; and carrying out data recovery on the nodes of the distributed database based on the downloaded transaction log file.

Description

Database recovery method and device based on time point and distributed database system
Technical Field
The present invention relates to the field of databases, and in particular, to a database recovery method based on a time point, a database recovery device based on a time point, a distributed database system, and a computer device.
Background
With the wide application of database technology in various industries and fields, important data may be lost due to human misoperation, human malicious damage, unstable system, damage to storage media and the like in the process of database application. Once the data is lost or corrupted, significant losses are incurred to businesses and individuals. This requires a database recovery.
For a multi-fragment distributed database, as global transactions are introduced, the data recovered by a single node cannot be guaranteed for transaction consistency. May result in recovered data that does not meet business expectations.
Disclosure of Invention
In order to solve the technical defects, the invention provides a database recovery method and device based on a time point and a distributed database system.
The first aspect of the present invention provides a database recovery method based on a time point, including:
receiving a recovery data instruction, and extracting recovery time in the recovery data instruction;
determining a plurality of recoverable times matched with the recovery time in the data recovery instruction, wherein the recoverable times are corresponding times of backup data in the distributed backup medium;
determining a recoverable time from the plurality of recoverable times as a global coherence time;
obtaining a transaction identifier corresponding to the global consistency time from the distributed backup media;
downloading a transaction log file corresponding to a transaction identifier corresponding to the global consistency time from a distributed backup medium;
and carrying out data recovery on the nodes of the distributed database based on the downloaded transaction log file.
In an embodiment of the present invention, the determining a plurality of recoverable times that match recovery times in a recovered data instruction includes:
scanning transaction log files in a distributed backup medium;
and analyzing the transaction log file to obtain a global transaction file of the transaction log file and a plurality of transaction identifiers corresponding to the global transaction file, and obtaining a plurality of recoverable times corresponding to the transaction identifiers.
In an embodiment of the present invention, the determining a recoverable time from a plurality of recoverable times as a global coherence time includes:
calculating an absolute difference between each recoverable time and a recovery time in the recovered data instruction;
selecting an optimal recovery time based on absolute differences between a plurality of recoverable times and recovery times in the recovery data instruction;
and taking the optimal recovery time as the global consistency time.
In the embodiment of the present invention, the selecting an optimal recovery time according to an absolute difference between a plurality of recoverable times and a recovery time in the recovery data instruction specifically includes:
comparing the absolute differences between the plurality of recoverable times and the recovery times in the recovered data instruction to determine a minimum absolute difference;
and selecting the available recovery time corresponding to the smallest absolute difference value as the optimal recovery time.
In an embodiment of the present invention, the method further includes:
after the transaction log file is downloaded, the parameter information in the downloaded transaction log file is modified.
In an embodiment of the present invention, the method further includes:
after the data recovery is completed, the routing information of the nodes of the distributed database is modified.
In the embodiment of the invention, the data recovery instruction is a data recovery instruction sent by a user.
A second aspect of the present invention provides a database restoration apparatus based on a point of time, including:
the instruction receiving module is used for receiving the recovery data instruction and extracting the recovery time in the recovery data instruction;
the system comprises a recoverable time determining module, a data processing module and a data processing module, wherein the recoverable time determining module is used for determining a plurality of recoverable times matched with the recoverable times in a data recovery instruction, and the recoverable times are corresponding times of backup data in a distributed backup medium;
the global consistency time determining module is used for determining one recoverable time from the plurality of recoverable times as the global consistency time;
a transaction identifier determining module, configured to obtain a transaction identifier corresponding to the global consistency time from the distributed backup medium;
the transaction log downloading module is used for downloading a transaction log file corresponding to the transaction identifier corresponding to the global consistency time from the distributed backup medium;
and the data recovery module is used for carrying out data recovery on the nodes of the distributed database based on the downloaded transaction log file.
A third aspect of the present invention provides a distributed database system comprising a distributed backup medium and a point-in-time based database restoration apparatus as described above.
A fourth aspect of the present invention provides a computer apparatus comprising:
a memory;
a processor; and
a computer program;
wherein the computer program is stored in a memory and configured to be executed by a processor to implement the point-in-time based database recovery method as described above.
The invention determines the optimal recovery time as the global consistency time based on the data recovery instruction and the backup data in the distributed backup medium, obtains the transaction log to be recovered and the corresponding transaction identifier according to the global consistency time, downloads the corresponding transaction log file from the distributed backup medium according to the transaction identifier to carry out data recovery, thereby ensuring the transaction consistency of the global transaction and the reliability of data recovery.
Other features and advantages of the present invention will be apparent from the detailed description that follows.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description serve to explain the invention and do not constitute a limitation on the invention. In the drawings:
FIG. 1 is a flowchart of a database recovery method based on a time point according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of a database recovery device based on a time point according to an embodiment of the present invention.
Detailed Description
In order to make the technical solutions and advantages of the embodiments of the present invention more apparent, the following detailed description of exemplary embodiments of the present invention is provided in conjunction with the accompanying drawings, and it is apparent that the described embodiments are only some embodiments of the present invention and not exhaustive of all embodiments. It should be noted that, without conflict, the embodiments of the present invention and features of the embodiments may be combined with each other.
Furthermore, the terms "first," "second," and the like, are used for descriptive purposes only and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include one or more such feature. In the description of the present invention, the meaning of "plurality" means at least two, for example, two, three, etc., unless specifically defined otherwise.
In the present invention, unless explicitly specified and limited otherwise, terms such as "mounted," "connected," "secured," and the like are to be construed broadly and may be, for example, fixedly attached, detachably attached, or integrally formed; may be mechanically connected, may be electrically connected or may communicate with each other; can be directly connected or indirectly connected through an intermediate medium, and can be communicated with the inside of two elements or the interaction relationship of the two elements. The specific meaning of the above terms in the present invention can be understood by those of ordinary skill in the art according to the specific circumstances.
In the process of implementing the invention, the inventor finds that with a large number of wide application of database technology in various industries and fields, in the process of applying the database, important data may be lost due to human misoperation, human malicious damage, instability of a system, damage of a storage medium and the like. Once the data is lost or corrupted, significant losses are incurred to businesses and individuals. This requires a database recovery. In the existing distributed database for multiple fragments, as global transactions are introduced, the data recovered by a single node cannot be ensured to be consistent. May result in recovered data that does not meet business expectations.
In view of the above problems, an embodiment of the present invention provides a database recovery method based on a time point, including: receiving a recovery data instruction, and extracting recovery time in the recovery data instruction; determining a plurality of recoverable times matched with the recovery time in the data recovery instruction, wherein the recoverable times are corresponding times of backup data in the distributed backup medium; determining a recoverable time from the plurality of recoverable times as a global coherence time; obtaining a transaction identifier corresponding to the global consistency time from the distributed backup media; downloading a transaction log file corresponding to a transaction identifier corresponding to the global consistency time from a distributed backup medium; and carrying out data recovery on the nodes of the distributed database based on the downloaded transaction log file. The invention determines the optimal recovery time as the global consistency time based on the data recovery instruction and the backup data in the distributed backup medium, obtains the transaction log to be recovered and the corresponding transaction identifier according to the global consistency time, downloads the corresponding transaction log file from the distributed backup medium according to the transaction identifier to carry out data recovery, thereby ensuring the transaction consistency of the global transaction and the reliability of data recovery.
The backup capability of the database is particularly important in coping with disasters and accidents. Typically, backup of a database is divided into full-volume backup (which may also be referred to as cold-standby) and incremental backup. Full-volume backup generally refers to backing up all data of a database (except for the log and transaction log files), typically periodically (one day, one week, or N days). Incremental backups are backups of incremental data, typically through transaction log file backups. When a database system creates a new transaction log file, the system typically backs up the transaction log file to a backup server in real-time.
CERDB supports full and incremental backups onto HDFS (distributed backup media) clusters (note: all nodes here requiring CERDB must configure HDFS clients). As shown in the following diagram, an administrator of an instance can configure a full-scale backup strategy and an incremental backup strategy of the instance on a CERDB management platform, and according to the backup strategy, full-scale data and incremental data are backed up to an HDFS respectively. After the backup policy of the CERDB is configured, the full back-up will begin running at the specified time. For the complete nodes of the main and the standby, the system automatically backs up on the standby nodes in order to reduce the performance influence on the service. If the node primary and backup are switched in the backup process, the current backup is continuously executed (the current backup is started by the node), and the current backup is automatically switched to be executed on a new backup machine when the next full backup is started. Due to the global distributed transaction nature of CERDB, if there is a node backup failure, it will result in failure to restore the entire cluster. Therefore, a full-scale backup requires that all the nodes participating in the backup in the system be successfully backed up. Incremental backups will also automatically start from after configuration, and backups will automatically be triggered when nodes create completed transaction log files.
When an accident or disaster occurs, the database needs to restore the generation system with the backed up data. The CERDB is a database system of global distributed transactions, and data between nodes are associated, so that the recovery system needs to recover through a global time point, node represents a Node to be parameter recovered (the parameter recovery of the master Node of the CERDB system), and a minimum timestamp of the global transaction (this timestamp is Unix timestamp, that is, the number of seconds elapsed since 1 st 1970 (midnight of UTC/GMT)) is found from a global transaction file of each Node as a globally consistent time point (for convenience of the following description, this global time point is recorded as target_gts).
Fig. 1 is a flowchart of a database recovery method based on a time point according to an embodiment of the present invention. As shown in fig. 1, the database recovery method based on the time point provided in this embodiment includes the following steps:
s1, receiving a recovery data instruction, and extracting recovery time in the recovery data instruction;
s2, determining a plurality of recoverable times matched with the recovery time in the data recovery instruction, wherein the recoverable times are corresponding times of backup data in the distributed backup medium;
s3, determining a recoverable time from a plurality of recoverable times as a global consistency time;
s4, obtaining a transaction identifier corresponding to the global consistency time from the distributed backup medium;
s5, downloading a transaction log file corresponding to the transaction identifier corresponding to the global consistency time from the distributed backup medium;
s6, carrying out data recovery on the nodes of the distributed database based on the downloaded transaction log file.
In step S2, the determining a plurality of recoverable times that match recovery times in the recovered data instruction includes:
scanning transaction log files in a distributed backup medium;
and analyzing the transaction log file to obtain a global transaction file of the transaction log file and a plurality of transaction identifiers corresponding to the global transaction file, and obtaining a plurality of recoverable times corresponding to the transaction identifiers.
Further, in step S2, the determining a recoverable time from the plurality of recoverable times as a global coherence time includes:
calculating an absolute difference between each recoverable time and a recovery time in the recovered data instruction;
selecting an optimal recovery time based on absolute differences between a plurality of recoverable times and recovery times in the recovery data instruction;
and taking the optimal recovery time as the global consistency time.
Specifically, the selecting an optimal recovery time according to an absolute difference between the plurality of recoverable times and the recovery time in the recovered data instruction specifically includes:
comparing the absolute differences between the plurality of recoverable times and the recovery times in the recovered data instruction to determine a minimum absolute difference;
and selecting the available recovery time corresponding to the smallest absolute difference value as the optimal recovery time.
In step S4, when the data is written into the transaction log file, the transaction log file is provided with a global transaction file and transaction identifiers corresponding to the global transaction file, the global transaction file corresponds to the transaction identifiers one by one, so that it can be known that the transactions have been submitted at a certain time point, when the user performs recovery at the specified time point, the transaction log file in the backup file is scanned, and then the transaction log file is parsed to obtain a global consistency file closest to the recovery time in the data instruction, so as to obtain the corresponding transaction identifiers, and thus, a consistency recovery can be completed.
In step S5, a transaction log file corresponding to the transaction identifier corresponding to the global consistency time is downloaded from the distributed backup medium, specifically: the corresponding full transaction log file and incremental transaction log file of GTM, CN, DN nodes are downloaded from above the distributed backup media to the corresponding recovery host. After the user selects the recovery time, the system will go to the backup medium according to the specified recovery time selected by the user to find the corresponding transaction log file to be recovered, then transmit the transaction log file to the specified machine, and then recover.
In this embodiment, the method further includes:
after the transaction log file is downloaded, the parameter information in the downloaded transaction log file is modified.
Specifically, after the transaction log file is downloaded, the modification is to start the file in the log file, including but not limited to: postgresql. Conf, pg_hba. Conf, recovery. The backup transaction log file contains the parameter information of the previous database, and the parameter information needs to be modified at this time, otherwise, the database possibly recovered cannot be connected.
In this embodiment, the method further includes:
after the data recovery is completed, the routing information of the nodes of the distributed database is modified. Specifically, after the completion of data recovery, the switching data service becomes readable and writable, and the modification of the pgxc_node routing information is completed. The pgxc-node records the database loading information, and because the database can be read and written, the information in the database needs to be modified, namely, when the application links the database again, the instance in the pgxc-node is found to be in a read-write state, so that the database can be connected.
In this embodiment, the recovery data instruction is a recovery data instruction issued by a user, the user can select whether to recover data by selecting a page, and the user can select a recovery time for which recovery of data is desired by selecting a page.
Fig. 2 is a schematic structural diagram of a database recovery device based on a time point according to an embodiment of the present invention. As shown in fig. 2, the database recovery device based on a time point provided in this embodiment includes: the instruction receiving module is used for receiving the recovery data instruction and extracting the recovery time in the recovery data instruction; the system comprises a recoverable time determining module, a data processing module and a data processing module, wherein the recoverable time determining module is used for determining a plurality of recoverable times matched with the recoverable times in a data recovery instruction, and the recoverable times are corresponding times of backup data in a distributed backup medium; the global consistency time determining module is used for determining one recoverable time from the plurality of recoverable times as the global consistency time; a transaction identifier determining module, configured to obtain a transaction identifier corresponding to the global consistency time from the distributed backup medium; the transaction log downloading module is used for downloading a transaction log file corresponding to the transaction identifier corresponding to the global consistency time from the distributed backup medium; and the data recovery module is used for carrying out data recovery on the nodes of the distributed database based on the downloaded transaction log file.
The database recovery device based on the time point is realized by adopting the database recovery method based on the time point, and the method comprises the following steps:
s1, receiving a recovery data instruction, and extracting recovery time in the recovery data instruction;
s2, determining a plurality of recoverable times matched with the recovery time in the data recovery instruction, wherein the recoverable times are corresponding times of backup data in the distributed backup medium;
s3, determining a recoverable time from a plurality of recoverable times as a global consistency time;
s4, obtaining a transaction identifier corresponding to the global consistency time from the distributed backup medium;
s5, downloading a transaction log file corresponding to the transaction identifier corresponding to the global consistency time from the distributed backup medium;
s6, carrying out data recovery on the nodes of the distributed database based on the downloaded transaction log file.
In step S2, the determining a plurality of recoverable times that match recovery times in the recovered data instruction includes:
scanning transaction log files in a distributed backup medium;
and analyzing the transaction log file to obtain a global transaction file of the transaction log file and a plurality of transaction identifiers corresponding to the global transaction file, and obtaining a plurality of recoverable times corresponding to the transaction identifiers.
Further, in step S2, the determining a recoverable time from the plurality of recoverable times as a global coherence time includes:
calculating an absolute difference between each recoverable time and a recovery time in the recovered data instruction;
selecting an optimal recovery time based on absolute differences between a plurality of recoverable times and recovery times in the recovery data instruction;
and taking the optimal recovery time as the global consistency time.
Specifically, the selecting an optimal recovery time according to an absolute difference between the plurality of recoverable times and the recovery time in the recovered data instruction specifically includes:
comparing the absolute differences between the plurality of recoverable times and the recovery times in the recovered data instruction to determine a minimum absolute difference;
and selecting the available recovery time corresponding to the smallest absolute difference value as the optimal recovery time.
In step S4, when the data is written into the transaction log file, the transaction log file is provided with a global transaction file and transaction identifiers corresponding to the global transaction file, the global transaction file corresponds to the transaction identifiers one by one, so that it can be known that the transactions have been submitted at a certain time point, when the user performs recovery at the specified time point, the transaction log file in the backup file is scanned, and then the transaction log file is parsed to obtain a global consistency file closest to the recovery time in the data instruction, so as to obtain the corresponding transaction identifiers, and thus, a consistency recovery can be completed.
In step S5, a transaction log file corresponding to the transaction identifier corresponding to the global consistency time is downloaded from the distributed backup medium, specifically: the corresponding full transaction log file and incremental transaction log file of GTM, CN, DN nodes are downloaded from above the distributed backup media to the corresponding recovery host. After the user selects the recovery time, the system will go to the backup medium according to the specified recovery time selected by the user to find the corresponding transaction log file to be recovered, then transmit the transaction log file to the specified machine, and then recover.
In this embodiment, the method further includes:
after the transaction log file is downloaded, the parameter information in the downloaded transaction log file is modified.
Specifically, after the transaction log file is downloaded, the modification is to start the file in the log file, including but not limited to: postgresql. Conf, pg_hba. Conf, recovery. The backup transaction log file contains the parameter information of the previous database, and the parameter information needs to be modified at this time, otherwise, the database possibly recovered cannot be connected.
In this embodiment, the method further includes:
after the data recovery is completed, the routing information of the nodes of the distributed database is modified. Specifically, after the completion of data recovery, the switching data service becomes readable and writable, and the modification of the pgxc_node routing information is completed. The pgxc-node records the database loading information, and because the database can be read and written, the information in the database needs to be modified, namely, when the application links the database again, the instance in the pgxc-node is found to be in a read-write state, so that the database can be connected.
In this embodiment, the recovery data instruction is a recovery data instruction issued by a user, the user can select whether to recover data by selecting a page, and the user can select a recovery time for which recovery of data is desired by selecting a page.
The embodiment of the invention also provides a distributed database system, which comprises a distributed backup medium and the database recovery device based on the time point, wherein the device comprises: the instruction receiving module is used for receiving the recovery data instruction and extracting the recovery time in the recovery data instruction; the system comprises a recoverable time determining module, a data processing module and a data processing module, wherein the recoverable time determining module is used for determining a plurality of recoverable times matched with the recoverable times in a data recovery instruction, and the recoverable times are corresponding times of backup data in a distributed backup medium; the global consistency time determining module is used for determining one recoverable time from the plurality of recoverable times as the global consistency time; a transaction identifier determining module, configured to obtain a transaction identifier corresponding to the global consistency time from the distributed backup medium; the transaction log downloading module is used for downloading a transaction log file corresponding to the transaction identifier corresponding to the global consistency time from the distributed backup medium; and the data recovery module is used for carrying out data recovery on the nodes of the distributed database based on the downloaded transaction log file.
The embodiment of the invention also provides a computer device, which comprises: a memory, a processor, and a computer program stored in the memory and configured to be executed by the processor to implement the above-described point-in-time based database recovery method.
It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as a method, system, 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 scheme in the embodiment of the invention can be realized by adopting various computer languages, such as object-oriented programming language Java, an transliteration script language JavaScript and the like.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations 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.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following claims be interpreted as including the preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various modifications and variations can be made to the present invention without departing from the spirit or scope of the invention. Thus, it is intended that the present invention also include such modifications and alterations insofar as they come within the scope of the appended claims or the equivalents thereof.

Claims (10)

1. A method for database recovery based on a point in time, comprising:
receiving a recovery data instruction, and extracting recovery time in the recovery data instruction;
determining a plurality of recoverable times matched with the recovery time in the data recovery instruction, wherein the recoverable times are corresponding times of backup data in the distributed backup medium;
determining a recoverable time from the plurality of recoverable times as a global coherence time;
obtaining a transaction identifier corresponding to the global consistency time from the distributed backup media;
downloading a transaction log file corresponding to a transaction identifier corresponding to the global consistency time from a distributed backup medium;
and carrying out data recovery on the nodes of the distributed database based on the downloaded transaction log file.
2. The point-in-time based database recovery method of claim 1, wherein the determining a plurality of recoverable times that match recovery times in a recovery data instruction comprises:
scanning transaction log files in a distributed backup medium;
and analyzing the transaction log file to obtain a global transaction file of the transaction log file and a plurality of transaction identifiers corresponding to the global transaction file, and obtaining a plurality of recoverable times corresponding to the transaction identifiers.
3. The method for recovering a database based on a time point according to claim 2, wherein said determining a recoverable time from a plurality of recoverable times as a global consistency time comprises:
calculating an absolute difference between each recoverable time and a recovery time in the recovered data instruction;
selecting an optimal recovery time based on absolute differences between a plurality of recoverable times and recovery times in the recovery data instruction;
and taking the optimal recovery time as the global consistency time.
4. A database recovery method based on time points according to claim 3, characterized in that the optimal recovery time is selected based on absolute differences between a plurality of recoverable times and recovery times in the recovery data instructions, in particular:
comparing the absolute differences between the plurality of recoverable times and the recovery times in the recovered data instruction to determine a minimum absolute difference;
and selecting the available recovery time corresponding to the smallest absolute difference value as the optimal recovery time.
5. The point-in-time based database retrieval method according to claim 1, wherein said method further comprises:
after the transaction log file is downloaded, the parameter information in the downloaded transaction log file is modified.
6. The point-in-time based database retrieval method according to claim 1, wherein said method further comprises:
after the data recovery is completed, the routing information of the nodes of the distributed database is modified.
7. The database recovery method based on time point according to claim 1, wherein the recovery data instruction is a recovery data instruction issued by a user.
8. A database restoration apparatus based on a point in time, comprising:
the instruction receiving module is used for receiving the recovery data instruction and extracting the recovery time in the recovery data instruction;
the system comprises a recoverable time determining module, a data processing module and a data processing module, wherein the recoverable time determining module is used for determining a plurality of recoverable times matched with the recoverable times in a data recovery instruction, and the recoverable times are corresponding times of backup data in a distributed backup medium;
the global consistency time determining module is used for determining one recoverable time from the plurality of recoverable times as the global consistency time;
a transaction identifier determining module, configured to obtain a transaction identifier corresponding to the global consistency time from the distributed backup medium;
the transaction log downloading module is used for downloading a transaction log file corresponding to the transaction identifier corresponding to the global consistency time from the distributed backup medium;
and the data recovery module is used for carrying out data recovery on the nodes of the distributed database based on the downloaded transaction log file.
9. A distributed database system comprising a distributed backup medium and a point-in-time based database restoration apparatus as recited in claim 8.
10. A computer device, comprising:
a memory;
a processor; and
a computer program;
wherein the computer program is stored in a memory and configured to be executed by a processor to implement the point-in-time based database recovery method of any one of claims 1 to 7.
CN202311014010.6A 2023-08-11 2023-08-11 Database recovery method and device based on time point and distributed database system Pending CN117271206A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311014010.6A CN117271206A (en) 2023-08-11 2023-08-11 Database recovery method and device based on time point and distributed database system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311014010.6A CN117271206A (en) 2023-08-11 2023-08-11 Database recovery method and device based on time point and distributed database system

Publications (1)

Publication Number Publication Date
CN117271206A true CN117271206A (en) 2023-12-22

Family

ID=89213262

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311014010.6A Pending CN117271206A (en) 2023-08-11 2023-08-11 Database recovery method and device based on time point and distributed database system

Country Status (1)

Country Link
CN (1) CN117271206A (en)

Similar Documents

Publication Publication Date Title
CN106407356B (en) Data backup method and device
CN106610876B (en) Data snapshot recovery method and device
US7634679B2 (en) Remote location failover server application
CN106776130B (en) Log recovery method, storage device and storage node
US8127174B1 (en) Method and apparatus for performing transparent in-memory checkpointing
US7043504B1 (en) System and method for parallel primary and secondary backup reading in recovery of multiple shared database data sets
US7549027B1 (en) System and method for managing replication of data in a data storage environment
US7496783B1 (en) Merging cluster nodes during a restore
US7685189B2 (en) Optimizing backup and recovery utilizing change tracking
US20040221149A1 (en) Storage system and cluster maintenance
US20070043973A1 (en) Isolating and storing configuration data for disaster recovery for operating systems providing physical storage recovery
US7770057B1 (en) System and method for customized disaster recovery reports
US20070156781A1 (en) Detecting failover in a database mirroring environment
CN110188000A (en) Application disaster recovery method and system based on virtualization and iSCSI or FC
US8578203B2 (en) Providing a backup service from a remote backup data center to a computer through a network
US20060294421A1 (en) Isolating and storing configuration data for disaster recovery
JP2005523517A (en) Method and system for disaster recovery
US7725669B1 (en) Backup and restore operations using coherency groups for ISB protocol systems
US7584339B1 (en) Remote backup and restore operations for ISB protocol systems
JP4141875B2 (en) Recovery processing method, its execution system, and its processing program
WO2013102812A1 (en) A fault tolerant system in a loosely-coupled cluster environment
CN113886143B (en) Virtual machine continuous data protection method and device and data recovery method and device
US7640454B1 (en) System and method for point-in-time recovery of application resource sets
US20220121527A1 (en) Dynamically updating database archive log dependency and backup copy recoverability
CN113360322A (en) Method and equipment for recovering data based on backup 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