Document Database Service

Access instance error: no primary node

2025-07-29 02:41:46

Issue Description

An error is reported when the client connects to the DDS instance, and the connection command is as follows:

mongo "mongodb://<user>:<password>@<IP1:Port1>/admin?authSource=admin"

After the connection is successful, the error message for executing the command is:

"ok" : 0,
"errmsg" : "not master and slaveOk=false",
"code" : 13435,
"codeName" : "NotMasterNoSlaveOk",

Cause Issue

Possible reasons:

• An instance exception results in no Primary node.

• Client is only connected to the Secondary node.

Solution

  1. Log in to the DDS instance console, and check the running status of each node in the Basic Information page to confirm that the running status of each node is normal.

  2. Check the client connection command to make sure all mongod nodes are connected, and specify the replicaSet parameter.


nDwiiz9y6qvK