All Products
Search
Document Center

ApsaraDB for MongoDB:Restart an instance, a component, or a node

Last Updated:Mar 28, 2026

Restart an ApsaraDB for MongoDB instance, component, or node to clear connection limits or resolve performance issues. All active connections drop during the restart, so make sure your application is configured to reconnect automatically before you proceed.

Limitations

  • You can restart components only on sharded cluster instances.

  • You can restart nodes only on instances that use cloud disks.

Understand the impact before restarting

Review the expected behavior for your restart scope before you proceed.

Instance restart behavior

Instance typeWhat happensPerformance note
Replica setAll active connections drop. Node roles (primary/secondary) may change. Processes typically restart within 30 seconds.If the instance has more than 10,000 collections, the mongod process can take several minutes to start. Keep collections at 10,000 or fewer. See the official MongoDB documentation for schema design guidance.
Sharded clusterShard nodes restart first (client connections are not dropped, but write operations may fail). Config Server nodes restart next (no service impact). Mongos nodes restart last, dropping all connections. Mongod and mongos processes typically restart within 30 seconds.Same 10,000-collection limit applies to mongod processes in shard nodes.

Component restart behavior (sharded cluster only)

ComponentConnection behaviorWrite operations
MongosAll connections to the Mongos node drop. Configure your application to reconnect automatically.Connections are dropped; ensure your application reconnects automatically.
ShardClient connections are not dropped.May fail during restart; retry as needed.

Node restart behavior

Node typeConnection behaviorWrite operations
Replica set nodeAll connections to that node drop. Node roles may change after restart.Write operations on the primary are unaffected unless a primary/secondary failover occurs.
Shard node (sharded cluster)Client connections are not dropped.May fail during restart; retry as needed.

Production recommendations

Use a high-availability (HA) connection string URI in production environments:

Restart an instance

  1. Log on to the ApsaraDB for MongoDB console.

  2. In the left navigation pane, click Replica Set Instances or Sharded Cluster Instances based on the instance type.

  3. At the top of the page, select the resource group and region where the instance is located.

  4. In the Actions column for the target instance, click More > Restart.

  5. In the Restart Instance dialog box, click OK.

The instance status changes to Rebooting. When the status returns to Running, the restart is complete.

Restart a component

Note

This operation applies to sharded cluster instances only.

  1. Go to the Sharded Cluster Instances page. At the top of the page, select the resource group and region, then click the ID of the target instance.

  2. In the Mongos List or Shard List area, find the component to restart and click Restart in the Actions column.

  3. In the Restart Node dialog box, click OK.

The instance status changes to Rebooting. When the status returns to Running, the component restart is complete.

Restart a node

  1. Go to the Replica Set Instances page or the Sharded Cluster Instances page. At the top of the page, select the resource group and region, then click the ID of the target instance.

  2. In the left navigation pane of the instance details page, click Service Availability.

  3. Find the node to restart and click Restart Node in the Actions column.

  4. In the Restart Node dialog box, click OK.

The instance status changes to Restarting Node. When the status returns to Running, the node restart is complete.

FAQ

What is the restart sequence for a replica set instance, and what is affected at each stage?

The system restarts nodes in this order:

  1. Hidden node — No impact on your service.

  2. Secondary and read-only nodes — All connections to these nodes drop; your client must reconnect. Write operations are unaffected because the primary remains available. Read operations using readPreference=Secondary are temporarily affected. If the instance has multiple read-only nodes, read traffic shifts to another available read-only node while one is restarting. Read operations using readPreference=secondary&readPreferenceTags=role:readonly are affected for that node.

  3. Primary/secondary failover — A transient disconnection of about 30 seconds occurs. If your application connects to the primary node address directly, write operations may fail during this window.

  4. Former primary node (now secondary) — Same behavior as restarting a secondary node.

What is the restart sequence for a sharded cluster instance, and what is affected at each stage?

The system restarts components in this order:

  1. Shard nodes — Restarted in parallel. Client connections are not dropped, but write operations may fail. Retry any failed write operations.

  2. Config Server nodes — No impact on your service.

  3. Mongos nodes — Restarted in parallel. All connections to these nodes drop. Configure your application to reconnect automatically.

What's next