这里是文章模块栏目内容页
PM2 Node 应用进程管理器

PM2是一个守护进程管理器,它将帮助您管理和保持应用程序在线。开始使用PM2很简单,它是一个简单直观的CLI,可以通过NPM安装。


官方文档:https://pm2.keymetrics.io/docs/usage/quick-start/

主要特性:

  • 内建负载均衡(使用 Node cluster 集群模块)

  • 后台运行

  • 0 秒停机重载

  • 具有 Ubuntu 和 CentOS 的启动脚本

  • 停止不稳定的进程(避免无限循环)

  • 控制台检测

  • 提供 HTTP API

  • 远程控制和实时的接口 API(Nodejs 模块,允许和 PM2 进程管理器交互)

安装&更新:

$ npm install pm2 -g
# Or install the V2 release candidate
$ npm install pm2@next -g
# Install latest pm2 version
$ npm install pm2 -g
# Save process list, exit old PM2 & restore all processes
$ pm2 update