[英]Getting error when trying to launch node.js app with PM2 Cluster
in an Ubuntu Server, I am unable to run the node.js app in cluster mode using PM2.在 Ubuntu 服务器中,我无法使用 PM2 在集群模式下运行 node.js 应用程序。
The command I use is :我使用的命令是:
PM2 start server.js --name Server -i max
PM2 启动 server.js --name 服务器 -i max
When I list the PM2 processes, I can see the Server has Error status.当我列出 PM2 进程时,我可以看到服务器具有错误状态。 I have tried looking into the log file generated by PM2 but it's empty.
我曾尝试查看 PM2 生成的日志文件,但它是空的。
I am however able to run the same server.js without the cluster mode using :但是,我可以使用以下命令在没有集群模式的情况下运行相同的 server.js:
PM2 start server.js --name Server
PM2 启动 server.js --name 服务器
You could also have used pm2 restart Server
to restart it您也可以使用
pm2 restart Server
重新启动它
If you use pm2 kill
you will just kill all processes, to clean up afterwards i would recommend to use pm2 flush
so all logfiles will be reset如果你使用
pm2 kill
你只会杀死所有进程,然后清理我建议使用pm2 flush
这样所有的日志文件都将被重置
执行PM2 Kill
并再次启动所有服务是上述问题的解决方案。
I have gone through this same kind of situations but in my case pm2 is showing error status cause of error in my code.我经历过同样的情况,但在我的情况下,pm2 在我的代码中显示错误状态原因。 use the below command
使用下面的命令
pm2 logs
pm2 logs command helped me by showing some hints to check where exactly the error is occured. pm2 logs 命令通过显示一些提示来检查错误发生的确切位置来帮助我。
if everything works fine then pm2 list
will show you the status online.如果一切正常,那么
pm2 list
将显示在线状态。
you can check the ports running by pm2(not only pm2 but all the process) using below command您可以使用以下命令检查 pm2 运行的端口(不仅是 pm2,还包括所有进程)
sudo netstat -tulpn
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.