我在Ubuntu 14.04.4上安装了MongoDB服务器 有时它停止不明原因。你有什么想法吗?
您可以在启动mongod实例之前和之后看到最后的日志。
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
注意:除了绑定Ip之外,我没有对配置文件进行任何更改。
更新
当我查看syslog文件时;
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
答案 0 :(得分:2)
看起来您的mongo进程已被Linux内存杀手杀死。这通常发生在您的计算机内存不足时,需要杀死某些内容以防止操作系统崩溃。
您可以为其提供一些指导。您可以查看本文以获取一些建议:
或者你可以尝试在更少的内存中运行Mongo,但Mongo可能很难配置来限制内存使用。这里有一些指导:
Easy Steps to Limit Mongodb Memory Usage
你可能没有足够的RAM来运行mongo - 你的Ubuntu服务器上有多少内存?