PSMDB and PBM in separated containers

Hi,

We’re about to upgrade our current backup mechanism.
First we’re deploying 2 containers with podman-compose
Please see our .yaml

version: '3'
services:
  mongodbpercona:
    ports:
    - "27017:27017"
    container_name: mongodbpercona
    command: --wiredTigerCacheSizeGB 0.25 --replSet rs0
    restart: always
    logging:
      options:
        max-size: 1g
    image: docker.io/percona/percona-server-mongodb:7.0.2
    volumes:
      - mongodb2:/data
  mongodbbackup:
    ports:
    - "28017:28017"
    container_name: mongodbbackup
    restart: always
    logging:
      options:
        max-size: 1g
    image: docker.io/perconalab/percona-backup-mongodb:2.3.1
    environment:
      #- PBM_MONGODB_URI="mongodb://pbmuser:secretpwd@localhost:27017/?authSource=admin&replicaSet=rs0&directConnection=true"
      - PBM_MONGODB_URI='mongodb://pbmuser:secretpwd@mongodbpercona:27017/?authSource=admin&replicaSet=rs0'
    volumes:
      - mongodb2:/data
      - backup2:/backup

volumes:
  mongodb2:
    driver: local
  backup2:
    driver: local

net:
  ipv6: true
  bindIp: localhost

The next step is setting MongoDB up

rs.initiate(
 {
 _id: "rs0",
 members: [
 { _id: 0, host: "mongodbpercona:27017"},
 ]
 });
db.getSiblingDB("admin").createRole({ "role": "pbmAnyAction",
      "privileges": [
         { "resource": { "anyResource": true },
           "actions": [ "anyAction" ]
         }
      ],
      "roles": []
   });

db.getSiblingDB("admin").createUser({user: "pbmuser",
       "pwd": "secretpwd",
       "roles" : [
          { "db" : "admin", "role" : "readWrite", "collection": "" },
          { "db" : "admin", "role" : "backup" },
          { "db" : "admin", "role" : "clusterMonitor" },
          { "db" : "admin", "role" : "restore" },
          { "db" : "admin", "role" : "pbmAnyAction" }
       ]
    });

Then we configure pbm config, initially we’re trying to take local backups

tmp/pbm_config.yaml
storage:
  type: filesystem
  filesystem:
    path: /backup

Our last step is to set config mentioned above

pbm config --file pbm_config.yaml 

It turned out we’re unable to establish connection with DB
We’ve been prompted that replica set is not available
On the other hand, when we add “&directConnection=true” to our connection string(as it has been shown in yaml) we’re getting message that it’s incorrect parameter

Please see our logs below

++ grep -E '^([0-9]+)$' /tmp/tmp.9YJKl6dJgQ
+ rs_size=
+ [[ 0 == 0 ]]
+ [[ '' -ge 1 ]]
+ sleep 45
+ for i in {1..10}
+ '[' '!' -e /usr/bin/mongo ']'
+ '[' '' ']'
+ set +o xtrace
2023-12-08T11:17:30.243+0000 F  -        [main] exception: No digits
2023-12-08T11:17:30.243+0000 E  -        [main] exiting with code 1
+ exit_status=0
++ grep -E '^([0-9]+)$' /tmp/tmp.9YJKl6dJgQ
+ rs_size=
+ [[ 0 == 0 ]]
+ [[ '' -ge 1 ]]
+ sleep 50
+ rm /tmp/tmp.9YJKl6dJgQ
+ exec pbm-agent
2023/12/08 11:18:50 Exit: connect to PBM: create mongo connection: mongo ping: server selection error: server selection timeout, current topology: { Type: ReplicaSetNoPrimary, Servers: [] }

Hi,

Please try removing quotation marks around PBM_MONGODB_URI value - it should fix PBM connection issue.

version: '3'
services:
  mongodbpercona:
    ports:
    - "27017:27017"
    container_name: mongodbpercona
    command: --wiredTigerCacheSizeGB 0.25 --replSet rs0
    restart: always
    logging:
      options:
        max-size: 1g
    image: docker.io/percona/percona-server-mongodb:7.0.2
    volumes:
      - mongodb2:/data
  mongodbbackup:
    ports:
    - "28017:28017"
    container_name: mongodbbackup
    restart: always
    logging:
      options:
        max-size: 1g
    image: docker.io/perconalab/percona-backup-mongodb:2.3.1
    environment:
      - PBM_MONGODB_URI=mongodb://pbmuser:secretpwd@mongodbpercona:27017/?authSource=admin&replicaSet=rs0
    volumes:
      - mongodb2:/data
      - backup2:/backup

volumes:
  mongodb2:
    driver: local
  backup2:
    driver: local

net:
  ipv6: true
  bindIp: localhost
> podman logs mongodbbackup
...
+ exec pbm-agent
2023-12-12T14:10:43.000+0000 I pbm-agent:
Version:   2.3.1
Platform:  linux/amd64
GitCommit: 8c4265cfb2d9a7581b782a829246d8fcb6c7d655
GitBranch: release-2.3.1
BuildTime: 2023-11-29_13:31_UTC
GoVersion: go1.19
2023-12-12T14:10:43.000+0000 I node: rs0/mongodbpercona:27017
2023-12-12T14:10:43.000+0000 I starting PITR routine
2023-12-12T14:10:43.000+0000 I listening for the commands

Hi,

Thanks for your feedback.
Please be informed that removing quotation marks do not resolve this issue.
Also I’ve created new thread where I described this issue more precisely.