I'm using zsh and installed mongo using: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/
when trying to use mongod --config /usr/local/etc/mongod.conf --fork I get:
➜ ~ brew list
gettext openjdk scala#2.11
git pcre2
mongodb-community#4.0 sbt
➜ ~ brew services start mongodb-community#4.0
Service `mongodb-community#4.0` already started, use `brew services restart mongodb-community#4.0` to restart.
➜ ~ mongod --config /usr/local/etc/mongod.conf --fork
zsh: command not found: mongod
Can someone help?
It looks like you haven't set path variable for mongodb. You can set it in .zshrc file.
Open .zshrc file in vim using vim ~/.zshrc
then paste the following line
export PATH="<your mongodb bin folder path>:$PATH"
in my case the path is
/Users/namardeepsood/Development/mongodb/bin
save this file and run source ~/.zshrc to refresh the current shell environment.
I installed mongodb by brew on my MacOS as the mongodb official documentation, but I tried to run MongoDB manually as a background process, use command "mongod --config /usr/local/etc/mongod.conf --fork". Then the terminal displayed the message is : command not found: mongo.
Did I miss any steps?
The above error appears when mongodb executable is not included in the PATH environment variable.
MongoDB gets installed to /usr/local/bin/mongod
The command 'mongod --config /usr/local....' will work only if '/usr/local/bin' is included in PATH.
How to fix the problem?
The problem can be fixed in 2 ways -
Calling the mongod command with full path
/usr/local/bin/mongod --config /usr/local/etc/mongod.conf --fork
Adding '/usr/local/bin' to PATH
export PATH=$PATH:/usr/local/bin
Run the above command or add the above line to the end of .zshrc file and .bash_profile file and execute mongodb command in a new terminal window.
mongod --config /usr/local/etc/mongod.conf --fork
Pretext: this has been asked before and i've tried implementing several solutions from previous posters. The only thing i can seem to get working is running mongo as sudo.
I'm not exactly sure what i'm doing wrong. I'm trying to do a tutorial using mongodb and every time i try to run the software i get back an error that its in a read-only directory. I'm on a mac running OS Sierra, i can force run it with sudo but i know thats wrong. I've been searching for an answer for awhile and i have already adjusted the folder permissions to 775 and nothing, then 777, still nothing.
Any help pointing me in the right direction would be greatly appreciated!
to resolve the "warning soft rlimits to low" check out this link - https://gist.github.com/tamitutor/6a1e41eec0ce021a9718
Lets start over as you are bouncing around on what you are trying.
Open activity monitor and kill any mongod process.
Go to your terminal and type which mongo - lets say it shows you download directory
cd to that directory and you should be in the bin directory
cd /mongo download directory/bin
sudo bash
mkdir -p /data/db
chmod 777 /data
chmod 777 /data/db
ls -ld /data/db this will validate you see the data/db directory as 777
exit
You're back in your mongo bin directory - if you are in /usr/local/bin skip this part.
If you are not in /usr/local/bin you will need to copy the mongo files to /usr/local/bin
sudo bash
ls - make sure you are in the correct directory
cp * /usr/local/bin
exit
which mongo should now show /usr/local/bin
type mongod to start it
open a new terminal and type mongo to connect to the instance
I recommend downloading Robo 3T (formally RoboMongo) to quickly check that you can connect.
If you do those steps, you should have no issues connecting to your local Mongo instance.
Your mongod.conf files should be in /usr/local/etc - check there to confirm you have your local host set.
Should be like net:
bindIp:127.0.0.1
I have a file named db.sh in bin folder and when I try to execute this command $ sh bin/db.sh I receive bin/db.sh: line 2: mongod: command not found in console what is wrong there?
#!/bin/sh
mongod --dbpath db --rest --jsonp;
Here is the situation:
which mongod would give you the path to the mongod binary. If there is no output from which, there which could not find mongod. This may be the case that there is not path in the $PATH variable, that contains the mongod binary. You can make sure by executing echo $PATH.
If you have your MongoDB installed manually, in some directory, then you will need to add /path/to/your/mongodb/bin to the $PATH variable in your .bashrc, like this:
PATH=/path/to/your/mongodb/bin:$PATH
But anyway :) seems like you do not have MongoDB installed on your machine. Follow this article to install it.
I'm trying to install habitrpg locally but I keep getting a mongoDB error after typing node src/seed.js:
Error: failed to connect to [localhost:27017]
I saw on other questions with the same error people have suggested typing in 'mongod' and that fixes it by creating a local server. I get the error:
-bash: mongod: command not found
Can't figure out what's wrong. Any ideas?
Open CMD (In Windows) or terminal (In Ubuntu).
type command >cd PATH_FOR_MONGODB_BIN_FOLDER
cd C:\Program Files\MongoDB\Server\3.2\bin
for ubuntu command will be same :
cd /home/MongoDB/Server/3.2/bin
then type command >mongod --dbpath PATH_FOR_DATA_FOLDER
mongod --dbpath C:\data\db
For ubuntu command will be :
./mongod --dbpath /home/data/db
you can specify any folder as data folder.
Wait till CMD or Terminal shows "waiting for connections"
2016-09-01T21:38:33.170+0530 I NETWORK [initandlisten] waiting for connections on port 27017
Then open new CMD or terminal window.
type command >cd PATH_FOR_MONGODB_BIN_FOLDER ( same as step 3 )
cd C:\Program Files\MongoDB\Server\3.2\bin
Don't close previous window of cmd or teminal.
then run mongodb by typing "mongo" in windows or "./mongo" in ubuntu
mongo
For ubuntu
./mongo
After mongodb run successfully you can close previous CMD window.
You don't have MongoDB installed. Follow the directions for your system to install it: http://docs.mongodb.org/manual/installation/
From the habitRPG docs:
Before starting make sure to have MongoDB, NodeJS and npm and Git installed and set up.
I think that you don't have an environmental variable declared. Assuming that your MongoDB installation is C:\ProgramFiles\MongoDB\Server\YOUR_VERSION_NUMBER\, you should just add the bin folder path of that version of MongoDB to your PATH system environment variable.
Here's a link where you can find the way to do that without complications :
http://www.computerhope.com/issues/ch000549.htm
After installing MongoDb you have to add the directory "data\db" under the C:\ directory,
then you should start the mongod.exe
on windows open task manager || Ctrl + shift + ESC > select service tab > search for mongo db > right click > start service
I got this issue because I didn't have MongoDB. So I installed MongoDB and tried to run node application and it worked.
If you don't have MongoDB then follow below steps to install and enjoy
Commands :
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
$ echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
$ sudo apt-get update
$ sudo apt-get install -y mongodb-org
Then type mongo in terminal and if you will get console for mongo then it's done.
Type sudo pip3 install mongodb, then sudo pip3 install pymongo, then mongod.
I had the same problem on my Mac.
I updated my Homebrew files, after I reinstaled MongoDB in my terminal
brew tap mongodb/brew
and
brew install mongodb-community#5.
and I started mongo server
brew services start mongodb/brew/mongodb-community
After that I coud to commect.
my problem is the connectoon is down, run script:
brew services start mongodb-community
And up mongoDB Compass and works.
I ran mongodb install file and choose repair