All Products
Search
Document Center

ApsaraDB for MongoDB:The system prompts "network error while attempting to run command" when logging on to apsaradb for MongoDB through the Mongo Shell from a Linux instance

Last Updated:Dec 07, 2022

Problem description

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

MongoDB shell version v3 4.10
connecting to: mongodb:ali123456XXXXXX.mongodb.rds.aliyuncs.com:3717/
2018-12-18T14:26:11.946+0800 E QUERY    [thread1] Error: network error while attempting to run command 'isMaster' on host 'ft123XXXXX.mongodb.rds.aliyuncs.com:3717'  :
connect@src/mongo/shell/mongo.js:237:13
@(connect):1:6
exception: connect failed

Cause

The IP address of the Linux instance is not added to the whitelist of the apsaradb for MongoDB instance.

Solution

Add the IP address of the Linux instance to a whitelist of the apsaradb for MongoDB instance. For more information, see set a whitelist.

Documentation

Application scope

  • ApsaraDB for MongoDB