Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
mmctony
Contributor
Contributor

Cannot connect to MongoDB: driver does not have load balancing enabled

Hi,

 

on TOS for Big Data 8.0.1.20211109_1610 I am not able to connect to a MongoDB service that icludes a load balancer:

 

org.talend.repository.nosql.exceptions.NoSQLServerException: Cannot connect to database!

   at org.talend.repository.nosql.db.util.mongodb.MongoDBConnectionUtil.checkConnection(MongoDBConnectionUtil.java:103)

   at org.talend.repository.nosql.db.provider.mongodb.MongoDBMetadataProvider.checkConnection(MongoDBMetadataProvider.java:243)

   at org.talend.repository.nosql.ui.common.AbstractNoSQLConnForm$1$1.run(AbstractNoSQLConnForm.java:157)

   at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)

Caused by: com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting to connect. Client view of cluster state is {type=UNKNOWN, servers=[{address=myhost-lb.mongodb.net:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoCommandException: Command failed with error 354 (LoadBalancerSupportMismatch): 'The server is being accessed through a load balancer, but this driver does not have load balancing enabled' on server myhost-lb.mongodb.net:27017. The full response is {"ok": 0, "errmsg": "The server is being accessed through a load balancer, but this driver does not have load balancing enabled", "code": 354, "codeName": "LoadBalancerSupportMismatch"}}}]

   at com.mongodb.internal.connection.BaseCluster.getDescription(BaseCluster.java:184)

   at com.mongodb.internal.connection.SingleServerCluster.getDescription(SingleServerCluster.java:46)

   at com.mongodb.client.internal.MongoClientDelegate.getConnectedClusterDescription(MongoClientDelegate.java:143)

   at com.mongodb.client.internal.MongoClientDelegate.createClientSession(MongoClientDelegate.java:100)

   at com.mongodb.client.internal.MongoClientDelegate$DelegateOperationExecutor.getClientSession(MongoClientDelegate.java:285)

   at com.mongodb.client.internal.MongoClientDelegate$DelegateOperationExecutor.execute(MongoClientDelegate.java:177)

   at com.mongodb.client.internal.MongoIterableImpl.execute(MongoIterableImpl.java:130)

   at com.mongodb.client.internal.MongoIterableImpl.iterator(MongoIterableImpl.java:90)

   at com.mongodb.client.internal.MappingIterable.iterator(MappingIterable.java:42)

   at com.mongodb.client.internal.MappingIterable.iterator(MappingIterable.java:30)

   at org.talend.repository.nosql.db.util.mongodb.MongoDBConnectionUtil.checkConnection(MongoDBConnectionUtil.java:94)

   ... 3 more

 

On the other hand, there are no issues connecting to a MongoDB service w/o a load balancer or for which replica hostnames are available.

 

Any workaround?

 

Thanks for your help,

Mick

Labels (2)
2 Replies
Anonymous
Not applicable

Hello Mick,

You don't need to use a load balancer, or to route queries to secondary nodes; the primary node can handle concurrent queries by itself, see https://stackoverflow.com/questions/43804022/mongodb-load-balancer-for-the-replica-set

As a workaround, please check the button 'Use replica set address' and setup the Replica host/ports

0695b00000fIga1AAC.png

mmctony
Contributor
Contributor
Author

Hi Achen,

unfortunately I don't have any control over that MongoDB server and they provided me no replica hosts.

Any other way?

Thanks