FAQ
Source: https://pm2.keymetrics.io/docs/faq/
What is the difference between fork mode and cluster mode?
Fork mode runs your application as a single process, exactly like running it with node directly.
Cluster mode spawns multiple instances of your Node.js application and load-balances incoming HTTP/TCP connections between them using the Node.js cluster module — using all available CPU cores with zero code change:
pm2 start app.js -i max
Cluster mode only works for Node.js applications; scripts in other languages run in fork mode. Read more in the cluster mode documentation.
How do I make PM2 restart my apps automatically after a server reboot?
Generate an init script for your platform, run the command it prints, then freeze your process list:
pm2 startup
# run the command printed by pm2
pm2 save
PM2 and your applications will be resurrected at boot. See the startup script documentation.
Where are the PM2 log files located?
Application logs live in $HOME/.pm2/logs, one output and one error file per process.
pm2 logs # stream logs in realtime
pm2 flush # empty all log files
pm2 install pm2-logrotate # rotate logs automatically
More in the log management documentation.
What is the difference between pm2 restart and pm2 reload?
pm2 restart kills and restarts the process (brief downtime). pm2 reload performs a zero-downtime reload for cluster-mode applications: new workers are spawned and old ones are only killed once the new ones are ready to accept connections.
How do I limit the memory used by an application?
pm2 start app.js --max-memory-restart 300M
PM2 checks memory usage every 30 seconds and reloads the process when it exceeds the threshold. Units K, M and G are supported. See memory limit.
How do I update PM2 to the latest version?
npm install pm2@latest -g
pm2 update
pm2 update replaces the in-memory daemon without losing your process list.
Can PM2 run applications written in other languages than Node.js?
Yes — PM2 can start any script or binary:
pm2 start app.py
pm2 start ./binary-file -- --port 1520
The interpreter is picked from the file extension and can be overridden with --interpreter. Cluster mode, however, is Node.js only.
How do I run PM2 inside a Docker container?
Use pm2-runtime, a drop-in replacement for the node binary designed for containers:
RUN npm install pm2 -g
CMD ["pm2-runtime", "app.js"]
It keeps PM2 in the foreground so the container stays alive. See the Docker integration documentation.
I can’t connect my local PM2 to the PM2.io dashboard
If you are in this situation, it might be for several reasons.
- You are behind a company proxy or firewall.
Make sure the 443 port is opened and/or set the proxy config:
PM2_PROXY=<proxy-address> pm2 link <secret> <public>
-
You are using a old PM2 version. Update PM2 to latest:
npm install pm2@latest -g -
You have concurrent PM2 sending data to the same bucket with an identical server name. Make sure you have only one PM2 instance launched
ps -aux | grep PM2 -
Refresh your connection to PM2.io.
pm2 link stopthenpm2 link start. Also don’t forget to refresh the dashboard itself, it might help sometimes.
The versioning buttons (Rollback/Pull/Upgrade) aren’t working
-
If the buttons are disabled, make sure that the
Local changesandLocal commitindicators are green. -
If you get a warning
Not authorizedwhen trying to perform such actions, it means you have not the admin privileges in this bucket. -
If none of the above happens, but the procedure just hangs, make sure you have a recent version of Node.js as well as the latest version of PM2.
-
Also, your repository should not ask for a password input (it means you must clone it via ssh), try typing
git remote updatemanually in the folder and see if it asks for a password or not.
How do I group processes together with namespaces?
Start processes with a namespace, either from the CLI or with the namespace attribute in the configuration file:
pm2 start api.js --namespace backend
pm2 start worker.js --namespace backend
Every command that accepts a process name also accepts a namespace, so you can act on the whole group at once:
pm2 restart backend
pm2 stop backend
pm2 logs backend
How do I get a diagnostic report about my PM2 installation?
pm2 report
It prints a full report — PM2, Node.js and OS versions, daemon state and the process list. Attach it when opening an issue.
How do I start or reload applications in a CI/CD pipeline?
pm2 startOrReload ecosystem.config.js
pm2 save
pm2 startOrReload starts the applications if they are not running and performs a zero-downtime reload if they are, making deployments idempotent: the same command works on the first deploy and on every update. pm2 startOrRestart does the same with a hard restart. Follow it with pm2 save so the new process list survives a reboot.
Can I use the PM2 documentation with AI assistants like ChatGPT, Claude or Cursor?
Yes — the documentation follows the llms.txt convention:
- https://pm2.keymetrics.io/llms.txt — a Markdown index of every documentation page
- https://pm2.keymetrics.io/llms-full.txt — the entire documentation in a single Markdown file
Paste either URL into your AI tool to give it up-to-date PM2 knowledge.