WiredTiger cursors provide access to data from a variety of sources.
One of these sources is the list of files required to perform a hot backup of the database. The list may be the files required by all of the objects in the database, or a subset of the objects in the database.
To perform a hot backup:
1. Open a cursor on the backup data source, which begins the process of a hot backup.
2. Copy each file returned by the WT_CURSOR::next method into a different directory.
3. Close the cursor; the cursor must not be closed until all of the files have been copied.
The directory to which the files are copied may subsequently be specified as an directory to the wiredtiger_open function and accessed as a WiredTiger database home.
The following is a programmatic example of creating a hot backup:
In cases where the backup is desired for a checkpoint other than the most recent, applications can discard all checkpoints subsequent to the checkpoint they want using the WT_SESSION::checkpoint method. For example:
The wt backup command may also be used to create hot backups:
Notes:
O_DIRECT
and memory mapping or normal I/O to the same file. If O_DIRECT
is configured for data files on Linux systems (using the wiredtiger_open direct_io
configuration), the utilities used to copy the database files should probably also specify O_DIRECT
when configuring their file access.