I have installed MongoDB in the C drive. the bin folder is in the below path.
i have also created the data and log folders.within the data folder have created a folder named db
C:\Program Files\MongoDB\Server\3.4\bin
i have opened the cmd and navigated to the bin folder and type the below command
mongod --directoryperdb --dbpath C:\Program Files\MongoDB\Server\3.4\data\db --logpath C:\Program Files\MongoDB\Server\3.4\log\mongo.log --logappend --rest --install
i am getting the below error
and when i type the below command also i am getting an error
guys i am clueless ,pls help me out
can you try this:
mongod --directoryperdb --dbpath "C:\Program Files\MongoDB\Server\3.4\data\db" --logpath "C:\Program Files\MongoDB\Server\3.4\log\mongo.log" --logappend --rest --install
The error can be because of the space between "Program Files".
For the second error, it is because MongoDB is not installed as a service.
You can check you this answer to see how to setup mongo as a service.
Related
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
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.
while installing MongoDB on my windows 7 64-bit, when I execute command
C:\mongodb\bin\mongod.exe --dbpath d:\test\mongodb\data
it gives me error that switch dbpath is not recognized and when I check in its help, I really cannot find this --dbpath switch.
any help where i'm doing mistake?
It looks right, on my system (windows 10) the following command line works to set up up as a windows service.
C:\Program Files\MongoDB\Server\3.4\bin\mongod.exe --storageEngine wiredTiger --dbpath "C:\mongodata\db" --logpath "C:\mongodata\log\mongo.log" --serviceName yourname --serviceDisplayName "your description" --install
from the help:
C:\Program Files\MongoDB\Server\3.4\bin\mongod.exe -help
--dbpath arg directory for datafiles - defaults to \data\db\
which is D:\data\db\ based on the current
working drive
I'm trying to configure windows 7 (32 bit) service for MongoDB with that cmd command:
mongod.exe -f mongo.conf --install --serviceName mongoDB --serviceDisplayName "MongoDB windows service" --serviceDescription "MongoDB"
-f mongo.conf is a reference to my configuration file located in the same directory with mongod.exe.
this is how my mongo.conf looks like:
dbpath = C:\Program Files\MongoDB 2.6 Standard\data
logpath = C:\Program Files\MongoDB 2.6 Standard\logs\mongo.log
port = 27017
and yet, when i'm trying to run the command, mongo logs to me:
--install has to be used with --logpath
anyone has an idea what is wrong with that?
Use the full path in the -f argument:
--install -f "C:\Program Files\MongoDB 2.6 Standard\mongod.conf"
(caveat: I haven't tried this with whitespaces in the folder names)
Services working directory isn't the directory that you install them from or that their exe resides in, but the %windir%\system32 directory.
I was following this quickstart guide, http://www.mongodb.org/display/DOCS/Quickstart+OS+X, but I got lost when they told me to to execute ./mongodb-xxxxxxx/bin/mongod, in which directory do I execute this command? I tried to find / -name mongodb results matched that directory format.
To start Mongo, run that command in the root installation directory of mongo, so, assuming you installed mongo in /opt/mongo/mongodb-linux-x86_64-2.0.2, just run in that folder like this...
/opt/mongo/mongodb-linux-x86_64-2.0.2$ ./bin/mongod
Add any additional parameters you need to start the instance, this is how I run my instance....
./bin/mongod --fork --dbpath /opt/mongo/data/db1/dbs --port 33479 --logpath /opt/mongo/data/db1/log/db1.log -logappend
My personal favorite way to install just about anything, including MongoDB, on Mac OS X:
/usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"
brew install mongodb