Re: mongod fails when changes made to dbpath in /ect/mongod.conf

896 views
Skip to first unread message

Ramazan POLAT

unread,
Feb 16, 2013, 4:53:13 PM2/16/13
to mongod...@googlegroups.com
Provide your conf file and error message, then maybe we can help.

On Saturday, February 16, 2013 11:32:16 PM UTC+2, Ramanujam Paravastu wrote:
Hello Everyone,

I have tried to make changes in the file /etc/mongod.conf for the location of dbpath and logpath making sure those folders exist.
When I start the service mongod it fails to start.

Can somebody help? 

Thanks,
Ram.

Ramanujam Paravastu

unread,
Feb 16, 2013, 5:02:50 PM2/16/13
to mongod...@googlegroups.com
Hello Ramazan,

Below is the excerpt of the conf file where I changed the old dbpath and logpath lines are commented out:
 mongo.conf

#where to log
#logpath=/var/log/mongo/mongod.log
logpath=/db/log/mongo/mongod.log

logappend=true

# fork and run in background
fork = true

#port = 27017

#dbpath=/var/lib/mongo
dbpath=/db/database/mongo

# location of pidfile
pidfilepath = /var/run/mongodb/mongod.pid

# Disables write-ahead journaling
# nojournal = true


The error I get when I start the service is as follows:

[root@project mongo]# service mongod start
Starting mongod: forked process: 8692
all output going to: /db/log/mongo/mongod.log
                                                           [FAILED]
[root@project mongo]#


the /db/log/mongo/mongod.log  details are as follows:

Sat Feb 16 15:58:43 [initandlisten] MongoDB starting : pid=8692 port=27017 dbpat
h=/db/database/mongo 64-bit host=project.net
Sat Feb 16 15:58:43 [initandlisten] db version v2.2.3, pdfile version 4.5
Sat Feb 16 15:58:43 [initandlisten] git version: f570771a5d8a3846eb7586eaffcf4c2
f4a96bf08
Sat Feb 16 15:58:43 [initandlisten] build info: Linux ip-10-2-29-40 2.6.21.7-2.e
c2.v1.2.fc8xen #1 SMP Fri Nov 20 17:48:28 EST 2009 x86_64 BOOST_LIB_VERSION=1_49
Sat Feb 16 15:58:43 [initandlisten] options: { config: "/etc/mongod.conf", dbpat
h: "/db/database/mongo", fork: "true", logappend: "true", logpath: "/db/log/mong
o/mongod.log", pidfilepath: "/var/run/mongodb/mongod.pid" }
Sat Feb 16 15:58:43 [initandlisten] exception in initAndListen: 10309 Unable to
create/open lock file: /db/database/mongo/mongod.lock errno:13 Permission denied
 Is a mongod instance already running?, terminating
Sat Feb 16 15:58:43 dbexit:
Sat Feb 16 15:58:43 [initandlisten] shutdown: going to close listening sockets..
.
Sat Feb 16 15:58:43 [initandlisten] shutdown: going to flush diaglog...
Sat Feb 16 15:58:43 [initandlisten] shutdown: going to close sockets...
Sat Feb 16 15:58:43 [initandlisten] shutdown: waiting for fs preallocator...
Sat Feb 16 15:58:43 [initandlisten] shutdown: lock for final commit...
Sat Feb 16 15:58:43 [initandlisten] shutdown: final commit...
Sat Feb 16 15:58:43 [initandlisten] shutdown: closing all files...
Sat Feb 16 15:58:43 [initandlisten] closeAllFiles() finished
Sat Feb 16 15:58:43 [initandlisten] shutdown: removing fs lock...
Sat Feb 16 15:58:43 [initandlisten] couldn't remove fs lock errno:9 Bad file des
criptor
Sat Feb 16 15:58:43 dbexit: really exiting now


I made sure there was no other mongod process running:

[root@project mongo]#  ps -ef |grep mongo
root      2372     1  0 14:26 ?        00:00:00 gedit /root/Desktop/ram_notes_mongo
root      8722  2108  0 16:01 pts/0    00:00:00 grep mongo
[root@project mongo]#



Thanks,

Ram.

Ronald Stalder

unread,
Feb 16, 2013, 8:37:23 PM2/16/13
to mongod...@googlegroups.com
Hi Ram

your logfile says:


Sat Feb 16 15:58:43 [initandlisten] MongoDB starting : pid=8692 port=27017 dbpat
h=/db/database/mongo 64-bit host=project.net
Sat Feb 16 15:58:43 [initandlisten] db version v2.2.3, pdfile version 4.5
Sat Feb 16 15:58:43 [initandlisten] git version: f570771a5d8a3846eb7586eaffcf4c2
f4a96bf08
Sat Feb 16 15:58:43 [initandlisten] build info: Linux ip-10-2-29-40 2.6.21.7-2.e
c2.v1.2.fc8xen #1 SMP Fri Nov 20 17:48:28 EST 2009 x86_64 BOOST_LIB_VERSION=1_49
Sat Feb 16 15:58:43 [initandlisten] options: { config: "/etc/mongod.conf", dbpat
h: "/db/database/mongo", fork: "true", logappend: "true", logpath: "/db/log/mong
o/mongod.log", pidfilepath: "/var/run/mongodb/mongod.pid" }
Sat Feb 16 15:58:43 [initandlisten] exception in initAndListen: 10309 Unable to
create/open lock file: /db/database/mongo/mongod.lock errno:13 Permission denied

 Is a mongod instance already running?, terminating
Sat Feb 16 15:58:43 dbexit:


 You run the service as root but the service script probably contains a "--chuid mongodb" and runs mongod as user mongodb. Verify that this user has write access to the new locations

Cheers
Ronald

Ramanujam Paravastu

unread,
Feb 16, 2013, 11:11:24 PM2/16/13
to mongod...@googlegroups.com
Ronald,

Thank You very much for all the help.  After fixing the permissions mongod worked like a charm.  
I am new to the MongoDB and learning the administration part by attending the courses offered by 10gen.  
Once again thanks for the help.

Ram.

Ronald Stalder

unread,
Feb 17, 2013, 12:55:13 AM2/17/13
to mongod...@googlegroups.com
We're on the same boat, then, I'm attending M102/DBA too - I'm known there in the discussion forum as ronalstal

Ramanujam Paravastu

unread,
Feb 17, 2013, 1:11:25 AM2/17/13
to mongod...@googlegroups.com
Hi Ronald,

Good to know that we are both in the same class.  I read all the discussions on 10gen in the class forum.  Now a new problem.  The machine I was talking about is a Oracle VirtualBox VM running on my laptop, mongo is running fine on the VM after all the fixes you suggested.  I have added on both sides in the hosts file the respective entries.  I trying to connect to the mongo running on the VM via MongoVue and the connetion is refused.  I have the used a different port other than the standard port.  On the VM I am able to do all I want to do.  From the host machine no connectivity.  I can ping the VM with the hostname as well as the IP address as well from the host machine.  No connections lost. I have also listed the new port in the IPTABLES on the VM machine to accept tcp connections.  Can you give me pointers where I am going wrong?

Thanks,
Ram.

Ronald Stalder

unread,
Feb 17, 2013, 7:42:47 AM2/17/13
to mongod...@googlegroups.com
Hi Ram,

sorry, I won't be able to help on this, I haven't done much with
Virtualboxes yet. All I have is a Windos XP VM on my Ubuntu machine....
I suggest you ask this question in a new post

Good luck!
Ronald

Asya Kamsky

unread,
Feb 17, 2013, 11:40:10 AM2/17/13
to mongod...@googlegroups.com
Just to clarify - you can ping the VM's address from outside of it?

Can you connect to the port that you are running mongod on? Simplest way to tell is with telnet:
$ telnet vmhostname 27017

(Except replace 27017 with the port number you used for mongod)

If you get connection refused, it's your system configuration problem, if not then you probably need to configure MongoVue to connect to correct port.

Try simple mongo shell from outside VM.

$ mongo vmhostname:27017
>

(Again use your specific port).

Asya

Reply all
Reply to author
Forward
0 new messages