Distributed database log backup processing methods, devices and storage media

CN116225780BActive Publication Date: 2026-08-14JINZHUAN INFORMATION TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-29
Publication Date
2026-08-14

AI Technical Summary

Technical Problem

[0003]对于具有主备关系的事务型分布式数据库而言,通过备份各存储节点数据的方法,从而保证分布式数据库的数据安全性;现有的拷贝备份方式是对每个数据节点上的逻辑日志都进行备份,其优点是简单,但是将每个数据节点上的逻辑日志都进行备份时,会产生大量重复多余的数据信息,此时会导致机房内出现大量的数据冗余,对数据库的容量空间造成较大浪费,并且在备份时会占用服务器的部分资源,导致各存储节点的性能并不理想,这种冗余问题在规模越大的分布式数据库下越为突出

Benefits of technology

[0043]本申请实施例通过在至少两个数据节点的分布式数据库中,选取一个目标备份节点,并获取目标备份节点的逻辑日志信息,将逻辑日志信息备份至分布式数据库对应的指定目录,得到目标备份节点对应的逻辑日志备份处理结果;从而解决了现有技术中备份各个数据节点的逻辑日志,所造成数据冗余的问题;实现了每次备份仅选取一个目标备份节点进行备份逻辑日志信息,减少数据库数据冗余以及优化数据节点性能的效果。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116225780B_ABST
    Figure CN116225780B_ABST
Patent Text Reader

Abstract

This application relates to a log backup processing method, apparatus, electronic device, and storage medium for a distributed database. The log backup processing method for a distributed database selects a target backup node in a distributed database with at least two data nodes, obtains the logical log information of the target backup node, and backs up the logical log information to a specified directory corresponding to the distributed database, thereby obtaining the logical log backup processing result corresponding to the target backup node. This solves the problem of data redundancy caused by backing up the logical logs of each data node in the prior art; it achieves the effect of selecting only one target backup node to back up the logical log information, reducing database data redundancy and optimizing data node performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of databases, and more particularly to a method, apparatus, electronic device, and storage medium for log backup processing of a distributed database. Background Technology

[0002] Database backup and recovery is a crucial method for ensuring data security and the normal operation of the database. Backup and recovery requires not only physical data backups but also logical log backups. To address database failures, backups must be performed on top of the database's physical data and logical logs, which can then be used during the database recovery phase.

[0003] For transactional distributed databases with master-slave relationships, data security is ensured by backing up the data of each storage node. The existing copy backup method backs up the logical logs on each data node. Its advantage is simplicity, but backing up the logical logs on each data node will generate a large amount of duplicate and redundant data. This will lead to a lot of data redundancy in the data center, which will waste a lot of database capacity and space. In addition, the backup will consume some server resources, resulting in less than ideal performance of each storage node. This redundancy problem becomes more prominent in the larger the scale of the distributed database. Summary of the Invention

[0004] To solve the above-mentioned technical problems, or at least partially solve them, this application provides a method, apparatus, electronic device, and storage medium for log backup processing of a distributed database.

[0005] In a first aspect, this application provides a log backup processing method for a distributed database, wherein the distributed database contains at least two data nodes, and the log backup processing method includes:

[0006] Select one target backup node from the at least two data nodes;

[0007] Obtain the logical log information of the target backup node;

[0008] The logical log information is backed up to the specified directory corresponding to the distributed database to obtain the logical log backup processing result corresponding to the target backup node.

[0009] Optionally, the method further includes:

[0010] Get the configuration file;

[0011] Create at least one specified directory based on the configuration file;

[0012] The at least two data nodes are determined based on the specified directory.

[0013] Optionally, a target backup node is selected from the at least two data nodes, including:

[0014] Determine the synchronization progress information of the logical log information in each of the data nodes;

[0015] The synchronization progress information is filtered to determine the target synchronization progress information;

[0016] The data node corresponding to the target synchronization progress information is identified as the target backup node.

[0017] Optionally, the logical log information is backed up to a specified directory corresponding to the distributed database, including:

[0018] Determine if a backup file exists in the specified directory;

[0019] When the backup file does not exist in the specified directory, obtain the logical log information of the target backup node;

[0020] A backup file is generated based on the logical log information, and the backup file is backed up to the specified directory corresponding to the distributed database.

[0021] Optional, also includes:

[0022] When the backup file exists in the specified directory, retrieve the backup file from the specified directory and back it up to the last backup file in the specified directory corresponding to the distributed database, and determine whether the target backup node is the same as the data node corresponding to the last backup file;

[0023] If they are the same, then determine the number information corresponding to the last backup file, and obtain the logical log information from the target backup node based on the number information;

[0024] If they are not the same, the last synchronization information in the last backup file is determined based on the last backup file, the position information of the last synchronization information in the target backup node is determined, and the logical log information is obtained from the target backup node according to the position information.

[0025] Optionally, the method further includes:

[0026] Receive user input for a recovery request;

[0027] Based on the recovery request, determine the logical log set information from the specified directory;

[0028] Determine whether the logical log set information meets the preset conditions;

[0029] If the logical log set information meets the preset conditions, then data recovery is performed based on the recovery request and the logical log set information, and the recovery result information corresponding to the recovery request is output.

[0030] If the logical log set information does not meet the preset conditions, then the prompt information corresponding to the recovery request will be output.

[0031] Optionally, determining whether the logical log set information meets preset conditions includes:

[0032] Obtain the number information of at least two recovery logical log entries from the logical log set information;

[0033] Determine whether the numbering information is consecutive.

[0034] Secondly, this application provides a log backup processing apparatus for a distributed database, wherein the distributed database comprises at least two data nodes, and the log backup processing apparatus includes:

[0035] A selection module is used to select a target backup node from the at least two data nodes;

[0036] The acquisition module is used to acquire the logical log information of the target backup node;

[0037] The backup module is used to back up the logical log information to a specified directory corresponding to the distributed database, and obtain the logical log backup processing result corresponding to the target backup node.

[0038] Thirdly, an electronic device is provided, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus;

[0039] Memory, used to store computer programs;

[0040] When a processor executes a program stored in memory, it implements the steps of the log backup processing method for a distributed database as described in any embodiment of the first aspect.

[0041] Fourthly, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps of the log backup processing method for a distributed database as described in any embodiment of the first aspect.

[0042] The technical solutions provided in this application have the following advantages compared with the prior art:

[0043] This application embodiment selects a target backup node in a distributed database with at least two data nodes, obtains the logical log information of the target backup node, and backs up the logical log information to a specified directory corresponding to the distributed database to obtain the logical log backup processing result corresponding to the target backup node. This solves the problem of data redundancy caused by backing up the logical logs of each data node in the prior art. It achieves the effect of selecting only one target backup node to back up the logical log information for each backup, reducing database data redundancy and optimizing data node performance. Attached Figure Description

[0044] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0045] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0046] Figure 1 A flowchart illustrating a log backup processing method for a distributed database provided in this application embodiment;

[0047] Figure 2 A flowchart illustrating a log backup processing method for a distributed database, provided as another embodiment of this application;

[0048] Figure 3 A schematic diagram of the structure of a log backup processing device for a distributed database provided in an embodiment of this application;

[0049] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0050] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0051] Logically, a distributed database is a unified whole, but physically, data is stored on different physical nodes. An application can access databases distributed across different geographical locations via a network connection. Its distributed nature is reflected in the fact that the data in the database is not stored in the same location, or more precisely, not on the same computer's storage device. Therefore, distributed databases typically have multi-layered structures: clusters, shards, and data centers. A distributed database can include multiple clusters, a cluster can include multiple shards, a shard can include multiple data centers, and a data center can include multiple computer storage devices.

[0052] In distributed database systems, primary and secondary databases are typically configured. When the primary database fails, the secondary database becomes the new primary database and continues operations, or the primary database is restored based on the secondary database, thus ensuring the normal operation of business. Here, the secondary database continuing to provide services improves the availability and reliability of the distributed storage system. The need for the secondary database to replace or restore the primary database involves the issue of data consistency; that is, the replacement or restoration of the primary database can only be achieved when the data in the primary and secondary databases is consistent.

[0053] For transactional distributed databases with a master-slave relationship, there are a master database and a slave database, also known as a primary and a standby machine. Typically, the primary database generates corresponding logical logs for each transaction. Transactions represent database operations such as adding, deleting, and modifying data, while logical logs can be binary logs. Since databases can experience failures due to various accidents during operation, it is usually necessary to restore the database to a specific state. Logical logs are essential for this recovery process. Therefore, during database operation, logical logs are typically copied and backed up on each data node for use during data recovery.

[0054] The existing logical log backup method mainly involves each standby machine synchronizing the logical logs generated by the primary machine and backing up the synchronized logical logs of each data node to a designated directory on that data node. This allows the database to recover from a failure by relying on the logical logs in that designated directory. The advantage of this method is its simplicity. However, this method of backing up logical logs has two problems. First, backing up the logical logs of each data node results in a large amount of redundancy and waste of data resources. Second, backing up the logical logs of each data node consumes a lot of server resources, which also leads to a waste of server resources.

[0055] Figure 1This is a flowchart illustrating a log backup processing method for a distributed database provided in an embodiment of this application.

[0056] This application discloses an embodiment of a log backup processing method for a distributed database. The distributed database contains at least two data nodes, and the log backup processing method includes:

[0057] S110: Select a target backup node from at least two data nodes;

[0058] S120: Obtain the logical log information of the target backup node;

[0059] S130: Back up the logical log information to the specified directory corresponding to the distributed database, and obtain the logical log backup processing result corresponding to the target backup node.

[0060] The log backup processing method in this embodiment is implemented in a distributed database containing at least two data nodes. These two data nodes primarily represent backup database nodes, used to synchronize logs generated by the primary database. The two data nodes can be two computer storage devices, etc., and each data node stores logical log information. This embodiment selects a target backup node from at least two data nodes, obtains the logical log information stored in the target backup node, and backs up this logical log information to a designated directory corresponding to the distributed database, thus obtaining the logical log backup processing result corresponding to the target backup node and achieving the effect of backing up the logical log information. This embodiment has at least two advantages over existing backup methods: First, it reduces data redundancy. By selecting a target backup node in the distributed database for logical log backup, compared to existing backup methods that back up each data node, the number of resource log information backups is greatly reduced, thus reducing database data redundancy. Second, it optimizes node performance. Since this embodiment only selects a target backup node for logical log information backup, other data nodes do not need to be backed up, which reduces the time spent backing up logical log information on numerous data nodes and reduces network, input / output (IO), and central processing unit (CPU) overhead. By reducing the use of resources such as units and CPU, the performance of nodes has been improved.

[0061] It's important to note that although both the primary and standby nodes in a distributed database store logical log information, the reason for backing up this information to a designated directory is that both nodes employ periodic cleanup mechanisms to ensure long-term stability and prevent excessive data from filling up storage space. Therefore, logical log information is only stored on either the primary or standby node for a specific period. This designated directory, created based on requirements, is shared by both nodes and is stored on a separate computer storage device. Consequently, the creation method for this designated directory differs depending on the backup method.

[0062] In one embodiment, the log backup processing method for a distributed database may further include:

[0063] S101: Obtain the configuration file;

[0064] S102: Create at least one specified directory based on the configuration file;

[0065] S103: Determine at least two data nodes based on the specified directory.

[0066] In this embodiment, the configuration file obtained can be input by the user based on their needs or a default file. The configuration file includes backup granularity information, shard ID (GroupidIdentity Document), data center ID, directory generation rules, etc. The backup granularity information indicates the scope to be backed up. For example, if the backup granularity is shard 1-2, then all data nodes within shards 1 and 2 will be backed up. The shard ID indicates the backup source of each backup file, while the directory generation rules are the rules for creating specified directories. All specified directories are stored as subdirectories under the main backup directory, and the directory generation rules generate the corresponding specified directories under the main backup directory. The names of the specified directories can be determined based on the backup granularity information, such as backup... If the granularity information is shard 1, the name of the specified directory can be 1-0. Alternatively, if the backup granularity information is data center 1, and data center 1 belongs to shard 1, the name of the specified directory can be 1-1. Therefore, after obtaining the configuration file, based on the backup granularity information, shard ID, data center ID, directory generation rule information, etc. in the configuration file, at least one specified directory is created. If there are multiple sets of information in the configuration file, multiple specified directories can be created. Based on the specified directory, at least two data nodes are determined. For example, if the backup granularity information is data center 1, then only one backup log is retained for data center 1. The range of data nodes selected during backup is the backup data nodes under the entire data center 1.

[0067] It should be noted that the logical log information of the standby data nodes is synchronized with the logical log information of the master. That is, each logical log information contains several synchronization messages. The synchronization messages are used to indicate the specific synchronized content of the logical log information, such as GTID transaction information. However, due to the different synchronization efficiency of different data nodes, the synchronized logical logs may not be consistent. For example, the master may currently generate logical log information 1-100, which has 100 logical log information, while the standby data node 1 is currently synchronizing logical log information 1-50, and the standby data node 2 is currently synchronizing logical log information 1-100. Therefore, there will be a problem that the number of synchronized logical log information for each data node is different.

[0068] In one embodiment, step S110 may include:

[0069] S111: Determine the synchronization progress information of logical log information in each data node;

[0070] S112: Filter the synchronization progress information to determine the target synchronization progress information;

[0071] S113: Confirm the data node corresponding to the target synchronization progress information as the target backup node.

[0072] In this embodiment, the synchronization speed of each backup data node relative to the primary data node is first detected, and the backup data node with the fastest synchronization is selected. It should be noted that after the configuration information is entered, the synchronization speed of each backup data node is compared within the range determined by the backup granularity information. Since each data node synchronizes the logical log information of the primary node, each data node synchronizes duplicate logical log information. The synchronization progress information is used to indicate the progress of the data node in synchronizing the logical log of the primary data node, such as synchronizing to 1-50 or 1-100 as mentioned above. Therefore, the larger the synchronization progress information, the closer the backed-up logical log information is to the current logical log information of the primary node. Therefore, the synchronization progress information is filtered to determine the target synchronization progress information, which represents the synchronization progress information with the largest number of logical log information. The data node corresponding to the target synchronization progress information is confirmed as the target backup node. The above is just an example, and the specific target synchronization progress information can be modified adaptively according to the requirements.

[0073] refer to Figure 2 In one embodiment, step S130 may include:

[0074] S131: Determine if a backup file exists in the specified directory;

[0075] S132: When the backup file does not exist in the specified directory, obtain the logical log information of the target backup node;

[0076] S133: Generate backup files based on logical log information and back up the backup files to the specified directory corresponding to the distributed database.

[0077] In this embodiment, the process of backing up logical log information to a designated directory corresponding to the distributed database involves packaging the logical log information into a backup file, storing the backup file in the designated directory, and ensuring that the backup file points to its corresponding target backup node. The backup file in this embodiment includes a timestamp, IP address (Internet Protocol Address), port information, and number information. The timestamp indicates the time the file corresponding to the logical log information was generated. The IP address and port information point to the target backup node corresponding to the logical log information. The number information indicates the sequence of logical log information in the designated directory. For example, if there are 100 backup files in the designated directory, with numbers 1-20 backed up from backup node 1 and 21-100 backed up from backup node 2, then during the generation of backup files 1-20, it is not necessary to modify the IP address and port information; only the timestamp and number information need to be modified. However, during the generation of backup file 21, it originates from a different backup node than the previous backup file 20. Therefore, the IP address and port information need to be obtained from backup node 2. Thus, during the process of backing up the logical log information to the specified directory corresponding to the distributed database, it is first necessary to determine whether a backup file exists in the specified directory. If no backup file exists, the logical log information of the target backup node is obtained, and a backup file is generated based on the logical log information. It should be noted that the logical log information and the backup file can be substantially the same data or different data. When the logical log information and the backup file are different, multiple logical log information entries can constitute one backup file. For example, logical log information 1-20 constitutes backup file 1, and logical log information 21-50 constitutes backup file 2. The above is merely an example and does not constitute a specific limitation.

[0078] When a backup file exists in the specified directory, there are two scenarios. If the current target backup node is the same as the data node from the last backup, then there is no need to modify the IP address and port information; only the timestamp and number information need to be modified. If the current target backup node is different from the data node from the last backup, then it is necessary to obtain a new IP address and port information based on the target backup node. Therefore, step S131 may also include:

[0079] S134: When a backup file exists in the specified directory, retrieve the last backup file in the specified directory and determine whether the target backup node is the same as the data node corresponding to the last backup file.

[0080] S135: If they are the same, determine the number information corresponding to the last backup file, and obtain the logical log information from the target backup node based on the number information;

[0081] S136: If they are not the same, determine the last synchronization information in the last backup file based on the last backup file, determine the location information of the last synchronization information in the target backup node, and obtain the logical log information from the target backup node based on the location information.

[0082] In this embodiment, when a backup file exists in a specified directory, the backup file is generated by determining whether the target backup node and the data node corresponding to the last backup file are the same. If the target backup node and the data node corresponding to the last backup file are the same, the number information corresponding to the last backup file is determined, and logical log information is obtained from the target backup node based on the number information, thereby accelerating the generation efficiency of the backup file. If the target backup node and the data node corresponding to the last backup file are different, the last synchronization information in the last backup file is determined based on the last backup file, and the position information of the last synchronization information in the target backup node is determined. Logical log information is obtained from the target backup node based on the position information. In specific implementation, taking the binary log used to record GTID transactions as an example, for the binary log used to record GTID transactions, the last synchronization information refers to the last GTID transaction recorded in the binary log. When the target backup node and the data node corresponding to the last backup file are different, the specific GTID transaction currently being backed up is determined by determining the last synchronization information in the current last backup file. Then, the position information of the last GTID transaction recorded is determined in the target backup node, and the subsequent logical log information of the last GTID transaction is backed up based on the position information.

[0083] After performing the above steps, the logical log information is backed up to the specified directory. Since the logical log information is primarily used for database recovery in case of failure, the log backup process for distributed databases can also include:

[0084] S140: Receive the user's input recovery request;

[0085] S150: Determine logical log set information from the specified directory based on the recovery request;

[0086] S160: Determine whether the logical log set information meets the preset conditions;

[0087] S170: If the logical log set information meets the preset conditions, then data recovery is performed based on the recovery request and the logical log set information, and the recovery result information corresponding to the recovery request is output;

[0088] S180: If the logical log set information does not meet the preset conditions, output the prompt information corresponding to the recovery request.

[0089] In this embodiment, the recovery request includes information such as whether recovery is required, execution time, and the target time to be recovered. That is, when a database failure occurs, a fault prompt will be sent to the user. The user can input a recovery request based on the fault prompt, or the user can actively input a recovery request upon noticing a server failure. Based on the recovery request, logical log set information is determined from a specified directory. This logical log set information represents the set of all logical log information required to complete the recovery request. For example, if logical log information 1-100 is required based on the target time information, it is necessary to determine whether the logical log information in logical log information 1-100 is continuous and whether there are any missing entries, in order to determine whether a recovery operation can be performed. An example is given of determining whether the logical log information in the logical log set is continuous.

[0090] Retrieve the ID information of at least two recovery logical log entries from the logical log set information;

[0091] Determine whether the numbering information is consecutive.

[0092] In this embodiment, by obtaining logical log information from the logical log set information, the timestamp, IP address, port information, and number information in the logical log information are determined. First, the IP address and port information are used to determine whether it belongs to the same data node as the next logical log information. If they belong to the same data node, the number information is checked for continuity. If they are not continuous, the recovery is deemed to have failed, and a prompt message is output. If they are continuous, the next logical log information is obtained, and the above judgment is repeated. If the current logical log information and the next logical log information do not belong to the same data node, the next logical log information is determined based on the dependency information. Based on the dependency information between logical log information, it is determined whether the next logical log information points to the current logical log information. The last synchronization information in the current logical log information is checked to see if it appears in the next logical log information. If it does not exist, the next logical log information is removed from the logical log information set. Based on the above steps, each logical log information in the logical log set information is traversed. If it is determined that the logical log information in the logical log set information is continuous, and the non-continuous logical log information is removed from the logical log information set, data recovery is performed based on the recovery request and the logical log set information, and the recovery result information corresponding to the recovery request is output.

[0093] In one embodiment, S160: Perform a recovery operation based on the judgment logical log set to obtain the recovery result corresponding to the logical log set.

[0094] In this embodiment, before performing the recovery operation based on the judgment logical log set, it also includes obtaining the recovery timeline. The recovery operation includes two cases: one is to restore to the time when the backup started, and the other is to restore to the time when the backup ended. In the first recovery case, specifically, the first timestamp in the timeline is determined, the first synchronization information corresponding to the first timestamp is determined based on the first timestamp, the current logical log information corresponding to the first synchronization information is determined through the logical log set, and flashback recovery is performed based on the current logical log information. Before applying the next logical log information for flashback, it is determined whether the next logical log information points to the current logical log information based on the dependency information between logical log information. In this way, each logical log information in the logical log information set is traversed from back to front until the recovery is performed to the time when the backup started. It should be noted that the dependency information between logical log information refers to the logical log information that the next logical log information will point to the logical log information of the previous synchronization information of its first synchronization information.

[0095] In the second recovery scenario, a combination of forward binary log tracing and active transaction rollback is used. The logical log information in the logical log information set is traversed from front to back, and each logical log information is checked to see if the last synchronization information in the current logical log information appears in the next logical log information, until the recovery ends at the time of backup.

[0096] As shown in Figure 3, this application also discloses an embodiment providing a log backup processing device for a distributed database, wherein the distributed database contains at least two data nodes, and the log backup processing device includes:

[0097] The selection module 310 is used to select a target backup node from the at least two data nodes;

[0098] The acquisition module 320 is used to acquire the logical log information of the target backup node;

[0099] Backup module 330 is used to back up the logical log information to a specified directory corresponding to the distributed database, and obtain the logical log backup processing result corresponding to the target backup node.

[0100] In one embodiment, the device further includes:

[0101] The configuration module is used to obtain configuration files;

[0102] The directory module is used to create at least one specified directory based on the configuration file;

[0103] The determination module is used to determine the at least two data nodes based on the specified directory.

[0104] In one embodiment, the selection module 310 may include:

[0105] A quantity unit is used to determine the synchronization progress information of logical log information in each of the data nodes;

[0106] A filtering unit is used to filter the synchronization progress information and determine the target synchronization progress information;

[0107] The target unit is used to identify the data node corresponding to the target synchronization progress information as the target backup node.

[0108] In one embodiment, the backup module 330 may include:

[0109] The first judgment unit is used to determine whether a backup file exists in the specified directory;

[0110] The first acquisition unit is used to acquire the logical log information of the target backup node when the backup file does not exist in the specified directory;

[0111] The generation unit is used to generate backup files based on the logical log information.

[0112] In one embodiment, the apparatus may further include:

[0113] The second judgment unit is used to obtain the last backup file in the specified directory when the backup file exists in the specified directory, and to determine whether the target backup node is the same as the data node corresponding to the last backup file.

[0114] The numbering unit is used to determine the numbering information corresponding to the last backup file if they are the same, and to obtain the logical log information from the target backup node based on the numbering information.

[0115] The dependent unit is used to determine the last synchronization information in the last backup file based on the last backup file, determine the location information of the last synchronization information in the target backup node, and obtain logical log information from the target backup node based on the location information.

[0116] In one embodiment, the device may further include:

[0117] The receiving module is used to receive user input for recovery requests;

[0118] The collection module is used to determine logical log collection information from the specified directory based on the recovery request;

[0119] The judgment module is used to determine whether the logical log set information meets preset conditions;

[0120] The recovery module is used to perform data recovery based on the recovery request and the logical log set information if the logical log set information meets the preset conditions, and output the recovery result information corresponding to the recovery request.

[0121] The prompt module is used to output prompt information corresponding to the recovery request if the logical log set information does not meet the preset conditions.

[0122] In one embodiment, the determination module may include:

[0123] The second acquisition unit is used to acquire the numbering information of at least two recovery logical log information in the logical log set information;

[0124] The third judgment unit is used to determine whether the numbering information is continuous.

[0125] The specific implementation process of the functions and roles of each module in the above device can be found in the implementation process of the corresponding steps in the above method, and will not be repeated here.

[0126] like Figure 4 As shown in the figure, this application embodiment provides an air conditioner control device, including a processor 410, a communication interface 420, a memory 430, and a communication bus 440, wherein the processor 410, the communication interface 420, and the memory 430 communicate with each other through the communication bus 440.

[0127] Memory 430 is used to store computer programs;

[0128] In one embodiment of this application, when the processor 410 executes a program stored in the memory 430, it implements the control method for log backup processing of a distributed database provided in any of the foregoing method embodiments, including:

[0129] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the distributed database log backup processing method provided in any of the foregoing method embodiments.

[0130] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0131] The foregoing has described specific embodiments of the embodiments described in this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0132] The above description is merely a specific embodiment of the present invention, enabling those skilled in the art to understand or implement the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the present invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A log backup processing method for a distributed database, characterized in that, The distributed database contains at least two data nodes, and the log backup processing method includes: Select one target backup node from the at least two data nodes; Obtain the logical log information of the target backup node; The logical log information is backed up to the specified directory corresponding to the distributed database to obtain the logical log backup processing result corresponding to the target backup node; The step of backing up the logical log information to the specified directory corresponding to the distributed database includes: Determine whether a backup file exists in the specified directory; if the backup file does not exist in the specified directory, obtain the logical log information of the target backup node; generate a backup file based on the logical log information, and back up the backup file to the specified directory corresponding to the distributed database; When the backup file exists in the specified directory, obtain the last backup file in the specified directory, and determine whether the target backup node is the same as the data node corresponding to the last backup file; If they are the same, then determine the number information corresponding to the last backup file, and obtain the logical log information from the target backup node based on the number information; If they are not the same, the last synchronization information in the last backup file is determined based on the last backup file, the position information of the last synchronization information in the target backup node is determined, and the logical log information is obtained from the target backup node according to the position information.

2. The method according to claim 1, characterized in that, The method further includes: Get the configuration file; Create at least one specified directory based on the configuration file; The at least two data nodes are determined based on the specified directory.

3. The method according to claim 1, characterized in that, Selecting a target backup node from the at least two data nodes includes: Determine the synchronization progress information of the logical log information in each of the data nodes; The synchronization progress information is filtered to determine the target synchronization progress information; The data node corresponding to the target synchronization progress information is identified as the target backup node.

4. The method according to claim 1, characterized in that, The method further includes: Receive user input for a recovery request; Based on the recovery request, determine the logical log set information from the specified directory; Determine whether the logical log set information meets the preset conditions; If the logical log set information meets the preset conditions, then data recovery is performed based on the recovery request and the logical log set information, and the recovery result information corresponding to the recovery request is output. If the logical log set information does not meet the preset conditions, then the prompt information corresponding to the recovery request will be output.

5. The method according to claim 4, characterized in that, Determining whether the logical log set information meets preset conditions includes: Obtain the number information of at least two recovery logical log entries from the logical log set information; Determine whether the numbering information is consecutive.

6. A log backup processing device for a distributed database, characterized in that, The distributed database contains at least two data nodes, and the log backup processing device includes: A selection module is used to select a target backup node from the at least two data nodes; The acquisition module is used to acquire the logical log information of the target backup node; The backup module is used to back up the logical log information to a specified directory corresponding to the distributed database, and obtain the logical log backup processing result corresponding to the target backup node; The step of backing up the logical log information to the specified directory corresponding to the distributed database includes: Determine whether a backup file exists in the specified directory; if the backup file does not exist in the specified directory, obtain the logical log information of the target backup node; generate a backup file based on the logical log information, and back up the backup file to the specified directory corresponding to the distributed database; When the backup file exists in the specified directory, obtain the last backup file in the specified directory, and determine whether the target backup node is the same as the data node corresponding to the last backup file; If they are the same, then determine the number information corresponding to the last backup file, and obtain the logical log information from the target backup node based on the number information; If they are not the same, the last synchronization information in the last backup file is determined based on the last backup file, the position information of the last synchronization information in the target backup node is determined, and the logical log information is obtained from the target backup node according to the position information.

7. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; When a processor executes a program stored in memory, it implements the steps of the log backup processing method for a distributed database as described in any one of claims 1-5.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the log backup processing method for a distributed database as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Database backup file recovery method and device and electronic equipment

    CN109597722A

  • Data processing method and device

    CN114090332A