Couchbase using Cbbackup Backup

Source: Internet
Author: User
Tags couchbase

cbbackupThe tool is a flexible backup command that enables you to back up local data and remote nodes and different combinations of data that involve your cluster:

Single node single buckets
All buckets on a single node
A single buckets on the entire cluster
All buckets on the entire cluster

Backups can copy files directly on a separate node, or they can be saved to a backup location by connecting to a remote cluster and then through the data stream. Backups can be run on a running node or on a cluster or offline node.

The Cbbackup command can store data in an easily recoverable format. When recovery is needed, you can restore the data to any configured cluster using Cbrestore. The source and destination clusters do not need to meet the information that you saved when you used the Cbbackup command.

The cbbackup command copies data from each item defined by the source to the destination backup directory. The format of the backup file is unique to Couchbase and enables you to restore all or part of the backed up data when you plan to restore the data to the cluster.

You can choose to store a specific vbucket ID on a key (via regular expression) or all of the data, or you can choose to copy the source data from one bucket to a bucket of a different name in the cluster.

cbbackup Command parameter options:

cbbackup [Options] [source] [Backup_dir]

Note: The Cbbackup tool is located in the couchbase standard command line directory.

Be aware that Cbbackup does not support external IP addresses. If you installed the Couchbase server with the default IP address, you cannot access it using an external host.

Next is the Cbbackup optional parameter:

The following options are used to configure the user and password information for the connection cluster, backup type, and bucket options.

You can use one or more options. The main options include:

    • –single-node

    • Backup single node


    • –bucket-sourceOr-b

    • Backing up buckets for a specific name

Next is the required parameter for Cbbackup:

Data source, local data directory reference, or remote node/cluster specification:

  • Local Directory Reference

  • The local directory specification is a couchstore-files URL defined using the protocol. Give me a chestnut:
    couchstore-files:///opt/couchbase/var/lib/couchbase/data/default

  • With this approach, you only need to back up the data for the specified bucket on a single node. If you back up all bucket data on a cluster or back up all the data on a single node, you must use the cluster node specification. This method is not supported for design documents defined in buckets.

  • Cluster nodes

  • This node, or a node in the cluster, designates the URL as either a node or a cluster service.

    Give me a chestnut:


  • http://HOST:8091//for distinction your can use the Couchbase protocol prefix:couchbase://host:8091//the Administrator And password can also is combined with both forms of the The URL for authentication.  If you are named data buckets (other than the default bucket), then want to backup, specify an administrative name and Password for the Bucket:couchbase://administrator:[email protected]:8091

The combination of other options provides a URL that refers to the entire cluster, a single node, or a separate bucket (node or cluster). where nodes and clusters can be made remote or local. This method is also used to back up design documents that define views and indexes.

The Cbbackup [Backup_dir] parameter is the directory that executes the Cbbackup command to save the backup data. This must be an absolutely unambiguous directory where the files will be stored directly in a particular directory, and no additional directory structure is created to differentiate between the different components of the backup data. The backup directory you specified should be nonexistent, or an empty directory exists. If the directory does not exist, it will be created, but if the parent directory already exists. The backup directory is always created on the local node, even if you are backing up a remote node or a cluster. The backup files are stored in a specific directory that is specified locally. Backups can be run in a running cluster or a node that corresponds to an IP

With this basic structure, you can back up different combinations of data from the source cluster. Here are some examples of different combinations of data:

Back up all buckets on all nodes

The data that backs up the entire cluster contains all bucket, all node data:


cbbackup http://host:8091 /backups/backup-20120501 \     -u  administrator -p password     [####################] 100.0%  ( 231726/231718 MSGS)  bucket: default, msgs transferred...            :                 total |     last | per sec      batch :     5298 |      5298 | 617.1     byte  : 10247683 | 10247683  | 1193705.5     msg   :   231726 |    231726 | 26992.7 done     [####################]  100.0%  (11458/11458 MSGS)  bucket: loggin, msgs transferred...            :                 Total |     last | per sec     batch  :     5943 |     5943 | 15731.0      byte  : 11474121 | 11474121 | 30371673.5      msg   :       84 |        84 | 643701.2 done

The combination of other options provides a URL that refers to the entire cluster, a single node, or a separate bucket (node or cluster). where nodes and clusters can be made remote or local. This method is also used to back up design documents that define views and indexes.

The Cbbackup [Backup_dir] parameter is the directory that executes the Cbbackup command to save the backup data. This must be an absolutely unambiguous directory where the files will be stored directly in a particular directory, and no additional directory structure is created to differentiate between the different components of the backup data. The backup directory you specified should be nonexistent, or an empty directory exists. If the directory does not exist, it will be created, but if the parent directory already exists. The backup directory is always created on the local node, even if you are backing up a remote node or a cluster. The backup files are stored in a specific directory that is specified locally. Backups can be run in a running cluster or a node that corresponds to an IP

With this basic structure, you can back up different combinations of data from the source cluster. Here are some examples of different combinations of data:

Back up all buckets on all nodes

The data that backs up the entire cluster contains all bucket, all node data:

cbbackup http://host:8091 /backups/backup-20120501       -u  administrator -p password       -b default       [####################] 100.0%  (231726/231718 MSGS)      bucket: default, msgs transferred...            :                 total |       last |    per sec      batch :                  5294 |       5294 |       617.0     byte  :              10247683 |   10247683 |  1194346.7      msg   :                231726 |     231726 |    27007.2     done

The-B option is used to specify the buckets you want to back up. If the bucket name is bucket, you must provide the administrator's account number and password. If you want to back up the entire cluster of data, you must perform the same backup operation on each bucket in the cluster.

Back up a single node all buckets

Backup all buckets of a single node all data:

Cbbackup http://HOST:8091/backups/backup-20120501-u administrator-p Password--single-node

Using this method, the data source must specify the name of the node that you want to back up.

Using this method to back up the data of a cluster, you should separately back up each node in the cluster.

Back up a single bucket of individual nodes

To back up a single bucket on a single node:

Cbbackup http://HOST:8091/backups/backup-20120501-u administrator-p Password--single-node-b default

Using this method, the data source must specify the name of the node that you want to back up.

Backup single node, single bucket; Backup files are stored on the same node

There are two ways to back up a single bucket of individual nodes, while the backup data is stored on the source data node.

You need to specify a node name and a data backup path, for example, chestnuts:

SSH [email protected] remote-> sudo su-couchbase remote-> Cbbackup http://127.0.0.1:8091/mnt/backup-20120501-u administrator-p Password--single-node-b defaul T

Using this method, the data source must specify the name of the node that you want to back up.

Backup single node, single bucket; Backup files are stored on the same node

There are two ways to back up a single bucket of individual nodes, while the backup data is stored on the source data node.

You need to specify a node name and a data backup path, for example, chestnuts:

SSH [email protected] remote-> sudo su-couchbase remote-> Cbbackup couchstore-files:///opt/couchbase/var/lib/couchbase/data/default/mnt/backup-20120501

Using this method to back up the entire cluster data, you need to back up the data in each bucket of each node in the cluster.

Note: Choosing the right backup solution depends on your requirements, and you expect the data to be restored to the cluster method.

Filter Keys at backup time

Cbbackup supports filtering keys backup. This will be a useful feature if you want to back up part of the data or you want to move some of the data to a different bucket.

This format is represented in the form of regular expressions and is performed by the client in the Cbbackup tool. For example, from a bucket, the key has an information backup of the prefix object:

Cbbackup http://HOST:8091/backups/backup-20120501-u administrator-p password-b default-k ' ^object.* '

The above backup simply stores the data that matches the regular match to the backup file. When the data is backed up, only the key that is logged in the backup file is restored.

Important NOTES:

Regular expression matching is performed on the client. This means that the contents of the bucket Cbbackup must be accessible if the mismatched data is discarded.

Key-based regular expressions are also useful for recovering data. You can back up the bucket and choose the keys you want to recover when you use Cbrestore recovery.

Backup in the form of a copy file

You can also back up data by using cbbackup and specifying where the data is stored in a local directory,

or directly copy data files such as: CP, tar ....

As an example,

Using Cbbackup:

Cbbackup couchstore-files:///opt/couchbase/var/lib/couchbase/data/default/mnt/backup-20120501

Use the CP command to achieve the same backup effect:

Cp-r/opt/couchbase/var/lib/couchbase/data/default/mnt/copy-20120501

Use this method to back up books that are restricted. In the same cluster configuration the data can only be restored to the offline node, to make the same vbucket map work,

You should also copy CONFIG.DAT configuration files from each node.

Parent topic: Backup and restore


Source text: Backup-cbbackup

License:attribution-noncommercial-sharealike 4.0 International
This article originates from Suzf Blog. If not noted, are suzf.net original.
Reprint Please specify: http://suzf.net/thread-0823-1051.html

This article is from the "SUZF blog" blog, please be sure to keep this source http://oceanszf.blog.51cto.com/6268931/1866293

Couchbase using Cbbackup Backup

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.