zoukankan      html  css  js  c++  java
  • pm2 安装使用

    pm2 是全新开发的进程守护服务, 同时集成了负载均衡功能. 以及开机启动, 自动重启有问题进程. 还可以查看各服务进程状态.

    使用方法参照:https://github.com/Unitech/pm2

    安装:

    $ npm install pm2@latest -g
    y@y:ydkt$ pm2 start server/app.js -i 4
    [PM2] Process server/app.js launched
    ┌──────────┬────┬─────────┬───────┬────────┬─────────┬────────┬─────────────┬──────────┐
    │ App name │ id │ mode    │ pid   │ status │ restart │ uptime │ memory      │ watching │
    ├──────────┼────┼─────────┼───────┼────────┼─────────┼────────┼─────────────┼──────────┤
    │ app      │ 0  │ cluster │ 32665 │ online │ 0       │ 0s     │ 28.398 MB   │ disabled │
    │ app      │ 1  │ cluster │ 32674 │ online │ 0       │ 0s     │ 34.203 MB   │ disabled │
    │ app      │ 2  │ cluster │ 32685 │ online │ 0       │ 0s     │ 27.977 MB   │ disabled │
    │ app      │ 3  │ cluster │ 32721 │ online │ 0       │ 0s     │ 20.570 MB   │ disabled │
    └──────────┴────┴─────────┴───────┴────────┴─────────┴────────┴─────────────┴──────────┘
     Use `pm2 show <id|name>` to get more details about an app
    y@y:ydkt$ pm2 list
    ┌──────────┬────┬─────────┬───────┬────────┬─────────┬────────┬─────────────┬──────────┐
    │ App name │ id │ mode    │ pid   │ status │ restart │ uptime │ memory      │ watching │
    ├──────────┼────┼─────────┼───────┼────────┼─────────┼────────┼─────────────┼──────────┤
    │ app      │ 0  │ cluster │ 32665 │ online │ 0       │ 5m     │ 61.953 MB   │ disabled │
    │ app      │ 1  │ cluster │ 32674 │ online │ 0       │ 5m     │ 63.715 MB   │ disabled │
    │ app      │ 2  │ cluster │ 32685 │ online │ 0       │ 5m     │ 61.867 MB   │ disabled │
    │ app      │ 3  │ cluster │ 32721 │ online │ 0       │ 5m     │ 59.648 MB   │ disabled │
    └──────────┴────┴─────────┴───────┴────────┴─────────┴────────┴─────────────┴──────────┘
     Use `pm2 show <id|name>` to get more details about an app
    y@y:ydkt$ 
    y@y:ydkt$ pm2 stop app
    [PM2] Stopping app
    [PM2] stopProcessId process id 0
    [PM2] stopProcessId process id 1
    [PM2] stopProcessId process id 2
    [PM2] stopProcessId process id 3
    ┌──────────┬────┬─────────┬─────┬─────────┬─────────┬────────┬────────┬──────────┐
    │ App name │ id │ mode    │ pid │ status  │ restart │ uptime │ memory │ watching │
    ├──────────┼────┼─────────┼─────┼─────────┼─────────┼────────┼────────┼──────────┤
    │ app      │ 0  │ cluster │ 0   │ stopped │ 000 B    │ disabled │
    │ app      │ 1  │ cluster │ 0   │ stopped │ 000 B    │ disabled │
    │ app      │ 2  │ cluster │ 0   │ stopped │ 000 B    │ disabled │
    │ app      │ 3  │ cluster │ 0   │ stopped │ 000 B    │ disabled │
    └──────────┴────┴─────────┴─────┴─────────┴─────────┴────────┴────────┴──────────┘
     Use `pm2 show <id|name>` to get more details about an app
    y@y:ydkt$ 

    参考:http://se77en.cc/2013/06/27/goodbye-node-forever-hello-pm2-translation/

  • 相关阅读:
    http 请求code状态码
    uni-app实现弹窗遮罩
    小程序分享报错 Cannot read property 'apply' of null;at page XXX onShareAppMessage function
    mac下出现xcrun: error导致git、svn无法使用的解决办法
    uniapp 小程序实现自定义底部导航栏(tarbar)
    Python2.X和Python3.X中Tkinter模块的文件对话框、下拉列表的不同
    Mac 设置git的template
    每天一点点之vue框架开发
    uni-app开发小程序-使用uni.switchTab跳转后页面不刷新的问题
    小程序实现微信朋友圈时间显示效果
  • 原文地址:https://www.cnblogs.com/yshyee/p/4570099.html
Copyright © 2011-2022 走看看