10 / 10
Apr 2022

I’ve installed MongoDB through my terminal using Homebrew. I did all the correct steps listed on their website. I get many errors when running mongod and mongo .

When I run mongod

{"t":{"$date":"2020-09-20T18:35:56.680-05:00"},"s":"I", "c":"CONTROL", "id":23285, "ctx":"main","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"} {"t":{"$date":"2020-09-20T18:35:56.690-05:00"},"s":"W", "c":"ASIO", "id":22601, "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"} {"t":{"$date":"2020-09-20T18:35:56.691-05:00"},"s":"I", "c":"NETWORK", "id":4648602, "ctx":"main","msg":"Implicit TCP FastOpen in use."} {"t":{"$date":"2020-09-20T18:35:56.694-05:00"},"s":"I", "c":"STORAGE", "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":43856,"port":27017,"dbPath":"/data/db","architecture":"64-bit","host":"Isaacs-MacBook-Air.local"}} {"t":{"$date":"2020-09-20T18:35:56.694-05:00"},"s":"I", "c":"CONTROL", "id":23403, "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"4.4.0","gitVersion":"563487e100c4215e2dce98d0af2a6a5a2d67c5cf","modules":[],"allocator":"system","environment":{"distarch":"x86_64","target_arch":"x86_64"}}}} {"t":{"$date":"2020-09-20T18:35:56.694-05:00"},"s":"I", "c":"CONTROL", "id":51765, "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Mac OS X","version":"19.5.0"}}} {"t":{"$date":"2020-09-20T18:35:56.694-05:00"},"s":"I", "c":"CONTROL", "id":21951, "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{}}} {"t":{"$date":"2020-09-20T18:35:56.696-05:00"},"s":"E", "c":"NETWORK", "id":23024, "ctx":"initandlisten","msg":"Failed to unlink socket file","attr":{"path":"/tmp/mongodb-27017.sock","error":"Permission denied"}} {"t":{"$date":"2020-09-20T18:35:56.696-05:00"},"s":"F", "c":"-", "id":23091, "ctx":"initandlisten","msg":"Fatal assertion","attr":{"msgid":40486,"file":"src/mongo/transport/transport_layer_asio.cpp","line":919}} {"t":{"$date":"2020-09-20T18:35:56.696-05:00"},"s":"F", "c":"-", "id":23092, "ctx":"initandlisten","msg":"\n\n***aborting after fassert() failure\n\n"}

When I run mongo :

MongoDB shell version v4.4.0 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:362:17 @(connect):2:6 exception: connect failed exiting with code 1

Hi @Isaac_Medina,

It looks like a permissions problem:

file","attr":{"path":"/tmp/mongodb-27017.sock","error":"Permission Denied

Is a mongod already running or the user running the process can’t unlink this file.

Have you tried running with sudo…

Best
Pavel

2 years later

see if your mongo instance is up and running

use command “sudo systemctl status mongodb”

you should get a prompt for your admin password

then you should get read out

  • under “Active:” you should see a “active (running)” in green if your instance process is working with a date and time that it was running for.

if that’s green open a new tab and type mongo

if it’s red, and you have only just set it up best to remove mongo and reinstall again
or you can try sudo systemctl start command on the mongo service

hopefully this helps.

The error message (the line with "s":"E") indicates that the file /tmp/mongodb-27917.sock cannot be removed (cannot unlink).

It means that it is own by a user other than the current user. Most likely a previous version was started as root. May be it is still running. Check that before using sudo to remove the file.

Do not

to check the status of mongod when you start mongod manually like you did.

To see if the socket is still being listen to, use

ss -tlnp | grep [2]7017

To see if a mongod is running, use

ps -aef | gre[ [m]ongod

Both commands might be different on MacOS.

You did not get an error for it, but I was under the impression that you could not use /data/db for mongod on MacOS.

On Macos access to root folder is removed.Thats why you get read only filesystem message
There is a difference between /data/db and ~/data/db

Your first command was correct.It says dir exists
Your data/db exists under your home dir
So include the full path in your config file

When you run just mongod without any params it starts mongod on default port and default dirpath /data/db.Since no access to /data/db(read only) it failed to start

You should not run mongod without any params
I already explained above
You second command with config file seems to work as no error
check ps -ef|grep mongod
Did you try to connect to your mongod?