Search code examples
javascriptnode.jsserverdevopspm2

PM2: How to reset useless ids of pm2?


Here is the situation :).

For instance, we have 2 ran instances using PM2. They have appropriate ids, #0, #1. And we have added other instances(#2, #3, #4), which were removed after some time. So, when we run a new instance, we will receive the id as #5. But we have only two ran instances, so it will be logical to have a new id that will increment a last ran instance's id.

The meaning of the question is how we can reset or clean the unused ids from the PM2, without killing the current PM2 process.

I know about the command

 pm2 kill

But in this case, we are killing the current pm2 process, which means that we will kill all our ran instances.

Thanks!


Solution

  • After much researches, I don't found any solution to solve the goal of the question. Looks like the only way to reset ids of PM2, its kill command

    pm2 kill
    

    IMPORTANT: When using this command all ran instances will be deleted, and ids will be reset.