PM2 常用命令与监控
启动
$ pm2 start app.js # 启动app.js应用程序
$ pm2 start app.js -i 4 # cluster mode 模式启动4个app.js的应用实例 # 4个应用程序会自动进行负载均衡
$ pm2 start app.js --name="api" # 启动应用程序并命名为 "api"
$ pm2 start app.js --watch # 实时监控app.js的方式启动,当app.js文件有变动时,pm2会自动reload
$ pm2 start script.sh # 启动 bash 脚本cat /proc/cpuinfo| grep "cpu cores"| uniq
重启
$ pm2 restart all # 重启所有应用重载
$ pm2 reload all # 重启 cluster mode下的所有应用停止
$ pm2 stop all # 停止所有的应用程序
$ pm2 stop 0 # 停止 id为 0的指定应用程序查看进程
实时监控
日志
删除
升级PM2
其他
开机自动启动
资料
示例
pm2-web监控
资料
Last updated