WO2020207010A1 - 数据备份方法、装置及计算机可读存储介质 - Google Patents

数据备份方法、装置及计算机可读存储介质 Download PDF

Info

Publication number
WO2020207010A1
WO2020207010A1 PCT/CN2019/117351 CN2019117351W WO2020207010A1 WO 2020207010 A1 WO2020207010 A1 WO 2020207010A1 CN 2019117351 W CN2019117351 W CN 2019117351W WO 2020207010 A1 WO2020207010 A1 WO 2020207010A1
Authority
WO
WIPO (PCT)
Prior art keywords
backup
data
source data
backed
mongodb
Prior art date
Application number
PCT/CN2019/117351
Other languages
English (en)
French (fr)
Inventor
张艳
Original Assignee
平安科技(深圳)有限公司
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 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2020207010A1 publication Critical patent/WO2020207010A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1448Management of the data involved in backup or backup restore
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/11File system administration, e.g. details of archiving or snapshots
    • G06F16/128Details of file system snapshots on the file-level, e.g. snapshot creation, administration, deletion
    • 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

Definitions

  • This application relates to the field of cloud storage technology, and in particular to a data backup method, device, and computer-readable storage medium.
  • This application provides a data backup method, device, and computer-readable storage medium, the main purpose of which is to provide an efficient source data backup method when the source data needs to be backed up.
  • a data backup method provided by this application includes:
  • obtain the source data to be backed up use the copy-on-write snapshot technology to create a snapshot volume, perform source data backup, and generate backup data, including:
  • the snapshot volume When the source data is updated, track the data changes of the source data through the pointer table of the source data and the position of the copy of the source data pointer table of the snapshot volume, and read and write the source data
  • the snapshot volume generates the backup data.
  • the restoration of the backup data through the MongoDB backup technology includes:
  • restoring the backup data through MongoDB backup technology also includes:
  • the slave backup server reads the update information of the main backup server
  • the secondary backup server automatically takes over the primary backup server to continue backup.
  • implement incremental log backup at the database level through MongoDB incremental backup including:
  • oplog.rs is found in the local database through the oplog function of the MongoDB cluster to achieve incremental data backup within a specified time period;
  • this application also provides a data backup device, which includes a memory and a processor, the memory stores a certificate verification program that can run on the processor, and the certificate verification program is The processor implements the following steps when executing:
  • the obtaining the source data to be backed up, using the copy-on-write snapshot technology to create a snapshot volume, performing source data backup, and generating backup data includes:
  • the snapshot volume When the source data is updated, track the data changes of the source data through the pointer table of the source data and the position of the copy of the source data pointer table of the snapshot volume, and read and write the source data
  • the snapshot volume generates the backup data.
  • the restoration of the backup data through the MongoDB backup technology includes:
  • restoring the backup data through MongoDB backup technology also includes:
  • the slave backup server reads the update information of the main backup server
  • the secondary backup server automatically takes over the primary backup server to continue backup.
  • the present application also provides a computer-readable storage medium having a data backup program stored on the computer-readable storage medium, and the data backup program may be executed by one or more processors to achieve The steps of the data backup method as described above.
  • the data backup method, device and computer-readable storage medium proposed in this application obtain the source data to be backed up, use the technology of copying snapshots on write, create a snapshot volume, perform source data backup, and generate backup data; when the backup cannot be performed normally Obtain the invalid source data to be backed up, and use MongoDB backup technology to restore the backup data; Obtain the full database backed up by the user in the preset period, and achieve database-level incremental log backup through MongoDB incremental backup, thus achieving Efficient backup of source data.
  • FIG. 1 is a schematic flowchart of a data backup method provided by an embodiment of this application
  • FIG. 2 is a schematic diagram of the internal structure of a data backup device provided by an embodiment of the application.
  • FIG. 3 is a schematic diagram of modules of a data backup program in a data backup device provided by an embodiment of the application.
  • This application provides a data backup method.
  • FIG. 1 it is a schematic flowchart of a data backup method provided by an embodiment of this application.
  • the method can be executed by a device, and the device can be implemented by software and/or hardware.
  • the data backup method includes:
  • the copy-on-write snapshot technology refers to a fully usable copy of the source data to be backed up.
  • the copy includes the corresponding data at a certain point in time (the copy starts). Point in time).
  • the aforementioned copy-on-write snapshot technology uses the pre-allocated snapshot space to create a snapshot volume.
  • the snapshot volume only needs to allocate a relatively small amount of storage space to save the snapshot in the source data volume after the point in time.
  • the creation of the snapshot volume does not occur with physical data copying, so the creation of the snapshot volume is very fast and can be completed instantly.
  • the storage system creates a source data pointer table and a copy of the source data pointer table for the source data volume.
  • Each source data volume has a source data pointer table, and each record stores a pointer to the corresponding data block.
  • the copy of the source data pointer table is the data pointer table of the snapshot volume.
  • the copy-on-write snapshot technology will query the source data pointer table and determine the physical storage location of the accessed data according to the pointer of the corresponding data block , And then update the snapshot volume and the source data pointer table and copy to generate backup data.
  • a valid data source to be backed up is continuously obtained, and the snapshot-on-write technology is used until complete backup data is generated.
  • the copy-on-write snapshot technology when using the copy-on-write snapshot technology to back up source data, when the source data is updated too fast, the copy-on-write snapshot technology may exceed the reserved space reserved in the snapshot library, resulting in The snapshot volume becomes invalid and loses the backup capability, causing the backup to not be performed normally. In this case, perform the following S2.
  • the MongoDB is a database based on distributed file storage, which adopts a document data model and can back up a large amount of data with different structures.
  • MongoDB backup technology mainly uses oplog to back up data.
  • Oplog is a fixed collection under the local library (also known as the local library).
  • the data processed by the MongoDB backup technology when the data processed by the MongoDB backup technology is relatively large, for example, greater than a preset value, firstly, multiple servers will be coordinated to cooperate with each other to ensure the normal operation of the server during the backup process. If a server accident occurs Stop the backup, MongoDB backup technology can immediately select another server to continue the backup, and so on.
  • the server is selected by using the master-slave replication method, that is, one server is set as the master backup server, and the others are slave backup servers.
  • the secondary backup server can realize the backup function and share the pressure of the primary backup server. When the primary backup server is working, the secondary backup server does not back up data, but only reads the update information of the primary backup server. When the primary backup server fails, it can automatically switch from the backup server to replace the primary backup server to continue backup.
  • the preferred embodiment of the present application restores the backup of non-dependent data by calling the oplog.rs collection.
  • the oplog.rs set is a fixed set of oplog under the local library of the master-slave server, which records all the operation records of the copy-on-write snapshot technology. If the copy-on-write snapshot technology updates the snapshot database once, the oplog.rs collection This update will be recorded at the same time.
  • the non-dependent data means that the data has no other data associated with it, and there is no need to consider other data when backing up.
  • the preferred embodiment of the present application restores the dependency data by calling the oplog.bson collection. If data A and data B use copy-on-write snapshot technology to back up data at the same time, and data A and data B are dependent on each other, such as data A stores an order, and data B stores all the details of the order, then only An order is the correct state when it has complete details. In the case that the copy-on-write snapshot technology backup dependent data fails, use the oplog.bson collection under the local library to restore the backup operation. When the master-slave server uses the Mongodb backup technology, an oplog.bson file will be generated.
  • This file collection will store all the oplogs for the entire time period from the beginning of the backup to the end of the backup, and there is no limitation on the backup time. Because the backup process of copy-on-write snapshot technology will lock the backup data at a fixed point in time, the release time of the oplog.bson file is used to limit the backup data. When the copy-on-write snapshot technology backup relies on data A and an error occurs, the Mongodb backup technology will based on the backup record of data A in the oplog log under the oplog.bson file, and at the same time according to the backup time of the dependent data B, which has no problems. Do the backup operation of all data A again to achieve the backup purpose of restoring dependent data A.
  • the one period may be one week.
  • the user may be a certain company, such as Ping An of China.
  • the user can perform a full backup of his database data in one cycle to prevent accidents and data loss.
  • some new data may be added.
  • the incremental backup of MongoDB can be used to achieve.
  • the incremental backup of MongoDB is implemented through the oplog function of the cluster.
  • the MongoDB cluster needs at least one copy In a cluster, oplog.rs can be found under the local database in the master node in a built-up cluster, so as to achieve incremental data backup within a specified time period.
  • the preferred embodiment of the present application can also perform multiple, accurate, lightweight and fast incremental backups of local.oplog.rs on the basis of full snapshot backups to implement database-level incremental log backups.
  • the incremental log backup includes conditional filtering and backup of local.oplog.rs, formatting and parsing local.oplog.rs, and precise location and restoration of damage points.
  • the local.oplog.rs incremental backup can support analytical recovery at any point in time and any operation; and according to the replication mechanism of the replicaSet, it can implement backup and recovery at different levels such as single node, replica cluster, shard cluster, etc.
  • the set of oplog is:
  • ts represents 8-byte timestamp, represented by 4-byte unix timestamp + 4-byte increment count;
  • ns represents the namespace where the operation is located
  • o represents the document corresponding to the operation, that is, the content of the current operation
  • o2 Represents the where condition when performing an update operation, and this attribute is only available when updating (update).
  • the invention also provides a data backup device.
  • FIG. 2 it is a schematic diagram of the internal structure of a data backup device provided by an embodiment of this application.
  • the data backup device 1 may be a PC (Personal Computer, personal computer), or a terminal device such as a smart phone, a tablet computer, or a portable computer, or a server.
  • the data backup device 1 at least includes a memory 11, a processor 12, a communication bus 13, and a network interface 14.
  • the memory 11 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), magnetic memory, magnetic disk, optical disk, etc.
  • the memory 11 may be an internal storage unit of the data backup device 1 in some embodiments, such as a hard disk of the data backup device 1.
  • the memory 11 may also be an external storage device of the data backup device 1, for example, a plug-in hard disk equipped on the data backup device 1, a smart memory card (Smart Media Card, SMC), and a secure digital (Secure Digital, SD card, Flash Card, etc.
  • the memory 11 may also include both an internal storage unit of the data backup device 1 and an external storage device.
  • the memory 11 can be used not only to store application software and various data installed in the data backup device 1, such as the code of the data backup program 01, etc., but also to temporarily store data that has been output or will be output.
  • the processor 12 may be a central processing unit (CPU), controller, microcontroller, microprocessor or other data processing chip in some embodiments, and is used to run the program code or processing stored in the memory 11 Data, for example, the execution data backup program 01 (the execution data backup program 01 is essentially a software system) and so on.
  • CPU central processing unit
  • controller microcontroller
  • microprocessor or other data processing chip in some embodiments, and is used to run the program code or processing stored in the memory 11 Data, for example, the execution data backup program 01 (the execution data backup program 01 is essentially a software system) and so on.
  • the communication bus 13 is used to realize the connection and communication between these components.
  • the network interface 14 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface), and is usually used to establish a communication connection between the device 1 and other electronic devices.
  • the device 1 may also include a user interface.
  • the user interface may include a display (Display) and an input unit such as a keyboard (Keyboard).
  • the optional user interface may also include a standard wired interface and a wireless interface.
  • the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode, organic light emitting diode) touch device, etc.
  • the display can also be appropriately called a display screen or a display unit, which is used to display the information processed in the data backup device 1 and to display a visualized user interface.
  • Figure 2 only shows the data backup device 1 with components 11-14 and the data backup program 01.
  • Figure 1 does not constitute a limitation on the data backup device 1, and may include Fewer or more components than shown, or some combination of components, or different component arrangement.
  • a data backup program 01 is stored in the memory 11; when the processor 12 executes the data backup program 01 stored in the memory 11, the following steps are implemented:
  • Step 1 Obtain the source data to be backed up, create a snapshot volume through the copy-on-write snapshot technology, perform source data backup, generate backup data, and always judge whether the backup is normally performed.
  • the copy-on-write snapshot technology refers to a fully usable copy of the source data to be backed up.
  • the copy includes the corresponding data at a certain point in time (the copy starts). Point in time).
  • the aforementioned copy-on-write snapshot technology uses the pre-allocated snapshot space to create a snapshot volume.
  • the snapshot volume only needs to allocate a relatively small amount of storage space to save the snapshot in the source data volume after the point in time.
  • the creation of the snapshot volume does not occur with physical data copying, so the creation of the snapshot volume is very fast and can be completed instantly.
  • the storage system creates a source data pointer table and a copy of the source data pointer table for the source data volume.
  • Each source data volume has a source data pointer table, and each record stores a pointer to the corresponding data block.
  • the copy of the source data pointer table is the data pointer table of the snapshot volume.
  • the copy-on-write snapshot technology will query the source data pointer table and determine the physical storage of the accessed data according to the pointer of the corresponding data block Then update the snapshot volume and source data pointer table and copy to generate backup data.
  • a valid data source to be backed up is continuously obtained, and the snapshot-on-write technology is used until complete backup data is generated.
  • the copy-on-write snapshot technology when using the copy-on-write snapshot technology to back up source data, when the source data is updated too fast, the copy-on-write snapshot technology may exceed the reserved space reserved in the snapshot library, resulting in The snapshot volume becomes invalid and loses the backup capability, causing the backup to not be performed normally. In this case, perform the following S2.
  • Step 2 When the backup cannot be performed normally, obtain the invalid source data to be backed up, and restore the backup data through the MongoDB backup technology.
  • the MongoDB is a database based on distributed file storage, which adopts a document data model and can back up a large amount of data with different structures.
  • MongoDB backup technology mainly uses oplog to back up data.
  • Oplog is a fixed collection under the local library (also known as the local library).
  • the preset value may be 10 million.
  • multiple servers will be coordinated to cooperate with each other to ensure that the servers are in the backup process. In normal operation, if the server stops the backup unexpectedly, the MongoDB backup technology can immediately select another server to continue the backup, and so on.
  • the server is selected by using the master-slave replication method, that is, one server is set as the master backup server, and the others are slave backup servers.
  • the secondary backup server can realize the backup function and share the pressure of the primary backup server. When the primary backup server is working, the secondary backup server does not back up data, but only reads the update information of the primary backup server. When the primary backup server fails, it can automatically switch from the backup server to replace the primary backup server to continue backup.
  • the preferred embodiment of the present application restores the backup of non-dependent data by calling the oplog.rs collection.
  • the oplog.rs set is a fixed set of oplog under the local library of the master-slave server, which records all the operation records of the copy-on-write snapshot technology. If the copy-on-write snapshot technology updates the snapshot database once, the oplog.rs collection This update will be recorded at the same time.
  • the non-dependent data means that the data has no other data associated with it, and there is no need to consider other data when backing up.
  • the preferred embodiment of the present application restores the dependency data by calling the oplog.bson collection. If data A and data B use copy-on-write snapshot technology to back up data at the same time, and data A and data B are dependent on each other, such as data A stores an order, and data B stores all the details of the order, then only An order is the correct state when it has complete details. In the case that the copy-on-write snapshot technology backup dependent data fails, use the oplog.bson collection under the local library to restore the backup operation. When the master-slave server uses the Mongodb backup technology, an oplog.bson file will be generated.
  • This file collection will store all the oplogs for the entire time period from the beginning of the backup to the end of the backup, and there is no limitation on the backup time. Because the backup process of copy-on-write snapshot technology will lock the backup data at a fixed point in time, the release time of the oplog.bson file is used to limit the backup data. When the copy-on-write snapshot technology backup relies on data A and an error occurs, the Mongodb backup technology will based on the backup record of data A in the oplog log under the oplog.bson file, and at the same time according to the backup time of the dependent data B, which has no problems. Do the backup operation of all data A again to achieve the backup purpose of restoring dependent data A.
  • Step 3 Obtain the full database backed up by the user in a preset period, and implement incremental log backup at the database level through MongoDB incremental backup.
  • the preset period may be one week.
  • the user may be a certain company, such as Ping An of China.
  • the user can perform a full backup of his database data in one cycle to prevent accidents and data loss.
  • some new data may be added.
  • the incremental backup of MongoDB can be used to achieve.
  • the incremental backup of MongoDB is implemented through the oplog function of the cluster.
  • the MongoDB cluster needs at least one copy In a cluster, oplog.rs can be found under the local database in the master node in a built-up cluster, so as to achieve incremental data backup within a specified time period.
  • the preferred embodiment of the present application can also perform multiple, accurate, lightweight and fast incremental backups of local.oplog.rs on the basis of full snapshot backups to implement database-level incremental log backups.
  • the incremental log backup includes conditional filtering and backup of local.oplog.rs, formatting and parsing local.oplog.rs, and precise location and restoration of damage points.
  • the local.oplog.rs incremental backup can support analytical recovery at any point in time and any operation; and according to the replication mechanism of the replicaSet, it can implement backup and recovery at different levels such as single node, replica cluster, shard cluster, etc.
  • the set of oplog is:
  • the query command field of the oplog set includes:
  • ts represents 8-byte timestamp, represented by 4-byte unix timestamp + 4-byte increment count;
  • ns represents the namespace where the operation is located
  • o represents the document corresponding to the operation, that is, the content of the current operation
  • o2 Represents the where condition when performing an update operation, and this attribute is only available when updating (update).
  • the data backup program may also be divided into one or more modules, and the one or more modules are stored in the memory 11 and are executed by one or more processors (in this embodiment, processing The device 12) is executed to complete this application.
  • the module referred to in this application refers to a series of computer program instruction segments that can complete specific functions, and is used to describe the execution process of the data backup program in the data backup device.
  • FIG. 3 is a schematic diagram of program modules of the data backup program in an embodiment of the data backup device of this application.
  • the data backup program can be divided into a source data backup module 10 and a source data recovery module.
  • the backup module 20 and the source data incremental backup module 30 are exemplary:
  • the source data backup module 10 is used to: use the copy-on-write snapshot technology for the source data to be backed up to create a snapshot volume, perform source data backup, and generate backup data.
  • the source data restoration and backup module 20 is configured to: when the backup cannot be performed normally, obtain the invalid source data to be backed up, and restore the backup data by using the MongoDB backup technology;
  • the source data incremental backup module 30 is used to obtain the full database backed up by the user in a preset period, and implement incremental log backup at the database level through MongoDB incremental backup.
  • the functions or operation steps implemented by the program modules such as the source data backup module 10, the source data restoration backup module 20, and the source data incremental backup module 30 when executed are substantially the same as those in the foregoing embodiment, and will not be repeated here.
  • an embodiment of the present application also proposes a computer-readable storage medium having a data backup program stored on the computer-readable storage medium, and the data backup program can be executed by one or more processors to implement the following operations:

Landscapes

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

Abstract

一种数据备份方法,包括:获取待备份的源数据,利用写时复制快照的技术,建立快照卷,执行源数据备份,生成备份数据,并时刻判断所述备份是否正常进行(S1);当备份不能正常进行时,获取失效的待备份源数据,利用MongoDB备份技术恢复所述备份数据(S2);获取用户在预设周期内所备份的全量数据库,通过MongoDB增量备份实现数据库级别的增量日志备份(S3)。同时,还提出一种数据备份装置以及一种计算机可读存储介质。该方法实现了源数据的高效备份。

Description

数据备份方法、装置及计算机可读存储介质
本申请要求于2019年04月08日提交中国专利局、申请号为201910275756.X、发明名称为“数据备份方法、装置及计算机可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在申请中。
技术领域
本申请涉及云存储技术领域,尤其涉及一种数据备份方法、装置及计算机可读存储介质。
背景技术
近年来,计算机技术取得了巨大的发展,但是数据备份技术却没有长足进步。数据备份操作代价和成本仍然比较高,并且消耗大量时间和系统资源,数据备份的恢复时间目标和恢复点目标比较长。传统的数据备份技术,都一直采用数据复制、恢复等技术来保护重要的数据信息,定期对数据进行备份或复制。由于数据备份过程会影响应用性能,并且非常耗时,通常数据备份都被安排在系统负载较轻时进行(如夜间)。所以传统方法耗时耗力,耽误工作进展。近年来,为了节省存储空间,通常结合全量和增量备份技术,虽然缩短了备份时间,加快工作进度,但全量和增量备份技术对数据丢失或系统灾难时的复制备份数据能力弱,鲁棒性差。
发明内容
本申请提供一种数据备份方法、装置及计算机可读存储介质,其主要目的在于当源数据需要进行备份时,提供一种高效的源数据备份方法。
为实现上述目的,本申请提供的一种数据备份方法,包括:
获取待备份的源数据,利用写时复制快照技术创建快照卷,执行源数据备份,生成备份数据;
当备份不能正常进行时,获取失效的待备份源数据,利用MongoDB备份技术恢复所述备份数据;
获取用户在预设周期内所备份的全量数据库,通过MongoDB增量备份实 现数据库级别的增量日志备份。
可选地,获取待备份的源数据,利用写时复制快照技术创建快照卷,执行源数据备份,生成备份数据,包括:
建立待备份的源数据的指针表及所述快照卷的源数据指针表副本;
当所述源数据发生更新时,通过所述源数据的指针表及所述快照卷的源数据指针表副本的位置,跟踪所述源数据的数据变化,将所述源数据读出并写入所述快照卷,生成所述备份数据。
可选地,所述通过MongoDB备份技术恢复备份数据,包括:
通过调用oplog.rs集合恢复所述待备份源数据中非依赖性数据的备份;
通过调用oplog.bson集合恢复所述待备份源数据中依赖性数据的备份。
可选地,通过MongoDB备份技术恢复备份数据,还包括:
利用主从复制法从执行源数据备份操作的多台服务器中选择一台服务器设定为主备份服务器,其他多台为从备份服务器;
当所述主备份服务器工作执行备份时,所述从备份服务器读取主备份服务器的更新信息;
当所述主备份服务器故障时,所述从备份服务器自动接替主备份服务器继续备份。
可选地,通过MongoDB增量备份实现数据库级别的增量日志备份,包括:
当所述全量数据库需要添加新的数据时,通过MongoDB集群的oplog功能在本地数据库下找到oplog.rs,实现指定时间段内的数据增量备份;
在全量的快照备份基础上,进行预设次数的local.oplog.rs增量备份,实现数据库级别的增量日志备份。
此外,为实现上述目的,本申请还提供一种数据备份装置,该装置包括存储器和处理器,所述存储器中存储有可在所述处理器上运行的证件验证程序,所述证件验证程序被所述处理器执行时实现如下步骤:
获取待备份的源数据,利用写时复制快照技术创建快照卷,执行源数据备份,生成备份数据;
当备份不能正常进行时,获取失效的待备份源数据,利用MongoDB备份技术恢复所述备份数据;
获取用户在预设周期内所备份的全量数据库,通过MongoDB增量备份实 现数据库级别的增量日志备份。
可选地,所述获取待备份的源数据,利用写时复制快照技术创建快照卷,执行源数据备份,生成备份数据,包括:
建立待备份的源数据的指针表及所述快照卷的源数据指针表副本;
当所述源数据发生更新时,通过所述源数据的指针表及所述快照卷的源数据指针表副本的位置,跟踪所述源数据的数据变化,将所述源数据读出并写入所述快照卷,生成所述备份数据。
可选地,所述通过MongoDB备份技术恢复备份数据,包括:
通过调用oplog.rs集合恢复所述待备份源数据中非依赖性数据的备份;
通过调用oplog.bson集合恢复所述待备份源数据中依赖性数据的备份。
可选地,通过MongoDB备份技术恢复备份数据,还包括:
利用主从复制法从执行源数据备份操作的多台服务器中选择一台服务器设定为主备份服务器,其他多台为从备份服务器;
当所述主备份服务器工作执行备份时,所述从备份服务器读取主备份服务器的更新信息;
当所述主备份服务器故障时,所述从备份服务器自动接替主备份服务器继续备份。
此外,为实现上述目的,本申请还提供一种计算机可读存储介质,所述计算机可读存储介质上存储有数据备份程序,所述数据备份程序可被一个或者多个处理器执行,以实现如上所述的数据备份方法的步骤。
本申请提出的数据备份方法、装置及计算机可读存储介质,获取待备份的源数据,利用写时复制快照的技术,建立快照卷,执行源数据备份,从而生成备份数据;当备份不能正常进行时,获取失效的待备份源数据,利用MongoDB备份技术恢复所述备份数据;获取用户在预设周期内所备份的全量数据库,通过MongoDB增量备份实现数据库级别的增量日志备份,从而实现了源数据的高效备份。
附图说明
图1为本申请一实施例提供的数据备份方法的流程示意图;
图2为本申请一实施例提供的数据备份装置的内部结构示意图;
图3为本申请一实施例提供的数据备份装置中数据备份程序的模块示意图。
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
具体实施方式
应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
本申请提供一种数据备份方法。参照图1所示,为本申请一实施例提供的数据备份方法的流程示意图。该方法可以由一个装置执行,该装置可以由软件和/或硬件实现。
在本实施例中,数据备份方法包括:
S1、获取待备份的源数据,通过写时复制快照技术创建快照卷,执行源数据备份,生成备份数据,并时刻判断所述备份是否正常进行。
本申请较佳实施例中,所述写时复制快照技术(copy-on-write,简称COW)是关于待备份源数据的完全可用拷贝,该拷贝包括相应数据在某个时间点(拷贝开始的时间点)的映像。当源数据进行备份时,上述的写时复制快照技术会使用预先分配的快照空间创建快照卷,所述快照卷只需分配相对少量的存储空间,用于保存快照时间点之后源数据卷中被更新的数据,其中由于仅复制了原始数据物理位置的源数据,所以快照卷的建立没有物理数据复制发生,因此快照卷建立速度非常快,可以瞬间完成。
本申请较佳实施例中,建立完上述快照卷后,存储系统为源数据卷建立一个源数据指针表和源数据指针表副本。每个源数据卷都具有一个源数据指针表,每条记录保存着指向对应数据块的指针,源数据指针表副本是作为快照卷的数据指针表。虽然快照卷与源数据卷具有各自的指针表,但其实共享同一份物理数据。
当源数据卷有数据将要被更新时,为了确保复制操作发生在更新操作之前,所述写时复制快照技术会通过查询源数据指针表,根据对应数据块的指针确定所访问数据的物理存储位置,然后更新快照卷和源数据指针表及副本,生成备份数据。
本申请较佳实施例,当备份正常进行时,持续获取有效的待备份数据源,利用写时复制快照技术,直到生成完整的备份数据。
本申请其他较佳实施例中,在上述利用写时复制快照技术备份源数据时,当源数据更新速度太快时,可能会超出写时复制快照技术预留在快照库的保留空间,进而导致快照卷失效,失去备份能力,导致备份不能正常进行,此时,需执行下述的S2。
S2、当备份不能正常进行时,获取失效的待备份源数据,通过MongoDB备份技术恢复备份数据。
本申请较佳实施例中,所述MongoDB是一种基于分布式文件存储的数据库,它采用了文档数据模型,能够备份大量且不同结构的数据。MongoDB备份技术主要以oplog来备份数据,oplog是本地库(又称local库)下的一个固定集合,除了同步备份外,还可以通过检索oplog日志,了解各时间段内的备份历史。默认情况下,oplog分配的是服务器5%的空闲磁盘空间。
进一步地,本申请较佳实施例中,当MongoDB备份技术处理的数据较大,例如大于预设值时,首先会协调多部服务器互相协作,保证服务器在备份过程中正常运行,若出现服务器意外停止备份,MongoDB备份技术可马上选择另一台服务器继续备份,以此类推。通过利用主从复制法选择服务器,即一台服务器设定为主备份服务器,其他多台为从备份服务器。从备份服务器可以实现备份功能,分担主备份服务器压力的作用。当主备份服务器工作时,从备份服务器并不备份数据,只读取主备份服务器的更新信息。当主备份服务器故障时,可自动切换从备份服务器接替主备份服务器继续备份。
进一步地,本申请较佳实施例通过调用oplog.rs集合恢复非依赖性数据的备份。所述的oplog.rs集合是主从服务器local库下的oplog固定集合的一种,记录着所有写时复制快照技术的操作记录,若写时复制快照技术更新一次快照库后,oplog.rs集合中就会同时记录本次更新。所述非依赖性数据是指该数据没有与之关联的其他数据,备份时无需考虑其他数据,当写时复制快照技术在备份数据A的某时间点(此时A为非依赖性数据)崩溃后,MongoDB会通过oplog.rs寻找到崩溃地方的操作记录,由于oplog具有非常重要的特性——幂等性(idempotent),即对一个数据集合,使用oplog中记录的操作重放时,无论被重放多少次,其结果都会是一样的。所以oplog.rs集合记录中可 查找到破坏操作的时间点,然后可以恢复到破坏操作时间点前的数据,以此实现对数据A的继续备份。
进一步地,本申请较佳实施例通过调用oplog.bson集合恢复依赖性数据。若数据A和数据B同时使用写时复制快照技术进行备份数据,且数据A和数据B之间互相有依赖性,如数据A中存放了订单,数据B中存放了订单的所有明细,那么只有一个订单具有完整的明细时才是正确的状态。在进行写时复制快照技术备份依赖性数据出现失效的情况下,利用local库下的oplog.bson集合进行恢复备份操作。在主从服务器使用Mongodb备份技术时,会生成一个oplog.bson文件,该文件集合会存放从开始备份到结束备份整个时间段所有的oplog,且不加以备份时间的限制。因为写时复制快照技术的备份进行过程中会把备份数据锁死在一个固定的时间点,所以使用oplog.bson文件释放时间对备份数据的限制。当写时复制快照技术备份依赖数据A发生错误时,Mongodb备份技术会根据oplog.bson文件下的oplog日志中关于数据A的备份记录,同时根据备份未出问题的依赖数据B的备份时间,重做一遍所有数据A的备份操作,达到恢复依赖性数据A的备份目的。
S3、获取用户在一个预设的周期内所备份的全量数据库,通过MongoDB增量备份实现数据库级别的增量日志备份。
本申请较佳实施例中,所述一个周期可以为一周。
本申请较佳实施例中,所述用户可以是某一个公司,如中国平安。所述用户可以在一个周期内对其数据库数据进行全量备份,以防止出现意外,造成数据丢失。在进行全量备份时,可能会新增加一些数据,此时可以利用MongoDB的增量备份来实现,所述MongoDB增量备份是通过集群的oplog功能来实现的,所述MongoDB集群至少需要是一个副本集集群,通过在一个搭建好的集群中的master节点中,可以在local数据库下找到oplog.rs,从而实现指定时间段内的数据增量备份。
进一步地,本申请较佳实施例还可以在全量快照备份的基础上,进行多次、精确、轻量、快速的local.oplog.rs增量备份来实现数据库级别的增量日志备份。所述增量日志备份包含对local.oplog.rs的条件筛选备份、格式化解析local.oplog.rs、破坏点精准定位恢复等。所述local.oplog.rs增量备份可支持任意时点、任意操作的解析恢复;并根据replicaSet的复制机制,可实现单节 点、副本集群、分片集群等不同级别的备份与恢复。
优选地,所述oplog的集合为:
db.oplog.rs.find().skip(1).limit(1).toArray()
其中所述oplog集合的查询命令字段包含:
ts:代表8字节的时间戳,由4字节unix timestamp+4字节自增计数表示;
op:代表1字节的操作类型,其中"i":insert,"u":update,"d":delete,"c":db cmd,"db":声明当前数据库(其中ns被设置成为=>数据库名称+'.'),"n":no op,即空操作;
ns:代表操作所在的命名空间(namespace);
o:代表操作所对应的文档(document),即当前操作的内容;
o2:代表在执行更新操作时的where条件,仅限于更新(update)时才有该属性。
发明还提供一种数据备份装置。参照图2所示,为本申请一实施例提供的数据备份装置的内部结构示意图。
在本实施例中,所述数据备份装置1可以是PC(Personal Computer,个人电脑),或者是智能手机、平板电脑、便携计算机等终端设备,也可以是一种服务器等。该数据备份装置1至少包括存储器11、处理器12,通信总线13,以及网络接口14。
其中,存储器11至少包括一种类型的可读存储介质,所述可读存储介质包括闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、磁性存储器、磁盘、光盘等。存储器11在一些实施例中可以是数据备份装置1的内部存储单元,例如该数据备份装置1的硬盘。存储器11在另一些实施例中也可以是数据备份装置1的外部存储设备,例如数据备份装置1上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,存储器11还可以既包括数据备份装置1的内部存储单元也包括外部存储设备。存储器11不仅可以用于存储安装于数据备份装置1的应用软件及各类数据,例如数据备份程序01的代码等,还可以用于暂时地存储已经输出或者将要输出的数据。
处理器12在一些实施例中可以是一中央处理器(Central Processing Unit,CPU)、控制器、微控制器、微处理器或其他数据处理芯片,用于运行存储器11中存储的程序代码或处理数据,例如执行数据备份程序01(所述执行数据备份程序01实质是一个软件系统)等。
通信总线13用于实现这些组件之间的连接通信。
网络接口14可选的可以包括标准的有线接口、无线接口(如WI-FI接口),通常用于在该装置1与其他电子设备之间建立通信连接。
可选地,该装置1还可以包括用户接口,用户接口可以包括显示器(Display)、输入单元比如键盘(Keyboard),可选的用户接口还可以包括标准的有线接口、无线接口。可选地,在一些实施例中,显示器可以是LED显示器、液晶显示器、触控式液晶显示器以及OLED(Organic Light-Emitting Diode,有机发光二极管)触摸器等。其中,显示器也可以适当的称为显示屏或显示单元,用于显示在数据备份装置1中处理的信息以及用于显示可视化的用户界面。
图2仅示出了具有组件11-14以及数据备份程序01的数据备份装置1,本领域技术人员可以理解的是,图1示出的结构并不构成对数据备份装置1的限定,可以包括比图示更少或者更多的部件,或者组合某些部件,或者不同的部件布置。
在图2所示的装置1实施例中,存储器11中存储有数据备份程序01;处理器12执行存储器11中存储的数据备份程序01时实现如下步骤:
步骤一、获取待备份的源数据,通过写时复制快照技术,创建快照卷,执行源数据备份,生成备份数据,并时刻判断所述备份是否正常进行。
本申请较佳实施例中,所述写时复制快照技术(copy-on-write,简称COW)是关于待备份源数据的完全可用拷贝,该拷贝包括相应数据在某个时间点(拷贝开始的时间点)的映像。当源数据进行备份时,上述的写时复制快照技术会使用预先分配的快照空间创建快照卷,所述快照卷只需分配相对少量的存储空间,用于保存快照时间点之后源数据卷中被更新的数据,其中由于仅复制了原始数据物理位置的源数据,所以快照卷的建立没有物理数据复制发生,因此快照卷建立速度非常快,可以瞬间完成。
本申请较佳实施例中,建立完上述快照卷后,存储系统为源数据卷建立一个源数据指针表和源数据指针表副本。每个源数据卷都具有一个源数据指针表,每条记录保存着指向对应数据块的指针,源数据指针表副本是作为快照卷的数据指针表。虽然快照卷与源数据卷具有各自的指针表,但其实共享同一份物理数据。
当源数据卷若有数据将要被更新时,为了确保复制操作发生在更新操作之前,所述写时复制快照技术会通过查询源数据指针表,根据对应数据块的指针确定所访问数据的物理存储位置,然后更新快照卷和源数据指针表及副本,生成备份数据。
本申请较佳实施例中,当备份正常进行时,持续获取有效的待备份数据源,利用写时复制快照技术,直到生成完整的备份数据。
本申请其他较佳实施例中,在上述利用写时复制快照技术备份源数据时,当源数据更新速度太快时,可能会超出写时复制快照技术预留在快照库的保留空间,进而导致快照卷失效,失去备份能力,导致备份不能正常进行,此时,需执行下述的S2。
步骤二、当备份不能正常进行时,获取失效的待备份源数据,通过MongoDB备份技术恢复备份数据。
本申请较佳实施例中,所述MongoDB是一种基于分布式文件存储的数据库,它采用了文档数据模型,能够备份大量且不同结构的数据。MongoDB备份技术主要以oplog来备份数据,oplog是本地库(又称local库)下的一个固定集合,除了同步备份外,还可以通过检索oplog日志,了解各时间段内的备份历史。默认情况下,oplog分配的是服务器5%的空闲磁盘空间。
进一步地,本申请较佳实施例中,当MongoDB备份技术处理的数据大于预设值时,所述预设值可以为一千万,首先会协调多部服务器互相协作,保证服务器在备份过程中正常运行,若出现服务器意外停止备份,MongoDB备份技术可马上选择另一台服务器继续备份,以此类推。通过利用主从复制法选择服务器,即一台服务器设定为主备份服务器,其他多台为从备份服务器。从备份服务器可以实现备份功能,分担主备份服务器压力的作用。当主备份服务器工作时,从备份服务器并不备份数据,只读取主备份服务器的更新信息。当主备份服务器故障时,可自动切换从备份服务器接替主备份服务器继续备份。
进一步地,本申请较佳实施例通过调用oplog.rs集合恢复非依赖性数据的备份。所述的oplog.rs集合是主从服务器local库下的oplog固定集合的一种,记录着所有写时复制快照技术的操作记录,若写时复制快照技术更新一次快照库后,oplog.rs集合中就会同时记录本次更新。所述非依赖性数据是指该数 据没有与之关联的其他数据,备份时无需考虑其他数据,当写时复制快照技术在备份数据A的某时间点(此时A为非依赖性数据)崩溃后,MongoDB会通过oplog.rs寻找到崩溃地方的操作记录,由于oplog具有非常重要的特性—幂等性(idempotent),即对一个数据集合,使用oplog中记录的操作重放时,无论被重放多少次,其结果都会是一样的。所以oplog.rs集合记录中可查找到破坏操作的时间点,然后可以恢复到破坏操作时间点前的数据,以此实现对数据A的继续备份。
进一步地,本申请较佳实施例通过调用oplog.bson集合恢复依赖性数据。若数据A和数据B同时使用写时复制快照技术进行备份数据,且数据A和数据B之间互相有依赖性,如数据A中存放了订单,数据B中存放了订单的所有明细,那么只有一个订单具有完整的明细时才是正确的状态。在进行写时复制快照技术备份依赖性数据出现失效的情况下,利用local库下的oplog.bson集合进行恢复备份操作。在主从服务器使用Mongodb备份技术时,会生成一个oplog.bson文件,该文件集合会存放从开始备份到结束备份整个时间段所有的oplog,且不加以备份时间的限制。因为写时复制快照技术的备份进行过程中会把备份数据锁死在一个固定的时间点,所以使用oplog.bson文件释放时间对备份数据的限制。当写时复制快照技术备份依赖数据A发生错误时,Mongodb备份技术会根据oplog.bson文件下的oplog日志中关于数据A的备份记录,同时根据备份未出问题的依赖数据B的备份时间,重做一遍所有数据A的备份操作,达到恢复依赖性数据A的备份目的。
步骤三、获取用户在一个预设的周期内所备份的全量数据库,通过MongoDB增量备份实现数据库级别的增量日志备份。
本申请较佳实施例中,所述预设周期可以为一周。
本申请较佳实施例中,所述用户可以是某一个公司,如中国平安。所述用户可以在一个周期内对其数据库数据进行全量备份,以防止出现意外,造成数据丢失。在进行全量备份时,可能会新增加一些数据,此时可以利用MongoDB的增量备份来实现,所述MongoDB增量备份是通过集群的oplog功能来实现的,所述MongoDB集群至少需要是一个副本集集群,通过在一个搭建好的集群中的master节点中,可以在local数据库下找到oplog.rs,从而实现指定时间段内的数据增量备份。
进一步地,本申请较佳实施例还可以在全量快照备份的基础上,进行多次、精确、轻量、快速的local.oplog.rs增量备份来实现数据库级别的增量日志备份。所述增量日志备份包含对local.oplog.rs的条件筛选备份、格式化解析local.oplog.rs、破坏点精准定位恢复等。所述local.oplog.rs增量备份可支持任意时点、任意操作的解析恢复;并根据replicaSet的复制机制,可实现单节点、副本集群、分片集群等不同级别的备份与恢复。
优选地,所述oplog的集合为:
db.oplog.rs.find().skip(1).limit(1).toArray()
其中,所述oplog集合的查询命令字段包含:
ts:代表8字节的时间戳,由4字节unix timestamp+4字节自增计数表示;
op:代表1字节的操作类型,其中"i":insert,"u":update,"d":delete,"c":db cmd,"db":声明当前数据库(其中ns被设置成为=>数据库名称+'.'),"n":no op,即空操作;
ns:代表操作所在的命名空间(namespace);
o:代表操作所对应的文档(document),即当前操作的内容;
o2:代表在执行更新操作时的where条件,仅限于更新(update)时才有该属性。
可选地,在其他实施例中,数据备份程序还可以被分割为一个或者多个模块,一个或者多个模块被存储于存储器11中,并由一个或多个处理器(本实施例为处理器12)所执行以完成本申请,本申请所称的模块是指能够完成特定功能的一系列计算机程序指令段,用于描述数据备份程序在数据备份装置中的执行过程。
例如,参照图3所示,为本申请数据备份装置一实施例中的数据备份程序的程序模块示意图,该实施例中,所述数据备份程序可以被分割为源数据备份模块10、源数据恢复备份模块20以及源数据增量备份模块30,示例性地:
所述源数据备份模块10用于:对待备份的源数据,利用写时复制快照技术,创建快照卷,执行源数据备份,生成备份数据。
所述源数据恢复备份模块20用于:当备份不能正常进行时,获取失效的待备份源数据,利用MongoDB备份技术恢复所述备份数据;
所述源数据增量备份模块30用于:获取用户在预设周期内所备份的全量数据库,通过MongoDB增量备份实现数据库级别的增量日志备份。
上述源数据备份模块10、源数据恢复备份模块20以及源数据增量备份模块30等程序模块被执行时所实现的功能或操作步骤与上述实施例大体相同,在此不再赘述。
此外,本申请实施例还提出一种计算机可读存储介质,所述计算机可读存储介质上存储有数据备份程序,所述数据备份程序可被一个或多个处理器执行,以实现如下操作:
对待备份的源数据,利用写时复制快照技术,创建快照卷,执行源数据备份,生成备份数据;
当备份不能正常进行时,获取失效的待备份源数据,利用MongoDB备份技术恢复所述备份数据;
获取用户在预设周期内所备份的全量数据库,通过MongoDB增量备份实现数据库级别的增量日志备份。
本申请计算机可读存储介质具体实施方式与上述数据备份装置和方法各实施例基本相同,在此不作累述。
需要说明的是,上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。并且本文中的术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、装置、物品或者方法不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、装置、物品或者方法所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、装置、物品或者方法中还存在另外的相同要素。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在如上所述的一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,或者网络设备等)执行本申请各个实施例所述的方法。
以上仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间 接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。

Claims (20)

  1. 一种数据备份方法,其特征在于,所述方法包括:
    获取待备份的源数据,利用写时复制快照技术创建快照卷,执行源数据备份,生成备份数据;
    当备份不能正常进行时,获取失效的待备份源数据,利用MongoDB备份技术恢复所述备份数据;
    获取用户在预设周期内所备份的全量数据库,通过MongoDB增量备份实现数据库级别的增量日志备份。
  2. 如权利要求1所述的数据备份方法,其特征在于,所述获取待备份的源数据,利用写时复制快照技术创建快照卷,执行源数据备份,生成备份数据,包括:
    建立待备份的源数据的指针表及所述快照卷的源数据指针表副本;
    当所述源数据发生更新时,通过所述源数据的指针表及所述快照卷的源数据指针表副本的位置,跟踪所述源数据的数据变化,将所述源数据读出并写入所述快照卷,生成所述备份数据。
  3. 如权利要求1所述的数据备份方法,其特征在于,所述通过MongoDB备份技术恢复备份数据,包括:
    通过调用oplog.rs集合恢复所述待备份源数据中非依赖性数据的备份;
    通过调用oplog.bson集合恢复所述待备份源数据中依赖性数据的备份。
  4. 如权利要求3中所述的数据备份方法,其特征在于,所述通过MongoDB备份技术恢复备份数据,还包括:
    利用主从复制法从执行源数据备份操作的多台服务器中选择一台服务器设定为主备份服务器,其他多台为从备份服务器;
    当所述主备份服务器工作执行备份时,所述从备份服务器读取主备份服务器的更新信息;
    当所述主备份服务器故障时,所述从备份服务器自动接替主备份服务器继续备份。
  5. 如权利要求1至4中任意一项所述的数据备份方法,其特征在于,所述通过MongoDB增量备份实现数据库级别的增量日志备份,包括:
    当所述全量数据库需要添加新的数据时,通过MongoDB集群的oplog功能在本地数据库下找到oplog.rs,实现指定时间段内的数据增量备份;
    在全量的快照备份基础上,进行预设次数的local.oplog.rs增量备份,实现数据库级别的增量日志备份。
  6. 一种数据备份装置,其特征在于,所述装置包括存储器和处理器,所述存储器上存储有可在所述处理器上运行的数据备份程序,所述数据备份程序被所述处理器执行时实现如下步骤:
    获取待备份的源数据,利用写时复制快照技术创建快照卷,执行源数据备份,生成备份数据;
    当备份不能正常进行时,获取失效的待备份源数据,利用MongoDB备份技术恢复所述备份数据;
    获取用户在预设周期内所备份的全量数据库,通过MongoDB增量备份实现数据库级别的增量日志备份。
  7. 如权利要求6所述的数据备份装置,其特征在于,所述对待备份的源数据利用写时复制快照技术,创建快照卷,包括:
    建立待备份的源数据的指针表及所述快照卷的源数据指针表副本;
    当所述源数据发生更新时,通过所述源数据的指针表及所述快照卷的源数据指针表副本的位置,跟踪所述源数据的数据变化,将所述源数据读出并写入所述快照卷,生成所述备份数据。
  8. 如权利要求6所述的数据备份装置,其特征在于,所述通过MongoDB备份技术恢复备份数据,包括:
    通过调用oplog.rs集合恢复所述待备份源数据中非依赖性数据的备份;
    通过调用oplog.bson集合恢复所述待备份源数据中依赖性数据的备份。
  9. 如权利要求8中所述的数据备份装置,其特征在于,所述通过MongoDB备份技术恢复备份数据,还包括:
    利用主从复制法从执行源数据备份操作的多台服务器中选择一台服务器设定为主备份服务器,其他多台为从备份服务器;
    当所述主备份服务器工作执行备份时,所述从备份服务器读取主备份服务器的更新信息;
    当所述主备份服务器故障时,所述从备份服务器自动接替主备份服务器 继续备份。
  10. 如权利要求6至9中任意一项所述的数据备份装置,其特征在于,所述通过MongoDB增量备份实现数据库级别的增量日志备份,包括:
    当所述全量数据库需要添加新的数据时,通过MongoDB集群的oplog功能在本地数据库下找到oplog.rs,实现指定时间段内的数据增量备份;
    在全量的快照备份基础上,进行预设次数的local.oplog.rs增量备份,实现数据库级别的增量日志备份。
  11. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有数据备份程序,所述数据备份程序可被一个或者多个处理器执行,以实现如下步骤:
    获取待备份的源数据,利用写时复制快照技术创建快照卷,执行源数据备份,生成备份数据;
    当备份不能正常进行时,获取失效的待备份源数据,利用MongoDB备份技术恢复所述备份数据;
    获取用户在预设周期内所备份的全量数据库,通过MongoDB增量备份实现数据库级别的增量日志备份。
  12. 如权利要求11所述的计算机可读存储介质,其特征在于,所述获取待备份的源数据,利用写时复制快照技术创建快照卷,执行源数据备份,生成备份数据,包括:
    建立待备份的源数据的指针表及所述快照卷的源数据指针表副本;
    当所述源数据发生更新时,通过所述源数据的指针表及所述快照卷的源数据指针表副本的位置,跟踪所述源数据的数据变化,将所述源数据读出并写入所述快照卷,生成所述备份数据。
  13. 如权利要求11所述的计算机可读存储介质,其特征在于,所述通过MongoDB备份技术恢复备份数据,包括:
    通过调用oplog.rs集合恢复所述待备份源数据中非依赖性数据的备份;
    通过调用oplog.bson集合恢复所述待备份源数据中依赖性数据的备份。
  14. 如权利要求13所述的计算机可读存储介质,其特征在于,所述通过MongoDB备份技术恢复备份数据,还包括:
    利用主从复制法从执行源数据备份操作的多台服务器中选择一台服务器 设定为主备份服务器,其他多台为从备份服务器;
    当所述主备份服务器工作执行备份时,所述从备份服务器读取主备份服务器的更新信息;
    当所述主备份服务器故障时,所述从备份服务器自动接替主备份服务器继续备份。
  15. 如权利要求11至14所述的计算机可读存储介质,其特征在于,所述通过MongoDB增量备份实现数据库级别的增量日志备份,包括:
    当所述全量数据库需要添加新的数据时,通过MongoDB集群的oplog功能在本地数据库下找到oplog.rs,实现指定时间段内的数据增量备份;
    在全量的快照备份基础上,进行预设次数的local.oplog.rs增量备份,实现数据库级别的增量日志备份。
  16. 一种数据备份系统,其特征在于,所述数据备份系统包括:
    源数据备份模块,用于:获取待备份的源数据,利用写时复制快照技术创建快照卷,执行源数据备份,生成备份数据;
    源数据恢复备份模块,用于:当备份不能正常进行时,获取失效的待备份源数据,利用MongoDB备份技术恢复所述备份数据;
    源数据增量备份模块,用于:获取用户在预设周期内所备份的全量数据库,通过MongoDB增量备份实现数据库级别的增量日志备份。
  17. 如权利要求16所述的数据备份系统,其特征在于,所述源数据备份模块用于:
    建立待备份的源数据的指针表及所述快照卷的源数据指针表副本;
    当所述源数据发生更新时,通过所述源数据的指针表及所述快照卷的源数据指针表副本的位置,跟踪所述源数据的数据变化,将所述源数据读出并写入所述快照卷,生成所述备份数据。
  18. 如权利要求16所述的数据备份系统,其特征在于,所述通过MongoDB备份技术恢复备份数据,包括:
    通过调用oplog.rs集合恢复所述待备份源数据中非依赖性数据的备份;
    通过调用oplog.bson集合恢复所述待备份源数据中依赖性数据的备份。
  19. 如权利要求18所述的数据备份系统,其特征在于,所述通过MongoDB备份技术恢复备份数据,还包括:
    利用主从复制法从执行源数据备份操作的多台服务器中选择一台服务器设定为主备份服务器,其他多台为从备份服务器;
    当所述主备份服务器工作执行备份时,所述从备份服务器读取主备份服务器的更新信息;
    当所述主备份服务器故障时,所述从备份服务器自动接替主备份服务器继续备份。
  20. 如权利要求16至18所述的数据备份系统,其特征在于,所述通过MongoDB增量备份实现数据库级别的增量日志备份,包括:
    当所述全量数据库需要添加新的数据时,通过MongoDB集群的oplog功能在本地数据库下找到oplog.rs,实现指定时间段内的数据增量备份;
    在全量的快照备份基础上,进行预设次数的local.oplog.rs增量备份,实现数据库级别的增量日志备份。
PCT/CN2019/117351 2019-04-08 2019-11-12 数据备份方法、装置及计算机可读存储介质 WO2020207010A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910275756.X 2019-04-08
CN201910275756.XA CN110096476B (zh) 2019-04-08 2019-04-08 数据备份方法、装置及计算机可读存储介质

Publications (1)

Publication Number Publication Date
WO2020207010A1 true WO2020207010A1 (zh) 2020-10-15

Family

ID=67444452

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/117351 WO2020207010A1 (zh) 2019-04-08 2019-11-12 数据备份方法、装置及计算机可读存储介质

Country Status (2)

Country Link
CN (1) CN110096476B (zh)
WO (1) WO2020207010A1 (zh)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112286728A (zh) * 2020-10-30 2021-01-29 深圳前海微众银行股份有限公司 数据备份方法、装置、设备及计算机存储介质
CN112905699A (zh) * 2021-02-23 2021-06-04 京东数科海益信息科技有限公司 一种全量数据比对方法、装置、设备及存储介质
CN113656149A (zh) * 2021-08-20 2021-11-16 深信服科技股份有限公司 一种应用处理方法、装置及相关设备
CN114168379A (zh) * 2021-10-31 2022-03-11 浪潮(山东)计算机科技有限公司 一种数据备份还原方法及相关装置
US11520809B2 (en) 2021-04-09 2022-12-06 International Business Machines Corporation Checkpoint management in a database system
CN117149527A (zh) * 2023-10-31 2023-12-01 江苏华鲲振宇智能科技有限责任公司 一种服务器数据备份与恢复系统及方法
CN117827544A (zh) * 2024-02-29 2024-04-05 苏州元脑智能科技有限公司 热备份系统、方法、电子设备及存储介质

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110096476B (zh) * 2019-04-08 2023-06-09 平安科技(深圳)有限公司 数据备份方法、装置及计算机可读存储介质
CN112306743B (zh) * 2019-07-26 2023-11-21 阿里巴巴集团控股有限公司 数据处理方法、装置、电子设备及计算机存储介质
CN110533534B (zh) * 2019-08-27 2022-08-26 海南新软软件有限公司 一种有序模式区块分组的生成、加载方法及装置
CN110825759B (zh) * 2019-11-04 2023-09-12 北京首汽智行科技有限公司 一种基于kettle工具的数据更新方法
CN111488243B (zh) * 2020-03-19 2023-07-07 北京金山云网络技术有限公司 MongoDB数据库的备份、恢复方法、装置、电子设备及存储介质
CN112035298A (zh) * 2020-09-10 2020-12-04 北京城市网邻信息技术有限公司 一种数据备份方法、装置、电子设备及存储介质
CN112685230B (zh) * 2021-01-05 2022-03-15 浪潮云信息技术股份公司 一种分布式数据库实现指定时间点备份还原的方法
CN114036004B (zh) * 2021-11-26 2022-09-30 江苏安超云软件有限公司 数据备份方法、恢复方法及装置

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104407933A (zh) * 2014-10-31 2015-03-11 华为技术有限公司 一种数据的备份方法及装置
US20150193315A1 (en) * 2014-01-07 2015-07-09 Electronics And Telecommunications Research Institute Method and device for managing multiple snapshots of data strorage device
CN104978241A (zh) * 2015-05-29 2015-10-14 上海爱数软件有限公司 一种cow类型文件系统的数据恢复方法及装置
CN110096476A (zh) * 2019-04-08 2019-08-06 平安科技(深圳)有限公司 数据备份方法、装置及计算机可读存储介质

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102012947A (zh) * 2010-12-16 2011-04-13 创新科存储技术有限公司 一种数据库在线备份的方法及系统
CN106326041A (zh) * 2016-08-31 2017-01-11 杭州沃趣科技股份有限公司 一种用于数据库秒级恢复的方法
CN109325075A (zh) * 2018-08-30 2019-02-12 黄疆 一种基于定时备份的Oracle及时挂载恢复系统及方法
CN109271283A (zh) * 2018-09-06 2019-01-25 北京云测信息技术有限公司 一种基于区块链的数据备份方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150193315A1 (en) * 2014-01-07 2015-07-09 Electronics And Telecommunications Research Institute Method and device for managing multiple snapshots of data strorage device
CN104407933A (zh) * 2014-10-31 2015-03-11 华为技术有限公司 一种数据的备份方法及装置
CN104978241A (zh) * 2015-05-29 2015-10-14 上海爱数软件有限公司 一种cow类型文件系统的数据恢复方法及装置
CN110096476A (zh) * 2019-04-08 2019-08-06 平安科技(深圳)有限公司 数据备份方法、装置及计算机可读存储介质

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112286728A (zh) * 2020-10-30 2021-01-29 深圳前海微众银行股份有限公司 数据备份方法、装置、设备及计算机存储介质
CN112905699A (zh) * 2021-02-23 2021-06-04 京东数科海益信息科技有限公司 一种全量数据比对方法、装置、设备及存储介质
CN112905699B (zh) * 2021-02-23 2024-04-09 京东科技信息技术有限公司 一种全量数据比对方法、装置、设备及存储介质
US11520809B2 (en) 2021-04-09 2022-12-06 International Business Machines Corporation Checkpoint management in a database system
CN113656149A (zh) * 2021-08-20 2021-11-16 深信服科技股份有限公司 一种应用处理方法、装置及相关设备
CN114168379A (zh) * 2021-10-31 2022-03-11 浪潮(山东)计算机科技有限公司 一种数据备份还原方法及相关装置
CN114168379B (zh) * 2021-10-31 2023-12-19 浪潮(山东)计算机科技有限公司 一种数据备份还原方法及相关装置
CN117149527A (zh) * 2023-10-31 2023-12-01 江苏华鲲振宇智能科技有限责任公司 一种服务器数据备份与恢复系统及方法
CN117149527B (zh) * 2023-10-31 2024-03-08 江苏华鲲振宇智能科技有限责任公司 一种服务器数据备份与恢复系统及方法
CN117827544A (zh) * 2024-02-29 2024-04-05 苏州元脑智能科技有限公司 热备份系统、方法、电子设备及存储介质
CN117827544B (zh) * 2024-02-29 2024-05-07 苏州元脑智能科技有限公司 热备份系统、方法、电子设备及存储介质

Also Published As

Publication number Publication date
CN110096476A (zh) 2019-08-06
CN110096476B (zh) 2023-06-09

Similar Documents

Publication Publication Date Title
WO2020207010A1 (zh) 数据备份方法、装置及计算机可读存储介质
US11429305B2 (en) Performing backup operations using replicas
WO2022048495A1 (zh) 一种数据备份方法、数据恢复方法、装置及电子设备
US10055148B1 (en) Storing application data as an enhanced copy
US9575849B2 (en) Synchronized backup and recovery of database systems
US9223805B2 (en) Durability implementation plan in an in-memory database system
WO2016180160A1 (zh) 数据快照的恢复方法和装置
US11531594B2 (en) Data recovery method and apparatus, server, and computer-readable storage medium
US20160048427A1 (en) Virtual subdirectory management
US20140089266A1 (en) Information processing system
US8732128B2 (en) Shadow copy bookmark generation
US20150046401A1 (en) File deletion detection in key value databases for virtual backups
US9223797B2 (en) Reparse point replication
US11003364B2 (en) Write-once read-many compliant data storage cluster
JP2022501747A (ja) データバックアップ方法、装置、サーバ及びコンピュータプログラム
US20070233753A1 (en) Database system management method, database system, database device, and backup program
US10409691B1 (en) Linking backup files based on data partitions
Pillai et al. Crash consistency
US20160085635A1 (en) Updating key value databases for virtual backups
CN111176887A (zh) MySQL误操作回滚方法、设备及系统
US10089190B2 (en) Efficient file browsing using key value databases for virtual backups
CN112800019A (zh) 基于Hadoop分布式文件系统的数据备份方法及系统
US10664356B1 (en) Method and system for enabling separation of database administrator and backup administrator roles
JP2017167811A (ja) バックアップ制御装置、バックアップ制御方法及びプログラム
Pillai et al. Crash Consistency: Rethinking the Fundamental Abstractions of the File System

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19924278

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19924278

Country of ref document: EP

Kind code of ref document: A1