Problem description

When you log on to a MongoDB database by using the Mongo Shell, the following error message is displayed.

2015-12-21T10:20:36.084+0800 I NETWORK  Socket recv() errno:54 Connection reset by peer  1.2.3.4:27017
2015-12-21T10:20:36.087+0800 I NETWORK  SocketException: remote: 1.2.3.4:27017 error: 9001 socket exception [RECV_ERROR] server [1.2.3.4:27017]
2015-12-21T10:20:36.087+0800 I NETWORK  DBClientCursor::init call() failed

Cause

The number of connections to the instance has reached the upper limit, and no new connection request can be established.

Solution

Alibaba Cloud reminds you that:

  • Before you perform operations that may cause risks, such as modifying instance configurations or data, we recommend that you check the disaster recovery and fault tolerance capabilities of the instances to ensure data security.
  • You can modify the configurations and data of instances including but not limited to Elastic Compute Service (ECS) and Relational Database Service (RDS) instances. Before the modification, we recommend that you create snapshots or enable RDS log backup.
  • If you have authorized or submitted sensitive information such as the logon account and password in the Alibaba Cloud Management Console, we recommend that you modify such information in a timely manner.
  1. Restart the instance to release all connections. For more information, see instance restart.
  2. Connect to your MongoDB instance by using the Mongo Shell. For more information, see connect to an instance.
  3. Analyze the source IP addresses of connections and limit the number of connections. For more information, see how to query and limit the number of connections.
    Instructions if the source IP addresses are normal, perhaps your current apsaradb for MongoDB instance is unqualified for your business needs. In this case, you can upgrade the instance to increase the number of connections. For more information, see configuration change Overview.

Application scope

  • ApsaraDB for MongoDB