[JAVA-4076] MongoTimeoutException: Error While Using MongoDB with Trino Created: 19/Mar/21 Updated: 26/Sep/22 Resolved: 19/Mar/21 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | Connection Management |
| Affects Version/s: | 3.6.0 |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Abhaypratap singh | Assignee: | Jeffrey Yemin |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Ubuntu,Trino |
||
| Attachments: |
|
| Description |
|
connector.name=mongodb mongodb.seeds=127.0.0.1:27017 mongodb.credentials=username:password@database But when running the catalog after passing the query it is giving error as , caused by {java.net.SocketTimeoutException: connect timed out}}]}} Note:- I'm running trino locally using single machine for testing, that functions as both a coordinator and worker and mongodb is on some other server but i'm routing the localhost to the desired server using ssh Slack Users can follow this thread :- https://trinodb.slack.com/archives/CGB0QHWSW/p1615977203044600 |
| Comments |
| Comment by Jeffrey Yemin [ 19/Mar/21 ] | |||||||||||||||
|
I'm going to close this issue now as I think I've answered your questions about the MongoDB Java driver itself, but in case you need additional support I wanted to give you some resources to get any further question answered:
| |||||||||||||||
| Comment by Jeffrey Sposetti [ 19/Mar/21 ] | |||||||||||||||
|
Hi abhaypratap.singh@capfront.in, Not sure exactly but here goes...when configuring the MongoDB connector in Trino, in addition to setting the mongodb.seeds list, you may also need to set mongodb.required-replica-set property. https://trino.io/docs/current/connector/mongodb.html Don't know if this is the exact right spot (not deeply familiar with the MongoDB connector), but it's using those properties to instantiate the MongoClient... (folks in the Trino / Presto community may know better): Unrelated question: are you just primarily looking to get SQL access to MongoDB? Or are you using Trino for other things? Just for what it's worth if it's just SQL access to MDB, you can try this BI Connector: https://docs.mongodb.com/bi-connector/current/ Hope this helps! Jeff | |||||||||||||||
| Comment by Abhaypratap singh [ 19/Mar/21 ] | |||||||||||||||
|
Thanks for helping out, yes the above code snippet which you sent is working But i want to use the mongodb in trino (presto sql) if you could help me with that also it'll be great | |||||||||||||||
| Comment by Jeffrey Yemin [ 19/Mar/21 ] | |||||||||||||||
|
Hi abhaypratap.singh@capfront.in, I'm afraid that this is not going to work if your application is trying to connect to a replica set. That's because drivers are required to discover all the servers in the replica set in order to determine which is the primary, and in doing so tries to connect using the hostnames that are known to the replica set, discarding the hostname from the original seed list. To test this hypothesis, try connecting with this code instead:
This will create a direct connection to localhost:27017 and not do discovery. Let me know if that works, and if so, we can determine next steps based on the requirements of your application. | |||||||||||||||
| Comment by Abhaypratap singh [ 19/Mar/21 ] | |||||||||||||||
|
This is also not working
|