mongo-connector: `ServerSelectionTimoutError` on Remote Replica Set

I’m trying to connect from a remote MongoDB instance to a local Elasticsearch instance. The MongoDB instance is a replica set behind a proxy, and I’m connecting with SSL. I’ve tried tweaking things with varying degrees of success, the closest I’ve gotten is when I hit this error:

ServerSelectionTimeoutError: <ip_address_1>:27017: timed out,<ip_address_2>:27017: timed out,<ip_address_3>:27017: timed out

The 3 IP addresses it lists are correct for the replica set members, which indicates to me that it’s actually connecting/authenticating properly, but some issue occurs afterward.

The command I’m using looks like this: mongo-connector -c mongo-connector-config.json -m mongodb://<ip_address>:<port>/?ssl=true -t 192.168.99.100:9200 -d elastic_doc_manager --ssl-ca-certs my-cert.pem --ssl-certificate-policy optional

The only things I’m specifying in my config are noDump: true and a few namespaces.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 25 (9 by maintainers)

Most upvoted comments

@pratyus Nice job with the fix, implemented it for my app’s architecture and it works fine.

Friendly ping to take a look at the PR. Thanks

The second-last option on that page is pretty much what I was trying to accomplish with my --ssl-ca-certs option:

client = pymongo.MongoClient('example.com',
...                              ssl=True,
...                              ssl_ca_certs='/path/to/ca.pem')

The equivalent works via command line, so I’m not sure what’s going on in between the CLI and the actual MongoClient call. I’ll try to debug and see.