Backup and Restore¶
Creates a object to manage backup of a single database.
Parameters: backup_dir (unicode) – Where to keep the backup files. Has to be different than db.db_name. For example db.db_name + ‘/backups’.
Triggers the creation of a backup.
- db (
rocksdb.DB) – Database object to backup.
- flush_before_backup (bool) – If
Truethe current memtable is flushed.
- db (
restore_backup(backup_id, db_dir, wal_dir)¶
Restores the backup from the given id.
- backup_id (int) – id of the backup to restore.
- db_dir (unicode) – Target directory to restore backup.
- wal_dir (unicode) – Target directory to restore backuped WAL files.
Restores the latest backup.
Can be called from another thread to stop the current backup process.
Deletes all backups (oldest first) until “num_backups_to_keep” are left.
Parameters: num_backups_to_keep (int) – Number of backupfiles to keep.
Parameters: backup_id (int) – Delete the backup with the given id.
Returns information about all backups.
It returns a list of dict’s where each dict as the following keys.
- (int): id of this backup.
- (int): Seconds since epoch, when the backup was created.
- (int): Size in bytes of the backup.