The cbrestore tool restores data from a file to an entire cluster or to a single bucket in the cluster. Items that had been written to file on disk will be restored to RAM. The tool is in the following locations, depending on your platform:
| Linux | /opt/couchbase/bin/cbrestore |
| Windows | C:\Program Files\Couchbase\Server\bin\cbrestore |
| Mac OS X | /Applications/Couchbase Server.app/Contents/Resources/couchbase-core/bin/cbrestore |
The format of the cbrestore command is:
cbrestore [options] [host:ip] [source] [destination]Where:
[options]
Command options for cbrestore are the same options for cbtransfer, see Section 7.10, “cbtransfer Tool”.
[host:ip]
Hostname and port for a node in cluster.
[source]
Source bucket name for the backup data. This is in the directory created by cbbackup when you performed the backup.
[destination]
The destination bucket for the restored information. This is a bucker in an existing cluster. If you restore the data to a single node in a cluster, provide the hostname and port for the node you want to restore to. If you restore an entire data bucket, provide the URL of one of the nodes within the cluster.
All command options for cbrestore are the same options available for cbtransfer. For a list of standard and special-use options, see Section 7.10, “cbtransfer Tool”.
Using cbrestore from Couchbase Server 2.0 with 1.8.x
You can use cbrestore 2.0 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 cbrestore 2.0 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:
./cbrestore ~/backup http://10.3.3.11:8091 -u Administrator -p password -B saslbucket_destination -b saslbucket_source
This restores all data in the
bucket-saslbucket_source directory under
~/backups on the physical machine where you
run cbbackup. It will restore this data into a
bucket named saslbucket_destination in the
cluster with the node host:port of
10.3.3.11:8091.
Be aware that if you are trying to restore data to a different
cluster, that you should make sure that cluster should have the
same number of vBuckets as the cluster that you backed up. If you
attempt to restore data from a cluster to a cluster with a
different number of vBuckets, it will fail when you use the
default port of 8091. The default number of
vBuckets for Couchbase 2.0 is 1024; in earlier versions of
Couchbase, you may have a different number of vBuckets. If you do
want to restore data to a cluster with a different number of
vBuckets, you should perform this command with port
11211, which will accomodate the difference in
vBuckets:
cbrestore /backups/backup-42 memcached://HOST:11211 \ --bucket-source=sessions --bucket-destination=sessions2
If you want more information about using cbbackup 2.0 tool to backup data onto a 1.8.x cluster. See Section 7.8, “cbbackup Tool”.
For general information on using cbbackup, see Section 5.6.2.2, “Restoring using cbrestore tool”.