linux – MongoDB进程每天都在关闭.怎么在服务器上永远运行mongod?

前端之家收集整理的这篇文章主要介绍了linux – MongoDB进程每天都在关闭.怎么在服务器上永远运行mongod?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我是MongoDB的初学者,我在服务器中执行此操作时遇到问题.

我的项目托管在hostmonster.com的服务器上,但他们不支持MongoDB数据库,尽管他们说我可以根据自己的责任安装它.

然后,我在没有问题的情况下将MongoDB 2.4.1安装到了Linux 64之后,在MongoDB bin文件夹中(使用:mongo,mongod,mongodump …)我创建了一个名为’data’的文件夹和’data / db’来做一些试验.

从控制台,我通过SSH协议连接到服务器,然后运行

./mongod --dbpath 'data/db'

它的工作原理.

但是,我需要它永远自动运行.

我按照Mongodb can’t start的步骤运行下一行:

./mongod --fork --dbpath 'data/db' --smallfiles --logpath 'data/mongodb.log' --logappend

它也有效,它开始了这个过程,我关闭了控制台,这个过程继续运行,我可以在我的域中查看我的数据.

问题是该过程需要一天时间才能关闭,即我无法跨域查看我的数据,然后,我需要再次运行mongod.有:

./mongod --fork --dbpath 'data/db' --smallfiles --logpath 'data/mongodb.log' --logappend

我不想每天都这样做,我的问题是:

可能是什么问题?为什么mongod进程每天都会死?

我怎么能永远运行这个过程?

对不起我的英语不好.

编辑:添加上一个错误日志.我不明白.

Fri Apr 12 03:19:34.577 [TTLMonitor] query local.system.indexes query: { expireAfterSeconds: { $exists: true } } ntoreturn:0 ntoskip:0 nscanned:0 keyUpdates:0 locks(micros) r:141663 nreturned:0 reslen:20 141ms
Fri Apr 12 03:19:34.789 [TTLMonitor] query users.system.indexes query: { expireAfterSeconds: { $exists: true } } ntoreturn:0 ntoskip:0 nscanned:3 keyUpdates:0 locks(micros) r:211595 nreturned:0 reslen:20 211ms
Fri Apr 12 03:20:57.869 [PeriodicTask::Runner] task: DBConnectionPool-cleaner took: 18215ms
Fri Apr 12 03:20:57.931 [PeriodicTask::Runner] task: WriteBackManager::cleaner took: 8ms
Fri Apr 12 03:22:14.155 [PeriodicTask::Runner] task: DBConnectionPool-cleaner took: 32ms
Fri Apr 12 03:22:14.215 [PeriodicTask::Runner] task: WriteBackManager::cleaner took: 14ms
Fri Apr 12 03:22:30.670 [TTLMonitor] query actarium.system.indexes query: { expireAfterSeconds: { $exists: true } } ntoreturn:0 ntoskip:0 nscanned:2 keyUpdates:0 locks(micros) r:430204 nreturned:0 reslen:20 430ms
Fri Apr 12 03:23:14.825 [PeriodicTask::Runner] task: DBConnectionPool-cleaner took: 7ms
Fri Apr 12 03:23:31.133 [TTLMonitor] query actarium.system.indexes query: { expireAfterSeconds: { $exists: true } } ntoreturn:0 ntoskip:0 nscanned:2 keyUpdates:0 locks(micros) r:179175 nreturned:0 reslen:20 168ms
Fri Apr 12 03:25:19.201 [PeriodicTask::Runner] task: WriteBackManager::cleaner took: 505ms
Fri Apr 12 03:25:23.370 [TTLMonitor] query local.system.indexes query: { expireAfterSeconds: { $exists: true } } ntoreturn:0 ntoskip:0 nscanned:0 keyUpdates:0 locks(micros) r:3604735 nreturned:0 reslen:20 3604ms
Fri Apr 12 03:25:25.294 [TTLMonitor] query users.system.indexes query: { expireAfterSeconds: { $exists: true } } ntoreturn:0 ntoskip:0 nscanned:3 keyUpdates:0 numYields: 1 locks(micros) r:3479328 nreturned:0 reslen:20 1882ms
Fri Apr 12 03:26:26.647 [TTLMonitor] query actarium.system.indexes query: { expireAfterSeconds: { $exists: true } } ntoreturn:0 ntoskip:0 nscanned:2 keyUpdates:0 numYields: 1 locks(micros) r:1764712 nreturned:0 reslen:20 1044ms
Fri Apr 12 04:09:27.804 [TTLMonitor] query actarium.system.indexes query: { expireAfterSeconds: { $exists: true } } ntoreturn:0 ntoskip:0 nscanned:2 keyUpdates:0 locks(micros) r:200919 nreturned:0 reslen:20 200ms
Fri Apr 12 04:43:54.002 got signal 15 (Terminated),will terminate after current cmd ends
Fri Apr 12 04:43:54.151 [interruptThread] now exiting
Fri Apr 12 04:43:54.151 dbexit: 
Fri Apr 12 04:43:54.157 [interruptThread] shutdown: going to close listening sockets...
Fri Apr 12 04:43:54.160 [interruptThread] closing listening socket: 9
Fri Apr 12 04:43:54.160 [interruptThread] closing listening socket: 10
Fri Apr 12 04:43:54.160 [interruptThread] closing listening socket: 11
Fri Apr 12 04:43:54.160 [interruptThread] removing socket file: /tmp/mongodb-27017.sock
Fri Apr 12 04:43:54.160 [interruptThread] shutdown: going to flush diaglog...
Fri Apr 12 04:43:54.160 [interruptThread] shutdown: going to close sockets...
Fri Apr 12 04:43:54.176 [interruptThread] shutdown: waiting for fs preallocator...
Fri Apr 12 04:43:54.176 [interruptThread] shutdown: lock for final commit...
Fri Apr 12 04:43:54.176 [interruptThread] shutdown: final commit...
Fri Apr 12 04:43:54.176 [interruptThread] shutdown: closing all files...
Fri Apr 12 04:43:54.212 [interruptThread] closeAllFiles() finished
Fri Apr 12 04:43:54.220 [interruptThread] journalCleanup...
Fri Apr 12 04:43:54.246 [interruptThread] removeJournalFiles
Fri Apr 12 04:43:54.280 [interruptThread] error removing journal files 
boost::filesystem::directory_iterator::construct: No such file or directory: "/home2/anuncio3/bin/mongodb-linux-x86_64-2.4.1/bin/data/db/journal"
Fri Apr 12 04:43:54.280 [interruptThread] error couldn't remove journal file during shutdown boost::filesystem::directory_iterator::construct: No such file or directory: "/home2/anuncio3/bin/mongodb-linux-x86_64-2.4.1/bin/data/db/journal"
Fri Apr 12 04:43:54.285 shutdown Failed with exception
Fri Apr 12 04:43:54.285 dbexit: really exiting now
最佳答案
你的答案在这里:

Fri Apr 12 04:43:54.002 got signal 15 (Terminated),will terminate after current cmd ends
Fri Apr 12 04:43:54.151 [interruptThread] now exiting

您的进程正在接收信号15,这是默认的终止信号.它们的系统可能会自动杀死长时间运行的进程或类似的东西.如果确实发生了这种情况,那么您的主机必须解决这个问题.

另外,这些错误

Fri Apr 12 04:43:54.280 [interruptThread] error removing journal files 
boost::filesystem::directory_iterator::construct: No such file or directory: "/home2/anuncio3/bin/mongodb-linux-x86_64-2.4.1/bin/data/db/journal"
Fri Apr 12 04:43:54.280 [interruptThread] error couldn't remove journal file during shutdown boost::filesystem::directory_iterator::construct: No such file or directory: "/home2/anuncio3/bin/mongodb-linux-x86_64-2.4.1/bin/data/db/journal"

表明安装的数据目录有问题.日志文件要么不存在要么丢失;如果系统上的某个进程正在尝试清理,那么如果某些东西正在查找你的日志文件,那就不会让我感到惊讶.

猜你在找的Linux相关文章