Mongo服务崩溃.需要查找崩溃原因 [英] Mongo service crashed. Need to find reason of crash

查看:647
本文介绍了Mongo服务崩溃.需要查找崩溃原因的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天早晨,我在服务器上发现了mongo的以下错误.

Today morning I found the following error with mongo, on my server.

*** System restart required ***
You have mail.
ubuntu@ip-xxx-xx-xx-xx:~$ mongo
MongoDB shell version: 2.4.9
connecting to: test
Wed Nov 25 05:18:51.381 Error: couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:145
exception: connect failed

它使我的网站崩溃了.我如何找到停止的mongo服务? mongo对此有日志吗?在哪里可以找到它们?另外,如何确定mongodb是否崩溃了,它也会重新启动服务?

It crashed my website. How can I find what stopped mongo service? Do mongo have logs for this? Where can I find them? Also How to make sure if if mongodb is crashed then it restart service as well?

我重新启动了mongodb服务,网站又重新开始工作.

I restarted mongodb service and website started working again.

ps -ef的输出| grep mongod:

Output of ps -ef | grep mongod:

mongodb   14756      1  0 05:20 ?        00:00:14 /usr/bin/mongod --config /etc/mongodb.conf
ubuntu    36865  14123  0 06:18 pts/2    00:00:00 grep --color=auto mongod

推荐答案

我遇到了同样的问题.经过一些搜索,我猜想是os牺牲了mongod来获取内存.如果内核杀死了您的mongod,您可以在内核日志中找到日志

I had the same issue. After some searching I guessed it was os that sacrificed mongod for memory. If kernel killed your mongod you can find the logs in kernel logs

大多数内核日志位于/var/log/kern.log中,这些日志可能已轮换.

Mostly kernel logs will be in /var/log/kern.log, The logs might be rotated.

最好做一个grep

grep mongod /var/log/kern.log*

如果日志已归档 find -name \*kern.log.*.gz -print0 | xargs -0 zgrep "mongod"

./kern.log.1:Nov 12 12:55:04 ip-xxx-xxx-xxx-xxx kernel: [8413229.118361] mongod invoked oom-killer: gfp_mask=0x24201ca, order=0, oom_score_adj=0
./kern.log.1:Nov 12 12:55:04 ip-xxx-xxx-xxx-xxx kernel: [8413229.118365] mongod cpuset=/ mems_allowed=0
./kern.log.1:Nov 12 12:55:04 ip-xxx-xxx-xxx-xxx kernel: [8413229.118371] CPU: 0 PID: 1830 Comm: mongod Not tainted 4.4.0-1062-aws #71-Ubuntu
./kern.log.1:Nov 12 12:55:04 ip-xxx-xxx-xxx-xxx kernel: [8413229.118531] [ 1301]   112  1301   300787   181207     485       4        0             0 mongod
./kern.log.1:Nov 12 12:55:04 ip-xxx-xxx-xxx-xxx kernel: [8413229.118680] Out of memory: Kill process 1301 (mongod) score 355 or sacrifice child
./kern.log.1:Nov 12 12:55:04 ip-xxx-xxx-xxx-xxx kernel: [8413229.130161] Killed process 1301 (mongod) total-vm:1203148kB, anon-rss:724828kB, file-rss:0kB

这篇关于Mongo服务崩溃.需要查找崩溃原因的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆