Luca Brozzi
Luca Brozzi

Reputation: 335

Mongo refusing connections after system shut it down for RAM outage

according to kern.log, system killed mongo due to having no more RAM available (server has 8GB)

Mar 15 18:06:21 ns504049 kernel: Out of memory: Kill process 10532 (mongod) score 0 or sacrifice child
Mar 15 18:06:21 ns504049 kernel: Killed process 10532 (mongod) total-vm:2556716kB, anon-rss:26968kB, file-rss:0kB

It also killed my screen process.

Now mongod service start will work, but mongo will get errno:111 Connection refused

i had mongod.lock in both data/db/ and var/lib/mongodb, removed both and issued mongod --repair every time, it claimed success but I'm still getting the same error when trying to connect .

Since i tought it may be that the old process using the 27017 port i tried to do mongod --shutdown but it will output:

There doesn't seem to be a server running with dbpath: /data/db

but my mongod.conf has dbpath=/var/lib/mongodb...

I even tried:

$sudo service mongod start
mongod start/running, process 17958
$service mongod status
mongod stop/waiting
$mongod --shutdown
There doesn't seem to be a server running with dbpath: /data/db

why is it looking for that dbpath ?

note: i'm running everything as root The only way i manged to at least look into the db is using mongod --dbpath=/var/lib/mongodb in a byobu window and opening mongo console in another

Upvotes: 0

Views: 1660

Answers (1)

Fox
Fox

Reputation: 2368

Try changing owner of your logfile to that mongodb runs under. In ubuntu its mongodb.

So chown mongodb /var/log/mongodb/mongod.log.

Upvotes: 1

Related Questions