Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I installed MongoDB using this tutorial. I have tried to set --dbpath in /etc/mongodb.conf like this:

dbpath=/path/that/iwant

#where to log
logpath=/var/log/mongodb/mongodb.log

logappend=true

When I mongod I get:

ERROR: dbpath (/data/db/) does not exist.

Further more, if I declare mongodb --dbpath /path/that/iwant i get:

exception in initAndListen: 10309 Unable to create/open lock file
errno:13 Permission denied Is a mongod instance already running?

Q: How do I get mongod to reference the proper path in the config file without specifying.

Bonus: Why is permission being denied from mongo. (I have tried sudo chmod -R 775 /path/that/iwant and sudo chown -R mongodb /path/that/iwant)

I am new to mongo and database admin exchange. As a brother from Stack Overflow I am humbled.

Edit: I added the path /data/db to the pie and chown mongodb on it. If I sudo mongod the server starts. If I try to start it with my user it will not start getting an error Unable to create/open lock file which exists.

Edit: Here is what my /etc/init.d/mongd looks like:

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/mongod
DESC=database

# Default defaults.  Can be overridden by the /etc/default/$NAME
NAME=mongodb
CONF=/etc/mongodb.conf
DATA=/path/that/iwant
LOGDIR=/var/log/mongodb
PIDFILE=/var/run/$NAME.pid
LOGFILE=$LOGDIR/$NAME.log  # Server logfile
ENABLE_MONGODB=yes

...further down

DAEMONUSER=${DAEMONUSER:-mongodb}
DAEMON_OPTS=${DAEMON_OPTS:-"--dbpath $DATA --logpath $LOGFILE run"}
DAEMON_OPTS="$DAEMON_OPTS --config $CONF --rest"

This is what ps aux | grep mongo looks like after i start the server with sudo mongod:

root     10747  0.1  0.3   5124  1612 pts/0    S+   10:41   0:00 sudo mongod
root     10748  1.8  3.8  84896 17416 pts/0    Sl+  10:41   0:00 mongod
1001     10823  0.0  0.1   3544   808 pts/1    S+   10:42   0:00 grep --color=auto mongo
share|improve this question
    
I've had somewhat similar issues. First, /data/db is going to be the default data path. That's why it's trying to start there if you don't specify. You can specify in the init script. I don't see a note that you did that, and couldn't find an instruction in the tutorial you linked. Is $DATA specified there as called in this line? DAEMON_OPTS=${DAEMON_OPTS:-"--dbpath $DATA --logpath $LOGFILE run"}. Also, are you calling the init script when you start (e.g., service mongo start) to call in those values? Can you paste in your ps aux | grep mongo here when it's running? –  Valerie Parham-Thompson Apr 20 at 12:49
    
I've edited my question and added that information @ValerieParham-Thompson. I thank you so much for the response. I thought I was a goner on this one. –  13ruce1337 Apr 20 at 14:43
    
OK. Are you typing "sudo mongod" or "sudo /etc/init.d/mongod start"? –  Valerie Parham-Thompson Apr 21 at 1:21
    
@ValerieParham-Thompson I am typing "sudo mongod" –  13ruce1337 Apr 21 at 12:18
    
Ah, okay. Try using the init file... the instructions in that tutorial say "sudo /etc/init.d/mongod start" so that should be the right command. That should call in the variables you've specified in the init file, including the mongodb user. Does that work? –  Valerie Parham-Thompson Apr 22 at 1:17

1 Answer 1

Firstly instead of installing mongodb through apt just get a tar or zip of it.

1)Extract it to your home folder or wherever you would like.

2)Mark the mongod,mongo,mongos executable.

3)make a conf file say mongod.conf and add

 dbpath=conf/data/db
 logpath=conf/log/mongod.log
 logappend=true
 port = 27001
 fork = true

4)Start mongod by

 path/bin/mongod --config path/mongod.conf

"bin" because you will find mongod in bin folder after extract

share|improve this answer
    
I'm not sure if you've noticed I have an ARM processor... –  13ruce1337 Apr 24 at 1:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.