Issue with indexes when restoring cluster

Hi there! I’m really new with Couchbase, still finding my way around. I’m in the process of setting up a development environment and am trying to backup and restore clusters, so that I can easily transfer the DB over different machines.

I read the documentation and figured that to backup a cluster (both data and design info) I can run the command:

$ cbbackup http://localhost:8091 -u Administrator -p Pswrd ./path/to/backup

In this test environment, I only have a test bucket called x.

At this point, I tried to restore the x bucket on another machine, which has a single bucket called xCopy.

To do this, I ran the command:

$ cbrestore /path/tp/backup -u Administrator -p Pswrd -x rehash=1 http://localhost:8091 --bucket-source x --bucket-destination xCopy

The data was correctly copied into xCopy, but the design info wasn’t. Specifically, I had an index in x, called idx1, which didn’t show in xCopy.

I did a bit of digging and found out that when restoring, the cbrestore re-creates the indexes in N1QL, but you still have to build them. So, I ran the query below in the query editor:

BUILD INDEX ON xCopy(idx1)

Unfortunately, I got this error message:

[ {
“code”: 5000,
“msg”: “GSI index idx1 not found.”,
“query_from_user”: “BUILD INDEX ON xCopy (idx1)”

I continued doing some research online, but I couldn’t find any solution to the problem. Do you guys have any idea what I’ve done wrong and how I could fix this?

Just for reference, I’m running Couchbase Server Enterprise 6.0.2.

Thanks in advance for your help :slight_smile:

@DiabulusInMusica , Can you please confirm if you had view indexes or GSI indexes at the time of creating backup? If they were GSI indexes, then you would not have got the error “GSI index idx1 not found.” . Also please check Indexes page (GSI / View indexes) after restore and check if any indexes show up there?

@prathibha thanks for the quick reply :slight_smile:

I checked idx1. It’s of type ‘standard GSI’. I created it with the query:

CREATE INDEX idx1 ON x(userName, email)

I tried to play around with this, and found a strange thing.

After the restore, if I have the source bucket with the same name of the destination bucket, then the index shows up in the Indexes page. Here’s what I ran:

$ cbrestore /path/to/backup -u Administrator -p Pswrd -x rehash=1 http://localhost:8091

If the name of the source and destination buckets are different, I can confirm you that nothing shows up in the Indexes page. In this case, I ran the command:

$ cbrestore /path/tp/backup -u Administrator -p Pswrd -x rehash=1 http://localhost:8091 --bucket-source x --bucket-destination xCopy

Any ideas why this may happen?


@DiabulusInMusica : I am afraid you have run into a known issue where restoring a backup to a different bucket than the original bucket does not work. We have fixed this in 6.5 beta of which is available.
Is the requirement to restore into a different bucket than source one?

@prathibha thanks for the clarification :slight_smile: No, we don’t need to restore a source bucket into a destination bucket, with another name. I was just fiddling around to get to know Couchbase better.

Just a curiosity, is the backup/restore utility (index included) also available in the Community version of the engine?

Thanks for your prompt help.


Yes. Standard backup/restore tools are available for both Enterprise and Community Editions. High performance and incremental backups are available only in Enterprise version. You can find comparison below : (search for backup)
Some more information:
Enterprise backup/restore: