Mongod service won't start in OSX - mongodb

I'm having trouble getting mongodb to run in OSX Mavericks.
I installed it using brew, but when I run mongod it tell me that output is going to usr/var... as normal then quits out to the terminal prompt with no errors. Any ideas what the problem could be?
I've tried removing the .conf file and reinstalling, I've checked nothing else is using the port. When I try and run it through the launchctl plist file it says the file doesn't exist.
Thanks,
Tom.

Create a folder somewhere in your drive and start it using
mongod --dbpath yourfolder --logpath myfile.log --logappend
.. and check the result.
I have several instances of mongo running in my Mac with Maverick OSX and it works perfectly.
I think it's the best way to test it. After that you can review what's going on with the config files.
If this works you can add --fork at the end to fork the process.

Related

Mongod not working in terminal, trying to reassign alias

I am using Mac Monterey
When I type mongod in the terminal, I get the shutting down exitCode:100 error.
I can reassign mongod with alias mongod="sudo mongod --dbpath /usr/local/data/db, then mongod works after I type in my password, it does not work if I do not add sudo.
If I do not add sudo, I get the aborting after fassert() failure error.
After restarting the terminal, I have to reassign mongod again otherwise I get the exitCode:100 error again
I tried to re-assign mongod with alias mongod="sudo mongod --dbpath /usr/local/data/db in the .bash_profile file using vim.
Then mongod works, but only for that one session... if I restart the terminal, then I have to re-assign it again.
I tried re-assigning it in the .bash_profile... but I think I might be doing it wrong or something
can someone please help with this?
I found the problem, all the comments on google says to use a .bash_profile to update the mongod file path, however I found that I was supposed to update the file path in a .zprofile file as I'm using zsh and not bash

Unable to configure mongoDB

Im learning mongoDB and exploring its features, i try several commands when i run the terminal and mongod acts like does not care. It always starts the server even though i simply run for reading help.
Some commands that i run
mongod --help
mongod --port 5000
mongod --dbpath C:\myfolder\myproj\data\db
Everytime, no matter witch i run from the above commands it starts the server always even when searching for help. The port and path do not change also, it looks like it ingores everything other than the mongod in the terminal. Any help?
mongod starts the service, but when you close the terminal then also the service terminates.
However, usually you install mongod as a Service. See mongod.exe for details.
Maybe this package will help you: mongoDB-oneClick

Mongo DB freezes during --config or --dbpath

(I am a Windows user)
I recently installed the MongoDB application onto a remote HDD. I have installed Mongo DB before on my Laptop's SDD and it worked perfectly. I am encountering an issue with the mongod --config "PATH to cfg file" command and the mongod --dbpath "PATH to database". When I run either command, the program halts (I can still close the Command Prompt window though). I am trying to change the database path because right now it defaults to C:/data/db even though Mongo is installed on a foreign Disk Drive. I have tried running both commands as a System Administrator to no avail. Any ideas as to I can solve this issue?

Cannot start mongodb server

I'm following this tutorial, as well as this one, and I keep getting the same error when starting up my mongodb server.
Running just mongo returns
zsh: command not found: mongod
Running ./mongod returns
zsh: exec format error: ./mongod
Running sudo ./mongod returns
./mongod: ./mongod: cannot execute binary file
My mongodb folder is located in ~/mongodb, which is where the bin folder is. I also created the directory where Mongo will store the data in /data/db, with the correct permissions: drwxr-xr-x. I don't know what I'm missing, or what I'm doing wrong.
How do I start the mongodb server?
Solved
I was using the wrong OS. I downloaded the linux version when I should have downloaded the OS X version since I'm on a Mac. Once I did, everything worked fine.
Much more robust is if you start it as a service with sudo service mongod start
Alternatively, you need to make sure the directory is added to .bashrc.
try this command. It worked for me in git bash
./mongod.exe --port <port number> --dbpath <db folder path>
Ex:
./mongod.exe --port 27017 --dbpath E:/Projects/Databases/data/db
Most likely the path to your MongoDB is not within your $PATH. If you are on linux you can quickly run:
echo $PATH
If it is not in your path, then you want to add it:
export PATH=/path_to_mongodb_bin/:$PATH
Once done, attempt to start mongodb by running:
mongod

Need to launch mongod using launchctl

I have installed MongoDB using manual option.
When I fire mongod it will take parameters from somewhere else specially for dbPath.
I want to have my own dbPath without specifying it with --dbPath each time.
So I found option to provide mongod.conf file and call mongod --config option but still I need to pass path of .conf file.
My ultimate goal is to just launch mongod as service and it will read config file from path I configured. For this I tried LaunchAgent and LaunchDaemon with no luck. What I thought is that if I can configure LaunchAgent or Daemon then I will provide path to mongod of bin directory of MongoDB folder and provide --config and path for .conf file as argument and then I need to just launch mongod using launchctl with name mongod and it will start mongod --config <.conf file path>.
But I am not able to do so. I read nearly 15-16 posts on LaunchAgent and Daemon but did not get solution my problem. I tried to do so with making mongod.plist file at various places like /Library/LaunchDaemon, /Library/LaunchAgent and ~/Library/LaunchDaemon but I always get error "Path had bad ownership/permissions". I tried chown and chgrp but no luck.
I hope you got my point. I really need complete solution to achieve my goal.
Do you use linux or windows?
This is the default location of mongodb.conf in linux:
/etc/mongodb.conf
You can simply edit it with your parameters, and start the service using:
sudo service mongodb restart
If you are using windows, it depends on the version of MongoDB you are using, but check in:
C:\Program Files\MongoDB\Server\3.4\...
For the same file.