I'm trying to connect to my mongodb database from URI that is hosted on mLab, but I couldn't, this error is displayed:
Connection failed.
SERVER [ds121090-a0.mlab.com:19490] (Type: UNKNOWN)
__/ Connection error (MongoSocketOpenException): Exception opening socket
|____/ I/O error: connect timed out
Details:
Timed out after 30000 ms while waiting to connect. Client view of cluster state is {type=UNKNOWN, servers=[{address=ds132132190-a0.mlab.com:19490, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.SocketTimeoutException: connect timed out}}]
mongodb://user:xxxxx#ds132132190.mlab.com:19490/mydb
My localhost db works fine.
What's wrong with my server db?
Related
Getting the Below error when trying to connect to mongodb via PySpark(Google DATAPROC), its happening both locally and in Dataproc in GCP. We’re getting the below errors:
py4j.protocol.Py4JJavaError: An error occurred while calling o68.load.
: com.mongodb.MongoTimeoutException: Timed out after 30000 ms while
waiting to connect. Client view of cluster state is {type=UNKNOWN,
servers=[{address=localhost:27017, type=UNKNOWN, state=CONNECTING,
exception={com.mongodb.MongoSocketOpenException: Exception opening
socket}, caused by {java.net.ConnectException: Connection refused
(Connection refused)}}]
org.mongodb.driver.cluster: Exception in monitor thread while
connecting to server localhost:27017
com.mongodb.MongoSocketOpenException: Exception opening socket
I’ve been using the below command to submit jobs to dataproc. But we’re not sure where the problem is.
gcloud dataproc jobs submit pyspark gs://initmatch/dataproc/files/mongo_spark.py
--cluster=custom-cluster-no-address --region=us-west1 --jars=gs://initmatch/dataproc/jars/mongo-spark-connector-10.0.5.jar,
gs://initmatch/dataproc/jars/mongodb-driver-core-4.8.1.jar,
gs://initmatch/dataproc/jars/mongodb-driver-sync-4.8.1.jar
I installed Mongodb version 6.0.3 but its not able to connect with Studio 3T and getting below error.
Connection failed.
SERVER [172.30.53.203:27017] (Type: UNKNOWN)
\_/ Connection error (MongoSocketOpenException): Exception opening socket
|____/ Socket error: Connection refused: connect
Details:
Timed out after 5000 ms while waiting to connect. Client view of cluster state is {type=UNKNOWN, servers=[{address=172.30.53.203:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused: connect}}]
This is my connection URI
"mongodb+srv://myUserName:myPassWord#myHost/myDb?retryWrites=true&w=majority"
My user has readAnyDatabase role. But when I try to find a document I get this error.
Error printing return value (MongoTimeoutException) at com.mongodb.internal.connection.BaseCluster/createTimeoutException (BaseCluster.java:401).
Timed out after 30000 ms while waiting for a server that matches com.mongodb.client.internal.MongoClientDelegate$1#63d3bb68. Client view of cluster state is {type=REPLICA_SET,
servers=[{address=myDb-shard-00-00.qwert.mongodb.net:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.SocketTimeoutException: Connect timed out}},
{address=myDb-shard-00-02.qwert.mongodb.net:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.SocketTimeoutException: Connect timed out}},
{address=myDb-shard-00-01.qwert.mongodb.net:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.SocketTimeoutException: Connect timed out}}]
If you see it's able to connect to the Mongo DB (I am infering this from the fact that it is able to discover all the nodes from myDb-shard-00-00 to myDb-shard-00-02), but gives this error when trying to read some data.
I have connected to other mongo dbs (different uri) with the same code and successfully read documents. So, I am guessing that there should be something wrong with my configuration? Or is it something else? What is the direction that I should be looking at to debug this?
mongodb is running on my local machine and i want to connect this mongodb from drone.io. but i am getting error message as below
com.mongodb.com.mongodb.MongoTimeoutException:
com.mongodb.MongoTimeoutException: Timed out after 30000 ms while
waiting for a server that matches
ReadPreferenceServerSelector{readPreference=primary}. Client view of
cluster state is {type=UNKNOWN, servers=[{address=localhost:27017,
type=UNKNOWN, state=CONNECTING,
exception={com.mongodb.MongoSocketOpenException: Exception opening
socket}, caused by {java.net.ConnectException: Connection refused}}]
Can any one help on this how can i connect my local mongodb from drone.io
I have two pods in my Kubernetes cluster - one is connecting just fine to my MongoDB Atlas cluster, the other is failing due to the following exception:
Caused by: com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting for a server that matches WritableServerSelector.
Client view of cluster state is {type=REPLICA_SET, servers=[{address=MY_MONGO_SERVER1:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.SocketTimeoutException: connect timed out}}, {address=MY_MONGO_SERVER2:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.SocketTimeoutException: connect timed out}}, {address=MY_MONGO_SERVER3:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.SocketTimeoutException: connect timed out}}]
Now I'm not sure why one pod is able to connect, while the second one fails. We have another environment (production) that has similar configuration and all is fine with that environment's pods. Also, that environment runs on same Atlas cluster-sized DB, with similarly configured Kubernetes deployments.