-
Type: Task
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: 0.0.17
-
Component/s: Options & Configuration
-
None
-
Environment:Go 1.11
Linux 64 bit
We have our custom monitoring agent we run on each mongo instance, which call `serverStatus` like this:
connectStr := fmt.Sprintf("mongodb://%s:%s@%s:%d/%s", h.Username, h.Password, "localhost", h.Port, h.Database) client, e := mongo.NewClient(connectStr) ctx, _ := context.WithTimeout(context.Background(), 3*time.Second) client.Connect(ctx) db := client.Database(h.Database) rdr, e := db.RunCommand(ctx, bson.NewDocument(bson.EC.Int32("serverStatus", 1)))
However, it seems the commands are always routed to the primary, since even when run on the secondaries, we get the exact same stats as the primary for metrics like connections, opcounters, opcountersRepl, etc.
This seems to be a bug in the driver, where a query being run on 'localhost' is being directed to the primary
- related to
-
GODRIVER-665 Support only "automatic" and "direct" as values for "connect" URI option
- Closed