SO的大师
我正在使用 monit 将 Node.js 作为守护程序运行,结果证明它每 60 秒就失败一次。这是我的monit.log
root@mybox:/etc/monit# tail -f /var/log/monit.log
[UTC Sep 4 12:07:50] info : 'nodejs' start: /sbin/start
[UTC Sep 4 12:08:50] error : 'nodejs' failed, cannot open a connection to INET[127.0.0.1:8000] via TCP
[UTC Sep 4 12:08:50] info : 'nodejs' trying to restart
[UTC Sep 4 12:08:50] info : 'nodejs' stop: /sbin/stop
[UTC Sep 4 12:08:50] info : 'nodejs' start: /sbin/start
[UTC Sep 4 12:09:50] error : 'nodejs' failed, cannot open a connection to INET[127.0.0.1:8000] via TCP
[UTC Sep 4 12:09:50] info : 'nodejs' trying to restart
[UTC Sep 4 12:09:50] info : 'nodejs' stop: /sbin/stop
[UTC Sep 4 12:09:50] info : 'nodejs' start: /sbin/start
[UTC Sep 4 12:10:50] info : 'nodejs' connection succeeded to INET[127.0.0.1:8000] via TCP
这是我来自 monitrc 的 monit 配置
set logfile /var/log/monit.log
check host nodejs with address 127.0.0.1
start program = "/sbin/start nodeapp"
stop program = "/sbin/stop nodeapp"
if failed port 8000 protocol HTTP
request /
with timeout 10 seconds
then restart
我在这个配置中做错了什么还是有其他原因 Node 似乎经常失败?我还应该在哪里查明这个问题?
谢谢你。