mongodump failing to connection replica set

All we need is an easy explanation of the problem, so here it is.

I’m able to connect to secondary node from arbiter node of the replica set.

mongo -u backup02 -p backup02_password --port 8133 --host p1dummy:8133,p2dummy:8133,drdummy:8133 --authenticationDatabase admin --ssl --sslAllowInvalidCertificates

mongo8133:SECONDARY>

when I try to connect the secondary node form arbiter node using mongodump command which is not happening . with mongodump command I’m passing the same parameter as mongo command.
I tried enabling verbose log but that’s not giving me the complete log information.
I’m able to connect specifying p1dummy as the parameter however I should also be able to connect using connection string like I used for mongo for host argument:

/usr/bin/mongodump -u backup02 -p backup02_password --port 8133 --host p1dummy:8133,p2dummy:8133,drdummy:8133 --authenticationDatabase admin --out /tmp --db mydbname --ssl --sslAllowInvalidCertificates --excludeCollectionsWithPrefix=system --verbose=5

2021-04-01T12:48:43.899+0000    will listen for SIGTERM, SIGINT, and SIGKILL
2021-04-01T12:48:47.400+0000    Failed: error connecting to db server: no reachable servers

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

Try to put "" round –host string… And you don’t need –port parameter, because your –host string have port information.

/usr/bin/mongodump -u backup02 -p backup02_password --host "p1dummy:8133,p2dummy:8133,drdummy:8133" --authenticationDatabase admin --out /tmp --db mydbname --ssl --sslAllowInvalidCertificates --excludeCollectionsWithPrefix=system --verbose=5

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply