Restore Couchbase Data with cbrestore Command

By | June 13, 2019

How to restore couchbase data

Being as a database administrator you must know how to take backup and restore backup data whenever required. In my previous tutorial I taught you how to take couchbase backup. 

Today I am gonna tell you how to restore Couchbase data. Cocuhbase data restore operation will help you in disaster recovery activity.

Couchbase is a distributive database which could be run on one or more than one nodes(servers).

To restore couchbase data, you need to go on any node of cluster. It doesn’t matter that the node on which you are logged in is data, query or index because couchbase cluster manager takes care of it. In my case I’ll type-

ssh -i privateKey.pem user@anyNodeIP

Once you logged in on a node(server) see where you have stored your backup files.

Suppose I have Couchbase data backup file in my /backupFolder/ directory.

Make sure that you have made  /backupFolder/ directory readable otherwise you might face permission issue. You can make /backupFolder/ directory readable by using chmod command-

sudo chmod 040 /backup/

To restore couchbase data you need to run cbrestore command, cbrestore is a Couchbase library that resides in /opt/couchbase/bin

Run following command to restore couchbase data which is stored in /backupFolder/ directory.

/opt/couchbase/bin/cbrestore /backupFolder/ http://localhost:8091 -u username -p password 

Once you type this command it will start to restore backup of all buckets in the cluster.

Here the username and password are same that you use at the time of login on Couchbase UI. Please make sure that this user has sufficient access for restoring backup data.

Leave a Reply

Your email address will not be published. Required fields are marked *