Pbm-agent keep failing on Primary node on a mongodb replicaset of 3 nodes

pbm-agent keep failing on the primary node with the following error in /var/log/message

Mar 8 14:18:23 uk11lmdb24as pbm-agent[2452361]: 2024/03/08 14:18:23 Exit: connect to PBM: create mongo connection: mongo ping: server selection error: server selection timeout, current topology: { Type: ReplicaSetNoPrimary, Servers: }

Below pbm version
pbm version
Version: 2.1.0
Platform: linux/amd64
GitCommit: 342b5b9c996e8bd17a678ea0cecbf2eaaf9704ab
GitBranch: release-2.1.0
BuildTime: 2023-04-14_12:23_UTC
GoVersion: go1.19

MongoDB version is 5.0.18-15

The pbm-agent is running on the 2 secondary nodes with the same PBM_MONGODB_URI in /etc/default/pbm-agent
And when I run the command backup --type=logical I get the following
Starting backup ‘2024-03-08T12:45:32Z’…Error: no progress from leader, backup metadata not found

Looking at this eror one of your advise is to ensure that the agent is running on all nodes
Can you please assist to have the agent running on the primary or is there any workaround?

Hi, first of all I’d advise you to upgrade to the latest version of PBM since it has some interesting new features as well as bug fixes. One aspect that can be confusing is that pbm agent and pbm client need actually different URIs. I believe this might be related to your issue.
The pbm agent always points at the local node, for example:

tee /etc/default/pbm-agent <<EOF

Differently, the pbm client (the command line program you run to interact with the pbm service) should be pointed at the replica set URI, for example:

export PBM_MONGODB_URI="mongodb://pbmuser:secretpwd@server1:27017,server2:27017/?replicaSet=testRPL"

hope that helps

Hi Ivan and thanks for your reply
I would prefer to upgrade later after fixing this issue as for now the agent is able work on secondary

I have updated /etc/default/pbm-agent with

instead of
as it is on the other 2 nodes currently secondary

The agent is running successfully on secondary nodes and still failing on primary

Below 2 lines I am able to see on the mongodb log of the primary related to the agent when I attempt to start the agent if this could help.

Could you please advise

{“t”:{“$date”:“2024-03-08T16:40:01.720+00:00”},“s”:“I”, “c”:“NETWORK”, “id”:51800, “ctx”:“conn3706”,“msg”:“client metadata”,“attr”:{“remote”:“”,“client”:“conn3706”,“doc”:{“driver”:{“name”:“mongo-go-driver”,“version”:“v1.11.2”},“os”:{“type”:“linux”,“architecture”:“amd64”},“platform”:“go1.19”,“application”:{“name”:“pbm-agent”}}}}
{“t”:{“$date”:“2024-03-08T16:40:01.721+00:00”},“s”:“I”, “c”:“NETWORK”, “id”:51800, “ctx”:“conn3707”,“msg”:“client metadata”,“attr”:{“remote”:“”,“client”:“conn3707”,“doc”:{“driver”:{“name”:“mongo-go-driver”,“version”:“v1.11.2”},“os”:{“type”:“linux”,“architecture”:“amd64”},“platform”:“go1.19”,“application”:{“name”:“pbm-agent”}}}}

I manage to get the agent started by updating the file /etc/sysconfig/pbm-agent instead with the PBM_MONGODB_URI value