Openshift NodeJS + MongoDB应用程序突然停止 [英] Openshift NodeJS + MongoDB application suddenly stops

查看:83
本文介绍了Openshift NodeJS + MongoDB应用程序突然停止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近开始使用OpenShift作为NodeJS + MongoDB应用程序的可扩展平台.我完成了所有工作,但过了一段时间(通常在几个小时或几天内)后,我的应用程序突然变得无法使用.我认为有2个原因导致我的应用停止运行.原因之一是MongoDB连接超时,这很容易解决,可以通过在使用数据库之前检查数据库是否仍处于连接状态来解决.

I recently started using OpenShift as a scalable platform for a NodeJS + MongoDB application. I got it all working, except that after some time (mostly within a few hours or days) my application suddenly gets inaccesible. I think there are 2 causes for my app to stop. One cause is that the MongoDB connection times out, which is probably an easy fixable error by checking whether the database is still connected before using the database.

然而,另一个原因是NodeJS突然停止侦听新请求.我不确定发生这种情况的原因是什么,但是发生这种情况的原因是什么,但是当发生这种情况时,我必须通过ssh手动重新启动应用程序,而在生产环境中,这是不可接受的.

However the other cause is that NodeJS suddenly stops listening to new requests. I am not exactly sure what happens and what the reason for this behaviour is, but when this happens, I have to manually restart the application through ssh, and in a production environment this is unacceptable.

由于我没有遇到任何错误,因此我无法提供更多详细信息,只是我(可能)有一个可扩展的应用程序,当前使用2个齿轮,其中1个用于NodeJS应用程序,一个用于MongoDB数据库.我使用MongooseJS连接到数据库.暂时仍处于免费计划中,但是一旦有更多流量来临,就可能不适合使用白银计划(假设扩展确实有效).

Since I dont get any errors, I can't really provide any more details, except that i (probably) have a scalable app, currently using 2 gears, one for the NodeJS app and one for the MongoDB database. I use MongooseJS to connect to the database. For the time being im still in the free plan, but once more traffic is coming, ill probably go for the silver plan (assuming that scaling actually works).

我希望有人能给我一些建议或解决方案.

I hope someone can provide me with some advice or a solution.

此致

Hylke Bron

Hylke Bron

推荐答案

因此,您需要注意一些事项.首先是闲置,如果您的应用程序在48小时内未收到任何外部http请求,它将被闲置.然后,一旦发出http请求,该应用程序将自动重新联机.

So there are a few things you should be aware of. The first being Idling, If your application does not receive any external http requests for 48 hours it will be idled. Then once a http request is made the application will come back online automatically.

如果您经常收到外部http请求,那么接下来我们需要检查的是您应用程序的日志.您可以检查应用程序的日志,但运行rhc tail <yourappname>.

If you're getting external http requests frequently then the next thing we'll need to check is the logs for your application. You can check the logs for your app but running rhc tail <yourappname>.

这篇关于Openshift NodeJS + MongoDB应用程序突然停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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