Dear team,
We have MongoDB shard server setup with Router + Config + 2 Shard servers [MongoDB version 4.4] and accessing the mongos connections via 4 servers with PHP7.
Recently add 1 extra server(4+1=5) with PHP8 setup [Same Mongo DB version 4.4] due to upgrade and use the common PHP latest libraries.
In new server mongos connection keep on increasing up to 240 and connections not clear after complete the application process.
So when reached the mongos connection above 450 in all 5 server means mongos disconnected with below error:
PHP Error message:
------------------
Uncaught MongoDB\Driver\Exception\ConnectionTimeoutException: No suitable servers found (`serverSelectionTryOnce` set): [connection refused calling ismaster on 'xx.xx.xxx.xxx:xxxxx'] in
MongoDB Error log message:
--------------------------
{"t":{"$date":"2023-10-31T08:31:32.410+00:00"},"s":"I", "c":"NETWORK", "id":23018, "ctx":"listener","msg":"Error accepting new connection on local endpoint","attr":{"localEndpoint":"xx.xx.xxx.xxx:xxxxx","error":"Too many open files"}}
Mongos connection count when disconnect:
----------------------------------------
{"current":452,"available":367,"totalCreated":29913,"active":10,"exhaustIsMaster":0,"exhaustHello":0,"awaitingTopologyChanges":0}
GitHub - mongodb/mongo-php-library: The Official MongoDB PHP library - Use this library to write queries.
Also tried with “maxPoolSize”, “socketTimeoutMS” and “connectTimeoutMS” and tuned that values. But not supported.
Could you please help us to solve this issue?
Thanks in Advance.