MongoDB not starting in docker-compose but mongod.service does work - mongodb

I am developing some application with a MongoDB database, a Nestjs API and front-end in Angular.
Currently, we develop stuff locally then deploy it on a CentOS-based VM. To that end, we put everything inside a docker-compose.
However, although mongodb is in the "general" docker-compose, it has been running in a separate compose up to now.
My problem arose while trying to update the VM with our newest developments.
I used docker-compose down to turn down the mongod service, then wanted to run our other compose to upgrade the application.
However, mongodb failed and returned error code = 14. And now I can't launch it back from the dedicated docker-compose.
However, I am still able to repair the mongodb.service and access my database by using :
chown -R mongod:mongod /var/lib/mongo/
chown mongod:mongod /tmp/mongodb-27017.sock
systemctl start mongod
What could be the problem here??
Here is the docker-compose file. From what I understand, it uses an image of MongoDB already built, so I do not have a Dockerfile.
version: '3.3'
services:
# API
#nestjs:
#container_name: nestjs_dev
#image: nestjs-api:1.0.0
#command: npm run start:prod
# Default port
#ports:
#- 8080:8080
#networks:
#- nestjs-network
#depends_on:
#- mongodb
#restart: always
# Database
mongodb:
image: mongo:latest
container_name: mongodb
volumes:
- /etc/mongod.conf:/etc/mongod.conf:z
- /var/lib/mongo:/data/db:z
# Default port
ports:
- 27017:27017
networks:
- nestjs-network
#restart: always
networks:
nestjs-network:
Finally, I noticed that there is a 1-hour difference between "real" time, and the time in the log produced when trying to docker-compose up :
Notice the 1-hour delta
I was expecting the docker-compose to run mongod normally, as it always did.
Instead, mongod returned error code 14.
I tried the chown commands, changing the mongod.conf file, etc. Ultimately, I think it is an issue with my compose.
Edit : Here is the log from the docker-compose :
2023-02-19T17:42:05.031063000Z {"t":{"$date":"2023-02-19T17:42:05.029+00:00"},"s":"I", "c":"CONTROL", "id":23285, "ctx":"-","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
2023-02-19T17:42:05.031365000Z {"t":{"$date":"2023-02-19T17:42:05.030+00:00"},"s":"I", "c":"NETWORK", "id":4915701, "ctx":"main","msg":"Initialized wire specification","attr":{"spec":{"incomingExternalClient":{"minWireVersion":0,"maxWireVersion":17},"incomingInternalClient":{"minWireVersion":0,"maxWireVersion":17},"outgoing":{"minWireVersion":6,"maxWireVersion":17},"isInternalClient":true}}}
2023-02-19T17:42:05.031583000Z {"t":{"$date":"2023-02-19T17:42:05.031+00:00"},"s":"I", "c":"NETWORK", "id":4648601, "ctx":"main","msg":"Implicit TCP FastOpen unavailable. If TCP FastOpen is required, set tcpFastOpenServer, tcpFastOpenClient, and tcpFastOpenQueueSize."}
2023-02-19T17:42:05.033237000Z {"t":{"$date":"2023-02-19T17:42:05.032+00:00"},"s":"I", "c":"REPL", "id":5123008, "ctx":"main","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationDonorService","namespace":"config.tenantMigrationDonors"}}
2023-02-19T17:42:05.033460000Z {"t":{"$date":"2023-02-19T17:42:05.032+00:00"},"s":"I", "c":"REPL", "id":5123008, "ctx":"main","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationRecipientService","namespace":"config.tenantMigrationRecipients"}}
2023-02-19T17:42:05.033665000Z {"t":{"$date":"2023-02-19T17:42:05.032+00:00"},"s":"I", "c":"REPL", "id":5123008, "ctx":"main","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"ShardSplitDonorService","namespace":"config.tenantSplitDonors"}}
2023-02-19T17:42:05.033865000Z {"t":{"$date":"2023-02-19T17:42:05.032+00:00"},"s":"I", "c":"CONTROL", "id":5945603, "ctx":"main","msg":"Multi threading initialized"}
2023-02-19T17:42:05.034102000Z {"t":{"$date":"2023-02-19T17:42:05.033+00:00"},"s":"F", "c":"CONTROL", "id":6384300, "ctx":"main","msg":"Writing fatal message","attr":{"message":"terminate() called. An exception is active; attempting to gather more information\n"}}
2023-02-19T17:42:05.034424000Z {"t":{"$date":"2023-02-19T17:42:05.033+00:00"},"s":"F", "c":"CONTROL", "id":6384300, "ctx":"main","msg":"Writing fatal message","attr":{"message":"std::exception::what(): Operation not permitted\nActual exception type: std::system_error\n\n"}}
2023-02-19T17:42:05.168487000Z {"t":{"$date":"2023-02-19T17:42:05.167+00:00"},"s":"I", "c":"CONTROL", "id":31380, "ctx":"main","msg":"BACKTRACE","attr":{"bt":{"backtrace":[{"a":"555603E458D4","b":"5555FF067000","o":"4DDE8D4","s":"_ZN5mongo18stack_trace_detail12_GLOBAL__N_119printStackTraceImplERKNS1_7OptionsEPNS_14StackTraceSinkE.constprop.362","C":"mongo::stack_trace_detail::(anonymous namespace)::printStackTraceImpl(mongo::stack_trace_detail::(anonymous namespace)::Options const&, mongo::StackTraceSink*) [clone .constprop.362]","s+":"1F4"},{"a":"555603E47E19","b":"5555FF067000","o":"4DE0E19","s":"_ZN5mongo15printStackTraceEv","C":"mongo::printStackTrace()","s+":"29"},{"a":"555603E42167","b":"5555FF067000","o":"4DDB167","s":"_ZN5mongo12_GLOBAL__N_111myTerminateEv","C":"mongo::(anonymous namespace)::myTerminate()","s+":"D7"},{"a":"555603FCCBF6","b":"5555FF067000","o":"4F65BF6","s":"_ZN10__cxxabiv111__terminateEPFvvE","C":"__cxxabiv1::__terminate(void (*)())","s+":"6"},{"a":"555603FCCC31","b":"5555FF067000","o":"4F65C31","s":"_ZSt9terminatev","C":"std::terminate()","s+":"11"},{"a":"555603FCCD6B","b":"5555FF067000","o":"4F65D6B","s":"__cxa_throw","s+":"4B"},{"a":"555600F7647B","b":"5555FF067000","o":"1F0F47B","s":"_ZSt20__throw_system_errori.cold.24","C":"std::__throw_system_error(int) [clone .cold.24]","s+":"2F"},{"a":"555603FE8F69","b":"5555FF067000","o":"4F81F69","s":"_ZNSt6thread15_M_start_threadESt10unique_ptrINS_6_StateESt14default_deleteIS1_EEPFvvE","C":"std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)())","s+":"29"},{"a":"555601F1107A","b":"5555FF067000","o":"2EAA07A","s":"_ZN5mongo27startSignalProcessingThreadENS_13LogFileStatusE","C":"mongo::startSignalProcessingThread(mongo::LogFileStatus)","s+":"11A"},{"a":"5556011871EA","b":"5555FF067000","o":"21201EA","s":"_ZN5mongo11mongod_mainEiPPc","C":"mongo::mongod_main(int, char**)","s+":"B8A"},{"a":"555600F771BE","b":"5555FF067000","o":"1F101BE","s":"main","s+":"E"},{"a":"7F9113BC8D90","b":"7F9113B9F000","o":"29D90","s":"__libc_init_first","s+":"90"},{"a":"7F9113BC8E40","b":"7F9113B9F000","o":"29E40","s":"__libc_start_main","s+":"80"},{"a":"555601181A95","b":"5555FF067000","o":"211AA95","s":"_start","s+":"25"}],"processInfo":{"mongodbVersion":"6.0.4","gitVersion":"44ff59461c1353638a71e710f385a566bcd2f547","compiledModules":[],"uname":{"sysname":"Linux","release":"3.10.0-1160.83.1.el7.x86_64","version":"#1 SMP Wed Jan 25 16:41:43 UTC 2023","machine":"x86_64"},"somap":[{"b":"5555FF067000","elfType":3,"buildId":"BCB8F6C3AD4ABF41C81882BAE25C6885C6266CC4"},{"b":"7F9113B9F000","path":"/lib/x86_64-linux-gnu/libc.so.6","elfType":3,"buildId":"69389D485A9793DBE873F0EA2C93E02EFAA9AA3D"}]}}},"tags":[]}
2023-02-19T17:42:05.171495000Z {"t":{"$date":"2023-02-19T17:42:05.167+00:00"},"s":"I", "c":"CONTROL", "id":31445, "ctx":"main","msg":"Frame","attr":{"frame":{"a":"555603E458D4","b":"5555FF067000","o":"4DDE8D4","s":"_ZN5mongo18stack_trace_detail12_GLOBAL__N_119printStackTraceImplERKNS1_7OptionsEPNS_14StackTraceSinkE.constprop.362","C":"mongo::stack_trace_detail::(anonymous namespace)::printStackTraceImpl(mongo::stack_trace_detail::(anonymous namespace)::Options const&, mongo::StackTraceSink*) [clone .constprop.362]","s+":"1F4"}}}
2023-02-19T17:42:05.172869000Z {"t":{"$date":"2023-02-19T17:42:05.167+00:00"},"s":"I", "c":"CONTROL", "id":31445, "ctx":"main","msg":"Frame","attr":{"frame":{"a":"555603E47E19","b":"5555FF067000","o":"4DE0E19","s":"_ZN5mongo15printStackTraceEv","C":"mongo::printStackTrace()","s+":"29"}}}
2023-02-19T17:42:05.173129000Z {"t":{"$date":"2023-02-19T17:42:05.167+00:00"},"s":"I", "c":"CONTROL", "id":31445, "ctx":"main","msg":"Frame","attr":{"frame":{"a":"555603E42167","b":"5555FF067000","o":"4DDB167","s":"_ZN5mongo12_GLOBAL__N_111myTerminateEv","C":"mongo::(anonymous namespace)::myTerminate()","s+":"D7"}}}
2023-02-19T17:42:05.173356000Z {"t":{"$date":"2023-02-19T17:42:05.167+00:00"},"s":"I", "c":"CONTROL", "id":31445, "ctx":"main","msg":"Frame","attr":{"frame":{"a":"555603FCCBF6","b":"5555FF067000","o":"4F65BF6","s":"_ZN10__cxxabiv111__terminateEPFvvE","C":"__cxxabiv1::__terminate(void (*)())","s+":"6"}}}
2023-02-19T17:42:05.173565000Z {"t":{"$date":"2023-02-19T17:42:05.167+00:00"},"s":"I", "c":"CONTROL", "id":31445, "ctx":"main","msg":"Frame","attr":{"frame":{"a":"555603FCCC31","b":"5555FF067000","o":"4F65C31","s":"_ZSt9terminatev","C":"std::terminate()","s+":"11"}}}
2023-02-19T17:42:05.173769000Z {"t":{"$date":"2023-02-19T17:42:05.167+00:00"},"s":"I", "c":"CONTROL", "id":31445, "ctx":"main","msg":"Frame","attr":{"frame":{"a":"555603FCCD6B","b":"5555FF067000","o":"4F65D6B","s":"__cxa_throw","s+":"4B"}}}
2023-02-19T17:42:05.173997000Z {"t":{"$date":"2023-02-19T17:42:05.167+00:00"},"s":"I", "c":"CONTROL", "id":31445, "ctx":"main","msg":"Frame","attr":{"frame":{"a":"555600F7647B","b":"5555FF067000","o":"1F0F47B","s":"_ZSt20__throw_system_errori.cold.24","C":"std::__throw_system_error(int) [clone .cold.24]","s+":"2F"}}}
2023-02-19T17:42:05.174219000Z {"t":{"$date":"2023-02-19T17:42:05.167+00:00"},"s":"I", "c":"CONTROL", "id":31445, "ctx":"main","msg":"Frame","attr":{"frame":{"a":"555603FE8F69","b":"5555FF067000","o":"4F81F69","s":"_ZNSt6thread15_M_start_threadESt10unique_ptrINS_6_StateESt14default_deleteIS1_EEPFvvE","C":"std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)())","s+":"29"}}}
2023-02-19T17:42:05.174451000Z {"t":{"$date":"2023-02-19T17:42:05.167+00:00"},"s":"I", "c":"CONTROL", "id":31445, "ctx":"main","msg":"Frame","attr":{"frame":{"a":"555601F1107A","b":"5555FF067000","o":"2EAA07A","s":"_ZN5mongo27startSignalProcessingThreadENS_13LogFileStatusE","C":"mongo::startSignalProcessingThread(mongo::LogFileStatus)","s+":"11A"}}}
2023-02-19T17:42:05.174675000Z {"t":{"$date":"2023-02-19T17:42:05.167+00:00"},"s":"I", "c":"CONTROL", "id":31445, "ctx":"main","msg":"Frame","attr":{"frame":{"a":"5556011871EA","b":"5555FF067000","o":"21201EA","s":"_ZN5mongo11mongod_mainEiPPc","C":"mongo::mongod_main(int, char**)","s+":"B8A"}}}
2023-02-19T17:42:05.174881000Z {"t":{"$date":"2023-02-19T17:42:05.167+00:00"},"s":"I", "c":"CONTROL", "id":31445, "ctx":"main","msg":"Frame","attr":{"frame":{"a":"555600F771BE","b":"5555FF067000","o":"1F101BE","s":"main","s+":"E"}}}
2023-02-19T17:42:05.175099000Z {"t":{"$date":"2023-02-19T17:42:05.167+00:00"},"s":"I", "c":"CONTROL", "id":31445, "ctx":"main","msg":"Frame","attr":{"frame":{"a":"7F9113BC8D90","b":"7F9113B9F000","o":"29D90","s":"__libc_init_first","s+":"90"}}}
2023-02-19T17:42:05.175328000Z {"t":{"$date":"2023-02-19T17:42:05.167+00:00"},"s":"I", "c":"CONTROL", "id":31445, "ctx":"main","msg":"Frame","attr":{"frame":{"a":"7F9113BC8E40","b":"7F9113B9F000","o":"29E40","s":"__libc_start_main","s+":"80"}}}
2023-02-19T17:42:05.175540000Z {"t":{"$date":"2023-02-19T17:42:05.167+00:00"},"s":"I", "c":"CONTROL", "id":31445, "ctx":"main","msg":"Frame","attr":{"frame":{"a":"555601181A95","b":"5555FF067000","o":"211AA95","s":"_start","s+":"25"}}}

Related

Failed to unlink socket file: Operation not permitted

I am facing this issue where I am unable to get my mongod started successfully:
This is the error:
{"t":{"$date":"2023-01-13T12:33:59.922+05: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":"2023-01-13T12:33:59.922+05: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":"2023-01-13T12:33:59.924+05:00"},"s":"I",
"c":"NETWORK", "id":4648601, "ctx":"main","msg":"Implicit TCP
FastOpen unavailable. If TCP FastOpen is required, set
tcpFastOpenServer, tcpFastOpenClient, and tcpFastOpenQueueSize."}
{"t":{"$date":"2023-01-13T12:33:59.925+05:00"},"s":"I", "c":"REPL",
"id":5123008, "ctx":"main","msg":"Successfully registered
PrimaryOnlyService","attr":{"service":"TenantMigrationDonorService","namespace":"config.tenantMigrationDonors"}}
{"t":{"$date":"2023-01-13T12:33:59.925+05:00"},"s":"I", "c":"REPL",
"id":5123008, "ctx":"main","msg":"Successfully registered
PrimaryOnlyService","attr":{"service":"TenantMigrationRecipientService","namespace":"config.tenantMigrationRecipients"}}
{"t":{"$date":"2023-01-13T12:33:59.925+05:00"},"s":"I", "c":"REPL",
"id":5123008, "ctx":"main","msg":"Successfully registered
PrimaryOnlyService","attr":{"service":"ShardSplitDonorService","namespace":"config.tenantSplitDonors"}}
{"t":{"$date":"2023-01-13T12:33:59.925+05:00"},"s":"I",
"c":"CONTROL", "id":5945603, "ctx":"main","msg":"Multi threading
initialized"} {"t":{"$date":"2023-01-13T12:33:59.925+05:00"},"s":"I",
"c":"CONTROL", "id":4615611, "ctx":"initandlisten","msg":"MongoDB
starting","attr":{"pid":24280,"port":27017,"dbPath":"/data/db","architecture":"64-bit","host":"ehsan-HP"}}
{"t":{"$date":"2023-01-13T12:33:59.925+05:00"},"s":"I",
"c":"CONTROL", "id":23403, "ctx":"initandlisten","msg":"Build
Info","attr":{"buildInfo":{"version":"6.0.3","gitVersion":"f803681c3ae19817d31958965850193de067c516","openSSLVersion":"OpenSSL
1.1.1 11 Sep 2018","modules":[],"allocator":"tcmalloc","environment":{"distmod":"ubuntu1804","distarch":"x86_64","target_arch":"x86_64"}}}}
{"t":{"$date":"2023-01-13T12:33:59.925+05:00"},"s":"I",
"c":"CONTROL", "id":51765, "ctx":"initandlisten","msg":"Operating
System","attr":{"os":{"name":"Ubuntu","version":"18.04"}}}
{"t":{"$date":"2023-01-13T12:33:59.925+05:00"},"s":"I",
"c":"CONTROL", "id":21951, "ctx":"initandlisten","msg":"Options set
by command line","attr":{"options":{}}}
{"t":{"$date":"2023-01-13T12:33:59.926+05:00"},"s":"E",
"c":"NETWORK", "id":23024, "ctx":"initandlisten","msg":"Failed to
unlink socket
file","attr":{"path":"/tmp/mongodb-27017.sock","error":"Operation not
permitted"}} {"t":{"$date":"2023-01-13T12:33:59.926+05: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":"2023-01-13T12:33:59.926+05:00"},"s":"F", "c":"ASSERT",
"id":23092, "ctx":"initandlisten","msg":"\n\n***aborting after
fassert() failure\n\n"}
What I have tried so far:
Delete /tmp/mongodb-27017.sock file and then start mongod by doing sudo service mongod start. It didn't work. The file mongodb-27017.sock created after running this comand has the following permissions:
srwx------ 1 mongodb mongodb 0 January 13 12:49 /tmp/mongodb-27017.sock
These are the permissions of /data/db:
$ ls -la /data/db
total 8
drwxr-xr-x 2 mongodb mongodb 4096 January 13 11:35 .
drwxr-xr-x 3 root root 4096 January 13 11:35 ..
What is going wrong here? This is my mongod version:
$ mongod --version
db version v6.0.3
Build Info: {
"version": "6.0.3",
"gitVersion": "f803681c3ae19817d31958965850193de067c516",
"openSSLVersion": "OpenSSL 1.1.1 11 Sep 2018",
"modules": [],
"allocator": "tcmalloc",
"environment": {
"distmod": "ubuntu1804",
"distarch": "x86_64",
"target_arch": "x86_64"
}
}
I am on Ubuntu 18.
EDIT:
Here are the contents of /var/log/auth.log:
Jan 13 13:40:24 ehsan-HP sudo: ehsan : TTY=pts/7 ; PWD=/home/ehsan ; USER=root ; COMMAND=/usr/sbin/service mongod restart
Jan 13 13:40:24 ehsan-HP sudo: pam_unix(sudo:session): session opened for user root by (uid=0)
Jan 13 13:40:24 ehsan-HP sudo: pam_unix(sudo:session): session closed for user root

Unable to start mongod in mongoDB 6 in macOS Monterery

When I try to start the service it gives me these errors, and then terminates.
{"t":{"$date":"2022-08-09T21:13:41.727+05:30"},"s":"I", "c":"CONTROL", "id":23352, "ctx":"initandlisten","msg":"Unable to resolve sysctl {sysctlName} (number) ","attr":{"sysctlName":"hw.cpufrequency"}} {"t":{"$date":"2022-08-09T21:13:41.727+05:30"},"s":"I", "c":"CONTROL", "id":23351, "ctx":"initandlisten","msg":"{sysctlName} unavailable","attr":{"sysctlName":"machdep.cpu.features"}} {"t":{"$date":"2022-08-09T21:13:41.727+05:30"},"s":"I", "c":"CONTROL", "id":23403, "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"6.0.0","gitVersion":"e61bf27c2f6a83fed36e5a13c008a32d563babe2","modules":[],"allocator":"system","environment":{"distarch":"aarch64","target_arch":"aarch64"}}}} {"t":{"$date":"2022-08-09T21:13:41.727+05:30"},"s":"I", "c":"CONTROL", "id":51765, "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Mac OS X","version":"21.6.0"}}} {"t":{"$date":"2022-08-09T21:13:41.727+05:30"},"s":"I", "c":"CONTROL", "id":21951, "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{"storage":{"dbPath":"/System/Volumes/Data/data/db"}}}} {"t":{"$date":"2022-08-09T21:13:41.729+05:30"},"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-08-09T21:13:41.729+05:30"},"s":"E", "c":"CONTROL", "id":20568, "ctx":"initandlisten","msg":"Error setting up listener","attr":{"error":{"code":9001,"codeName":"SocketException","errmsg":"Address already in use"}}} {"t":{"$date":"2022-08-09T21:13:41.729+05:30"},"s":"I", "c":"REPL", "id":4784900, "ctx":"initandlisten","msg":"Stepping down the ReplicationCoordinator for shutdown","attr":{"waitTimeMillis":15000}} {"t":{"$date":"2022-08-09T21:13:41.730+05:30"},"s":"I", "c":"REPL", "id":4794602, "ctx":"initandlisten","msg":"Attempting to enter quiesce mode"} {"t":{"$date":"2022-08-09T21:13:41.730+05:30"},"s":"I", "c":"-", "id":6371601, "ctx":"initandlisten","msg":"Shutting down the FLE Crud thread pool"}
{"code":9001,"codeName":"SocketException","errmsg":"Address already in use"}
I think you're running your mongod on a port that is already in use. Make sure that a port you specify is free (default ones are started from 27107 and then incremented on 1 for each rs/sharded and etc nodes)

Running mongod service failed in Ubuntu 18.04.6

mongod service failed to start. After rebooting the machine, checking if mongod is allowed to read and write in the files/directories, I don't find the root of the issue.
Checking the service, it fails:
(base) avy#machine:~$ sudo service mongod status
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2022-08-07 14:16:22 CEST; 2min 20s ago
Docs: https://docs.mongodb.org/manual
Process: 5230 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=100)
Main PID: 5230 (code=exited, status=100)
août 07 14:16:22 machine systemd[1]: Started MongoDB Database Server.
août 07 14:16:22 machine systemd[1]: mongod.service: Main process exited, code=exited, status=100/n/a
août 07 14:16:22 machine systemd[1]: mongod.service: Failed with result 'exit-code'.
I looked if the database (dbPath storage) was still owned by mongod and it is:
(base) avy#machine:~$ ls -l
drwxrwxrwx 5 avy mongodb 4096 août 6 13:08 mongodatabases
My config file is very simple and I did not write on it since I used MongoDB for the first time:
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# Where and how to store data.
storage:
dbPath: /home/avy/mongodatabases
journal:
enabled: true
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
# network interfaces
net:
port: 27017
bindIp: 127.0.0.1
# how the process runs
processManagement:
timeZoneInfo: /usr/share/zoneinfo
It seemed it was due to 27017.sock:
(base) avy#machine:~$ mongo
MongoDB shell version v5.0.10
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
I changed the owning:
(base) avy#machine:/tmp$ sudo chown mongodb:mongodb mongodb-27017.sock
(base) avy#machine:/tmp$ ls -l
srwx------ 1 mongodb mongodb 0 août 7 15:27 mongodb-27017.sock
it is still failling.
UPDATE, answer to rickhg12hs comment What's in /var/log/mongodb/mongod.log?
(base) avy#machine:/var/log/mongodb$ ls -l
total 112156
-rw------- 1 mongodb mongodb 114841063 août 7 17:37 mongod.log
There is only this file.
Does mongod still have an old lock file that needs to be deleted?
There is one in the desired dbPath:
(base) avy#machine:~/mongodatabases$ ls -l
...
-rw------- 1 mongodb mongodb 5 août 5 10:49 mongod.lock
...
I noticed something, let me know what you think about it
# the whole result of command
(base) avy#machine:~$ mongod
{"t":{"$date":"2022-08-07T17:37:43.960+02:00"},"s":"I", "c":"NETWORK", "id":4915701, "ctx":"thread1","msg":"Initialized wire specification","attr":{"spec":{"incomingExternalClient":{"minWireVersion":0,"maxWireVersion":13},"incomingInternalClient":{"minWireVersion":0,"maxWireVersion":13},"outgoing":{"minWireVersion":0,"maxWireVersion":13},"isInternalClient":true}}}
{"t":{"$date":"2022-08-07T17:37:43.960+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-08-07T17:37:43.960+02:00"},"s":"W", "c":"ASIO", "id":22601, "ctx":"thread1","msg":"No TransportLayer configured during NetworkInterface startup"}
{"t":{"$date":"2022-08-07T17:37:43.960+02:00"},"s":"I", "c":"NETWORK", "id":4648601, "ctx":"thread1","msg":"Implicit TCP FastOpen unavailable. If TCP FastOpen is required, set tcpFastOpenServer, tcpFastOpenClient, and tcpFastOpenQueueSize."}
{"t":{"$date":"2022-08-07T17:37:43.962+02:00"},"s":"W", "c":"ASIO", "id":22601, "ctx":"thread1","msg":"No TransportLayer configured during NetworkInterface startup"}
{"t":{"$date":"2022-08-07T17:37:43.962+02:00"},"s":"I", "c":"REPL", "id":5123008, "ctx":"thread1","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationDonorService","ns":"config.tenantMigrationDonors"}}
{"t":{"$date":"2022-08-07T17:37:43.962+02:00"},"s":"I", "c":"REPL", "id":5123008, "ctx":"thread1","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationRecipientService","ns":"config.tenantMigrationRecipients"}}
{"t":{"$date":"2022-08-07T17:37:43.962+02:00"},"s":"I", "c":"CONTROL", "id":5945603, "ctx":"thread1","msg":"Multi threading initialized"}
{"t":{"$date":"2022-08-07T17:37:43.962+02:00"},"s":"I", "c":"CONTROL", "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":4638,"port":27017,"dbPath":"/data/db","architecture":"64-bit","host":"machine"}}
{"t":{"$date":"2022-08-07T17:37:43.962+02:00"},"s":"I", "c":"CONTROL", "id":23403, "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"5.0.10","gitVersion":"bbf5bc7e16d1713c9349a09adf4901ca37472e66","openSSLVersion":"OpenSSL 1.1.1 11 Sep 2018","modules":[],"allocator":"tcmalloc","environment":{"distmod":"ubuntu1804","distarch":"x86_64","target_arch":"x86_64"}}}}
{"t":{"$date":"2022-08-07T17:37:43.962+02:00"},"s":"I", "c":"CONTROL", "id":51765, "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Ubuntu","version":"18.04"}}}
{"t":{"$date":"2022-08-07T17:37:43.962+02:00"},"s":"I", "c":"CONTROL", "id":21951, "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{}}}
{"t":{"$date":"2022-08-07T17:37:43.963+02:00"},"s":"E", "c":"NETWORK", "id":23024, "ctx":"initandlisten","msg":"Failed to unlink socket file","attr":{"path":"/tmp/mongodb-27017.sock","error":"Operation not permitted"}}
{"t":{"$date":"2022-08-07T17:37:43.963+02:00"},"s":"F", "c":"-", "id":23091, "ctx":"initandlisten","msg":"Fatal assertion","attr":{"msgid":40486,"file":"src/mongo/transport/transport_layer_asio.cpp","line":1019}}
{"t":{"$date":"2022-08-07T17:37:43.963+02:00"},"s":"F", "c":"-", "id":23092, "ctx":"initandlisten","msg":"\n\n***aborting after fassert() failure\n\n"}
When I focus on this line I saw it is still trying to run dbPath on /data/db contrary to what the config file tells:
{"t":{"$date":"2022-08-07T17:37:43.962+02:00"},"s":"I", "c":"CONTROL", "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":4638,"port":27017,"dbPath":"/data/db","architecture":"64-bit","host":"machine"}}
besides it says the connection to the socket 27017 is not permitted
{"t":{"$date":"2022-08-07T17:37:43.963+02:00"},"s":"E", "c":"NETWORK", "id":23024, "ctx":"initandlisten","msg":"Failed to unlink socket file","attr":{"path":"/tmp/mongodb-27017.sock","error":"Operation not permitted"}}
so I tried this:
(base) avy#machine:~$ sudo mongod --repair --config /etc/mongod.conf
But this is the same problem
UPDATE 2
What's in /lib/systemd/system/mongod.service?
[Unit]
Description=MongoDB Database Server
Documentation=https://docs.mongodb.org/manual
After=network-online.target
Wants=network-online.target
[Service]
User=mongodb
Group=mongodb
EnvironmentFile=-/etc/default/mongod
ExecStart=/usr/bin/mongod --config /etc/mongod.conf
PIDFile=/var/run/mongodb/mongod.pid
# file size
LimitFSIZE=infinity
# cpu time
LimitCPU=infinity
# virtual memory size
LimitAS=infinity
# open files
LimitNOFILE=64000
# processes/threads
LimitNPROC=64000
# locked memory
LimitMEMLOCK=infinity
# total threads (user+kernel)
TasksMax=infinity
TasksAccounting=false
# Recommended limits for mongod as specified in
# https://docs.mongodb.com/manual/reference/ulimit/#recommended-ulimit-settings
[Install]
WantedBy=multi-user.target
Does the tail of the contents of /var/log/mongodb/mongod.log have some enlightening messages?
I am not expert of database at all so "enlightening message" is difficult to judge for me. But I checked the behavior of a typical "good day" and the day it started to fail. I think this is due to a violent shutdown.
# a good day
{"t":{"$date":"2022-08-04T23:49:03.773+02:00"},"s":"I", "c":"CONTROL", "id":23138, "ctx":"SignalHandler","msg":"Shutting down","attr":{"exitCode":0}}
{"t":{"$date":"2022-08-05T10:49:00.638+02:00"},"s":"I", "c":"CONTROL", "id":20698, "ctx":"-","msg":"***** SERVER RESTARTED *****"}
# some lines
{"t":{"$date":"2022-08-05T10:49:00.651+02:00"},"s":"I", "c":"CONTROL", "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":2027,"port":27017,"dbPath":"/home/avy/mongodatabases","architecture":"64-bit","host":"machine"}}
{"t":{"$date":"2022-08-05T10:49:00.651+02:00"},"s":"I", "c":"CONTROL", "id":23403, "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"5.0.10","gitVersion":"bbf5bc7e16d1713c9349a09adf4901ca37472e66","openSSLVersion":"OpenSSL 1.1.1 11 Sep 2018","modules":[],"allocator":"tcmalloc","environment":{"distmod":"ubuntu1804","distarch":"x86_64","target_arch":"x86_64"}}}}
{"t":{"$date":"2022-08-05T10:49:00.651+02:00"},"s":"I", "c":"CONTROL", "id":51765, "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Ubuntu","version":"18.04"}}}
{"t":{"$date":"2022-08-05T10:49:00.651+02:00"},"s":"I", "c":"CONTROL", "id":21951, "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{"config":"/etc/mongod.conf","net":{"bindIp":"127.0.0.1","port":27017},"processManagement":{"timeZoneInfo":"/usr/share/zoneinfo"},"storage":{"dbPath":"/home/avy/mongodatabases","journal":{"enabled":true}},"systemLog":{"destination":"file","logAppend":true,"path":"/var/log/mongodb/mongod.log"}}}}
{"t":{"$date":"2022-08-05T10:49:00.654+02:00"},"s":"I", "c":"STORAGE", "id":22270, "ctx":"initandlisten","msg":"Storage engine to use detected by data files","attr":{"dbpath":"/home/avy/mongodatabases","storageEngine":"wiredTiger"}}
I shutdown without issue but it seems that today the schema is different:
{"a":"7FEA0E67261F","b":"7FEA0E551000","o":"12161F","s":"clone","s+":"3F"}}} # you see no {"exitCode":0}
{"t":{"$date":"2022-08-07T08:56:02.403+02:00"},"s":"I", "c":"CONTROL", "id":20698, "ctx":"-","msg":"***** SERVER RESTARTED *****"}
... # some lines
{"t":{"$date":"2022-08-07T08:56:02.416+02:00"},"s":"I", "c":"CONTROL", "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":1932,"port":27017,"dbPath":"/home/avy/mongodatabases","architecture":"64-bit","host":"machine"}}
{"t":{"$date":"2022-08-07T08:56:02.416+02:00"},"s":"I", "c":"CONTROL", "id":23403, "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"5.0.10","gitVersion":"bbf5bc7e16d1713c9349a09adf4901ca37472e66","openSSLVersion":"OpenSSL 1.1.1 11 Sep 2018","modules":[],"allocator":"tcmalloc","environment":{"distmod":"ubuntu1804","distarch":"x86_64","target_arch":"x86_64"}}}}
{"t":{"$date":"2022-08-07T08:56:02.416+02:00"},"s":"I", "c":"CONTROL", "id":51765, "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Ubuntu","version":"18.04"}}}
{"t":{"$date":"2022-08-07T08:56:02.416+02:00"},"s":"I", "c":"CONTROL", "id":21951, "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{"config":"/etc/mongod.conf","net":{"bindIp":"127.0.0.1","port":27017},"processManagement":{"timeZoneInfo":"/usr/share/zoneinfo"},"storage":{"dbPath":"/home/av/mongodatabases","journal":{"enabled":true}},"systemLog":{"destination":"file","logAppend":true,"path":"/var/log/mongodb/mongod.log"}}}}
and then the initandlisten operation started to fail.
Before mongod starts, there should be no lock file
I removed all .lock files related to mongo in the whole machine.
I tried once again repair command
(base) avy#machine:~$ mongod --repair --dbpath "/home/avy/mongodatabases"
{"t":{"$date":"2022-08-07T19:24:17.116+02:00"},"s":"I", "c":"NETWORK", "id":4915701, "ctx":"-","msg":"Initialized wire specification","attr":{"spec":{"incomingExternalClient":{"minWireVersion":0,"maxWireVersion":13},"incomingInternalClient":{"minWireVersion":0,"maxWireVersion":13},"outgoing":{"minWireVersion":0,"maxWireVersion":13},"isInternalClient":true}}}
{"t":{"$date":"2022-08-07T19:24:17.116+02: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":"2022-08-07T19:24:17.117+02:00"},"s":"W", "c":"ASIO", "id":22601, "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"}
{"t":{"$date":"2022-08-07T19:24:17.117+02:00"},"s":"I", "c":"NETWORK", "id":4648601, "ctx":"main","msg":"Implicit TCP FastOpen unavailable. If TCP FastOpen is required, set tcpFastOpenServer, tcpFastOpenClient, and tcpFastOpenQueueSize."}
{"t":{"$date":"2022-08-07T19:24:17.118+02:00"},"s":"W", "c":"ASIO", "id":22601, "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"}
{"t":{"$date":"2022-08-07T19:24:17.118+02:00"},"s":"I", "c":"REPL", "id":5123008, "ctx":"main","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationDonorService","ns":"config.tenantMigrationDonors"}}
{"t":{"$date":"2022-08-07T19:24:17.118+02:00"},"s":"I", "c":"REPL", "id":5123008, "ctx":"main","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationRecipientService","ns":"config.tenantMigrationRecipients"}}
{"t":{"$date":"2022-08-07T19:24:17.118+02:00"},"s":"I", "c":"CONTROL", "id":5945603, "ctx":"main","msg":"Multi threading initialized"}
{"t":{"$date":"2022-08-07T19:24:17.119+02:00"},"s":"I", "c":"CONTROL", "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":8346,"port":27017,"dbPath":"/home/avy/mongodatabases","architecture":"64-bit","host":"machine"}}
{"t":{"$date":"2022-08-07T19:24:17.119+02:00"},"s":"I", "c":"CONTROL", "id":23403, "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"5.0.10","gitVersion":"bbf5bc7e16d1713c9349a09adf4901ca37472e66","openSSLVersion":"OpenSSL 1.1.1 11 Sep 2018","modules":[],"allocator":"tcmalloc","environment":{"distmod":"ubuntu1804","distarch":"x86_64","target_arch":"x86_64"}}}}
{"t":{"$date":"2022-08-07T19:24:17.119+02:00"},"s":"I", "c":"CONTROL", "id":51765, "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Ubuntu","version":"18.04"}}}
{"t":{"$date":"2022-08-07T19:24:17.119+02:00"},"s":"I", "c":"CONTROL", "id":21951, "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{"repair":true,"storage":{"dbPath":"/home/avy/mongodatabases"}}}}
{"t":{"$date":"2022-08-07T19:24:17.123+02:00"},"s":"F", "c":"STORAGE", "id":28661, "ctx":"initandlisten","msg":"Unable to read the storage engine metadata file","attr":{"error":{"code":38,"codeName":"FileNotOpen","errmsg":"Failed to read metadata from /home/mongodatabases/storage.bson"}}}
{"t":{"$date":"2022-08-07T19:24:17.123+02:00"},"s":"F", "c":"-", "id":23091, "ctx":"initandlisten","msg":"Fatal assertion","attr":{"msgid":28661,"file":"src/mongo/db/storage/storage_engine_metadata.cpp","line":91}}
{"t":{"$date":"2022-08-07T19:24:17.123+02:00"},"s":"F", "c":"-", "id":23092, "ctx":"initandlisten","msg":"\n\n***aborting after fassert() failure\n\n"}
About the version used:
(base) avy#machine:~$ mongod --version
db version v5.0.10
Build Info: {
"version": "5.0.10",
"gitVersion": "bbf5bc7e16d1713c9349a09adf4901ca37472e66",
"openSSLVersion": "OpenSSL 1.1.1 11 Sep 2018",
"modules": [],
"allocator": "tcmalloc",
"environment": {
"distmod": "ubuntu1804",
"distarch": "x86_64",
"target_arch": "x86_64"
}
}

Mongod aborts on Mac

When I try to start mongod on my Mac I get the following error in the log file:
{"t":{"$date":"2020-08-24T16:29:32.041+03: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-08-24T16:29:32.044+03:00"},"s":"W", "c":"ASIO", "id":22601, "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"}
{"t":{"$date":"2020-08-24T16:29:32.044+03:00"},"s":"I", "c":"NETWORK", "id":4648602, "ctx":"main","msg":"Implicit TCP FastOpen in use."}
{"t":{"$date":"2020-08-24T16:29:32.045+03:00"},"s":"I", "c":"STORAGE", "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":30381,"port":27017,"dbPath":"yourfolder","architecture":"64-bit","host":"Chaims-MacBook-Pro.local"}}
{"t":{"$date":"2020-08-24T16:29:32.045+03: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-08-24T16:29:32.045+03:00"},"s":"I", "c":"CONTROL", "id":51765, "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Mac OS X","version":"18.2.0"}}}
{"t":{"$date":"2020-08-24T16:29:32.045+03:00"},"s":"I", "c":"CONTROL", "id":21951, "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{"storage":{"dbPath":"yourfolder"},"systemLog":{"destination":"file","logAppend":true,"path":"myfile.log"}}}}
{"t":{"$date":"2020-08-24T16:29:32.047+03: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-08-24T16:29:32.047+03: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-08-24T16:29:32.047+03:00"},"s":"F", "c":"-", "id":23092, "ctx":"initandlisten","msg":"\n\n***aborting after fassert() failure\n\n"}
Any idea what the problem is?
Please use one of the following solutions.
for Linux
$ sudo rm -rf /tmp/mongodb-27017.sock
$ sudo service mongod start
for Mac
$ sudo rm -rf /tmp/mongodb-27017.sock
$ sudo brew services restart mongod
I had the same problem and this worked for me.
sudo mongod

Mongo server is not running while mongo shell is running and status of mongod is showing active

I get the following message after I run sudo mongod:
{"t":{"$date":"2020-08-12T20:09:04.629+05:30"},"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-08-12T20:09:04.631+05:30"},"s":"W", "c":"ASIO", "id":22601, "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"}
{"t":{"$date":"2020-08-12T20:09:04.631+05:30"},"s":"I", "c":"NETWORK", "id":4648601, "ctx":"main","msg":"Implicit TCP FastOpen unavailable. If TCP FastOpen is required, set tcpFastOpenServer, tcpFastOpenClient, and tcpFastOpenQueueSize."}
{"t":{"$date":"2020-08-12T20:09:04.631+05:30"},"s":"I", "c":"STORAGE", "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":9455,"port":27017,"dbPath":"/data/db","architecture":"64-bit","host":"pragya"}}
{"t":{"$date":"2020-08-12T20:09:04.631+05:30"},"s":"I", "c":"CONTROL", "id":23403, "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"4.4.0","gitVersion":"563487e100c4215e2dce98d0af2a6a5a2d67c5cf","openSSLVersion":"OpenSSL 1.1.1 11 Sep 2018","modules":[],"allocator":"tcmalloc","environment":{"distmod":"ubuntu1804","distarch":"x86_64","target_arch":"x86_64"}}}}
{"t":{"$date":"2020-08-12T20:09:04.631+05:30"},"s":"I", "c":"CONTROL", "id":51765, "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Ubuntu","version":"18.04"}}}
{"t":{"$date":"2020-08-12T20:09:04.631+05:30"},"s":"I", "c":"CONTROL", "id":21951, "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{}}}
{"t":{"$date":"2020-08-12T20:09:04.632+05:30"},"s":"E", "c":"STORAGE", "id":20568, "ctx":"initandlisten","msg":"Error setting up listener","attr":{"error":{"code":9001,"codeName":"SocketException","errmsg":"Address already in use"}}}
{"t":{"$date":"2020-08-12T20:09:04.632+05:30"},"s":"I", "c":"CONTROL", "id":20565, "ctx":"initandlisten","msg":"Now exiting"}
{"t":{"$date":"2020-08-12T20:09:04.632+05:30"},"s":"I", "c":"CONTROL", "id":23138, "ctx":"initandlisten","msg":"Shutting down","attr":{"exitCode":48}}
message after status of mongod:
mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2020-08-12 19:11:52 IST; 57min ago
Docs: https://docs.mongodb.org/manual
Main PID: 7312 (mongod)
CGroup: /system.slice/mongod.service
└─7312 /usr/bin/mongod --config /etc/mongod.conf
Aug 12 19:11:52 pragya systemd[1]: Started MongoDB Database Server.
You could try to run MongoDB manually as a background process, issue the following:
sudo mongod --config /usr/local/etc/mongod.conf --fork
Confirm your Password
check in: brew services list
there you will see: mongodb-community started