Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

edX MongoDB connection error 111

Tags:

mongodb

edx

When I try to login to the edX Studio I always get a connection error:

ConnectionFailure at /home/
[Errno 111] Connection refused

Request Method: GET
Request URL: http://localhost:8001/home/
Django Version: 1.4.20
Exception Type: ConnectionFailure
Exception Value: [Errno 111] Connection refused

Exception Location: /edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/pymongo/mongo_client.py in __init__, line 369
Python Executable: /edx/app/edxapp/venvs/edxapp/bin/python
Python Version: 2.7.3

I've done my due diligence on Google and did the:

sudo rm /var/lib/mongodb/mongod.lock

sudo mongod --repair

sudo service mongodb start

and all it's variations and nothing did the trick.

Can somebody help me, please? Thanks for reading.

EDIT: The error occurs when I try to login to the edX Studio via: [email protected] edx

I get a login success message on the server but immediately after that I get that error.

like image 244
Vedran Avatar asked May 27 '15 10:05

Vedran


2 Answers

This did the trick:

sudo rm /edx/var/mongo/mongodb/mongod.lock
sudo -u mongodb mongod --dbpath /edx/var/mongo/mongodb --repair --repairpath /edx/var/mongo/mongodb
sudo start mongodb

I've got this from this site, many thanks to the author. In my case the last line was:

sudo start mongod

without the 'b' at the end.

Thanks everyone for your efforts!

UPDATE:

If you get this error sudo: /etc/init.d/mongod: command not found when running the script on Ubuntu 16.04. host, try this command:

sudo rm /edx/var/mongo/mongodb/mongod.lock && sudo mongod -repair --config /etc/mongod.conf && sudo chown -R mongodb:mongodb /edx/var/mongo/. && sudo systemctl start mongod.service

It's the same as the last one, except it's a one-liner and the last part is replaced with the systemctl start command.

like image 155
Vedran Avatar answered Nov 13 '22 13:11

Vedran


This set of commands solved my problem (similar to Vedran's solution):

sudo rm /edx/var/mongo/mongodb/mongod.lock
sudo mongod -repair --config /etc/mongod.conf
sudo chown -R mongodb:mongodb /edx/var/mongo/.
sudo service mongod start

This happens always when you shutdown your pc with the vagrant machine running. So my recommendation is to perform a 'vagrant halt' before shutting down your host machine.

like image 40
Ignacio Vazquez Avatar answered Nov 13 '22 14:11

Ignacio Vazquez