I don’t speak very good English, but I will try to answer your questions correctly .
I got the old code from the developer for support.
I use a 4-node server.
hosts = ‘db0.mongo_server.com:27017,db1.mongo_server.com:27017,db2.mongo_server.com:27017,db3.mongo_server.com:27017’
yes, there are no routing/firewall issues.
client and masterClient these are different points for methods inside a self-written class for working with databases and data.
As far as I understand, the idea was that methods that modify data in the database should use PRIMARY . And the methods that get the data went to the nearest database and took the data there.
The databases are located in different geolocation.
сlient - used for methods: find, count_documents, aggregate, count.
masterClient - used for methods: find_and_modify, drop, create, count,
masterClient -used only primery.
client -used nearest node.
I can’t say anything about point 4 yet. The code was written by a previous developer.
As far as I understand, w =4, because the previous developer wants the write confirmation to be from all 4 nodes. I understand this in my case . if one node is unavailable, the record cannot be confirmed ?
our version of mongo is 4.0.19 .
Our network got into the
DigitalOcean for a couple of seconds, and it only had access to one node, the api couldn’t connect to one node. Then the network appeared, the replica was reassembled and started working. But the api couldn’t connect to the mongobd replica. Everything was solved by restarting the servers using mongobd. When the servers were rebooted, the api was able to connect to mongobd.
our serverSelectionTimeoutMS default 30 seconds
Now I’m trying to understand the situation, maybe it’s something else. But if you give any recommendations, I will be happy, as I am not an expert in mongobd. I can try to throw you a list of code where the database is connected and methods are written for inserting updating and deleting data from the database . If it helps.