Installed docker and ran a container with mongodb, now brew's mongodb isn't working
I am using a mac and originally installed mongodb using homebrew.
brew services list now shows the mongodb service as ‘running’ but in yellow (apparently this means unknown), and I cannot connect using mongochef. This began happening after only once stopping the service
brew service stop mongodb, as it was preventing me from using docker with this project: https://meanjs.org/. I stopped the service because there was a conflict for the mongodb port. Now even after destroying all the docker containers, I can’t get mongodb working on my machine. I have tried reinstalling mongodb using brew, and stopping and starting the service.
I have also tried deleting the file in /tmp as here:
MongoDB Failing to Start – ***aborting after fassert() failure
Any suggestions about where to look and what to do?
One Solution collect form web for “Installed docker and ran a container with mongodb, now brew's mongodb isn't working”
So this turned out to be one of those really annoying problems that comes up when you have a lot of other stuff to do. I am still not completely sure if it was one issue or multiple issues. If I was to try and fix it again though, this is the order I would go in:
I removed mongo completely and reinstalled (this finally fixed the mongodb service’s status from being shown in yellow instead of in green), as here: https://gist.github.com/katychuang/10439243:
# checks to see if running launchctl list | grep mongo launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist launchctl remove homebrew.mxcl.mongodb pkill -f mongod rm -f ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist brew uninstall mongodb # double check existence ls -al /usr/local/bin/mong* ls -al ~/Library/LaunchAgents # this was mentioned in the comments rm -R /usr/local/var/mongodb
However, I think my data was corrupted too. Unfortunately
mongod --repair (mongodb error: how do I make sure that your journal directory is mounted) was saying it couldn’t repair the data without running with
--journaled but that didn’t work either. So I deleted my databases in
/data/db I didn’t need them anyway because I have backups and just restored them easily.
Hope that can help anyone having similar issues.
mongod command on the command line gave some helpful output in tracking this down.
vim ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist allowed me to see which command was being run:
<string>/usr/local/opt/mongodb/bin/mongod</string> <string>--config</string> <string>/usr/local/etc/mongod.conf</string>
This showed me that /usr/local/etc/mongod.conf was being used, and realising that whilst running
/usr/local/opt/mongodb/bin/mongod was working, running:
/usr/local/opt/mongodb/bin/mongod --config /usr/local/etc/mongod.conf was not working, helped me narrow the problem down