@@ -13,7 +13,7 @@ Troubleshoot Private Endpoint Connection Issues
1313.. contents:: On this page
1414 :local:
1515 :backlinks: none
16- :depth: 1
16+ :depth: 2
1717 :class: singlecol
1818
1919This page outlines common private endpoint connection issues and possible resolutions.
@@ -103,6 +103,197 @@ This page outlines common private endpoint connection issues and possible resolu
103103 Name: vpce-024f5b57108c8d3ed-ypwbxwll.vpce-svc-02863655456245e5c.us-east-1.vpce.amazonaws.com
104104 Address: 10.0.20.54
105105
106+ Connection Refused Because There are Too Many Open Connections
107+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
108+
109+ - If your connections exceed the connection limits for your
110+ `cluster service limit <https://www.mongodb.com/docs/atlas/reference/atlas-limits/#connection-limits-and-cluster-tier>`__,
111+ you should increase the cluster tier.
112+ - If your connection count is significantly higher than your
113+ expected connection count, see section below :ref:`Gather More Information on the Client Making the Most Connections <pl-troubleshoot-gather-info>`.
114+ - E.g. enforcement on a sharded cluster v7.0.22 using load balanced
115+ optimized connection string.
116+
117+ .. io-code-block::
118+ :copyable: false
119+
120+ .. input::
121+
122+ $ mongosh "mongodb+srv://aws-replica-set-7-pl-0-lb.22qdu.mongodb-dev.net/" --apiVersion 1 --username sarah
123+ Enter password: *****
124+ Current Mongosh Log ID: 68910f1754be6d9adc74e399
125+ Connecting to: mongodb+srv://<credentials>@aws-replica-set-7-pl-0-lb.22qdu.mongodb-dev.net/?appName=mongosh+2.5.6
126+ MongoNetworkError: Client network socket disconnected before secure TLS connection was established
127+
128+ .. output::
129+
130+ {"t":{"$date":"2025-08-04T19:48:17.649+00:00"},"s":"I", "c":"NETWORK",
131+ "id":22942, "ctx":"listener","msg":"Connection refused because there are
132+ too many open connections","attr":{"remote":"54.172.143.8:33205",
133+ "isLoadBalanced":false,"uuid":{"uuid":{"$uuid":"e52e9c14-7648-430a-bc2e-95292347b7e0"}},
134+ "connectionId":380,"connectionCount":58}}
135+
136+
137+ Viewing the Client Source IP
138+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
139+
140+ .. note::
141+
142+ This feature is rolling out gradually. We expect it to be
143+ available for all the dedicated clusters in AWS by the end of September, 2025.
144+
145+ - You can view the client source IP in the mongos logs for sharded
146+ clusters connecting via Private Endpoints.
147+ - You can view the client source IP in the mongod logs for replica sets
148+ connecting via Private Endpoints.
149+ - You can view the client source IP in the audit logs for both replica sets
150+ and sharded clusters connecting via Private Endpoints.
151+ - This functionality is supported on AWS for the following versions:
152+
153+ - 8.1 and v8.1.0+
154+ - 8.0 and v8.0.10+
155+ - 7.0 and v7.0.22+
156+
157+ - The origin client IP address and port is indicated by the ``sourceClient`` field.
158+ That value is ``10.50.4.23`` in the above example.
159+
160+ .. code-block::
161+
162+ {"t":{"$date":"2025-07-21T12:15:42.123+00:00"},"s":"I","c":"NETWORK",
163+ "id":22943,"ctx":"listener","msg":"Connection accepted","attr":{"remote":"192.168.100.55:31245",
164+ "isLoadBalanced":true,"sourceClient":"10.50.4.23:50123","uuid":{"uuid":{"$uuid":"12345678-abcd-4321-abcd-87654321abcd"}},
165+ "connectionId":345,"connectionCount":19}}
166+
167+
168+
169+ .. _pl-troubleshoot-gather-info:
170+
171+ Gather More Information on the Client Making the Most Connections
172+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
173+
174+ Gathering these details requires using the
175+ `jq tool <https://www.mongodb.com/docs/manual/reference/log-messages/#log-parsing-examples>`__,
176+ which can be downloaded from the `jq website <https://jqlang.github.io/jq/>`__.
177+
178+ Connections created from the client metadata
179+ `````````````````````````````````````````````
180+
181+ The following query provides the number of connections created from a
182+ particular client IP address. You can now collect the exact source VPC Private IP address
183+ using the attribute ``sourceClient``.
184+
185+ .. io-code-block::
186+
187+ .. input::
188+
189+ grep '"c":"NETWORK"' mongod.log | jq -c '.attr.sourceClient' | grep -v null | sort | uniq -c
190+
191+ .. output::
192+
193+ 1 "172.31.36.2:32958"
194+ 1 "172.31.36.2:52904"
195+ 1 "172.31.36.2:52908"
196+ 1 "172.31.36.2:52910"
197+ 1 "172.31.36.2:52918"
198+
199+ Drivers used by the applications to connect to the cluster
200+ ```````````````````````````````````````````````````````````
201+
202+ The following query provides the number of connections created by each
203+ driver. This is useful in scenarios where customers might use different
204+ drivers for different applications.
205+
206+ .. io-code-block::
207+
208+ .. input::
209+
210+ more mongodb.log| grep 'NETWORK' | jq -r '.attr.doc.driver.name' | grep -v null | sort | uniq -c | sort -rn
211+
212+ .. output::
213+
214+ 56447 mongo-go-driver
215+ 21633 mongo-java-driver|sync
216+ 75 mongo-java-driver|sync|Airbyte
217+ 4 nodejs|Mongoose
218+
219+ For a more detailed analysis of connection counts and driver details,
220+ you can use the following Python script, which provides comprehensive
221+ information on the number of connections created and terminated, along
222+ with the driver names and version details.
223+
224+ .. io-code-block::
225+
226+ .. input:: /includes/driver_details_and_connection_details.py
227+
228+ .. output::
229+
230+ Driver: ('mongo-go-driver', 'v1.12.0-cloud')
231+ Connection Opened: 14368
232+ Connection Closed: 14362
233+
234+ Driver: ('mongo-go-driver', 'v1.12.1')
235+ Connection Opened: 42056
236+ Connection Closed: 41958
237+
238+ Driver: ('mongo-java-driver|sync', '4.11.1')
239+ Connection Opened: 18012
240+ Connection Closed: 17987
241+
242+ Driver: ('mongo-java-driver|sync', '4.8.2')
243+ Connection Opened: 3621
244+ Connection Closed: 3610
245+
246+ Driver: ('nodejs|Mongoose', '4.17.1|6.12.0')
247+ Connection Opened: 3
248+ Connection Closed: 1
249+
250+ Driver: ('mongo-go-driver', 'v1.13.0')
251+ Connection Opened: 23
252+ Connection Closed: 20
253+
254+ Driver: ('mongo-java-driver|sync|Airbyte', '4.11.0')
255+ Connection Opened: 75
256+ Connection Closed: 75
257+
258+ Driver: ('nodejs|Mongoose', '4.17.2|6.13.0')
259+ Connection Opened: 1
260+ Connection Closed: 0
261+
262+ Application names used by client applications to connect to the cluster
263+ ```````````````````````````````````````````````````````````````````````
264+ We can suggest that customers include the application name in the connection
265+ string to specify different applications connecting to the cluster. By using the
266+ ``appName``, we can identify which application is creating many connections
267+ to the cluster in the future. See the `Miscellaneous Configuration <https://www.mongodb.com/docs/v6.2/reference/connection-string/#miscellaneous-configuration>`__
268+ section of our documentation for more details on using the ``appName`` in
269+ the connection string. Additionally, you can use the ``db.currentOp().appname``
270+ command to see the current operations associated with the application name.
271+ The following query provides details of the ``appName`` with the number of
272+ connections created by that particular application.
273+
274+ .. io-code-block::
275+
276+ .. input::
277+
278+ more mongodb.log| grep 'NETWORK' | jq -r '.attr.doc.application.name' | grep -v null | sort | uniq -c | sort -rn
279+
280+ .. output::
281+
282+ 10809 niyo-*******-api
283+ 8616 MongoDB CPS Module v13.17.2.8878 (git: 70c0b932f47f4f0b3e82a75e223f39ed9635b47f)
284+ 7203 niyo-ns*****
285+ 5752 MongoDB Automation Agent v13.17.2.8878 (git: 70c0b932f47f4f0b3e82a75e223f39ed9635b47f)
286+ 3601 *****-auth-service
287+
288+ The provided details help to pinpoint the specific factors
289+ contributing to the high number of connections. By analyzing Source Client
290+ IP, client metadata, driver usage, and application names, you can identify
291+ which elements are responsible for the increased connections and determine
292+ the necessary areas to investigate. This targeted approach allows you
293+ to disregard other less relevant factors and concentrate on
294+ addressing the issues with the highlighted information, ultimately
295+ streamlining the mitigation process and enhancing cluster performance.
296+
106297 Multi-Region Private Endpoints
107298 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
108299
@@ -421,4 +612,3 @@ This page outlines common private endpoint connection issues and possible resolu
421612
422613 telnet pl-0-<xyz>.mongodb.net 27017
423614
424-
0 commit comments