简体   繁体   English

如何重置pm2的id?

[英]How to reset the id of pm2?

I using pm2.我用的是pm2。 After I started my app several times, the id increased.在我多次启动我的应用程序后,id 增加了。 I deleted all in pm2, and started again, but the id didn't count from 0 any more.我在pm2里全删了,重新开始,可是id已经不是从0开始算了。 How can I reset it?我该如何重置它?

解决方案是重启pm2,在评论中键入pm2 pm2 kill如ItalyPaleAle所述。

Per pm2's GitHub: 每pm2的GitHub:

$ pm2 reset <process>    # Reset meta data (restarted time...)

Reference: GitHub issue#1456 参考: GitHub问题#1456

Looking at the help menu ( pm2 --help ) it seems like pm2 reset would be the way to go. But that command resets metadata (restarted time, etc) and does not reset IDs.查看帮助菜单 ( pm2 --help ) 似乎 pm2 pm2 reset将是通往 go 的方式。但是该命令会重置元数据(重启时间等)并且不会重置 ID。 One solution is to use pm2 kill to kill the pm2 daemon and restart it again (thanks, @Yao Zhao).一种解决方案是使用pm2 kill杀死 pm2 守护进程并重新启动它(感谢@Yao Zhao)。 But doing so will stop all current processes.但这样做会停止所有当前进程。 A better approach would be to save the list of current processes, restart pm2, and then restore those processes using the following set of commands.更好的方法是保存当前进程列表,重新启动 pm2,然后使用以下命令集恢复这些进程。

$ pm2 dump
$ pm2 kill
$ pm2 resurrect

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

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