We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6f3aa6f commit 65d9e0bCopy full SHA for 65d9e0b
shared/connection.go
@@ -56,14 +56,17 @@ func MongoSession(opts MongoSessionOpts) *mgo.Session {
56
return nil
57
}
58
59
+ // For direct connection, we need to set mode to be Monotonic (similar to SecondaryPreferred) or
60
+ // Eventual (similar to Nearest) before login. Otherwise, mongo exporter can not log in secondary mongod.
61
+ session.SetMode(mgo.Eventual, true)
62
+
63
if cred != nil {
64
if err := session.Login(cred); err != nil {
65
glog.Errorf("Cannot login to server using TLS credential: %s", err)
66
67
68
69
- session.SetMode(mgo.Eventual, true)
70
session.SetSyncTimeout(syncMongodbTimeout)
71
session.SetSocketTimeout(opts.SocketTimeout)
72
return session
0 commit comments