A sharded cluster instance consists of Mongos, shard, and Configserver nodes. Typically, you need only to connect to the Mongos node to read and write data. In some special scenarios such as data synchronization between clusters, you must read the oplog of a shard node or the configuration information of a Configserver node. You can apply for a connection string of the corresponding node.
Prerequisites
Usage notes
- After you apply for a connection string, two connection strings are allocated to each node, one for the primary node and one for the secondary node.
- The network type of the connection strings must be the same as that of the current Mongos node.
- You cannot modify the connection string of a shard or Configserver node.
- The connection strings allocated here can only be used to access the node over the internal network. If you want to access the node over the Internet, you can apply for a public endpoint for a sharded cluster instance. For more information, see Apply for a public endpoint for a sharded cluster instance.
Introduction to the sharded cluster architecture and nodes
For more information, see Architecture of sharded cluster instances.
Procedure
Node types
After you apply for the connection string of a shard or Configserver node, you can view the connection string on the Database Connection page. The following table describes node types.
Node type | Description |
---|---|
Shard | The shard node. |
CS | The Configserver node. |
Mongos | The mongos node. |
References
If the connection string of a shard or Configserver node is no longer needed, you can Release the connection string of a shard or Configserver node.