mongo version: mongodb-win32-x86_64-2008plus-ssl-3.2.6-signed
It succeeded in another computer.
I do as README but nothing happend..
What should I do ?
PS D:\MongoDB\Server\3.2\bin> mongod --config D:\mongodb\Server\3.2\mongo.config
PS D:\MongoDB\Server\3.2\bin>
PS D:\MongoDB\Server\3.2\bin> mongod --dbpath D:\mongodb\Server\3.2\data\db
PS D:\MongoDB\Server\3.2\bin>
Try mongod -vvvv ... for verbose output during sturtup.
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
Based on the question here, I have the following rc.local
#!/bin/bash
#start script
exec 2> /scriptfolder/rc.local.log
exec 1>&2
set -x
/scriptfolder/startscript.sh
exit 0
Here is the specific line of startscript.sh that isn't working properly from rc.local
nohup sudo mongod --dbpath /scriptfolder/subfolder/ta_data/ --port 27027 --logRotate reopen --logappend --logpath /scriptfolder/autostart.mongod.log --fork &
I've also tried a few variants, including:
nohup sudo mongod --dbpath /scriptfolder/subfolder/ta_data/ --port 27027 &> /scriptfolder/autostart.mongod.log&
They all work when I run ./startscript.sh manually but when it runs from rc.local mongo never starts. Subsequent commands (including some docker commands) do run, so I know the script itself is executing. I don't see any errors in rc.local.log and autostart.mongod.log is just empty.
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 experiment with mongoDB's new full text search:
http://docs.mongodb.org/manual/tutorial/enable-text-search/
However, when I either use the parameter in the mongod command, or in a config file, I get the following error:
[root#bobby etc]# /usr/bin/mongod --dbpath /home/bobby/data/ --setParameter textSearchEnabled=true
error command line: unknown option setParameter use --help for help
And I'm running the latest version of MongoDB on Scientific Linux
[root#bobby etc]# mongo
MongoDB shell version: 2.4.3
connecting to: test
Interestingly, setParameter isn't listed in --help either:
[root#bobby etc]# /usr/bin/mongod --help | grep setParameter
(nothing)
It was because yum was only updating mongo, not mongo-server.
So I used the command:
yum install mongo-10gen-server.x86_64
And now everything works :)
I understand that mongo db need to be started before I can interact with it. But what I don't understand why do I set the dbpath every time? I thought we only need to configure that path once. Am I correct?
You can solve this two ways:
change your dbpath to the hard coded one which will point to /data/db/
Or make a startup script that will actually call the MongoDB instance for you
You could make a few scripts, as I said in my last point, to do this for you, as an example:
=== rnMongo.sh ===
./mongod --dbpath
Then with a single command:
./rnMongo.sh
Or as an upstart job:
# mongodb - Mongo Starter
author "lol"
description "Starts the MongoDB servers"
start on started network-services
#expect fork
exec /home/ubuntu/mongodb/bin/mongod --auth
#echo "Mongodb is now running";
#exit 0;
#stop
stop on runlevel [016]
#pre-stop
Something along those lines
Just add mongod --dbpath /home/user/mongodb to your startup applications ;)
sudo mongod --port portnumber --dbpath /path to your folder
By default it is set to
sudo mongod --port 27017 --dbpath /var/lib/mongodb