Constant mongodb-community error 3584

Hello everrybody, I’m new here.
I’m trying to learn how to use MongoDB with Mongo Community / Compass, but even if I followed the installation process, I have / had a constant error:

mongodb-community error 3584 root ~/Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist

I checked my /usr/local/var/log/mongodb/ folder for the log file, and I find a lot of different files:

mongo.log                     mongo.log.2022-10-24T09-42-06 mongo.log.2022-10-24T09-48-09 mongo.log.2022-10-24T10-01-22
mongo.log.2022-10-24T09-40-55 mongo.log.2022-10-24T09-47-32 mongo.log.2022-10-24T09-49-12 mongo.log.2022-10-24T10-02-49
mongo.log.2022-10-24T09-41-59 mongo.log.2022-10-24T09-47-44 mongo.log.2022-10-24T10-01-12 mongod.conf

Yes, I’ve tried more times to this and everytime this occurs.

mongo.log

{"t":{"$date":"2022-10-24T12:02:49.563+02:00"},"s":"I",  "c":"NETWORK",  "id":4915701, "ctx":"-","msg":"Initialized wire specification","attr":{"spec":{"incomingExternalClient":{"minWireVersion":0,"maxWireVersion":17},"incomingInternalClient":{"minWireVersion":0,"maxWireVersion":17},"outgoing":{"minWireVersion":6,"maxWireVersion":17},"isInternalClient":true}}}
{"t":{"$date":"2022-10-24T12:02:49.565+02:00"},"s":"I",  "c":"CONTROL",  "id":23285,   "ctx":"thread1","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
{"t":{"$date":"2022-10-24T12:02:49.566+02:00"},"s":"I",  "c":"NETWORK",  "id":4648602, "ctx":"thread1","msg":"Implicit TCP FastOpen in use."}
{"t":{"$date":"2022-10-24T12:02:49.566+02:00"},"s":"I",  "c":"REPL",     "id":5123008, "ctx":"thread1","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationDonorService","namespace":"config.tenantMigrationDonors"}}
{"t":{"$date":"2022-10-24T12:02:49.567+02:00"},"s":"I",  "c":"REPL",     "id":5123008, "ctx":"thread1","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationRecipientService","namespace":"config.tenantMigrationRecipients"}}
{"t":{"$date":"2022-10-24T12:02:49.567+02:00"},"s":"I",  "c":"REPL",     "id":5123008, "ctx":"thread1","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"ShardSplitDonorService","namespace":"config.tenantSplitDonors"}}
{"t":{"$date":"2022-10-24T12:02:49.567+02:00"},"s":"I",  "c":"CONTROL",  "id":5945603, "ctx":"thread1","msg":"Multi threading initialized"}
{"t":{"$date":"2022-10-24T12:02:49.567+02:00"},"s":"I",  "c":"CONTROL",  "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":25973,"port":27017,"dbPath":"/usr/local/var/mongodb","architecture":"64-bit","host":"AndreaAir.local"}}
{"t":{"$date":"2022-10-24T12:02:49.567+02:00"},"s":"I",  "c":"CONTROL",  "id":23352,   "ctx":"initandlisten","msg":"Unable to resolve sysctl {sysctlName} (number) ","attr":{"sysctlName":"hw.cpufrequency"}}
{"t":{"$date":"2022-10-24T12:02:49.567+02:00"},"s":"I",  "c":"CONTROL",  "id":23351,   "ctx":"initandlisten","msg":"{sysctlName} unavailable","attr":{"sysctlName":"machdep.cpu.features"}}
{"t":{"$date":"2022-10-24T12:02:49.568+02:00"},"s":"I",  "c":"CONTROL",  "id":23403,   "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"6.0.2","gitVersion":"94fb7dfc8b974f1f5343e7ea394d0d9deedba50e","modules":[],"allocator":"system","environment":{"distarch":"aarch64","target_arch":"aarch64"}}}}
{"t":{"$date":"2022-10-24T12:02:49.568+02:00"},"s":"I",  "c":"CONTROL",  "id":51765,   "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Mac OS X","version":"21.6.0"}}}
{"t":{"$date":"2022-10-24T12:02:49.568+02:00"},"s":"I",  "c":"CONTROL",  "id":21951,   "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{"processManagement":{"fork":true},"storage":{"dbPath":"/usr/local/var/mongodb"},"systemLog":{"destination":"file","path":"/usr/local/var/log/mongodb/mongo.log"}}}}
{"t":{"$date":"2022-10-24T12:02:49.568+02: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":"2022-10-24T12:02:49.568+02:00"},"s":"F",  "c":"ASSERT",   "id":23091,   "ctx":"initandlisten","msg":"Fatal assertion","attr":{"msgid":40486,"file":"src/mongo/transport/transport_layer_asio.cpp","line":1125}}
{"t":{"$date":"2022-10-24T12:02:49.568+02:00"},"s":"F",  "c":"ASSERT",   "id":23092,   "ctx":"initandlisten","msg":"\n\n***aborting after fassert() failure\n\n"}

mongo.conf

processManagement:
   fork: true
net:
   bindIp: localhost
   port: 27017
storage:
   dbPath: /var/lib/mongo
systemLog:
   destination: file
   path: "/var/log/mongodb/mongod.log"
   logAppend: true
storage:
   journal:
      enabled: true

Currently I literally do not understand how this works, since even uninstalling everything take me to the same error. Also, I’ve tried most of the solutions here, so I do not know what to do.

FYI: I’m using a MacBook Air (M1, 2020), Monterey 12.6

Thank you in advance for the help!

There are many reasons for this. You will find one that fits your situation by reading
https://www.mongodb.com/community/forums/search?q=Failed%20to%20unlink%20socket%20file

Hi! That was helpful to understand how to move between different cases but still nothing works.
I cannot understand how to read the log file to check where is the issue (and obv how to solve it)

The search string I provided was

which is the error you have. Log entries with

are errors and line with

are fatal.

Often the error gives more clue about the issue compared to the following fatals. In your case, the

already exists is needed to start mongod. However you do not have the permission to remove it as expressed by

Here you have a choice

  1. you do the safest thing and you read carefully the threads that the search I provided gives you

OR at your own risk

  1. become root user and delete the file /tmp/mongodb-27017.sock

Thank you for the help. I’ve done the unsafe option and I still get the same error.
mongod looks like this at the moment:

{"t":{"$date":"2022-12-12T09:03:00.813+01:00"},"s":"I",  "c":"CONTROL",  "id":23285,   "ctx":"-","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
{"t":{"$date":"2022-12-12T09:03:00.813+01:00"},"s":"I",  "c":"NETWORK",  "id":4915701, "ctx":"-","msg":"Initialized wire specification","attr":{"spec":{"incomingExternalClient":{"minWireVersion":0,"maxWireVersion":17},"incomingInternalClient":{"minWireVersion":0,"maxWireVersion":17},"outgoing":{"minWireVersion":6,"maxWireVersion":17},"isInternalClient":true}}}
{"t":{"$date":"2022-12-12T09:03:00.818+01:00"},"s":"I",  "c":"NETWORK",  "id":4648602, "ctx":"main","msg":"Implicit TCP FastOpen in use."}
{"t":{"$date":"2022-12-12T09:03:00.819+01:00"},"s":"I",  "c":"REPL",     "id":5123008, "ctx":"main","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationDonorService","namespace":"config.tenantMigrationDonors"}}
{"t":{"$date":"2022-12-12T09:03:00.819+01:00"},"s":"I",  "c":"REPL",     "id":5123008, "ctx":"main","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationRecipientService","namespace":"config.tenantMigrationRecipients"}}
{"t":{"$date":"2022-12-12T09:03:00.819+01:00"},"s":"I",  "c":"REPL",     "id":5123008, "ctx":"main","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"ShardSplitDonorService","namespace":"config.tenantSplitDonors"}}
{"t":{"$date":"2022-12-12T09:03:00.819+01:00"},"s":"I",  "c":"CONTROL",  "id":5945603, "ctx":"main","msg":"Multi threading initialized"}
{"t":{"$date":"2022-12-12T09:03:00.819+01:00"},"s":"I",  "c":"CONTROL",  "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":20677,"port":27017,"dbPath":"/data/db","architecture":"64-bit","host":"AndreaAir.LocalDomain"}}
{"t":{"$date":"2022-12-12T09:03:00.819+01:00"},"s":"I",  "c":"CONTROL",  "id":23352,   "ctx":"initandlisten","msg":"Unable to resolve sysctl {sysctlName} (number) ","attr":{"sysctlName":"hw.cpufrequency"}}
{"t":{"$date":"2022-12-12T09:03:00.819+01:00"},"s":"I",  "c":"CONTROL",  "id":23351,   "ctx":"initandlisten","msg":"{sysctlName} unavailable","attr":{"sysctlName":"machdep.cpu.features"}}
{"t":{"$date":"2022-12-12T09:03:00.819+01:00"},"s":"I",  "c":"CONTROL",  "id":23403,   "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"6.0.1","gitVersion":"32f0f9c88dc44a2c8073a5bd47cf779d4bfdee6b","modules":[],"allocator":"system","environment":{"distarch":"aarch64","target_arch":"aarch64"}}}}
{"t":{"$date":"2022-12-12T09:03:00.819+01:00"},"s":"I",  "c":"CONTROL",  "id":51765,   "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Mac OS X","version":"21.6.0"}}}
{"t":{"$date":"2022-12-12T09:03:00.819+01:00"},"s":"I",  "c":"CONTROL",  "id":21951,   "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{}}}
{"t":{"$date":"2022-12-12T09:03:00.820+01:00"},"s":"I",  "c":"NETWORK",  "id":5693100, "ctx":"initandlisten","msg":"Asio socket.set_option failed with std::system_error","attr":{"note":"acceptor TCP fast open","option":{"level":6,"name":261,"data":"00 04 00 00"},"error":{"what":"set_option: Invalid argument","message":"Invalid argument","category":"asio.system","value":22}}}
{"t":{"$date":"2022-12-12T09:03:00.820+01:00"},"s":"E",  "c":"CONTROL",  "id":20557,   "ctx":"initandlisten","msg":"DBException in initAndListen, terminating","attr":{"error":"NonExistentPath: Data directory /data/db not found. Create the missing directory or specify another path using (1) the --dbpath command line option, or (2) by adding the 'storage.dbPath' option in the configuration file."}}
{"t":{"$date":"2022-12-12T09:03:00.820+01:00"},"s":"I",  "c":"REPL",     "id":4784900, "ctx":"initandlisten","msg":"Stepping down the ReplicationCoordinator for shutdown","attr":{"waitTimeMillis":15000}}
{"t":{"$date":"2022-12-12T09:03:00.821+01:00"},"s":"I",  "c":"REPL",     "id":4794602, "ctx":"initandlisten","msg":"Attempting to enter quiesce mode"}
{"t":{"$date":"2022-12-12T09:03:00.821+01:00"},"s":"I",  "c":"-",        "id":6371601, "ctx":"initandlisten","msg":"Shutting down the FLE Crud thread pool"}
{"t":{"$date":"2022-12-12T09:03:00.821+01:00"},"s":"I",  "c":"COMMAND",  "id":4784901, "ctx":"initandlisten","msg":"Shutting down the MirrorMaestro"}
{"t":{"$date":"2022-12-12T09:03:00.821+01:00"},"s":"I",  "c":"SHARDING", "id":4784902, "ctx":"initandlisten","msg":"Shutting down the WaitForMajorityService"}
{"t":{"$date":"2022-12-12T09:03:00.821+01:00"},"s":"I",  "c":"NETWORK",  "id":20562,   "ctx":"initandlisten","msg":"Shutdown: going to close listening sockets"}
{"t":{"$date":"2022-12-12T09:03:00.821+01:00"},"s":"I",  "c":"NETWORK",  "id":4784905, "ctx":"initandlisten","msg":"Shutting down the global connection pool"}
{"t":{"$date":"2022-12-12T09:03:00.821+01:00"},"s":"I",  "c":"CONTROL",  "id":4784906, "ctx":"initandlisten","msg":"Shutting down the FlowControlTicketholder"}
{"t":{"$date":"2022-12-12T09:03:00.821+01:00"},"s":"I",  "c":"-",        "id":20520,   "ctx":"initandlisten","msg":"Stopping further Flow Control ticket acquisitions."}
{"t":{"$date":"2022-12-12T09:03:00.821+01:00"},"s":"I",  "c":"NETWORK",  "id":4784918, "ctx":"initandlisten","msg":"Shutting down the ReplicaSetMonitor"}
{"t":{"$date":"2022-12-12T09:03:00.821+01:00"},"s":"I",  "c":"SHARDING", "id":4784921, "ctx":"initandlisten","msg":"Shutting down the MigrationUtilExecutor"}
{"t":{"$date":"2022-12-12T09:03:00.821+01:00"},"s":"I",  "c":"ASIO",     "id":22582,   "ctx":"MigrationUtil-TaskExecutor","msg":"Killing all outstanding egress activity."}
{"t":{"$date":"2022-12-12T09:03:00.821+01:00"},"s":"I",  "c":"COMMAND",  "id":4784923, "ctx":"initandlisten","msg":"Shutting down the ServiceEntryPoint"}
{"t":{"$date":"2022-12-12T09:03:00.821+01:00"},"s":"I",  "c":"CONTROL",  "id":4784925, "ctx":"initandlisten","msg":"Shutting down free monitoring"}
{"t":{"$date":"2022-12-12T09:03:00.821+01:00"},"s":"I",  "c":"CONTROL",  "id":4784927, "ctx":"initandlisten","msg":"Shutting down the HealthLog"}
{"t":{"$date":"2022-12-12T09:03:00.821+01:00"},"s":"I",  "c":"CONTROL",  "id":4784928, "ctx":"initandlisten","msg":"Shutting down the TTL monitor"}
{"t":{"$date":"2022-12-12T09:03:00.821+01:00"},"s":"I",  "c":"CONTROL",  "id":6278511, "ctx":"initandlisten","msg":"Shutting down the Change Stream Expired Pre-images Remover"}
{"t":{"$date":"2022-12-12T09:03:00.821+01:00"},"s":"I",  "c":"CONTROL",  "id":4784929, "ctx":"initandlisten","msg":"Acquiring the global lock for shutdown"}
{"t":{"$date":"2022-12-12T09:03:00.821+01:00"},"s":"I",  "c":"-",        "id":4784931, "ctx":"initandlisten","msg":"Dropping the scope cache for shutdown"}
{"t":{"$date":"2022-12-12T09:03:00.821+01:00"},"s":"I",  "c":"CONTROL",  "id":20565,   "ctx":"initandlisten","msg":"Now exiting"}
{"t":{"$date":"2022-12-12T09:03:00.821+01:00"},"s":"I",  "c":"CONTROL",  "id":23138,   "ctx":"initandlisten","msg":"Shutting down","attr":{"exitCode":100}}

What other issue could be?
I see some things here that are not ok, such as:

{"t":{"$date":"2022-12-12T09:03:00.819+01:00"},"s":"I",  "c":"CONTROL",  "id":23352,   "ctx":"initandlisten","msg":"Unable to resolve sysctl {sysctlName} (number) ","attr":{"sysctlName":"hw.cpufrequency"}}
{"t":{"$date":"2022-12-12T09:03:00.819+01:00"},"s":"I",  "c":"CONTROL",  "id":23351,   "ctx":"initandlisten","msg":"{sysctlName} unavailable","attr":{"sysctlName":"machdep.cpu.features"}}

or

{"t":{"$date":"2022-12-12T09:03:00.820+01:00"},"s":"I",  "c":"NETWORK",  "id":5693100, "ctx":"initandlisten","msg":"Asio socket.set_option failed with std::system_error","attr":{"note":"acceptor TCP fast open","option":{"level":6,"name":261,"data":"00 04 00 00"},"error":{"what":"set_option: Invalid argument","message":"Invalid argument","category":"asio.system","value":22}}}

Thank you again for the availability.

How did you start your mongod?
Your earlier post shows dbpath is under /var/lib but now it is looking for /data/db

After removing TMP file you are suppose to start mongod as service which uses the standard config file

It is not

As mentioned earlier, error are lines marked with

Your original error was

now your error is

You could search the forum for a more detailed explanation but the condition that causes the error is:

Data directory /data/db not found.

and two solutions

  1. Create the missing directory
    or
  2. specify another path

are provided as part of error message.

As mentioned

and you posted the configuration and you used it when you started mongod as we can see by the informational message (log lines with “s”:“I”) in your first post

Now in your latest post you have

which indicates that you started mongod by simply typing the command mongod (which does not use the configuration file you shared) rather than

And about

the messages are marked as “s”:“I” so they are informational and do not stop mongod from starting.

Yep, sorry for that, I share to you different files without realising it.
I’ll try what you mentioned, and I’ll keep you posted about my issue. Thanks!

Hi! Since I’m still new and I cannot find anything online, how you do this?

What method you followed to install Mongodb on Macos?
Check this link

I used the homebrew’s method, considering also M1 processor

So did you try brew start,brew list,brew status etc
You can start mongod from command line also but give different dbpath,logpath,port to avoid clash with default mongod which comes up on port 27017
If you run just mongod without any params it will try to start mongod on port 27017 and default dirpath /data/db
In your case it failed because /data/db not existing
As suggested by Steve you have to create the missing directory but even that will not work as Macos removed access to root dir
If you attempt to create the /data/db dir it will say read only file
So best thing is start from brew services
If that does not work you can start it from command line
mongo --port 29000 --dbpath your_homedir --logpath your_homedir/mongod.log --fork
Once it is up connect as below
mongo --port 29000

1 Like

Ok. I started:

brew services start mongodb/brew/mongodb-community

Then, you said:

Does it mean that the corresponding code is brew services start mongod or what?
This command returned:

Error: No available formula with the name "mongod". Did you mean mono or mongosh?

Therefore:

returned me

zsh: command not found: mongo

I tried with and without starting mongodb-cmmunity!

From the documentation provided by Ramachandra_Tummala the following is wrong.

The correct way is documented:

I missed d in mongod
mongod is used to start a mongod instance
mongo/mongosh is used to connect to a mongod instance
Regarding the mongo not found error you must be having mongosh with latest version of mongodb indtallation.Thats why it says mongo not found
So after mongod is up try to connect as
mongosh --port 29000
Did you try to start the service with correct command as per doc?

Ok, now mongosh and mongod in port 29000 started! But still, calling

brew services list

gives me

mongodb-community error  3584 root ~/Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist

At least mongosh and mongo compass seem to work, even if I’m still wrapping my head around this mongodb community error

Brew list will show only those which are started by brew start

What you started is your own mongod from command line which can be checked by ps -ef|grep mongo

What is the result of brew service start@ver_num as per doc?

Please read documentation on how many ways we can start mongod and what is default mongod
Looks like you are getting confused

Yea, sorry for that, as I said before I’m extremely new to this. I’ll read the documentation. Thanks!

Hello everyone, I am really driving my self crazy with this topic. I read the entire thread and I couldn’t resolve this annoying error 3584.
I installed mongodb using homebrew, I have a M1 Mac Studio, and the current version of mongodb is this one:

mongod --version
db version v7.0.0
Build Info: {
    "version": "7.0.0",
    "gitVersion": "37d84072b5c5b9fd723db5fa133fb202ad2317f1",
    "modules": [],
    "allocator": "system",
    "environment": {
        "distarch": "aarch64",
        "target_arch": "aarch64"
    }
}

If I check brew services, that’s what I got.

brew services list

Let’s check my mongod.conf file:

systemLog:
  destination: file
  path: /opt/homebrew/var/log/mongodb/mongo.log
  logAppend: true
storage:
  dbPath: /opt/homebrew/var/mongodb
net:
  bindIp: 127.0.0.1, ::1
  ipv6: true

The folder for the dbPath and logs are there, I mean, they exist, and I have permission to write on those folders.
If I run the command, mongd, that’s what I got:

{"t":{"$date":"2023-08-21T20:46:57.561-04:00"},"s":"I",  "c":"CONTROL",  "id":23285,   "ctx":"thread1","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
{"t":{"$date":"2023-08-21T20:46:57.562-04:00"},"s":"I",  "c":"NETWORK",  "id":4915701, "ctx":"thread1","msg":"Initialized wire specification","attr":{"spec":{"incomingExternalClient":{"minWireVersion":0,"maxWireVersion":21},"incomingInternalClient":{"minWireVersion":0,"maxWireVersion":21},"outgoing":{"minWireVersion":6,"maxWireVersion":21},"isInternalClient":true}}}
{"t":{"$date":"2023-08-21T20:46:57.575-04:00"},"s":"I",  "c":"NETWORK",  "id":4648602, "ctx":"thread1","msg":"Implicit TCP FastOpen in use."}
{"t":{"$date":"2023-08-21T20:46:57.579-04:00"},"s":"I",  "c":"REPL",     "id":5123008, "ctx":"thread1","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationDonorService","namespace":"config.tenantMigrationDonors"}}
{"t":{"$date":"2023-08-21T20:46:57.579-04:00"},"s":"I",  "c":"REPL",     "id":5123008, "ctx":"thread1","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationRecipientService","namespace":"config.tenantMigrationRecipients"}}
{"t":{"$date":"2023-08-21T20:46:57.579-04:00"},"s":"I",  "c":"CONTROL",  "id":5945603, "ctx":"thread1","msg":"Multi threading initialized"}
{"t":{"$date":"2023-08-21T20:46:57.579-04:00"},"s":"I",  "c":"TENANT_M", "id":7091600, "ctx":"thread1","msg":"Starting TenantMigrationAccessBlockerRegistry"}
{"t":{"$date":"2023-08-21T20:46:57.579-04:00"},"s":"I",  "c":"CONTROL",  "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":5046,"port":27017,"dbPath":"/data/db","architecture":"64-bit","host":"Mac-Studio-de-Juancho.local"}}
{"t":{"$date":"2023-08-21T20:46:57.579-04:00"},"s":"I",  "c":"CONTROL",  "id":23403,   "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"7.0.0","gitVersion":"37d84072b5c5b9fd723db5fa133fb202ad2317f1","modules":[],"allocator":"system","environment":{"distarch":"aarch64","target_arch":"aarch64"}}}}
{"t":{"$date":"2023-08-21T20:46:57.579-04:00"},"s":"I",  "c":"CONTROL",  "id":51765,   "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Mac OS X","version":"22.6.0"}}}
{"t":{"$date":"2023-08-21T20:46:57.579-04:00"},"s":"I",  "c":"CONTROL",  "id":21951,   "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{}}}
{"t":{"$date":"2023-08-21T20:46:57.581-04:00"},"s":"I",  "c":"NETWORK",  "id":5693100, "ctx":"initandlisten","msg":"Asio socket.set_option failed with std::system_error","attr":{"note":"acceptor TCP fast open","option":{"level":6,"name":261,"data":"00 04 00 00"},"error":{"what":"set_option: Invalid argument","message":"Invalid argument","category":"asio.system","value":22}}}
{"t":{"$date":"2023-08-21T20:46:57.582-04:00"},"s":"E",  "c":"CONTROL",  "id":20557,   "ctx":"initandlisten","msg":"DBException in initAndListen, terminating","attr":{"error":"NonExistentPath: Data directory /data/db not found. Create the missing directory or specify another path using (1) the --dbpath command line option, or (2) by adding the 'storage.dbPath' option in the configuration file."}}
{"t":{"$date":"2023-08-21T20:46:57.582-04:00"},"s":"I",  "c":"REPL",     "id":4784900, "ctx":"initandlisten","msg":"Stepping down the ReplicationCoordinator for shutdown","attr":{"waitTimeMillis":15000}}
{"t":{"$date":"2023-08-21T20:46:57.583-04:00"},"s":"I",  "c":"REPL",     "id":4794602, "ctx":"initandlisten","msg":"Attempting to enter quiesce mode"}
{"t":{"$date":"2023-08-21T20:46:57.583-04:00"},"s":"I",  "c":"-",        "id":6371601, "ctx":"initandlisten","msg":"Shutting down the FLE Crud thread pool"}
{"t":{"$date":"2023-08-21T20:46:57.583-04:00"},"s":"I",  "c":"COMMAND",  "id":4784901, "ctx":"initandlisten","msg":"Shutting down the MirrorMaestro"}
{"t":{"$date":"2023-08-21T20:46:57.583-04:00"},"s":"I",  "c":"SHARDING", "id":4784902, "ctx":"initandlisten","msg":"Shutting down the WaitForMajorityService"}
{"t":{"$date":"2023-08-21T20:46:57.583-04:00"},"s":"I",  "c":"NETWORK",  "id":20562,   "ctx":"initandlisten","msg":"Shutdown: going to close listening sockets"}
{"t":{"$date":"2023-08-21T20:46:57.583-04:00"},"s":"I",  "c":"NETWORK",  "id":4784905, "ctx":"initandlisten","msg":"Shutting down the global connection pool"}
{"t":{"$date":"2023-08-21T20:46:57.583-04:00"},"s":"I",  "c":"CONTROL",  "id":4784906, "ctx":"initandlisten","msg":"Shutting down the FlowControlTicketholder"}
{"t":{"$date":"2023-08-21T20:46:57.583-04:00"},"s":"I",  "c":"-",        "id":20520,   "ctx":"initandlisten","msg":"Stopping further Flow Control ticket acquisitions."}
{"t":{"$date":"2023-08-21T20:46:57.583-04:00"},"s":"I",  "c":"NETWORK",  "id":4784918, "ctx":"initandlisten","msg":"Shutting down the ReplicaSetMonitor"}
{"t":{"$date":"2023-08-21T20:46:57.583-04:00"},"s":"I",  "c":"SHARDING", "id":4784921, "ctx":"initandlisten","msg":"Shutting down the MigrationUtilExecutor"}
{"t":{"$date":"2023-08-21T20:46:57.583-04:00"},"s":"I",  "c":"ASIO",     "id":22582,   "ctx":"MigrationUtil-TaskExecutor","msg":"Killing all outstanding egress activity."}
{"t":{"$date":"2023-08-21T20:46:57.583-04:00"},"s":"I",  "c":"COMMAND",  "id":4784923, "ctx":"initandlisten","msg":"Shutting down the ServiceEntryPoint"}
{"t":{"$date":"2023-08-21T20:46:57.583-04:00"},"s":"I",  "c":"CONTROL",  "id":4784925, "ctx":"initandlisten","msg":"Shutting down free monitoring"}
{"t":{"$date":"2023-08-21T20:46:57.583-04:00"},"s":"I",  "c":"CONTROL",  "id":4784928, "ctx":"initandlisten","msg":"Shutting down the TTL monitor"}
{"t":{"$date":"2023-08-21T20:46:57.583-04:00"},"s":"I",  "c":"CONTROL",  "id":6278511, "ctx":"initandlisten","msg":"Shutting down the Change Stream Expired Pre-images Remover"}
{"t":{"$date":"2023-08-21T20:46:57.583-04:00"},"s":"I",  "c":"CONTROL",  "id":4784929, "ctx":"initandlisten","msg":"Acquiring the global lock for shutdown"}
{"t":{"$date":"2023-08-21T20:46:57.583-04:00"},"s":"I",  "c":"-",        "id":4784931, "ctx":"initandlisten","msg":"Dropping the scope cache for shutdown"}
{"t":{"$date":"2023-08-21T20:46:57.583-04:00"},"s":"I",  "c":"CONTROL",  "id":20565,   "ctx":"initandlisten","msg":"Now exiting"}
{"t":{"$date":"2023-08-21T20:46:57.583-04:00"},"s":"I",  "c":"CONTROL",  "id":23138,   "ctx":"initandlisten","msg":"Shutting down","attr":{"exitCode":100}}

If you see in that log, it says:

NonExistentPath: Data directory /data/db not found. Create the missing directory or specify another path using (1) the --dbpath command line option, or (2) by adding the 'storage.dbPath' option in the configuration file.

But as mentioned before, the mongodb.conf file is pointing the database to be stored in a different location, plus I can’t create the /data/db folder as it complains with the following error:

mkdir -p /data/db
mkdir: /data: Read-only file system

I have done the following:

  • Restarted the services with brew services restart mongodb-community
  • I have uninstall it and reinstall it with no success
  • I have notice that this problem began after installing postgres, but I uninstall postgres, uninstall mongodb, install mongodb again and the problem persist.

I have also run the following script, to start the services without homebrew, but I got this error:

mongod --config /opt/homebrew/etc/mongod.conf --fork
about to fork child process, waiting until server is ready for connections.
forked process: 5225
ERROR: child process failed, exited with 1
To see additional information in this output, start without the "--fork" option.

I tried without --fork but the terminal does not show an output.
The homebrew.mxcl.mongodb-community.plist looks ok to me:

cat homebrew.mxcl.mongodb-community.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>homebrew.mxcl.mongodb-community</string>
    <key>ProgramArguments</key>
    <array>
    <string>/opt/homebrew/opt/mongodb-community/bin/mongod</string>
    <string>--config</string>
    <string>/opt/homebrew/etc/mongod.conf</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
    <false/>
    <key>WorkingDirectory</key>
    <string>/opt/homebrew</string>
    <key>StandardErrorPath</key>
    <string>/opt/homebrew/var/log/mongodb/output.log</string>
    <key>StandardOutPath</key>
    <string>/opt/homebrew/var/log/mongodb/output.log</string>
    <key>HardResourceLimits</key>
    <dict>
    <key>NumberOfFiles</key>
    <integer>64000</integer>
    </dict>
    <key>SoftResourceLimits</key>
    <dict>
    <key>NumberOfFiles</key>
    <integer>64000</integer>
    </dict>
</dict>
</plist>

I also have permission to write and read these folders:

 /opt/homebrew/Cellar/mongodb-community/7.0.0/bin
 /opt/homebrew/Cellar/mongodb-community/7.0.0/bin/mongod
 /opt/homebrew/opt/mongodb-community
 /opt/homebrew/opt/mongodb-community/bin
 /opt/homebrew/var/homebrew/linked/mongodb-community

So, please help, I’ve tried everything I know, and I really need to have mongodb up and running in my machine, I would really appreciate your help.

Thank you very much,

Juan

When you run just mongod without any params it looks for default dbpath /data/db
Since it is not there it failed
On Macos access to root dir /data is removed
so you have to give some other dir
Try this
mongod --port 28000 --dbpath your_home_dir --logpath your_home_dir/mongod.log --fork
Once mongod is up connect as mongo --port 28000 or mongosh --port 28000 depending on the shell you have
Regarding the error exited with error 1 from services you need to investigate why it is filing to start

1 Like