Selective backup

I would like to take a selective backup - to back up the “trademarks.who” collection in “ctr” database, I run the following command:

pbm backup --ns=ctr.trademarks.who

but failed with below:

**2023-01-06T13:00:14Z 0.00B <logical, selective> [ERROR: namespace check: selective backup: sharded collections: ctr.trademarks.who] [2023-01-06T13:00:15Z]**

Please suggest:

[mongod@ip-10-80-10-47 ~]$ pbm version
Version: 2.0.2
Platform: linux/amd64
GitCommit: 3ec38a5fc6706515fb1be72b015972af1500aa17
GitBranch: release-2.0.2
BuildTime: 2022-10-24_12:15_UTC
GoVersion: go1.19

1 Like

Hi, collections with a dot are tricky sometimes. Try referencing the namespace as ctr["trademarks.who"]

1 Like

Hi @aranjith0,

Sharded collections cannot be backed up/restored selectively.

It is a current limitation. Please look at Known limitations of selective backups and restores.

Selective Backup and Restore features are in the technical preview. However, you can backup/restore unsharded collections only (or whole database if it does not contain a sharded collection).

We are going to support shared collections later.

1 Like

Thanks.

Also i see the backups got errored in newer version 2.0.2. it works fine in 1.8.1

[mongod@ip-10-80-10-113 ~]$ pbm status
Cluster:

configReplSet:

  • configReplSet/pmgo-pl204.int.compumark.com:27019: pbm-agent v2.0.2 OK
  • configReplSet/pmgo-pl202.int.compumark.com:27019: pbm-agent v2.0.2 OK
  • configReplSet/pmgo-pl206.int.compumark.com:27029: pbm-agent v2.0.2 OK
    shard1ReplSet:
  • shard1ReplSet/pmgo-pl203.int.compumark.com:27018: pbm-agent v2.0.2 OK
  • shard1ReplSet/pmgo-pl201.int.compumark.com:27018: pbm-agent v2.0.2 OK
  • shard1ReplSet/pmgo-pl202.int.compumark.com:27028: pbm-agent v2.0.2 OK
    shard2ReplSet:
  • shard2ReplSet/pmgo-pl204.int.compumark.com:27018: pbm-agent v2.0.2 OK
  • shard2ReplSet/pmgo-pl202.int.compumark.com:27018: pbm-agent v2.0.2 OK
  • shard2ReplSet/pmgo-pl205.int.compumark.com:27028: pbm-agent v2.0.2 OK
    shard3ReplSet:
  • shard3ReplSet/pmgo-pl206.int.compumark.com:27018: pbm-agent v2.0.2 OK
  • shard3ReplSet/pmgo-pl205.int.compumark.com:27018: pbm-agent v2.0.2 OK
  • shard3ReplSet/pmgo-pl201.int.compumark.com:27028: pbm-agent v2.0.2 OK

PITR incremental backup:

Status [OFF]

Currently running:

Snapshot backup “2023-01-07T07:30:53Z”, started at 2023-01-07T07:30:53Z. Status: error. [op id: 63b91fad41c5a1d22c767e7c]

Backups:

S3 us-east-1 s3://cm-mongo-db-shared-prod-va/pbm/backup/
Snapshots:
2023-01-07T07:30:53Z 0.00B [ERROR: check cluster for dump done: convergeCluster: lost shard shard2ReplSet, last beat ts: 1673080644] [2023-01-07T08:37:56Z]

[mongod@ip-10-80-10-113 ~]$ pbm logs

2023-01-07T07:30:54Z I [shard2ReplSet/pmgo-pl205.int.compumark.com:27028] [backup/2023-01-07T07:30:53Z] backup started
2023-01-07T07:30:54Z I [configReplSet/pmgo-pl202.int.compumark.com:27019] [backup/2023-01-07T07:30:53Z] backup started
2023-01-07T07:30:54Z I [shard3ReplSet/pmgo-pl201.int.compumark.com:27028] [backup/2023-01-07T07:30:53Z] backup started
2023-01-07T07:31:01Z I [configReplSet/pmgo-pl202.int.compumark.com:27019] [backup/2023-01-07T07:30:53Z] mongodump finished, waiting for the oplog
2023-01-07T08:37:54Z I [configReplSet/pmgo-pl202.int.compumark.com:27019] [backup/2023-01-07T07:30:53Z] dropping tmp collections
2023-01-07T08:37:56Z I [configReplSet/pmgo-pl202.int.compumark.com:27019] [backup/2023-01-07T07:30:53Z] mark RS as error check cluster for dump done: convergeCluster: lost shard shard2ReplSet, last beat ts: 1673080644:
2023-01-07T08:37:56Z I [configReplSet/pmgo-pl202.int.compumark.com:27019] [backup/2023-01-07T07:30:53Z] mark backup as error check cluster for dump done: convergeCluster: lost shard shard2ReplSet, last beat ts: 1673080644:
2023-01-07T08:37:56Z E [configReplSet/pmgo-pl202.int.compumark.com:27019] [backup/2023-01-07T07:30:53Z] backup: check cluster for dump done: convergeCluster: lost shard shard2ReplSet, last beat ts: 1673080644

1 Like

Hi Ranjith,
The below error means that the pbm was was having some issues with shard2 while backup. It might be due to network split, node restart or load issue on mongodb etc:
2023-01-07T07:30:53Z 0.00B [ERROR: check cluster for dump done: convergeCluster: lost shard shard2ReplSet, last beat ts: 1673080644] [2023-01-07T08:37:56Z]

It is worth to check the pbm logs (journalctl -u pbm-agent) and MongoDB logs on shard2 (pl204:27018, pl202:27018, pl205:27028) ? You can get the below log as well:
pbm logs -t 1000 -s D --event=backup/2023-01-07T07:30:53Z

You can check Troubleshoot PBM - Percona Backup for MongoDB for more details on troubleshooting pbm. If you still have issues, you can open a new thread to track it separately as this thread is about selective backup.

Have a nice day!

1 Like

Also, I see message [ERROR: get file 2023-01-09T06:43:27Z/configReplSet/local.oplog.rs.bson.s2: no such file] [2023-01-09T06:43:38Z] while backup is running status: is this a bug?

Currently running:

Snapshot backup “2023-01-09T06:43:27Z”, started at 2023-01-09T06:43:27Z. Status: snapshot backup. [op id: 63bbb78fd2f512ab52c2b704]

Backups:

S3 us-east-1 s3://cm-mongo-db-shared-prod-va/pbm/backup/
Snapshots:
2023-01-09T06:43:27Z 0.00B [ERROR: get file 2023-01-09T06:43:27Z/configReplSet/local.oplog.rs.bson.s2: no such file] [2023-01-09T06:43:38Z]

1 Like