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
Related
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
I'm getting the following error when I try to run "mongod" in the terminal. I've tried uninstalling, reinstalling, and restarting the machine. Any suggestions on how to get it working would be amazing.
ERROR:
dbpath (/data/db) does not exist.
Create this directory or give existing directory in --dbpath.
See http://dochub.mongodb.org/core/startingandstoppingmongo
Side note:
Node also stopped working on my machine around the same time that I got this error.
events.js:72
throw er; // Unhandled 'error' event
^
Error: failed to connect to [localhost:27017]
Any help would be much appreciated!
This should work to ensure that the directory is set up in the right place so that Mongo can find it:
sudo mkdir -p /data/db/
sudo chown `id -u` /data/db
You need to create the directory on root /data/db or set any other path with the following command :
mongod --dbpath /srv/mongodb/
See the example link
I solved the problem with :
sudo mongod --dbpath=/var/lib/mongodb and then mongo to access the mongodb Shell.
Change the user of the new data directory:
chown mongodb [rute_directory]
And try another time to start the mongo service
service mongod start
I solve the same problem with this.
Daemons (usually ending with d) are normally started as services. Starting the service (daemon) will allow mongodb to work as designed (without permission changes if integrates well with your distro). I start it using the service named mongodb instead of starting mongod directly--on distro with systemd enable on startup then run like:
sudo systemctl enable mongodb
sudo systemctl start mongodb
or, on distro with upstart (if you have /etc/init) or init (if you have /etc/init.d) ( https://www.tecmint.com/systemd-replaces-init-in-linux/ ) instead run:
sudo service mongodb enable
sudo service mongodb start
If you have a distro with rc ("run commands") such as Gentoo (settings in /etc/init.d) (https://forums.gentoo.org/viewtopic-t-854138-start-0.html) run:
rc-update add mongodb default
/etc/init.d/mongodb start
In a distro/version of FreeBSD which still has rc (check whether your version switched to systemd, otherwise see below):
add the following line to /etc/rc.conf:
mongod_enable="YES"
then:
sudo service mongod start
After starting the service, an unpriveleged user can use mongo, and each user will have separate data.
I also got the error that "The file /data/db doesn't exist" when I tried to save my file using the "mkdir -p /data/db" command(using both with and without sudo command). But later on one site, a person named Emil answered that the path "/data/db" no longer works on Mac, so use "~/data/db" instead
i.e., use the command
mkdir -p ~/data/db
instead of previous command.
Moreover, use
mongod --dbpath ~/data/db
to run mongod
It worked for me, hope it work for others too facing the same problem
I have installed mongodb using macports. I can run mongod from the terminal with
sudo mongod --dbpath /opt/local/var/db/mongodb
When I try to run it with:
sudo port load mongodb
mongod fails to start. The log file shows repeated attempts to start, each of them including the message
info preallocateIsFaster couldn't run due to: couldn't open file /opt/local/var/db/mongodb/journal/tempLatencyTest for writing errno:13 Permission denied; returning false
There is no such file, but the directory exists. It is owned by root with group _mongo. Changing its ownership to _mongo resulted in other problems. I also tried
mongod --repair
and although that had fixed a problem with the lock file it isn't fixing this one. Help appreciated.
A fairly simple question...
mongod in the command line just stopped working?
In the command line i start up mongod like i used to and it doesn't start and just goes straight back to the command line:
username:~ computer$ mongod
all output going to: /usr/local/var/log/mongodb/mongo.log
username:~ computer$
Tried in terminal mongod --repair and nothing happens... it just waits longer before going back to the normal username:~ computer$
Why is this broken now?... how do i figure out what went wrong? So confused.
I'm trying to uninstall mongodb and re-install... even that is hard... how to you uninstall it in terminal?
ER
This cmd seems to have fixed it:
$ mongod --repairpath arg
For start mongod you need parameter -dbpath -logpath mandatorily or configure all parameters in /etc/mongod.conf and run with root user
If you run mongo shell, in console typing mongo, not mongod, mongod launch mongo process, mongo is for access to shell.
If you need unistall mongo, only need delete all mongo files in /user/bin or path where unzipped the pack mongo
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.