Mongodb – mongodump failing to connection replica set

mongodbmongodb-4.0

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

Best Answer

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