Hi,
Thanks for your response. Please be informed I’ve added the connection string in my Dockerfile so I thought it’s not necessary at this point. Is it?
Both containers are running in the same Docker Network. They’re being run with the following commands:
docker run -p 27017:27017 --network perconanet -d percona-server:1.2
docker run --network perconanet -d percona-backup:0.12
Please see my PBM Dockerfile below:
FROM docker.io/percona/percona-backup-mongodb:2.3.1
EXPOSE 28017
ENV PBM_MONGODB_URI="mongodb://pbmuser:secretpwd@10.89.3.18:27017/?authSource=admin&replicaSet=rs0&directConnection=true"
USER root
COPY pbm-config.yaml .
RUN rm /etc/sysconfig/pbm-agent \
&& echo "PBM_MONGODB_URI='$PBM_MONGODB_URI'" > /etc/sysconfig/pbm-agent \
&& chmod 640 /etc/sysconfig/pbm-agent \
&& pbm config --file pbm-config.yaml
Then for Percona Server
FROM docker.io/percona/percona-server-mongodb:7.0.2
EXPOSE 27017
#VOLUME /data
USER root
COPY script.sh .
RUN rm -f etc/mongod.conf
COPY mongod.conf /etc
RUN chmod +x script.sh
USER mongodb
CMD ["mongod", "--wiredTigerCacheSizeGB", "0.25", "--replSet", "rs0", "--bind_ip", "0.0.0.0"]
With the configuration above I’m getting such error messages:
2023-12-13T06:31:25.727+0000 I NETWORK [js] Starting new replica set monitor for rs0/10.89.3.3:27017
2023-12-13T06:31:25.728+0000 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to 10.89.3.3:27017
2023-12-13T06:31:25.729+0000 I NETWORK [ReplicaSetMonitor-TaskExecutor] Confirmed replica set for rs0 is rs0/localhost:27017
2023-12-13T06:31:25.729+0000 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to localhost:27017
2023-12-13T06:31:26.228+0000 W NETWORK [ReplicaSetMonitor-TaskExecutor] Unable to reach primary for set rs0
2023-12-13T06:31:26.228+0000 I NETWORK [ReplicaSetMonitor-TaskExecutor] Cannot reach any nodes for set rs0. Please check network connectivity and the status of the set. This has happened for 1 checks in a row.
But if I edit /etc/hosts file in the way shown below it seems to be working properly
[root@59a82c7385e2 etc]# cat hosts
10.89.3.18 localhost
With edited hosts file my logs look like this:
2023-12-13T06:33:01.840+0000 I NETWORK [js] Starting new replica set monitor for rs0/10.89.3.3:27017
2023-12-13T06:33:01.840+0000 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to 10.89.3.3:27017
2023-12-13T06:33:01.841+0000 I NETWORK [ReplicaSetMonitor-TaskExecutor] Confirmed replica set for rs0 is rs0/localhost:27017
2023-12-13T06:33:01.841+0000 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to localhost:27017
2023-12-13T06:33:01.842+0000 I NETWORK [ReplicaSetMonitor-TaskExecutor] Confirmed replica set for rs0 is rs0/localhost:27017
1
+ exit_status=0
++ grep -E '^([0-9]+)$' /tmp/tmp.oNyx38678P
+ rs_size=1
+ [[ 0 == 0 ]]
+ [[ 1 -ge 1 ]]
+ break
+ rm /tmp/tmp.oNyx38678P
+ exec pbm-agent
2023-12-13T06:33:01.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-13T06:33:01.000+0000 I node: rs0/localhost:27017
2023-12-13T06:33:01.000+0000 I starting PITR routine
2023-12-13T06:33:01.000+0000 I listening for the commands
2023-12-13T06:33:06.000+0000 W [agentCheckup] get current storage status: query mongo: mongo: no documents in result
I tried to:
- use localhost directly in MongoDB connection string
- build new Percona Server image both with and without “–bind_ip”, “0.0.0.0”
- set connection string with Replica Set parameter only
/?replicaSet=rs0