Is it possible to check one document from the latest backup?

I would like to check one document from the backup as. Is it possible to extract one document from the latest backup so I can manually check the fields?

This is the command I run for the backup:

/opt/couchbase/bin/cbbackupmgr backup -a /home/backup/couchbase/md-even/ -r data -c couchbase://127.0.0.1 -u xxx..... -p yyyy.....

… hmmm, it seems some of the path info is mis-formatted??

So I guess I will need to use something like the same command above with “restore” instead of “backup” - but how do I specify a particular document with this key: “User:DA2B12DC0498FF1FC1258961005679EF” and can I just add “–dry-run” to show the contents of which document would be restored?

Thanks in advance!

Edit:
I’m on Couchbase Server CE 7.2.4 (7070)

Hey @jda. If you just wish to see the value of a particular document you can use examine

/opt/couchbase/bin/cbbackupmgr examine -a /home/backup/couchbase/md-even/ -r data --collection-string "<bucket>.<scope>.<collection>" --key "User:DA2B12DC0498FF1FC1258961005679EF"

If you wish to restore a single document you can use --filter-keys "User:DA2B12DC0498FF1FC1258961005679EF" but note that it will scan the entire backup so could be quite slow.

Hope that helps

1 Like

Ah, very nice, if not for:

Error examining data: examining backups is an Enterprise Edition feature

:frowning:

Any way to do this in Community Edition? Eg. using the restore command?

Apologies @jda I did not see that you were on CE. I’m afraid there is no --dry-run flag so you will need a cluster to restore to. As noted in my previous comment you can ensure that only that document is restored by using --filter-keys

1 Like

Ok, thanks.

Is there a way to restore a document like this to a new key? That could also be useful.

In the current situation I will just take a copy of the existing document prior to restoring and then I can compare them. As long as it only restores that one document, then it shouldn’t cause problems :innocent:

You are right - it does take some time… :grin:

However, I see that it “skipped” the document in the first backup it looked at. How come?

/opt/couchbase/bin/cbbackupmgr restore -a /home/backup/couchbase/md-even/ -r data -c couchbase://127.0.0.1 -u xxxx..... -p yyy.... --filter-keys "User:DA2B12DC0498FF1FC1258961005679EF"
(1/12) Restoring backup '2024-04-01T04_00_05.795543946+02_00'
Copied all data in 9m51s (Avg. 128B/Sec)                                                                                                                        1 items / 73.92KiB
[========================================================================================================================================================================] 100.00%

| Transfer
| --------
| Status    | Avg Transfer Rate | Started At                      | Finished At                     | Duration |
| Succeeded | 127B/s            | Fri, 12 Apr 2024 16:06:02 +0200 | Fri, 12 Apr 2024 16:15:55 +0200 | 9m53s    |

| Bucket
| ------
| Name | Status    | Transferred | Avg Transfer Rate | Started At                      | Finished At                     | Duration |
| data | Succeeded | 73.92KiB    | 219B/s            | Fri, 12 Apr 2024 16:10:10 +0200 | Fri, 12 Apr 2024 16:15:55 +0200 | 5m45s    |
|
| Mutations                    | Deletions                    | Expirations                  |
| ---------                    | ---------                    | -----------                  |
| Received | Errored | Skipped | Received | Errored | Skipped | Received | Errored | Skipped |
| 0        | 0       | 1       | 0        | 0       | 0       | 0        | 0       | 0       |

(2/12) Restoring backup '2024-04-02T04_00_02.598757838+02_00'
Copied all data in 15m17s (Avg. 80B/Sec)                                                                                                                        0 items / 72.00KiB
[========================================================================================================================================================================] 100.00%

| Transfer
| --------
| Status    | Avg Transfer Rate | Started At                      | Finished At                     | Duration |
| Succeeded | 80B/s             | Fri, 12 Apr 2024 16:06:02 +0200 | Fri, 12 Apr 2024 16:21:21 +0200 | 15m18s   |

| Bucket
| ------
| Name | Status    | Transferred | Avg Transfer Rate | Started At                      | Finished At                     | Duration |
| data | Succeeded | 72.00KiB    | 501B/s            | Fri, 12 Apr 2024 16:18:54 +0200 | Fri, 12 Apr 2024 16:21:21 +0200 | 2m27s    |
|
| Mutations                    | Deletions                    | Expirations                  |
| ---------                    | ---------                    | -----------                  |
| Received | Errored | Skipped | Received | Errored | Skipped | Received | Errored | Skipped |
| 0        | 0       | 0       | 0        | 0       | 0       | 0        | 0       | 0       |

(3/12) Restoring backup '2024-04-03T04_00_02.619394971+02_00'
:
:

… is it look through all of the others to find the newest? Or do I need to add the --force-updates option as the current document exists and was changed earlier today?

… and just for reference. Yes, it worked if I use the --force-updates option - and I combined it with start/end options as I had now seen the latest backup that the document was backed up in. So the final command is:

/opt/couchbase/bin/cbbackupmgr restore -a /home/backup/couchbase/md-even/ -r data -c couchbase://127.0.0.1 -u xxxx..... -p yyy.... --filter-keys "User:DA2B12DC0498FF1FC1258961005679EF" --force-updates --start 2024-04-10T04_00_03.113076908+02_00 --end 2024-04-10T04_00_03.113076908+02_00
Restoring backup '2024-04-10T04_00_03.113076908+02_00'

Thanks for your help!