I am using mac osx 10.10.5
This question has been asked many times before and after following the steps, I notice bizarre behavior.
These are the steps which I have taken
brew tap gapple/services
brew install mongodb
This installs the product and now when I do brew services list
I can see mongodb in a stopped state.
When I tried to start the process by brew services start mongodb
I get an error
Error: Could not read the plist for mongodb
!
OK. I googled a solution
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/mongodb/3.0.6/homebrew.mxcl.mongodb.plist ~/Library/LaunchAgents/
Now as soon as the file is copied, when I do brew services list
... the mongo process is automatically running.
Now when I do brew services stop mongodb
It says
Error: Service `mongodb` not running, wanna start it? Try `brew services start mongodb`
Now this is bizarre, because just in the last step it said its running. Now when I do
mongodb services list
it says that the service is stopped. (so the stop command above did work. Even though it threw an error).
Now if I do
brew services start mongodb
It gives error Error: Could not read the plist for mongodb
!
Now if I copy the file again
cp /usr/local/Cellar/mongodb/3.0.6/homebrew.mxcl.mongodb.plist ~/Library/LaunchAgents/
The service automatically begins to run.
I find this whole thing really bizarre. All I want is a clean way to start stop the mongo db service. And although there are many threads on this site (and elsewhere) ... they don't work or just have strange behavior.
To start the service use: NET START MONGODB. To stop the service use: NET STOP MONGODB.
Run the Mongo daemon, in one terminal window run ~/mongodb/bin/mongod . This will start the Mongo server. Run the Mongo shell, with the Mongo daemon running in one terminal, type ~/mongodb/bin/mongo in another terminal window. This will run the Mongo shell which is an application to access data in MongoDB.
Open the terminal, and navigate to your home directory: cd ~ . Then make a folder where all of the actual database data will go: mkdir -p mongodb/data/db . Now you're ready to start the server. To ensure that you have MongoDB installed correctly, run mongo --version and mongod --version .
brew services start/restart/stop [email protected]
For me I had multiple version of mongodb and when I tried to switching between them, I got this error
Error: Could not read the plist for `mongodb26`!
This is what I did to start mongodb26 service.
brew unlink mongodb24
brew link mongodb26
brew services start mongodb26
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With