简体   繁体   English

当应用程序以群集模式运行时,是否有一种方法可以调试pm2中的工作进程

[英]Is there a way to debug the worker processes in pm2 while application is running in Cluster mode

So I have a node.js application which I am running in cluster mode using pm2 . 所以我有一个node.js应用程序,它使用pm2cluster mode运行。 I am passing the following options for the web node in my pm2 schema. 我在pm2模式中为Web节点传递了以下选项。

exec-mode : "cluster"
--node-args : ["--inspect=5678"]

and for worker node I am passing following configuration 对于工作者节点,我正在通过以下配置

--node-args=["--inspect=5679"]

When I start my application in cluster mode , debugging is not possible as I cannot see the debugging URL printed in pm2 logs. cluster mode启动应用程序时,无法调试,因为我看不到pm2 URL。 Even if I send the USR1 signal to the web or worker node (as mentioned in node inspector help ), I do not see any way to debug the processes. 即使我将USR1信号发送到Web节点或工作节点(如节点检查器帮助中所述 ),也看不到任何调试过程的方法。

My guess is that in cluster mode , debugging node.js is not possible. 我的猜测是,在cluster mode ,不可能调试node.js I tried the same process with node-inspector but no luck yet. 我用node-inspector尝试了相同的过程,但是还没有运气。

将node_args作为字符串而不是数组传递(例如--node-args =“-inspect = 1234”)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM