server keeps crashing using mongodb

April 7, 2017 160 views
DigitalOcean Ubuntu

I use this command to hang up a mongodb in background and set dbpath to mount:

sudo mongod --dbpath /mnt/volume-nyc1-04/mongodata2 --fork --logpath /var/log/mongod.log --bind_ip 127.0.0.1

this works well for mongodata, but for mongodata2 whenever i type into command line the whole server just keep crashing and i have to log into console and power on.

This mongodata2 is a large db (300GB) with large collection (3billion rows). I am wondering what could cause the server crashing?

2 Answers

Why are you running mongodb as root? What do you mean by "crashing"? Did you check the logs?

  • I tried mongod without sudo, it crashes as well.
    crashing means the whole system just went down, like shut down.
    which log should I check? I have checked one of them, it simply says 'crash', nothing else

    • I sincerely doubt the log file just says "crash". Check /var/log/syslog for example.

Hi @adrian3118b6a2c

If the server reboots, meaning kernel crash, then you should find some information in /var/log/kern.log
https://help.ubuntu.com/community/DebuggingSystemCrash#log_files

But you're using MongoDB incorrect. You shouldn't run it as root - never. And if you run multiple MongoDBs at the same time, you need to set different PID, dataPath, listen address, etc.

Have another answer? Share your knowledge.