Search:

Search all manuals
Search this manual
Manual
Couchbase Server Manual 2.0
Community Wiki and Resources
Download Couchbase Server 2.0
Couchbase Developer Guide 2.0
Client Libraries
Couchbase Server Forum
Additional Resources
Community Wiki
Community Forums
Couchbase SDKs
Parent Section
7 Command-line Interface for Administration
Chapter Sections
Chapters

7.8. cbbackup Tool

The cbbackup tool creates a copy of data from an entire running cluster, an entire bucket, a single node, or a single bucket on a single functioning node. Your node or cluster needs to be functioning in order to create the backup. Couchbase Server will write a copy of data onto disk.

Depending upon your platform, this tool is the following directories:

Linux/opt/couchbase/bin/cbbackup
WindowsC:\Program Files\Couchbase\Server\bin\cbbackup
Mac OS X/Applications/Couchbase Server.app/Contents/Resources/couchbase-core/bin/cbbackup

The format of the cbbackup command is:

cbbackup [options] [source] [destination]

Where:

This tool has several different options which you can use to:

All command options for cbbackup are the same options available for cbtransfer. For a list of standard and special-use options, see Section 7.10, “cbtransfer Tool”.

You can backup an entire cluster, which includes all of the data buckets and data at all nodes. This will also include all design documents; do note however that you will need to rebuild any indexes after you restore the data. To backup an entire cluster and all buckets for that cluster:

shell> cbbackup http://HOST:8091 ~/backups \
  		-u Administrator -p password

Where ~/backups is the directory where you want to store the data. When you perform this operation, be aware that cbbackup will create the following directory structure and files in the ~/backups directory assuming you have two buckets in your cluster named my_name and sasl and two nodes N1 and N2:

~/backups
		bucket-my_name
			N1
			N2
		bucket-sasl
			N1
			N2

Where bucket-my_name and bucket-sasl are directories containing data files and where N1 and N2 are two sets of data files for each node in the cluster. To backup a single bucket in a cluster:

shell> cbbackup http://HOST:8091 /backups/backup-20120501 \
  -u Administrator -p password \
  -b default

In this case -b default specifies you want to backup data from the default bucket in a cluster. You could also provide any other given bucket in the cluster that you want to backup. To backup all the data stored in multiple buckets from a single node which access the buckets:

shell> cbbackup http://HOST:8091 /backups/ \
  -u Administrator -p password \
  --single-node

This is an example of how to backup data from a single bucket on a single node follows:

shell> cbbackup http://HOST:8091 /backups \
  -u Administrator -p password \
  --single-node \
  -b bucket_name

This example shows you how you can specify keys that are backed up using the - k option. For example, to backup all keys from a bucket with the prefix 'object':

shell> cbbackup http://HOST:8091 /backups/backup-20120501 \
  -u Administrator -p password \
  -b bucket_name \
  -k '^object.*'

For more information on using cbbackup scenarios when you may want to use it and best practices for backup and restore of data with Couchbase Server, see Section 5.6.1, “Backing Up Using cbbackup.

Using cbbackup from Couchbase Server 2.0 with 1.8.x

You can use cbbackup 2.x to backup data from a Couchbase 1.8.x cluster, including 1.8. To do so you use the same command options you use when you backup a 2.0 cluster except you provide it the hostname and port for the 1.8.x cluster. You do not need to even install Couchbase Server 2.0 in order to use cbbackup 2.x to backup Couchbase Server 1.8.x. You can get a copy of the tool from the Couchbase command-line tools GitHub repository. After you get the tool, go to the directory where you cloned the tool and perform the command. For instance:

./cbbackup http://1.8_host_name:port ~/backup -u Administrator -p password

This creates a backup of all buckets in the 1.8 cluster at ~/backups on the physical machine where you run cbbackup. So if you want to make the backup on the machine containing the 1.8.x data bucket, you should copy the tool on that machine. As in the case where you perform backup with Couchbase 2.0, you can use cbbackup 2.0 options to backup all buckets in a cluster, backup a named bucket, backup the default bucket, or backup the data buckets associated with a single node.

Be aware that you can also use the cbrestore 2.0 tool to restore backup data onto a 1.8.x cluster. See Section 7.9, “cbrestore Tool”.