You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I successfully installed the replicaset, and everything works fine except when I try to connect from an application, where I randomly get this error using the headless service in the connection string: mongodb://mongo-hlservice
2019-04-12T16:05:29.650570679Z [16:05:29 ERR] Connection id "0HLLVC1EI38R1", Request id "0HLLVC1EI38R1:00000001": An unhandled exception was thrown by the application.
2019-04-12T16:05:29.650623979Z System.TimeoutException: A timeout occured after 30000ms selecting a server using CompositeServerSelector{ Selectors = ReadPreferenceServerSelector{ ReadPreference = { Mode : Primary } }, LatencyLimitingServerSelector{ AllowedLatencyRange = 00:00:00.0150000 } }. Client view of cluster state is { ClusterId : "1", ConnectionMode : "Automatic", Type : "ReplicaSet", State : "Connected", Servers : [{ ServerId: "{ ClusterId : 1, EndPoint : "Unspecified/mongo-hlservice:27017" }", EndPoint: "Unspecified/mongo-hlservice:27017", State: "Connected", Type: "ReplicaSetSecondary", WireVersionRange: "[0, 7]" }] }.
While everything works as expected if I specify the pod names in the connection string: mongodb://mongo-0.mongo-hlservice.default.svc.cluster.local:27017,mongo-1.mongo-hlservice.default.svc.cluster.local:27017,mongo-2.mongo-hlservice.default.svc.cluster.local:27017/
I suppose the issue could be related to readPreference settings, because trying to connect directly from my application pod to mongodb://mongo-hlservice I am randomly routed to primary and secondaries at each try, but the mongo driver should be able to retrieve the primary name from each node via the config, which is the following:
Hi,
I successfully installed the replicaset, and everything works fine except when I try to connect from an application, where I randomly get this error using the headless service in the connection string:
mongodb://mongo-hlservice
While everything works as expected if I specify the pod names in the connection string:
mongodb://mongo-0.mongo-hlservice.default.svc.cluster.local:27017,mongo-1.mongo-hlservice.default.svc.cluster.local:27017,mongo-2.mongo-hlservice.default.svc.cluster.local:27017/
I suppose the issue could be related to readPreference settings, because trying to connect directly from my application pod to mongodb://mongo-hlservice I am randomly routed to primary and secondaries at each try, but the mongo driver should be able to retrieve the primary name from each node via the config, which is the following:
I attached also my yaml, any clue or suggestion on why I have this error?
Thanks,
Carlo Alberto
mongo-statefulset.yaml.zip
The text was updated successfully, but these errors were encountered: