This topic describes how to connect to a sharded cluster instance by using the mongo shell, which is a database management tool provided with MongoDB. You can install the mongo shell on your client or an ECS instance.
Prerequisites
- To ensure successful authentication, the version of the mongo shell must match with that of the ApsaraDB for MongoDB instance. For more information about the installation procedure, visit Install MongoDB. Select the correct version based on your client.
- The IP address of your client is added to a whitelist of the sharded cluster instance.
For more information, see Configure a whitelist for a sharded cluster instance.
Note If you want to connect to the instance over the Internet, you must apply for a public endpoint.
Procedure
Common connection scenarios
- Connect a local client to an ApsaraDB forMongoDB instance over the Internet
- How to connect an ECS instance to an ApsaraDB for MongoDB instance when their network types are different
- How to connect an ECS instance to an ApsaraDB for MongoDB instance when they are in different regions
- How to connect an ECS instance to an ApsaraDB for MongoDB instance when they do not belong to the same Alibaba Cloud account