Skip to content

Commit 62c9c4c

Browse files
authored
DOCSP-48389 Connection Troubleshooting Revisions (#1068)
* DOCSP-48389 Connection Troubleshooting Revisions * tech question * edits * tech review * edit * remov * technical review * security comment * JS review * edit
1 parent a5b3f12 commit 62c9c4c

File tree

1 file changed

+27
-64
lines changed

1 file changed

+27
-64
lines changed

source/connect/connection-troubleshooting.txt

Lines changed: 27 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -26,36 +26,20 @@ using the {+driver-long+} to connect to a MongoDB deployment.
2626
with MongoDB or the driver, visit the following resources:
2727

2828
- The :ref:`Issues & Help <node-issues-help>` page, which has
29-
information about reporting bugs, contributing to the driver, and
30-
finding more resources
29+
information about how to report bugs, contribute to the driver, and
30+
find more resources
3131
- The `MongoDB Community Forums <https://community.mongodb.com>`__ for
3232
questions, discussions, or general technical support
3333

3434
Connection Error
3535
----------------
3636

37-
The following error message indicates that the driver cannot connect to a server
38-
on the specified hostname or port. Multiple situations can generate this error
39-
message. In this sample error message, the hostname is ``127.0.0.1`` and the
40-
port is ``27017``:
41-
42-
.. code-block:: none
43-
:copyable: false
44-
45-
Error: couldn't connect to server 127.0.0.1:27017
37+
If the driver cannot connect to the specified host, you might get an
38+
``MongoServerSelectionError``.
4639

4740
The following sections describe actions you can take to potentially resolve the
4841
issue.
4942

50-
.. _node-troubleshooting-connection-string-port:
51-
52-
Check Your Connection String
53-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
54-
55-
Verify that the hostname and port number in the connection string are both
56-
accurate. The default port value for a MongoDB instance is
57-
``27017``, but you can configure MongoDB to communicate on another port.
58-
5943
.. _node-troubleshooting-connection-firewall:
6044

6145
Configure Your Firewall
@@ -64,18 +48,28 @@ Configure Your Firewall
6448
Verify that the ports your MongoDB deployment listens on are not blocked by a
6549
firewall on the same network. MongoDB uses port ``27017`` by default. To learn
6650
more about the default ports MongoDB uses and how to change them, see
67-
:manual:`Default MongoDB Port </reference/default-mongodb-port/>`.
51+
:manual:`Default MongoDB Port </reference/default-mongodb-port/>` in the
52+
{+mdb-server+} manual.
6853

6954
.. warning::
7055

7156
Do not open a port in your firewall unless you are sure it's the port
7257
used by your MongoDB deployment.
7358

59+
Check Your Network Access List
60+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
61+
62+
Verify that your IP Address is listed in the IP Access List for your cluster.
63+
You can find your IP Access List in the Network Access section of
64+
the Atlas UI. To learn more about how to configure your IP Access List,
65+
see the :atlas:`Configure IP Access List Entries </security/ip-access-list/>`
66+
guide in the Atlas documentation.
67+
7468
ECONNREFUSED Error
7569
------------------
7670

7771
If the connection is refused when the driver attempts to connect to the MongoDB
78-
instance, it generates this error message:
72+
instance, it generates an error message similar to the following:
7973

8074
.. code-block:: none
8175
:copyable: false
@@ -85,8 +79,8 @@ instance, it generates this error message:
8579
The following sections describe actions you can take to potentially resolve the
8680
issue.
8781

88-
Ensure MongoDB and Your Client Use the Same Protocol
89-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
82+
Ensure MongoDB and Your Client Use the Same IP Address
83+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9084

9185
In Node.js v17 and later, the DNS resolver uses ``IPv6`` by default when both
9286
the client and host support both. For example, if MongoDB uses IPv4 and your
@@ -112,7 +106,7 @@ ECONNRESET Error
112106
----------------
113107

114108
If the connection is reset when the driver calls ``client.connect()``, it
115-
generates this error message:
109+
generates an error message similar to the following:
116110

117111
.. code-block:: none
118112
:copyable: false
@@ -133,7 +127,9 @@ if the number of connections exceeds this limit.
133127
You can set the maximum number of connections by setting ``maxPoolSize``. To
134128
resolve this error, you can decrease the number of maximum allowed connections
135129
by setting the value of ``maxPoolSize``. Alternatively, you could increase the
136-
file descriptor limit in your operating system.
130+
file descriptor limit in your operating system. To learn more about how to set
131+
``maxPoolSize``, see the API documentation for
132+
`maxPoolSize <{+api+}/interfaces/MongoClientOptions.html#maxPoolSize>`__ .
137133

138134
.. warning::
139135

@@ -150,8 +146,7 @@ error message similar to one of the following messages:
150146
.. code-block:: none
151147
:copyable: false
152148

153-
Command failed with error 18 (AuthenticationFailed): 'Authentication
154-
failed.' on server <hostname>:<port>.
149+
MongoServerError: bad auth : authentication failed
155150

156151
.. code-block:: none
157152
:copyable: false
@@ -169,12 +164,13 @@ Check Your Connection String
169164
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
170165

171166
An invalid connection string is the most common cause of authentication
172-
issues when attempting to connect to MongoDB using ``SCRAM-SHA-256``.
167+
issues when you attempt to connect to MongoDB by using ``SCRAM-SHA-256``.
173168

174169
.. tip::
175170

176171
For more information about connection strings,
177-
see :ref:`Connection URI <node-connection-uri>` in the Connection Guide.
172+
see the :ref:`Connection URI <node-connection-uri>` section in the Connection
173+
Guide.
178174

179175
If your connection string contains a username and password, ensure that they
180176
are in the correct format. If the username or password includes any of the
@@ -216,10 +212,6 @@ database:
216212
const uri = "mongodb://<db_username>:<db_password>@<hostname>:<port>/?authSource=users";
217213
const client = new MongoClient(uri);
218214

219-
You can check if this is the issue by attempting to connect to a MongoDB
220-
instance hosted on the local machine with the same code. A deployment on
221-
the same machine doesn't require any authorization to connect.
222-
223215
Error Sending Message
224216
---------------------
225217

@@ -271,27 +263,6 @@ For more information about how connection pooling works, see the
271263
:ref:`Connection Pool Overview <node-faq-connection-pool>`
272264
in the Connection Pools page.
273265

274-
Too Many Open Connections
275-
-------------------------
276-
277-
The driver creates the following error message when it attempts to open a
278-
connection, but it's reached the maximum number of connections:
279-
280-
.. code-block:: none
281-
:copyable: false
282-
283-
connection refused because too many open connections
284-
285-
The following section describes a method that may help resolve the issue.
286-
287-
Check the Number of Connections
288-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
289-
290-
To create more open connections, increase the value of ``maxPoolSize``. For more
291-
information about checking the number of connections, see
292-
:ref:`Check the Number of Connections <node-troubleshooting-connection-number-connections>`
293-
in the Error Sending Message section.
294-
295266
Timeout Error
296267
-------------
297268

@@ -313,7 +284,7 @@ Set connectTimeoutMS
313284
The driver may hang when it's unable to establish a connection because it
314285
takes too long attempting to reach unreachable replica set nodes. You can limit the
315286
time the driver spends attempting to establish the connection by using the
316-
``connectTimeMS`` setting. To learn more about this setting, see the
287+
``connectTimeoutMS`` setting. To learn more about this setting, see the
317288
:manual:`Timeout Options </reference/connection-string/#timeout-options>` in
318289
the Server manual.
319290

@@ -331,14 +302,6 @@ The following example sets ``connectTimeoutMS`` to 10000 milliseconds.
331302
connectTimeoutMS: 10000,
332303
});
333304

334-
Check the Number of Connections
335-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
336-
337-
The number of connections to the server may exceed ``maxPoolSize``. For more
338-
information about checking the number of connections, see
339-
:ref:`Check the Number of Connections <node-troubleshooting-connection-number-connections>`
340-
in the Error Sending Message section.
341-
342305
Client Disconnect While Running Operation
343306
-----------------------------------------
344307

0 commit comments

Comments
 (0)