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/

  • 相关阅读:
    ArcEngine 地图与布局的联动
    ArcGIS Server安装篇
    AO+C#设置栅格图层基高 制作三维
    ArcGIS 10研究(一) 之 Desktop总体介绍 转载
    linux centos7 增加硬盘
    linux CentOS7安装oracle12c
    java中关于Socket类通信的基本测试程序
    Ubuntu 的中国梦
    我们无需“开始”菜单
    数据库战略高度解析 之系列说明
  • 原文地址:https://www.cnblogs.com/yshyee/p/4570099.html
Copyright © 2011-2022 走看看