hi @Dmytro_Zghoba,
I am using pbm-agent in the host machine and PSMD in a container. It looks like pbm does not work the same way with other applications, such as mongo shell, when connecting to a containerised mongo server instance.
My setup only currently is using 1 PSMD node which is also the primary node for replica set ‘rs’.
With this usage scenario, is there any additional mappings or configuration needed so that PBM can connect properly?
Thanks.
No. I just made a test PCMDB node like this:
podman run --rm -d --name rs101 -p 27018:27017 percona/percona-server-mongodb:4.4 --port=27017 --replSet rs
And then initialise the replica set and made it as the primary node within the container. I am not sure how or why PBM working that way when it mentioned the host as the container ID and port within the error.
I am going to start the container again with the alias hostname as advised to see how it will work.
Thanks.
hi @Dmytro_Zghoba,
I re-create the PSMBD node again with -hostname and added this host to the host’s /etc/hosts. But it still can not connect.
$ podman run --rm -d --name rs101 -p 27018:27017 --hostname=psmongo1 percona/percona-server-mongodb:4.4 --port=27017 --replSet rs
$ podman ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
07f7e9841c40 docker.io/percona/percona-server-mongodb:4.4 --port=27017 --re… 39 minutes ago Up 39 minutes 0.0.0.0:27018->27017/tcp rs101
$ ping psmongo1
PING psmongo1 (127.0.0.1) 56(84) bytes of data.
64 bytes from psmongo1 (127.0.0.1): icmp_seq=1 ttl=64 time=0.008 ms
64 bytes from psmongo1 (127.0.0.1): icmp_seq=2 ttl=64 time=0.013 ms
PBM usually runs on the same host as mongod or on the same container, or in a sidecar (but with the same linux namespaces).
The error comes from the mongo driver. PBM should have the same hostname and port in the connection string as the replset deployed.
In short, psmongo1:27018 won’t work because MongoDB identifies itself as psmongo1:27017.
Thanks @Dmytro_Zghoba. Now that I am trying pbm with the local mongod instance. My storage config using the local filesystem storage (for testing):
storage:
type: filesystem
filesystem:
path: /home/user/local_backups
The permission on the folder:
drwxrwxr-x 2 user user 4096 Jun 9 12:50 /home/user/local_backups
But then running pbm status there is an error:
ERROR with storage: storage: no init file, attempt to create failed: create destination file </home/user/local_backups/.pbm.init>: open /home/user/local_backups/.pbm.init: permission denied
In this case, which permissions are set for the folder so pbm can write to?