Hello, I am learning to build web app architecture using k8s’ ReplicaSet but without MongoDB’s replicaSet nor mongos.
This works okay until I closed one client while stress test. Other client will sometimes receive these errors
{
"type": "MongoNetworkError",
"msg": "connection 967 to REDACTED closed"
},{
"type": "PoolClearedError",
"msg": "Connection pool for REDACTED was cleared because another operation failed with: \"connection 967 to REDACTED closed"\""
}
My hunch is both clients and drivers can’t differentiate one to another as they come from same hostname without any DNS resolver evolved. I’ve also explored some options such as loadBalanced=true but the driver won’t support it. Please tell me if there are any solution or this architecture shouldn’t exist at all. Thanks!
EDIT:
is loadBalanced option only works on mongos? Load balancing mongos - Working with Data / Drivers - MongoDB Developer Community Forums