Skip to content
Couchbase Backup and Restore
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
readme.adoc typo Jun 15, 2017


Backup Data in 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 restore data to 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.

Let’s backup the data first.

  1. Create a directory that will store backup data. PS C:\myprojects> mkdir couchbasebackups

  2. You may need to give write permissions to the directory, depending on your OS.

Backup configuration

You need to configure the folder to act as a backup archive. To backup an entire cluster, for instance, start by creating an archive like this:

PS C:\myprojects> & 'C:\Program Files\Couchbase\Server\bin\cbbackupmgr.exe' config --archive C:\myprojects\couchbasebackups\ --repo cluster

Backup repository `cluster` created successfully in archive `C:\myprojects\couchbasebackups\`

PS C:\myprojects>

Once you’ve done this, you can execute the list command to see the archive contents. There should be one archive in there named "cluster".

PS C:\myprojects> & 'C:\Program Files\Couchbase\Server\bin\cbbackupmgr.exe' list --archive C:\myprojects\couchbasebackups\
 Size      Items          Name
 0B        -              /
 0B        -              + cluster
PS C:\myprojects>

You can also configure cbbackupmgr to include/exclude buckets, exclude views, indexes, etc. For the full details, check out the documentation on cbbackupmgr config.

Backup the cluster

To backup with the given configuration, execute a command like this:

PS C:\myprojects> & 'C:\Program Files\Couchbase\Server\bin\cbbackupmgr.exe' backup --archive C:\myprojects\couchbasebackups\ --repo cluster --c couchbase://localhost --username Administrator --password password

Backing up to 2017-06-12T15_05_40.3096949-04_00
Copied all data in 12.01s (Avg. 11.67KB/Sec)                                                         0 items / 140.00KB
mybucket                [=====================================================================================] 100.00%

myotherbucket                [=====================================================================================] 100.00%

travel-sample           [=====================================================================================] 100.00%

Backup successfully completed
PS C:\myprojects>

Notice that I’ve need to specify the location of the cluster (localhost), the username and password of an administrator account, and the name of the repo (which as we saw earlier was named "cluster".

If you go back and execute the list command from earlier, you’ll see more detail about what was backed up, and when. Here’s a short example that shows two dated backups.

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
 365B      0                          bucket-config.json
 50.30MB   6                          + data
 50.30MB   6                              shard_0.fdb
 2B        0                          full-text.json
 1.56KB    1                          gsi.json
 2B        0                          views.json
 50.08MB   -                      + myotherbucket

... etc ...

 250.16MB  -                  + 2017-06-12T15_05_40.3096949-04_00
 50.03MB   -                      + mybucket
 365B      0                          bucket-config.json
 50.02MB   0                          + data
 50.02MB   0                              shard_0.fdb
 2B        0                          full-text.json
 1.56KB    1                          gsi.json
 2B        0                          views.json
 50.03MB   -                      + myotherbucket

... etc ...

PS C:\zproj>

Put the backup someplace safe

Keeping the backup data on the same host introduces a single point of failure. It’s recommended to save the backup data on a remote drive. Somewhere outside of the same datacenter at least, or maybe a cloud provider like Amazon’s S3.

Add these cbbackupmgr commands to a script that will be automatically run on a schedule (like a Cron job or a Scheduled Task Cmdlet). You may also want to make ZIP a part of this backup task to save disk space.


In this quick start guide, you went from no backup to having a backup in just a few commands. 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 Restore quick start guide so you are able to test restoring (because what good is a backup if you can’t restore it).

You can’t perform that action at this time.