Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MongoDB "Connection refused" error

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.

like image 642
pratik-acharya Avatar asked Jun 14 '26 08:06

pratik-acharya


1 Answers

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

like image 129
DarkMukke Avatar answered Jun 16 '26 23:06

DarkMukke



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!