Sunday, January 2, 2022

[FIXED] MongoDB "Connection refused" error

Issue

I wanted to know what is the actual reason behind MongoDB "connection refused " error and How can we prevent this from happening.I am using ubuntu server.

I found that we can solve the problem after it has occured by:

sudo -u mongodb mongod --repair -dbpath /var/lib/mongodb
sudo start mongodb

I would like to know the way how can we stop it from occurring rather than solving it after it has occurred

The scenario is:

Mongodb is running well but after sometime I get this error .What I am doing in that span of time is I am continuously inserting data to that mongodb database in an interval of 1 minute.

I am using yii's yiiMongoDbsuite extension.The actual error thrown is.

EMongoDB failed to open connection: Failed to connect to: xx.xxx.xxx.xx:27017:
Connection refused

I would really appreciate if somebody helps me in this case.Thanks.


Solution

You might want to look if Journaling is turned on in your settings, for more information, please refer to this previously answered question

Restarting / Autorepairing Mongodb in Production



Answered By - DarkMukke

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.