This has been asked before, but I can't seem to get this resolved for me from other answers.
I am getting the following error when trying to run mongo on OSX Yosemite:
2015-11-27T11:50:51.644+0000 W NETWORK Failed to connect to 127.0.0.1:27017, reason: errno:61 Connection refused
2015-11-27T11:50:51.645+0000 E QUERY Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed
at connect (src/mongo/shell/mongo.js:179:14)
at (connect):1:6 at src/mongo/shell/mongo.js:179
I installed via brew.
People have mentioned a /data/db directory (which I can't find) and removing a mongo.lock file (which I can't find either).
I can see mongo files located at /usr/local/bin, but no lock files.
Thank you
I installed on my mac MongoDB few days ago. You can follow for this Link and complete all steps. It's quite easy to install MongoDB on mac.
Additional information :
Link, Failed to unlink socket file
I hope it will help you.
Thanks!
Related
I am trying to install MONGODB, followed a bunch of tutorials and haven't had luck. Prior to this, when I typed mongo in the terminal, it would say it wasn't found. However I stumbled upon https://www.mongodb.com/community/forums/t/unable-to-connect-to-mongo-shell-error-connecting-to-127-0-0-1-27017-caused-by-connection-refused-connect-src-mongo-shell-mongo-js13/89945/2 and copied
>mongo "mongodb://cluster0-shard-00-00-jxeqq.mongodb.net:27017,cluster0-shard-00-01-jxeqq.mongodb.net:27017,cluster0-shard-00-02-jxeqq.mongodb.net:27017/100YWeatherSmall?replicaSet=Cluster0-shard-0" --authenticationDatabase admin --ssl --username m001-student --password m001-mongodb-basics
into my terminal. I want to restart fresh and get rid of everything related to mongo. However, even after following the instructions from https://www.mongodb.com/basics/uninstall-mongodb for mac, I can't seem to restart fresh. I seem to get
MongoDB shell version v5.0.9
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect#src/mongo/shell/mongo.js:372:17
#(connect):2:6
exception: connect failed
exiting with code 1
My problem is that I am having trouble installing MongoDB and ended up blindly copying something. Now I can't seem to go back to the original message where after I type mongo, it would give the message saying it wasn't found. Instead, I get the message that I mentioned above. Any ideas on how to fix this? Thanks!
You may want to try these commands to repair and restart your mongodb server:
1) Remove .lock file
sudo rm /var/lib/mongodb/mongod.lock
2) repair the mongodb
mongod -–repair
3) start the mongod server
sudo service mongod start
4) start the mongo client
mongo
I am trying to start a MERN app, I have installed mongo and any relevant things. But when I run mongo in my terminal the following appears.
I have looked across the board but the solutions do not help me. I am also running on Ubuntu 20.04.
MongoDB shell version v4.4.3
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect#src/mongo/shell/mongo.js:374:17
#(connect):2:6
exception: connect failed
exiting with code 1
Fixed the issue by running
$ sudo rm -rf /tmp/mongodb-27017.sock
$ sudo service mongod start
Try to start the MongoDB server first running mongod command or from task manager>services> MongoDB server> right-click and start it
Read this Document for more
Sorry I have ask the same question again from Robo 3T Error : Network is unreachable
Beacause I really can't find out the file /etc/mongod.conf.
My machine is mac and use homebrew install mongodb.
There is no mongod.conf in my path /usr/local/var/mongodb.
Any help would be appreciated.
According suggestion the path /usr/local/opt/mongodb/mongod.conf
My /usr/local/opt like this:
Try brew uninstall mongo and brew install mongo.
Connect it still get the same error.
But find the file mongod.conf in the path /usr/local/etc.
I try to remove the file and restart mongodb server then type command mongo get the error:
MongoDB shell version v4.0.2
connecting to: mongodb://127.0.0.1:27017
2018-09-18T14:38:21.241+0800 E QUERY [js] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect#src/mongo/shell/mongo.js:257:13
#(connect):1:6
exception: connect failed
It is so strange...:(
You can create the mongod.conf at any folder on your Mac you like and pass the path to this file during the start of the Mongo DB server like:
mongod -f /path/to/mongod.conf
You have to create the mongod.conf manually e.g. on the desktop of your Mac. You can do this with the following commands.
Open a terminal
$ cd Desktop
$ touch mongod.conf
Then open the created (currently empty file) with a text editor of your choice and fill in your configurations (Here you can find a manual for the config file: https://docs.mongodb.com/manual/reference/configuration-options/)
Then start your Mongo DB server with
$ mongod -f /Users/YOUR_USERNAME/Desktop/mongod.conf
Please replace YOUR_USERNAME with your MacOs username you are currently working with
I am trying to install MangoDB. I have already installed the log and configure files. When I run mongo command in mongodb/bin directory, I receive the error messages:
mongo MongoDB shell version: 3.0.4, connecting to: test
W NETWORK Failed to connect to 127.0.0.1:27017, reason: errno:10061 No connection could be made because the target machine actively refused it.
Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1)
This is my mongod.cfg configure file; I don't know if it is correct.
logpath=C:\mongodb\log\mongo.log
dbpath=C:\mongodb\data
rest=true
Can anyone help? Thanks.
There are many more hurdles you can face during installation of mongodb. Installation of Mongodb is not as easy task I am also stuck with these issue for some time.the only option is to install mongodb step by step as described on Mongodb's official website.
Dont miss any step!.
here is the link http://docs.mongodb.org/manual/tutorial/install-mongodb-on-windows/
I'm running Ubuntu 14.04 on an AWS EC2 instance with Apache2. This morning I upgraded my Apache2 settings to allow multiple virtual servers following these instructions: https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-14-04-lts
Just now I tried to access my MongoDB instance, but I cannot do it either through the PHP MongoDB driver or through the shell. I get this error when attempting to connect with a PHP MongoClient():
Failed to connect to: localhost:27017: Connection refused'
and I get this error when trying to run the mongo shell:
2015-06-03T19:23:57.307+0000 W NETWORK Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
2015-06-03T19:23:57.308+0000 E QUERY Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed
at connect (src/mongo/shell/mongo.js:179:14)
at (connect):1:6 at src/mongo/shell/mongo.js:179
exception: connect failed
Everything was running fine just last night, and I haven't directly modified MongoDB settings. What can I do to fix this? How do Apache2 settings relate to MongoDB? I've been trying to look through the MongoDB docs, but I don't see anything that looks relevant.
You need to setup Security Group for your EC2 instance. And allow Inbound connection for the mongodb port, in your case 27017.
When I went through the logs, I saw a message that there was insufficient room for "journal file." I rebooted my AMI on an EC2 instance with more storage and reinstalled Mongo. That did the trick. I had uploaded a few files to the instance after updating my Apache2 settings, so those few more files must have pushed the instance past what Mongo could tolerate. Too bad the error message wasn't more helpful, but I should have checked the logs sooner. It would also be nice if the logs had a more explicit message.