NotMasterNoSlaveOk

After relaunching the server (following a DNS edit) the server logs say that the mongodb container is running but the mup-app:latest container is not and that container’s log says
=> Starting meteor app on port 3000
Exception in setInterval callback: MongoServerSelectionError: Server selection timed out after 30000 ms

Exception while invoking method ‘login’ MongoError: not master and slaveOk=false

  • What does this mean and how can I avoid it?
  • How can I inspect and rescue the content of the mongodb from the server?

I am trying to access the mongodb using Studio 3T with SSH tunnel with a user name with admin rights. What should I set in the T3 Server tab ( the docker container has been created with mup settings port 6000 in env and port 28017 in mongo)

What’s your Mongo URL looks like?

Not sure what you mean with Mongo URL. The Meteor app is assessesd through an https://subdomain.domain.eu.

Meanwhile I managed to access the MongoDB with Studio 3T through an SSH tunnel as standalone localhost with port 27017 and I could see the collections, but access gave the Mongo Query Exception

node is not in primary or recovering state

.

I mean this: Environment Variables | Meteor API Docs

From mup.js:
MONGO_URL: ‘mongodb://mongodb/meteor’,
MONGO_OPLOG_URL: ‘mongodb://mongodb/local’,

I managed to log into the mongodb docker container as root and run a mongo shell.
Running rs.slaveOk() had no effect.
Running rs.status() gave

"ok" : 0,
"errmsg" : "Our replica set config is invalid or we are not a member of it",
"code" : 93,
"codeName" : "InvalidReplicaSetConfig"

I also have the output of rs.config() which, among other infos, gives a replicaSetId but I don’t know, which of its fields might be helpful or how to proceed further.

I’m not sure but I had the semilar error before. But it’s when I try to read from the slave server but I haven’t enabled slaveOk. It looks like you’re trying to connect to a server member instead of connecting to the replica set.

I have enabled slaveOk but when I connect to replica set I get Prematurely reached end of stream. When I connect to the db as standalone I can see at least the collections and their metadata in Studio 3T. In this view, the database name is shown with the addition replica set.
The status message seems to indicate that the replica set configuration is broken, but I don’t know where to find and how to repair it.

I have executed slaveOk() and when I connect to a replica I get Prematurely reached end of stream while I see at least the available collections and their metadata when I connect as standalone. In the generated view Studio 3T shows the database name with the addition [replica set].
To me the rs.status() message looks as if the replica set configuration is broken, but I know neither where to find nor how to repair it.

Solved, following the second method in this link.

  1. logged into the server on which the app was running
  2. logged as root into the mongodb container
  3. got the mongo hostname from /etc/host in this container
  4. launched mongo shell - OTHER in the prompt indicated that Mongo wasn’t running as primary
  5. reset the hostname in the replica set as described in the link above
  6. restarted the server