Skip to content

Commit 86d22d6

Browse files
committed
DOCSP-48389 Connection Troubleshooting Revisions (mongodb#1068)
* DOCSP-48389 Connection Troubleshooting Revisions * tech question * edits * tech review * edit * remov * technical review * security comment * JS review * edit
1 parent 2c7d5f5 commit 86d22d6

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
@@ -27,36 +27,20 @@ using the {+driver-long+} to connect to a MongoDB deployment.
2727
with MongoDB or the driver, visit the following resources:
2828

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

3535
Connection Error
3636
----------------
3737

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

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

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

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

7055
.. warning::
7156

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

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

7872
If the connection is refused when the driver attempts to connect to the MongoDB
79-
instance, it generates this error message:
73+
instance, it generates an error message similar to the following:
8074

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

89-
Ensure MongoDB and Your Client Use the Same Protocol
90-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
83+
Ensure MongoDB and Your Client Use the Same IP Address
84+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9185

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

115109
If the connection is reset when the driver calls ``client.connect()``, it
116-
generates this error message:
110+
generates an error message similar to the following:
117111

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

139135
.. warning::
140136

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

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

157152
.. code-block:: none
158153
:copyable: false
@@ -170,12 +165,13 @@ Check Your Connection String
170165
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
171166

172167
An invalid connection string is the most common cause of authentication
173-
issues when attempting to connect to MongoDB using ``SCRAM-SHA-256``.
168+
issues when you attempt to connect to MongoDB by using ``SCRAM-SHA-256``.
174169

175170
.. tip::
176171

177172
For more information about connection strings,
178-
see :ref:`Connection URI <node-connection-uri>` in the Connection Guide.
173+
see the :ref:`Connection URI <node-connection-uri>` section in the Connection
174+
Guide.
179175

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

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

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

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

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

@@ -332,14 +303,6 @@ The following example sets ``connectTimeoutMS`` to 10000 milliseconds.
332303
connectTimeoutMS: 10000,
333304
});
334305

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

0 commit comments

Comments
 (0)