I am trying to install Mongodb on my Mac (M2 chip)
I run the following:
brew tap mongodb/brew
brew install [email protected]
brew services start [email protected]
I then check if the service is running and check the logs
➜ brew services list
Name Status User File
mongodb-community error 15872 foo ~/Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist
➜ payload tail $(brew --prefix)/var/log/mongodb/mongo.log
{"t":{"$date":"2024-08-07T17:23:20.516+08:00"},"s":"I", "c":"STORAGE", "id":4795902, "ctx":"initandlisten","msg":"Closing WiredTiger","attr":{"closeConfig":"leak_memory=true,use_timestamp=false,"}}
{"t":{"$date":"2024-08-07T17:23:20.516+08:00"},"s":"I", "c":"WTCHKPT", "id":22430, "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":{"ts_sec":1723022600,"ts_usec":516819,"thread":"62910:0x2058c7ac0","session_name":"close_ckpt","category":"WT_VERB_CHECKPOINT_PROGRESS","category_id":6,"verbose_level":"DEBUG_1","verbose_level_id":1,"msg":"saving checkpoint snapshot min: 2, snapshot max: 2 snapshot count: 0, oldest timestamp: (0, 0) , meta checkpoint timestamp: (0, 0) base write gen: 48"}}}
{"t":{"$date":"2024-08-07T17:23:20.537+08:00"},"s":"I", "c":"WTRECOV", "id":22430, "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":{"ts_sec":1723022600,"ts_usec":537513,"thread":"62910:0x2058c7ac0","session_name":"WT_CONNECTION.close","category":"WT_VERB_RECOVERY_PROGRESS","category_id":30,"verbose_level":"DEBUG_1","verbose_level_id":1,"msg":"shutdown checkpoint has successfully finished and ran for 20 milliseconds"}}}
{"t":{"$date":"2024-08-07T17:23:20.537+08:00"},"s":"I", "c":"WTRECOV", "id":22430, "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":{"ts_sec":1723022600,"ts_usec":537566,"thread":"62910:0x2058c7ac0","session_name":"WT_CONNECTION.close","category":"WT_VERB_RECOVERY_PROGRESS","category_id":30,"verbose_level":"DEBUG_1","verbose_level_id":1,"msg":"shutdown was completed successfully and took 21ms, including 0ms for the rollback to stable, and 20ms for the checkpoint."}}}
{"t":{"$date":"2024-08-07T17:23:20.570+08:00"},"s":"I", "c":"STORAGE", "id":4795901, "ctx":"initandlisten","msg":"WiredTiger closed","attr":{"durationMillis":54}}
{"t":{"$date":"2024-08-07T17:23:20.570+08:00"},"s":"I", "c":"STORAGE", "id":22279, "ctx":"initandlisten","msg":"shutdown: removing fs lock..."}
{"t":{"$date":"2024-08-07T17:23:20.570+08:00"},"s":"I", "c":"-", "id":4784931, "ctx":"initandlisten","msg":"Dropping the scope cache for shutdown"}
{"t":{"$date":"2024-08-07T17:23:20.570+08:00"},"s":"I", "c":"CONTROL", "id":20565, "ctx":"initandlisten","msg":"Now exiting"}
{"t":{"$date":"2024-08-07T17:23:20.570+08:00"},"s":"I", "c":"CONTROL", "id":8423404, "ctx":"initandlisten","msg":"mongod shutdown complete","attr":{"Summary of time elapsed":{"Statistics":{"Enter terminal shutdown":"0 ms","Step down the replication coordinator for shutdown":"0 ms","Time spent in quiesce mode":"0 ms","Shut down FLE Crud subsystem":"0 ms","Shut down MirrorMaestro":"0 ms","Shut down WaitForMajorityService":"1 ms","Shut down the transport layer":"0 ms","Shut down the global connection pool":"0 ms","Shut down the flow control ticket holder":"0 ms","Kill all operations for shutdown":"0 ms","Shut down all tenant migration access blockers on global shutdown":"0 ms","Shut down all open transactions":"0 ms","Acquire the RSTL for shutdown":"0 ms","Shut down the IndexBuildsCoordinator and wait for index builds to finish":"0 ms","Shut down the replica set monitor":"0 ms","Shut down the migration util executor":"0 ms","Shut down the TTL monitor":"0 ms","Shut down expired pre-images and documents removers":"0 ms","Shut down the storage engine":"54 ms","Wait for the oplog cap maintainer thread to stop":"0 ms","Shut down full-time data capture":"0 ms","shutdownTask total elapsed time":"55 ms"}}}}
{"t":{"$date":"2024-08-07T17:23:20.570+08:00"},"s":"I", "c":"CONTROL", "id":23138, "ctx":"initandlisten","msg":"Shutting down","attr":{"exitCode":62}}
Any idea what that log shows?
===== EDIT =====
I tried a few other things:
➜ ps aux | grep mongod
grant 92174 0.0 0.0 41073264 1488 s000 S+ 6:41pm 0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn --exclude-dir=.idea --exclude-dir=.tox mongod
➜ brew services list
Name Status User File
mongodb-community error 3584 grant ~/Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist
The contents of ~/Library/LaunchAgents/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>
cat /opt/homebrew/var/log/mongodb/output.log
Output:
cat /opt/homebrew/etc/mongod.conf
Output:
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
ls -l /opt/homebrew/var/log/mongodb/
Output:
-rw------- 1 grant admin 10183 7 Aug 19:03 mongo.log
-rw-r--r-- 1 grant admin 0 7 Aug 18:39 output.log
/opt/homebrew/opt/mongodb-community/bin/mongod --config /opt/homebrew/etc/mongod.conf
Output:
2
Answers
The log you provided from MongoDB indicates that the mongodb server is starting up but then shuts down immediately.
The log entries related to ‘WiredTiger’ sho wthat Mongodb’s storage engine is closing and shuting down. WiredTiger is the default storage engine user by mongodb
The exit code 62 generally indicated that mongodb encountered an error during startup or shutdown.
Potential causes:
Try uninstall and re-install mongodb. But this time try this command,
or
brew update
brew uninstall [email protected]
brew install [email protected]
To check if it has started,
Just in case you can do it this operation with sudo
From https://www.mongodb.com/docs/manual/reference/exit-codes/ the code 62 is…
The simples way to prove it is correct is to create an empty
/opt/homebrew/var/mongodb_test
and change/opt/homebrew/etc/mongod.conf
to point dbPath to that location.Mongo will initialise the wt files on first run.