pm2
Production process manager for Node.JS applications with a built-in load balancer.
Last updated a month ago by tknew .
AGPL-3.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install pm2 -g
SYNC missed versions from official npm registry.

pm2 logo

P(rocess) M(anager) 2
Runtime Edition

Downloads per Month Downloads per Year npm version Build Status


PM2 is a production process manager for Node.js applications with a built-in load balancer. It allows you to keep applications alive forever, to reload them without downtime and to facilitate common system admin tasks.

Starting an application in production mode is as easy as:

$ pm2 start app.js

PM2 is constantly assailed by more than 1800 tests.

Official website: https://pm2.keymetrics.io/

Works on Linux (stable) & macOS (stable) & Windows (stable). All Node.js versions are supported starting Node.js 12.X.

Installing PM2

With NPM:

$ npm install pm2 -g

You can install Node.js easily with NVM or ASDF.

Start an application

You can start any application (Node.js, Python, Ruby, binaries in $PATH...) like that:

$ pm2 start app.js

Your app is now daemonized, monitored and kept alive forever.

Managing Applications

Once applications are started you can manage them easily:

Process listing

To list all running applications:

$ pm2 list

Managing apps is straightforward:

$ pm2 stop     <app_name|namespace|id|'all'|json_conf>
$ pm2 restart  <app_name|namespace|id|'all'|json_conf>
$ pm2 delete   <app_name|namespace|id|'all'|json_conf>

To have more details on a specific application:

$ pm2 describe <id|app_name>

To monitor logs, custom metrics, application information:

$ pm2 monit

More about Process Management

Cluster Mode: Node.js Load Balancing & Zero Downtime Reload

The Cluster mode is a special mode when starting a Node.js application, it starts multiple processes and load-balance HTTP/TCP/UDP queries between them. This increase overall performance (by a factor of x10 on 16 cores machines) and reliability (faster socket re-balancing in case of unhandled errors).

Framework supported

Starting a Node.js application in cluster mode that will leverage all CPUs available:

$ pm2 start api.js -i <processes>

<processes> can be 'max', -1 (all cpu minus 1) or a specified number of instances to start.

Zero Downtime Reload

Hot Reload allows to update an application without any downtime:

$ pm2 reload all

More informations about how PM2 make clustering easy

Container Support

With the drop-in replacement command for node, called pm2-runtime, run your Node.js application in a hardened production environment. Using it is seamless:

RUN npm install pm2 -g
CMD [ "pm2-runtime", "npm", "--", "start" ]

Read More about the dedicated integration

Host monitoring speedbar

PM2 allows to monitor your host/server vitals with a monitoring speedbar.

To enable host monitoring:

$ pm2 set pm2:sysmonit true
$ pm2 update

Framework supported

Terminal Based Monitoring

Monit

Monitor all processes launched straight from the command line:

$ pm2 monit

Log Management

To consult logs just type the command:

$ pm2 logs

Standard, Raw, JSON and formated output are available.

Examples:

$ pm2 logs APP-NAME       # Display APP-NAME logs
$ pm2 logs --json         # JSON output
$ pm2 logs --format       # Formated output

$ pm2 flush               # Flush all logs
$ pm2 reloadLogs          # Reload all logs

To enable log rotation install the following module

$ pm2 install pm2-logrotate

More about log management

Startup Scripts Generation

PM2 can generates and configure a Startup Script to keep PM2 and your processes alive at every server restart.

Init Systems Supported: systemd, upstart, launchd, rc.d

# Generate Startup Script
$ pm2 startup

# Freeze your process list across server restart
$ pm2 save

# Remove Startup Script
$ pm2 unstartup

More about Startup Scripts Generation

Updating PM2

# Install latest PM2 version
$ npm install pm2@latest -g
# Save process list, exit old PM2 & restore all processes
$ pm2 update

PM2 updates are seamless

PM2+ Monitoring

If you manage your apps with PM2, PM2+ makes it easy to monitor and manage apps across servers.

https://app.pm2.io/

Feel free to try it:

Discover the monitoring dashboard for PM2

Thanks in advance and we hope that you like PM2!

CHANGELOG

CHANGELOG

Contributors

Contributors

License

PM2 is made available under the terms of the GNU Affero General Public License 3.0 (AGPL 3.0). For other licenses contact us.

Current Tags

  • 0.10.0-beta1                                ...           0.10.0-beta1 (7 years ago)
  • 0.10.0-beta10                                ...           0.10.0-beta10 (7 years ago)
  • 0.10.0-beta11                                ...           0.10.0-beta11 (7 years ago)
  • 0.10.0-beta12                                ...           0.10.0-beta12 (7 years ago)
  • 0.10.0-beta13                                ...           0.10.0-beta13 (7 years ago)
  • 0.10.0-beta14                                ...           0.10.0-beta14 (7 years ago)
  • 0.10.0-beta15                                ...           0.10.0-beta15 (7 years ago)
  • 0.10.0-beta16                                ...           0.10.0-beta16 (7 years ago)
  • 0.10.0-beta17                                ...           0.10.0-beta17 (7 years ago)
  • 0.10.0-beta18                                ...           0.10.0-beta18 (7 years ago)
  • 0.10.0-beta19                                ...           0.10.0-beta19 (7 years ago)
  • 0.10.0-beta2                                ...           0.10.0-beta2 (7 years ago)
  • 0.10.0-beta20                                ...           0.10.0-beta20 (7 years ago)
  • 0.10.0-beta21                                ...           0.10.0-beta21 (7 years ago)
  • 0.10.0-beta22                                ...           0.10.0-beta22 (7 years ago)
  • 0.10.0-beta23                                ...           0.10.0-beta23 (7 years ago)
  • 0.10.0-beta25                                ...           0.10.0-beta25 (7 years ago)
  • 0.10.0-beta4                                ...           0.10.0-beta4 (7 years ago)
  • 0.10.0-beta5                                ...           0.10.0-beta5 (7 years ago)
  • 0.10.0-beta6                                ...           0.10.0-beta6 (7 years ago)
  • 0.10.0-beta7                                ...           0.10.0-beta7 (7 years ago)
  • 0.10.0-beta8                                ...           0.10.0-beta8 (7 years ago)
  • 0.10.0-beta9                                ...           0.10.0-beta9 (7 years ago)
  • 5.1.2                                ...           latest (a month ago)
  • 2.9.2-next                                ...           next (4 years ago)

270 Versions

  • 5.1.2                                ...           a month ago
  • 5.1.1                                ...           2 months ago
  • 5.1.0                                ...           4 months ago
  • 5.0.4                                ...           4 months ago
  • 5.0.3                                ...           4 months ago
  • 5.0.2                                ...           4 months ago
  • 5.0.1                                ...           4 months ago
  • 5.0.0                                ...           4 months ago
  • 4.5.6                                ...           7 months ago
  • 4.5.5                                ...           8 months ago
  • 4.5.4                                ...           9 months ago
  • 4.5.3                                ...           9 months ago
  • 4.5.2                                ...           9 months ago
  • 4.5.1                                ...           10 months ago
  • 4.5.0                                ...           a year ago
  • 4.4.1                                ...           a year ago
  • 4.4.0                                ...           a year ago
  • 4.3.1                                ...           2 years ago
  • 4.3.0                                ...           2 years ago
  • 4.2.3                                ...           2 years ago
  • 4.2.2                                ...           2 years ago
  • 4.2.1                                ...           2 years ago
  • 3.5.2                                ...           2 years ago
  • 4.2.0                                ...           2 years ago
  • 4.1.2                                ...           2 years ago
  • 4.1.1                                ...           2 years ago
  • 4.1.0                                ...           2 years ago
  • 4.0.2                                ...           2 years ago
  • 4.0.1                                ...           2 years ago
  • 4.0.0                                ...           2 years ago
  • 3.5.1                                ...           2 years ago
  • 3.5.0                                ...           3 years ago
  • 3.4.1                                ...           3 years ago
  • 3.4.0                                ...           3 years ago
  • 3.3.1                                ...           3 years ago
  • 3.3.0                                ...           3 years ago
  • 3.2.9                                ...           3 years ago
  • 3.2.8                                ...           3 years ago
  • 3.2.7                                ...           3 years ago
  • 3.2.6                                ...           3 years ago
  • 3.2.5                                ...           3 years ago
  • 3.2.4                                ...           3 years ago
  • 3.2.3                                ...           3 years ago
  • 3.2.2                                ...           3 years ago
  • 3.2.1                                ...           3 years ago
  • 3.2.0                                ...           3 years ago
  • 3.1.3                                ...           3 years ago
  • 3.1.2                                ...           3 years ago
  • 3.1.1                                ...           3 years ago
  • 3.1.0                                ...           3 years ago
  • 3.0.4                                ...           3 years ago
  • 3.0.3                                ...           3 years ago
  • 3.0.2                                ...           3 years ago
  • 3.0.1                                ...           3 years ago
  • 3.0.0                                ...           3 years ago
  • 2.10.4                                ...           3 years ago
  • 2.10.3                                ...           3 years ago
  • 2.10.2                                ...           4 years ago
  • 2.10.1                                ...           4 years ago
  • 2.10.0                                ...           4 years ago
  • 2.9.3                                ...           4 years ago
  • 2.9.2                                ...           4 years ago
  • 2.9.2-next                                ...           4 years ago
  • 2.9.1                                ...           4 years ago
  • 2.9.0                                ...           4 years ago
  • 2.8.0-next                                ...           4 years ago
  • 2.8.0                                ...           4 years ago
  • 2.7.2                                ...           4 years ago
  • 2.7.1                                ...           4 years ago
  • 2.7.0                                ...           4 years ago
  • 2.6.1                                ...           4 years ago
  • 2.6.0                                ...           4 years ago
  • 2.5.0                                ...           4 years ago
  • 2.5.0-beta1                                ...           4 years ago
  • 2.4.6                                ...           4 years ago
  • 2.4.5                                ...           5 years ago
  • 2.4.4                                ...           5 years ago
  • 2.4.3                                ...           5 years ago
  • 2.4.3-rc1                                ...           5 years ago
  • 2.4.2                                ...           5 years ago
  • 2.4.1                                ...           5 years ago
  • 2.4.1-beta5                                ...           5 years ago
  • 2.4.1-beta4                                ...           5 years ago
  • 2.4.1-beta3                                ...           5 years ago
  • 2.4.1-beta2                                ...           5 years ago
  • 2.4.1-beta1                                ...           5 years ago
  • 2.4.0                                ...           5 years ago
  • 2.4.0-beta5                                ...           5 years ago
  • 2.4.0-beta4                                ...           5 years ago
  • 2.4.0-beta3                                ...           5 years ago
  • 2.4.0-beta2                                ...           5 years ago
  • 2.4.0-beta1                                ...           5 years ago
  • 2.3.1-next                                ...           5 years ago
  • 2.3.0                                ...           5 years ago
  • 2.3.0-beta1                                ...           5 years ago
  • 2.2.3                                ...           5 years ago
  • 2.2.2                                ...           5 years ago
  • 2.2.1                                ...           5 years ago
  • 2.2.0                                ...           5 years ago
  • 2.1.6                                ...           5 years ago
  • 2.1.5                                ...           5 years ago
  • 2.1.4                                ...           5 years ago
  • 2.1.3                                ...           5 years ago
  • 2.1.2                                ...           5 years ago
  • 2.1.1                                ...           5 years ago
  • 2.1.0                                ...           5 years ago
  • 2.0.19                                ...           5 years ago
  • 2.0.18                                ...           5 years ago
  • 2.0.17                                ...           5 years ago
  • 2.0.16                                ...           5 years ago
  • 2.0.15                                ...           5 years ago
  • 2.0.14                                ...           5 years ago
  • 2.0.13                                ...           5 years ago
  • 2.0.12                                ...           5 years ago
  • 2.0.10                                ...           5 years ago
  • 2.0.9                                ...           5 years ago
  • 2.0.8                                ...           5 years ago
  • 2.0.7                                ...           5 years ago
  • 2.0.6                                ...           5 years ago
  • 2.0.5                                ...           5 years ago
  • 2.0.4                                ...           5 years ago
  • 2.0.3                                ...           5 years ago
  • 2.0.2                                ...           5 years ago
  • 2.0.1                                ...           5 years ago
  • 2.0.0                                ...           5 years ago
  • 1.1.3                                ...           5 years ago
  • 1.1.2                                ...           6 years ago
  • 1.1.1                                ...           6 years ago
  • 1.0.2                                ...           6 years ago
  • 1.0.1                                ...           6 years ago
  • 1.0.0                                ...           6 years ago
  • 0.15.10                                ...           6 years ago
  • 0.15.9                                ...           6 years ago
  • 0.15.8                                ...           6 years ago
  • 0.15.7                                ...           6 years ago
  • 0.15.6                                ...           6 years ago
  • 0.15.5                                ...           6 years ago
  • 0.15.4                                ...           6 years ago
  • 0.15.3                                ...           6 years ago
  • 0.15.2                                ...           6 years ago
  • 0.15.1                                ...           6 years ago
  • 0.15.0                                ...           6 years ago
  • 0.14.7                                ...           6 years ago
  • 0.14.6                                ...           6 years ago
  • 0.14.5                                ...           6 years ago
  • 0.14.4                                ...           6 years ago
  • 0.14.3                                ...           6 years ago
  • 0.14.2                                ...           6 years ago
  • 0.14.1                                ...           6 years ago
  • 0.14.0                                ...           6 years ago
  • 0.12.16                                ...           6 years ago
  • 0.12.15                                ...           6 years ago
  • 0.12.14                                ...           6 years ago
  • 0.12.13                                ...           6 years ago
  • 0.12.12                                ...           6 years ago
  • 0.12.11                                ...           7 years ago
  • 0.12.10                                ...           7 years ago
  • 0.12.9                                ...           7 years ago
  • 0.12.8                                ...           7 years ago
  • 0.12.7                                ...           7 years ago
  • 0.12.6                                ...           7 years ago
  • 0.12.5                                ...           7 years ago
  • 0.12.4                                ...           7 years ago
  • 0.12.3                                ...           7 years ago
  • 0.12.2                                ...           7 years ago
  • 0.12.1                                ...           7 years ago
  • 0.12.0                                ...           7 years ago
  • 0.11.1                                ...           7 years ago
  • 0.11.0                                ...           7 years ago
  • 0.11.0-beta1                                ...           7 years ago
  • 0.10.8                                ...           7 years ago
  • 0.10.7                                ...           7 years ago
  • 0.10.6                                ...           7 years ago
  • 0.10.5                                ...           7 years ago
  • 0.10.4                                ...           7 years ago
  • 0.10.3                                ...           7 years ago
  • 0.10.2                                ...           7 years ago
  • 0.10.1                                ...           7 years ago
  • 0.10.0                                ...           7 years ago
  • 0.10.0-beta25                                ...           7 years ago
  • 0.10.0-beta23                                ...           7 years ago
  • 0.10.0-beta22                                ...           7 years ago
  • 0.10.0-beta21                                ...           7 years ago
  • 0.10.0-beta20                                ...           7 years ago
  • 0.10.0-beta19                                ...           7 years ago
  • 0.10.0-beta18                                ...           7 years ago
  • 0.10.0-beta17                                ...           7 years ago
  • 0.10.0-beta16                                ...           7 years ago
  • 0.10.0-beta15                                ...           7 years ago
  • 0.10.0-beta14                                ...           7 years ago
  • 0.10.0-beta13                                ...           7 years ago
  • 0.10.0-beta12                                ...           7 years ago
  • 0.10.0-beta11                                ...           7 years ago
  • 0.10.0-beta10                                ...           7 years ago
  • 0.10.0-beta9                                ...           7 years ago
  • 0.10.0-beta8                                ...           7 years ago
  • 0.10.0-beta7                                ...           7 years ago
  • 0.10.0-beta6                                ...           7 years ago
  • 0.10.0-beta5                                ...           7 years ago
  • 0.10.0-beta4                                ...           7 years ago
  • 0.10.0-beta2                                ...           7 years ago
  • 0.10.0-beta1                                ...           7 years ago
  • 0.9.6                                ...           7 years ago
  • 0.9.5                                ...           7 years ago
  • 0.9.4                                ...           7 years ago
  • 0.9.3                                ...           7 years ago
  • 0.9.2                                ...           7 years ago
  • 0.9.1                                ...           7 years ago
  • 0.9.0                                ...           7 years ago
  • 0.8.15                                ...           7 years ago
  • 0.8.14                                ...           7 years ago
  • 0.8.13                                ...           7 years ago
  • 0.8.12                                ...           7 years ago
  • 0.8.11                                ...           7 years ago
  • 0.8.10                                ...           7 years ago
  • 0.8.9                                ...           7 years ago
  • 0.8.8                                ...           7 years ago
  • 0.8.7                                ...           7 years ago
  • 0.8.6                                ...           7 years ago
  • 0.8.5                                ...           7 years ago
  • 0.8.4                                ...           7 years ago
  • 0.8.3                                ...           7 years ago
  • 0.8.2                                ...           7 years ago
  • 0.8.1                                ...           8 years ago
  • 0.8.0                                ...           8 years ago
  • 0.7.8                                ...           8 years ago
  • 0.7.7                                ...           8 years ago
  • 0.7.6                                ...           8 years ago
  • 0.7.5                                ...           8 years ago
  • 0.7.4                                ...           8 years ago
  • 0.7.3                                ...           8 years ago
  • 0.7.2                                ...           8 years ago
  • 0.7.1                                ...           8 years ago
  • 0.7.0                                ...           8 years ago
  • 0.6.15                                ...           8 years ago
  • 0.6.14                                ...           8 years ago
  • 0.6.13                                ...           8 years ago
  • 0.6.12                                ...           8 years ago
  • 0.6.11                                ...           8 years ago
  • 0.6.10                                ...           8 years ago
  • 0.6.9                                ...           8 years ago
  • 0.6.8                                ...           8 years ago
  • 0.6.7                                ...           8 years ago
  • 0.6.6                                ...           8 years ago
  • 0.6.5                                ...           8 years ago
  • 0.6.4                                ...           8 years ago
  • 0.6.3                                ...           8 years ago
  • 0.6.2                                ...           8 years ago
  • 0.5.7                                ...           8 years ago
  • 0.5.6                                ...           8 years ago
  • 0.5.5                                ...           8 years ago
  • 0.5.4                                ...           8 years ago
  • 0.5.3                                ...           8 years ago
  • 0.5.2                                ...           8 years ago
  • 0.5.1                                ...           8 years ago
  • 0.5.0                                ...           8 years ago
  • 0.4.14                                ...           8 years ago
  • 0.4.13                                ...           8 years ago
  • 0.4.12                                ...           8 years ago
  • 0.4.11                                ...           8 years ago
  • 0.4.10                                ...           8 years ago
  • 0.4.8                                ...           8 years ago
  • 0.4.7                                ...           8 years ago
  • 0.4.6                                ...           8 years ago
  • 0.4.5                                ...           8 years ago
  • 0.4.4                                ...           8 years ago
  • 0.4.3                                ...           8 years ago
  • 0.4.2                                ...           8 years ago
  • 0.4.1                                ...           8 years ago
  • 0.4.0                                ...           8 years ago
Maintainers (1)
Downloads
Today 1,465
This Week 9,354
This Month 29,696
Last Day 1,949
Last Week 11,542
Last Month 59,788
Dependencies (30)
Dev Dependencies (2)
Dependents (1274)

Copyright 2014 - 2021 © npmmirror.com |