--filter-keys in cbbackupmgr restore is working on windows but not on linux


I have a backup where I’m trying to restore only specific documents to a specific bucket… I tried the command on my Windows machine where I have a test couchbase server and it worked fine… trying the same command on a redhat 7 server it always restores zero documents.

The command i’m using is

cbbackupmgr restore -a /home/x/backups/couchbase -r cbbackup --host couchbase://localhost --username xyz --password xyz --include-buckets mybucket --filter-keys \[Abc\.com].+

The documents I’m trying to restore begins with the prefix [Abc.com] (i.e. [Abc.com]HelloWorld)

I even tried to do double back-slash instead of single back-slash to escape the bracket and the dot but it’s not working on linux.

Maybe somebody can shed some light onto this?


regex example here: https://regex101.com/r/JMTRMX/1

On the Linux machine is it a new bucket or have you deleted all of the documents then done a restore?

It’s not a new bucket, it’s a bucket with the same name but I only need to restore the documents that starts with [Abc.com] as these documents are missing from that node.

I think that’s why these documents are not getting restored, seems to me that couchbase keeps a track of all files and updates deletions too… (because if I do the operation on a new bucket or a flushed one, it works like I intend)

At this point I’m not sure how can I transfer a bunch of files cleanly from one node to another.


This is working as design, the restore using conflict resolution just like XDCR for more information see the documentation. This behaviour can be over written by using the --force-updates option:

Forces data in the Couchbase cluster to be overwritten even if the data in the cluster is newer. By default updates are not forced and all updates use Couchbase’s conflict resolution mechanism to ensure that if newer data exists on the cluster that is not overwritten by older restore data.

Let me know if that works.

I tried --force-updates and then the documents starting with [Abc.com] were restored but the problem is that even the other documents that doesn’t have the prefix were also restored… It’s like if I use --force-updates the --filter-keys flag is totally ignored. My objective is to restore documents that have a specific prefix without any conflict resolution and without operating/restoring any other documents. Is that possible?

Hello @lenix,
I just tried this with a simple case on Couchbase Server 6.5.0 on Mac OS and it worked as expected. Here are my steps:

Backup successfully completed
Backed up bucket "test" succeeded
Mutations backedup; 4, Mutations failed to backup: 0
Deletions backedup: 0, Deletions failed to backup: 0
  • Deleted all 4 documents in the UI:
  • Restore with --force-updates and --filter-keys:
cbbackupmgr restore -a ~/backup/ -r test -c localhost -u Administrator -p password   --filter-keys  \[Abc\.com].+  --force-updates
Restore bucket "test" succeeded
Mutations restored: 3, Mutations failed to restore: 0
Deletions restored: 0, Deletions failed to restore: 0
Skipped due to purge number or conflict resolution: Muatations: 0 Deletions: 0
Restore completed successfully

To help debug this further, can you provided the following:

  • An example of document that was incorrectly restore
  • The version of Couchbase Server is being used