Skip to content

couchbase-guides/couchbase-restore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Restore Data to Couchbase Database

Backing up data for a Couchbase database is an essential part of a Disaster Recovery plan. This ensures that the data can be restored to the last backup in case of a disaster. This quick start guide will show how to backup data using Couchbase Community Edition. Another guide shows how to backup data from a Couchbase server.

Couchbase Server has a command line tool called cbbackupmgr. Complete details about this tool is at cbbackupmgr.

For this guide, Couchbase Server is installed locally on a Windows machine. But similar instructions can be followed for other operating systems or cloud deployment.

I’m assuming you’ve already done the "backup" quick start guide, and you have a backup archive in a folder named couchbasebackups.

Remember that you can run cbbackupmgr’s list command to get information about a backup archive folder.

PS C:\zproj> & 'C:\Program Files\Couchbase\Server\bin\cbbackupmgr.exe' list --archive C:\zproj\couchbasebackups\
 Size      Items          Name
 567.91MB  -              /
 567.91MB  -              + cluster
 317.76MB  -                  + 2017-06-12T15_05_13.877654-04_00
 50.31MB   -                      + mybucket

Take note of the timestamp 2017-06-12T15_05_13.877654-04_00.

Restore Data to Couchbase Server

I’ve removed all the documents from all the buckets from my Couchbase cluster in preparation for the restore.

No documents in any buckets

Note that the bucket must exist: the restore command will not create a bucket for you.

To restore all the buckets, run this command:

PS C:\myprojects> & 'C:\Program Files\Couchbase\Server\bin\cbbackupmgr.exe' restore
    --archive C:\myprojects\couchbasebackups\
    --repo cluster
    --c http://localhost:8091
    --username Administrator
    --password password
    --start 2017-06-12T15_05_13.877654-04_00
    --end 2017-06-12T15_05_13.877654-04_00

(1/1) Restoring backup 2017-06-12T15_05_13.877654-04_00
Copied all data in 22.25s (Avg. 2.17MB/Sec)                                                       75700 items / 47.76MB
mybucket                 [=====================================================================================] 100.00%
travel-sample           [=====================================================================================] 100.00%
myotherbucket              [=====================================================================================] 100.00%

Restore completed successfully
PS C:\myprojects>

Some notes about what you’re doing here:

  • --archive specifies the archive folder which was created for the backup

  • --repo specifies the repo within the archive

  • --c, --username, --password specify where to connect to the cluster, and the cluster credentials

  • --start and --end specify the timestamp to start the restore from. I’m only going to restore from one backup, so start and end are the same.

Summary

In this quick start guide, you went from a backup to restore. The cbbackupmgr tool has a lot of options to suit your needs, so make sure to check out the full documentation to see how it fits your organization’s backup strategy. Also check out the Backup quick start guide. And remember to test your backups and your backup process, so you can have confidence when something goes sideways.

About

Restore data in Couchbase Server

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published