Closed E4gle closed 7 years ago
Are you sure all HOST[123]:PORT addresses are accessible from your host? TxMongo lost connection to MongoDB
is usually logged when txmongo fails to connect to one of the servers.
Unfortunately, it is hard to reproduce without access to Atlas managed cluster.
The cluster URI is valid:
I realize this is difficult to reproduce, is there anything I can provide to help understand the cause of this issue ? (Logs or the URI in private or anything else to help solve this)
@E4gle Is txmongo able to execute any query? Or all queries fail/timed out?
The errors begin as soon as the server application starts as seen in the logs posted above I have not seen it perform any query successfully, I am beginning to suspect that the txmongo driver does not authenticate with the cluster successfully.
The Atlas documentation state that "Atlas uses TLS/SSL to encrypt the connections to your databases." https://docs.atlas.mongodb.com/setup-cluster-security/#security-features-and-setup
Does txmongo establish a SSL connection if it is set in the URI regardless of whether an ssl_context_factory is provided ?
@E4gle I've noticed ssl=true in your URL, but txmongo doesn't handle this option, at least for now. You should provide ssl_context_factory parameter to ConnectionPool constructor. Please see https://github.com/twisted/txmongo/blob/master/tests/test_auth.py#L472 for example of how to create one.
Atlas is a managed cluster so I do not have access to the shell so I cannot create the certificate and key for the ssl_context_factory
Is there any way to create them without having access to the shell ?
@E4gle Sorry, example I've linked is overcomplicated because it uses X509 authentication. Since you're using username/password, you probably can just use ssl.ClientContextFactory() as ssl_context_factory. Please try this.
looks like it is working ! Thank you so much for the help.
Thanks for using txmongo :-) I'm going to close this issue for now. Feel free to reopen it or create new one if something will go wrong.
Nice work! We should probably have an example that covers this use case. :)
When connecting to a Atlas managed cluster TxMongo continuously loses connection and the application fails to run smoothly.
What am I missing in order for it to work smoothly ?