I have an existing PM2 process that I would like to add the "--max-memory-restart" setting to. How can I do that? The process was created from the command line without a JSON file.
If I were creating a new process I would just run:
PM2 start [process name] --max-memory-restart 700M
or whatever
How can I do the same for an existing process? How can I confirm that it works?
Thanks!
I have an existing PM2 process that I would like to add the "--max-memory-restart" setting to. How can I do that? The process was created from the command line without a JSON file.
If I were creating a new process I would just run:
PM2 start [process name] --max-memory-restart 700M
or whatever
How can I do the same for an existing process? How can I confirm that it works?
Thanks!
Share Improve this question asked Sep 9, 2016 at 22:02 AlexAlex 7302 gold badges9 silver badges30 bronze badges 2- 1 Is there a reason you cant stop it and start it or restart it? – Craicerjack Commented Sep 12, 2016 at 13:27
- If your server is an http server u can use Apache Benchmarking Tool and make thousand of request and if your server restart u can check in pm2 status. – Ye Lwin Soe Commented Sep 13, 2016 at 4:52
3 Answers
Reset to default 10 +25To change your existing PM2 process. you can use this command:
pm2 restart [existing name] --max-memory-restart 700M
To check if it affect or not, you can set it with low memory to restart (like 30M). Then check restart time by : pm2 ls
command.
Sorry for my bad English. Hope it help.
For 0 downtime you can now also use (more preferable in production):
pm2 reload my_current_name --name my_new_name --max-memory-restart 700M
For differences, please see:
What is the difference between pm2 restart and pm2 reload
If you want to edit this setting 'WITHOUT' restarting the process, there doesn't seem to be a way to do it. PM2's docs don't list any way to do this, such options have to be stated along with starting the process.