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

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

安装:

$ npm install pm2@latest -g
y@y:ydkt$ pm2 start server/app.js -i
[PM2] Process server/app.js launched
┌──────────┬────┬─────────┬───────┬────────┬─────────┬────────┬─────────────┬──────────┐
│ App name │ id │ mode │ pid │ status │ restart │ uptime │ memory │ watching │
├──────────┼────┼─────────┼───────┼────────┼─────────┼────────┼─────────────┼──────────┤
│ app │ │ cluster │ │ online │ │ 0s │ 28.398 MB │ disabled │
│ app │ │ cluster │ │ online │ │ 0s │ 34.203 MB │ disabled │
│ app │ │ cluster │ │ online │ │ 0s │ 27.977 MB │ disabled │
│ app │ │ cluster │ │ online │ │ 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 │ │ cluster │ │ online │ │ 5m │ 61.953 MB │ disabled │
│ app │ │ cluster │ │ online │ │ 5m │ 63.715 MB │ disabled │
│ app │ │ cluster │ │ online │ │ 5m │ 61.867 MB │ disabled │
│ app │ │ cluster │ │ online │ │ 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
[PM2] stopProcessId process id
[PM2] stopProcessId process id
[PM2] stopProcessId process id
┌──────────┬────┬─────────┬─────┬─────────┬─────────┬────────┬────────┬──────────┐
│ App name │ id │ mode │ pid │ status │ restart │ uptime │ memory │ watching │
├──────────┼────┼─────────┼─────┼─────────┼─────────┼────────┼────────┼──────────┤
│ app │ │ cluster │ │ stopped │ │ │ B │ disabled │
│ app │ │ cluster │ │ stopped │ │ │ B │ disabled │
│ app │ │ cluster │ │ stopped │ │ │ B │ disabled │
│ app │ │ cluster │ │ stopped │ │ │ 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/

pm2 安装使用的更多相关文章

  1. pm2安装及常用命令

    安装:npm install -g pm2 启动程序:pm2 start <app_name|id|all> 列举进程:pm2 list 退出程序:pm2 stop <app_nam ...

  2. 【宝塔面板】pm2 安装没反应问题

    在使用宝塔安装 node环境时候..点击 PM2管理器安装.然后没反应.刷新列表.还是未安装 解决办法: 进入SSH, 查看错误 cat /tmp/panelExec.log 更新git yum up ...

  3. ubuntu 16.04下node和pm2安装

    一.安装node,这里安装9.0的版本,安装其它版本直接到https://deb.nodesource.com/setup_9.x找相应版本的更改既可 1.sudo apt-get remove no ...

  4. 安装 nodejs,npm,pm2

    一:需要安装组件: nodejs,npm,pm2 安装epel 源: rpm -ivh http://download.fedoraproject.org/pub/epel/6/x86_64/epel ...

  5. [转] node.js express的安装与部署,以及pm2下的运行启动。

    node.js 下的express 安装可以参考官方网站的 http://www.expressjs.com.cn/ 这里主要讲一下一些不同的地方,将我们生成的dist文件夹里的文件放在public里 ...

  6. Centos7 使用pm2快速安装创建定时任务

    Centos7 安装 pm2 一丶拿到一个动态拨号的服务器还不用使用网络得先打开: pppoe-start 如果没有wget,需要先下载安装: yum install wget 二丶环境搭建 wget ...

  7. 自建git node pm2 (不赘述,就说遇见的问题)

    //======================[git]部分 主题部分还是按照网上的办法进行安装. 安装的话  分为两个办法(一个是yum (contos办法)  或者sudo(ubuntu办法) ...

  8. nodejs pm2部署配置

    pm2是一个进程管理工具,可以用它来管理你的node进程,并查看node进程的状态,当然也支持性能监控,进程守护,负载均衡等功能. 1.pm2安装使用需要全局安装  npm install -g pm ...

  9. Nodejs学习笔记(十三)— PM2

    目录 简介 pm2安装 操作 启动 关闭 其它方式启动/关闭 从PM2中删除 重载和重启 查看详细信息 多项目操作 集群 其它操作 写在之后... 简介 PM2 pm2是一个内置负载均衡的node.j ...

随机推荐

  1. N - Marriage Match II - HDU 3081(最大流)

    题目大意:有一些男孩和女孩玩一个游戏,每个女孩都可以挑一个男孩来进行这个游戏(所有人都要参加),女孩只会挑选她喜欢的男孩,并且她们认为她们朋友喜欢的男孩她们也是喜欢的(朋友的男朋友也是我的男朋友??? ...

  2. C# asp.net页面通过URL参数传值中文乱码问题解决办法

    1.编码string state=Server.UrlEncode(stateName.Text.Trim());Response.Redirect("aaa.aspx?state=&quo ...

  3. 在网页中在线浏览ppt文档

    方法一: 把ppt文件的扩展名直接修改为pps,嵌入到网页中 缺点:这种方式浏览器会提示是打开,还是下载,选择打开的话会直接在浏览器中打开,并且客户端一定要安装Office PowerPoint才能打 ...

  4. sql server 扩展存储过程

    C# 代码 using Microsoft.SqlServer.Server; using System; using System.Collections.Generic; using System ...

  5. C primer plus 读书笔记第六章和第七章

    这两章的标题是C控制语句:循环以及C控制语句:分支和跳转.之所以一起讲,是因为这两章内容都是讲控制语句. 第六章的第一段示例代码 /* summing.c --对用户输入的整数求和 */ #inclu ...

  6. Lecture Halls

    Lecture Halls (会议安排)   时间限制(普通/Java):1000MS/10000MS     运行内存限制:65536KByte 总提交: 38            测试通过: 2 ...

  7. db2 存储过程迁移方法

    大家在迁移数据库时,存储过程一般也要迁移过去,但一般有两个问题: 1. 非常多存储过程有先后关系(存储过程调用存储过程),假设存储过程数量少,还能手动操作.假设量大,那真是要疯了. 2. 存储过程过大 ...

  8. 趣味算法——青蛙过河(JAVA)

    青蛙过河是一个非常有趣的智力游戏,其大意如下: 一条河之间有若干个石块间隔,有两队青蛙在过河,每队有3只青蛙,这些青蛙只能向前移动,不能向后移动,且一次只能有一只青蛙向前移动.在移动过程中,青蛙可以向 ...

  9. https大势已来?看腾讯专家如何在高并发压测中支持https

    WeTest 导读 用epoll编写一个高并发网络程序是很常见的任务,但在epoll中加入ssl层的支持则是一个不常见的场景.腾讯WeTest服务器压力测产品,在用户反馈中收到了不少支持https协议 ...

  10. SQL 查询字段为值不为空

      方法一sql="select   *   from   table   where   id<>null   "     or   sql="select ...