This topic describes how to connect to a sharded cluster instance by using the mongo shell. The mongo shell is a database management tool that comes with MongoDB. You can install the mongo shell on your client or in an ECS instance.
Prerequisites
- The version of the mongo shell is the same as your instance. This ensures successful authentication. 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 ApsaraDB for MongoDB
instance. For more information, see Configure a whitelist for a standalone ApsaraDB for MongoDB instance.
Note If you want to connect to the instance over the Internet, you must apply for a public endpoint. For more information, see Apply for a public endpoint for a sharded cluster instance.
Procedure
Common connection scenarios
- Connect to an ApsaraDB for MongoDB 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
- Connect an ECS instance with an ApsaraDB for MongoDB instance in another Alibaba Cloud account