MongoDB connector can not select data from read-only node #23123
-
When I recently deployed trino in stand-alone mode and connected it to mongodb, I was unable to read data from the mongodb read-only instance node. The result indicate that the read-only instance node is not master node of mongodb. The specific error message is: 2024-08-21T21:58:25.873+0800 INFO Query-20240821_135825_00018_swwvh-199 org.mongodb.driver.cluster Waiting for server to become available for operation with ID 125. Remaining time: 30000 ms. Selector: ReadPreferenceServerSelector{readPreference=primary}, topology description: {type=UNKNOWN, servers=[{address=xxxxxxxxx:8635, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoNotPrimaryException: Command failed with error 10107 (NotMaster): 'not master' on server xxxxxxx:8635. The full response is {"operationTime": {"$timestamp": {"t": 1724248705, "i": 10}}, "ok": 0.0, "errmsg": "**not master**", "code": 10107, "codeName": "**NotMaster**", "$clusterTime": {"clusterTime": {"$timestamp": {"t": 1724248705, "i": 10}}, "signature": {"hash": {"$binary": {"base64": "J7HW9Nj7fF7lRpJJiIS/4z2zJP0=", "subType": "00"}}, "keyId": 7378427933884416004}}}}}].
2024-08-21T21:58:25.920+0800 INFO dispatcher-query-10 io.trino.event.QueryMonitor TIMELINE: Query 20240821_135825_00018_swwvh :: FAILED (USER_CANCELED) :: elapsed 46ms :: planning 46ms :: waiting 0ms :: scheduling 0ms :: running 0ms :: finishing 0ms :: begin 2024-08-21T21:58:25.872+08:00 :: end 2024-08-21T21:58:25.918+08:00
2024-08-21T21:58:25.930+0800 ERROR page-buffer-client-callback-3 io.trino.operator.HttpPageBufferClient Request to delete http://172.31.33.113:8080/v1/task/20240821_135825_00017_swwvh.1.0.0/results/0 failed java.util.concurrent.CancellationException: Task was cancelled. I noticed that the official deployment guide mentioned that trino needs to have write permissions for information schema. Does this mean that mongodb read-only instance nodes cannot connect to trino? If trino can connect to mongodb read-only instance nodes, do I need to add any configuration? My current mongodb connection config is: connector.name=mongodb
mongodb.connection-url=mongodb://<user>:<pwd>@<ip>:<port>/?authSource=admin basic environment:
mongodb cluster environment:
Update: I have read the source code of So will trino support maintaining similar table structures within the cluster instead of in specific data source instances? In many production scenarios, from the perspective of data security, data analysis is often connected to read-only instances. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
I have a very similar situation, where basically I would like to give trino only read access to the data. Since it needs to maintain the _schema document, is there any way this document could exist in a different mongo database (within the same mongo instance)? Then the document would be named something like "_db-name_schema" |
Beta Was this translation helpful? Give feedback.
-
What about this option? @alexanderhw @ErikTheBerik
|
Beta Was this translation helpful? Give feedback.
Now we have solved this problem in another way. We have made a second modification based on the source code of trino, and added two methods of external database & memory to store the Mongodb table structure, which is equivalent to managing the schema-collection function separately.