I have 4 servers each hosting a website and a mongo replica set.
- MongoDB version: v3.4.13
- Driver: PHP
Server 1 is PRIMARY.
- Located on the west coast
Server 2 is SECONDARY with tag: { location: 'east' }
Server 3 and 4 are SECONDARY with no tags.
I want server 2 to read from it's local database, but instead it is reading from primary (or another secondary, I can't tell, but it's definitely not reading from it's local database)
- I suspect it's not reading from it's own SECONDARY db because there is about a 3 second lag for any query I run.
How can I tell server 2 to read from it's own local SECONDARY db?
simagix :
Include readPreferenceTags in your connection string. Refer to the online doc.\n\nBy the way, you shouldn't have a even number of nodes in a replica set unless one of them has no voting right.",
2019-01-29T23:18:09