Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MongoDB stops unknown reason

I was setup MongoDB server on Ubuntu 14.04.4 and sometimes its stops unknown reason. Do you have any ideas ?

You can see the last logs before and after I start the mongod instance.

2016-10-12T08:47:32.223+0000 I NETWORK [HostnameCanonicalizationWorker] Starting hostname canonicalization worker
2016-10-12T08:47:32.222+0000 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory '/var/lib/mongodb/diagnostic.data'
2016-10-12T08:47:31.727+0000 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=1G,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
2016-10-12T08:47:31.727+0000 W STORAGE [initandlisten] Recovering data from the last clean checkpoint.
2016-10-12T08:47:31.727+0000 W - [initandlisten] Detected unclean shutdown - /var/lib/mongodb/mongod.lock is not empty.
2016-10-12T08:47:31.727+0000 I - [initandlisten] Detected data files in /var/lib/mongodb created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2016-10-12T08:47:31.700+0000 I CONTROL [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1,server_ip", port: 27017 }, storage: { dbPath: "/var/lib/mongodb", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log" } }
2016-10-12T08:47:31.700+0000 I CONTROL [initandlisten] target_arch: x86_64
2016-10-12T08:47:31.700+0000 I CONTROL [initandlisten] distarch: x86_64
2016-10-12T08:47:31.700+0000 I CONTROL [initandlisten] distmod: ubuntu1404
2016-10-12T08:47:31.700+0000 I CONTROL [initandlisten] build environment:
2016-10-12T08:47:31.700+0000 I CONTROL [initandlisten] modules: none
2016-10-12T08:47:31.700+0000 I CONTROL [initandlisten] allocator: tcmalloc
2016-10-12T08:47:31.700+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1f 6 Jan 2014
2016-10-12T08:47:31.700+0000 I CONTROL [initandlisten] git version: 79d9b3ab5ce20f51c272b4411202710a082d0317
2016-10-12T08:47:31.700+0000 I CONTROL [initandlisten] db version v3.2.10
2016-10-12T08:47:31.700+0000 I CONTROL [initandlisten] MongoDB starting : pid=4487 port=27017 dbpath=/var/lib/mongodb 64-bit host=db-server
2016-10-11T06:54:31.233+0000 I ACCESS [conn1] Successfully authenticated as principal agent on admin
2016-10-11T06:54:29.641+0000 I ACCESS [conn6] Successfully authenticated as principal agent on admin

Note: I was not change anything on config file except bind Ip.

UPDATE

When I look syslog file;

Oct 11 02:54:38 db-server kernel: [] Out of memory: Kill process 26603 (mongod) score 687 or sacrifice child
Oct 11 02:54:38 db-server kernel: [] init: mongod main process (26603) killed by KILL signal
like image 383
Furkan yeşiloğlu Avatar asked Apr 19 '26 17:04

Furkan yeşiloğlu


1 Answers

Looks like your mongo process has been killed by the Linux out-of-memory killer. This generally happens when your machine is running out of memory and something needs to be killed to prevent the OS from crashing.

You can give it some guidance as to what to do. You can take a look at this article for some advice:

OOM Killer

Alternatively you can try to run Mongo in less memory, but Mongo can be difficult to configure to limit the memory usage. There is some guidance here:

Easy Steps to Limit Mongodb Memory Usage

Might be you don't have enough RAM on the box to run mongo - how much memory do you have on your Ubuntu server?

like image 137
Matt Innes Avatar answered Apr 22 '26 05:04

Matt Innes