Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I find out why mongodb crashes?

Tags:

mongodb

I have recently started having my mongodb instance crash on an ubuntu machine at random times, it usually stays up for a day or so. The mongo log has no trace of the crash, just the last operation and when I restarted the server. I need some guidance in finding out the problem and the log doesn't have any information. Is there another log I should be looking at?

The setup is fairly straightforward, single instance (no sharding), of mongodb 2.2 running on an ubuntu box, with pretty much default install.

The only change I have done recently which seems to coincide with this in timing is I have replaced some simple map reduce execution with the aggregate framework.

Thanks.

like image 898
machunter Avatar asked Mar 16 '13 18:03

machunter


People also ask

How do I view MongoDB logs?

MongoDB logs can be found in the MongoDB log files at /var/log/mongodb/mongodb. log. If you can't find the log files from this location, you can check the mongodb. conf.

How fix MongoDB connection failed?

These are some of the solutions: Ensure that your MongoDB instance is running: Compass must connect to a running MongoDB instance. Also check you have installed MongoDB and have a running mongod process. You should also check that the port where MongoDB is running matches the port you provide in the compass connect.

How do I see what processes are running in MongoDB?

pgrep mongo: Prints the process ID of running mongo instance. pgrep command looks through the list of running processes and list down the process ids based on name. nc -v localhost 27017: Prints whether connection to mongodb running on port 27017 is succeeded.

How do I view MongoDB in my browser?

By default, MongoDB starts at port 27017. But you can access it in a web browser not at that port, rather, at a port number 1000 more than the port at which MongoDB is started. So if you point your browser to http://localhost:28017, you can see MongoDB web interface.


2 Answers

MongoDB unofficially have Mtools try download and run with your logs in this tool. it can give you why it went down, how many time it restarted and many more details. you can get this in github

like image 134
Darshan J Avatar answered Sep 18 '22 15:09

Darshan J


Through Logs you can view the actual cause of crash

/var/log/mongodb/mongod.log  ####Common path of logs
 or use this command                   

db.adminCommand( { getLog : "global" } )
like image 45
paul Avatar answered Sep 20 '22 15:09

paul