Search code examples
mongodbgomongo-gomongo-go-driver

how to resume Mongodb M0 Cluster?


MongoDB cluster(free) paused only after a couple hours of inactivity (as opposed to the stated 7 days for the free cluster).

I have tried to resume using mongosh and through my Go code but it still does not work. This is my second time encountering this issue, the first time I assumed it was a non-anachronistic error and terminated the cluster but now it does not look like it. i would love to find out a better way to handle this issue.

here are my error logs:

from the Go driver

server selection error: server selection timeout, current topology: { Type: ReplicaSetNoPrimary, Servers: [{ Addr: cluster[].mongodb.net:27017, Type: Unknown, Last error: connection() error occured during connection handshake: connection(cluster0-shard-00-00.r3cqf.mongodb.net) socket was unexpectedly closed: EOF }

from mongosh in terminal

MongoServerSelectionError: connection <monitor> to 32.65.3.208:27017 closed

Solution

  • After a couple hours of combing through the error logs, I realized my issue was authorization related.

    To fix this, navigate through the network/settings section of your Mongodb cluster and set the cluster to accept connection requests from your current IP -- mine had changed when I switched internet sources. You could also just set it to accept requests from all IP addresses by inputting 0.0.0.0 in the IP address field. Granted this is definitely not the best solution when working in prod but for now(on local machine), it'll do.