[咨询] 这个问题 你能解决 你就是大牛 pm2相关的
pm2的log:
2016-06-01 20:46:28: App [app] with id [13] and pid [12633], exited with code [0] via signal [SIGINT]
2016-06-01 20:46:28: Starting execution sequence in -cluster mode- for app name:app id:13
2016-06-01 20:46:28: App name:app id:13 online
2016-06-01 20:46:28: App name:app id:4 disconnected
2016-06-01 20:46:28: App [app] with id [4] and pid [47284], exited with code [0] via signal [SIGINT]
2016-06-01 20:46:28: Starting execution sequence in -cluster mode- for app name:app id:4
2016-06-01 20:46:29: App name:app id:4 online
2016-06-01 20:46:44: App name:app id:3 disconnected
2016-06-01 20:46:44: App [app] with id [3] and pid [42456], exited with code [0] via signal [SIGINT]
2016-06-01 20:46:44: Starting execution sequence in -cluster mode- for app name:app id:3
2016-06-01 20:46:44: App name:app id:3 online
2016-06-01 20:46:45: App name:app id:2 disconnected
2016-06-01 20:46:45: App [app] with id [2] and pid [47045], exited with code [0] via signal [SIGINT]
2016-06-01 20:46:45: Starting execution sequence in -cluster mode- for app name:app id:2
2016-06-01 20:46:45: App name:app id:2 online
2016-06-01 20:46:49: App name:app id:6 disconnected
2016-06-01 20:46:49: App [app] with id [6] and pid [47326], exited with code [0] via signal [SIGINT]
2016-06-01 20:46:49: Starting execution sequence in -cluster mode- for app name:app id:6
2016-06-01 20:46:49: App name:app id:6 online
2016-06-01 20:46:49: App name:app id:10 disconnected
2016-06-01 20:46:49: App [app] with id [10] and pid [47291], exited with code [0] via signal [SIGINT]
2016-06-01 20:46:49: Starting execution sequence in -cluster mode- for app name:app id:10
2016-06-01 20:46:49: App name:app id:10 online
2016-06-01 20:48:33: App name:app id:2 disconnected
2016-06-01 20:48:33: App [app] with id [2] and pid [47436], exited with code [0] via signal [SIGINT]
2016-06-01 20:48:33: Starting execution sequence in -cluster mode- for app name:app id:2
2016-06-01 20:48:33: App name:app id:2 online
2016-06-01 20:48:33: App name:app id:1 disconnected
2016-06-01 20:48:33: App [app] with id [1] and pid [47215], exited with code [0] via signal [SIGINT]
2016-06-01 20:48:33: Starting execution sequence in -cluster mode- for app name:app id:1
2016-06-01 20:48:33: App name:app id:1 online
2016-06-01 21:44:32: App name:app id:3 disconnected
2016-06-01 21:44:32: App [app] with id [3] and pid [47425], exited with code [0] via signal [SIGINT]
2016-06-01 21:44:32: Starting execution sequence in -cluster mode- for app name:app id:3
2016-06-01 21:44:32: App name:app id:3 online
2016-06-01 22:41:52: App name:app id:1 disconnected
2016-06-01 22:41:52: App [app] with id [1] and pid [47518], exited with code [0] via signal [SIGINT]
2016-06-01 22:41:52: Starting execution sequence in -cluster mode- for app name:app id:1
2016-06-01 22:41:52: App name:app id:1 online
2016-06-01 22:41:55: App name:app id:8 disconnected
2016-06-01 22:41:55: App [app] with id [8] and pid [13399], exited with code [0] via signal [SIGINT]
2016-06-01 22:41:55: Starting execution sequence in -cluster mode- for app name:app id:8
2016-06-01 22:41:55: App name:app id:8 online
2016-06-01 23:11:27: App name:app id:11 disconnected
2016-06-01 23:11:27: App [app] with id [11] and pid [47254], exited with code [0] via signal [SIGINT]
2016-06-01 23:11:27: Starting execution sequence in -cluster mode- for app name:app id:11
2016-06-01 23:11:28: App name:app id:11 online
2016-06-02 10:32:31: App name:app id:12 disconnected
2016-06-02 10:32:31: App [app] with id [12] and pid [40234], exited with code [0] via signal [SIGINT]
2016-06-02 10:32:31: Starting execution sequence in -cluster mode- for app name:app id:12
2016-06-02 10:32:31: App name:app id:12 online
2016-06-02 11:11:13: App name:app id:7 disconnected
2016-06-02 11:11:13: App [app] with id [7] and pid [47386], exited with code [0] via signal [SIGINT]
2016-06-02 11:11:13: Starting execution sequence in -cluster mode- for app name:app id:7
2016-06-02 11:11:13: App name:app id:7 online
2016-06-02 11:11:16: App name:app id:6 disconnected
2016-06-02 11:11:16: App [app] with id [6] and pid [47447], exited with code [0] via signal [SIGINT]
2016-06-02 11:11:16: Starting execution sequence in -cluster mode- for app name:app id:6
2016-06-02 11:11:16: App name:app id:6 online
2016-06-02 12:29:17: App name:app id:0 disconnected
2016-06-02 12:29:17: App [app] with id [0] and pid [47317], exited with code [0] via signal [SIGINT]
2016-06-02 12:29:17: Starting execution sequence in -cluster mode- for app name:app id:0
2016-06-02 12:29:17: App name:app id:0 online
2016-06-02 14:24:11: App name:app id:2 disconnected
2016-06-02 14:24:11: App [app] with id [2] and pid [47511], exited with code [0] via signal [SIGINT]
2016-06-02 14:24:11: Starting execution sequence in -cluster mode- for app name:app id:2
2016-06-02 14:24:11: App name:app id:2 online
2016-06-02 14:57:33: App name:app id:5 disconnected
2016-06-02 14:57:33: App [app] with id [5] and pid [47302], exited with code [0] via signal [SIGINT]
2016-06-02 14:57:33: Starting execution sequence in -cluster mode- for app name:app id:5
2016-06-02 14:57:33: App name:app id:5 online
2016-06-02 15:15:23: App name:app id:13 disconnected
2016-06-02 15:15:23: App [app] with id [13] and pid [47393], exited with code [0] via signal [SIGINT]
2016-06-02 15:15:23: Starting execution sequence in -cluster mode- for app name:app id:13
2016-06-02 15:15:23: App name:app id:13 online
2016-06-02 15:15:36: App name:app id:6 disconnected
2016-06-02 15:15:36: App [app] with id [6] and pid [64319], exited with code [0] via signal [SIGINT]
2016-06-02 15:15:36: Starting execution sequence in -cluster mode- for app name:app id:6
2016-06-02 15:15:36: App name:app id:12 disconnected
2016-06-02 15:15:36: App [app] with id [12] and pid [63616], exited with code [0] via signal [SIGINT]
2016-06-02 15:15:36: Starting execution sequence in -cluster mode- for app name:app id:12
2016-06-02 15:15:36: App name:app id:6 online
2016-06-02 15:15:36: App name:app id:12 online
2016-06-02 15:17:24: App name:app id:13 disconnected
2016-06-02 15:17:24: App [app] with id [13] and pid [68616], exited with code [0] via signal [SIGINT]
2016-06-02 15:17:24: Starting execution sequence in -cluster mode- for app name:app id:13
2016-06-02 15:17:24: App name:app id:13 online
2016-06-02 15:17:52: App name:app id:7 disconnected
2016-06-02 15:17:52: App [app] with id [7] and pid [64308], exited with code [0] via signal [SIGINT]
2016-06-02 15:17:52: Starting execution sequence in -cluster mode- for app name:app id:7
2016-06-02 15:17:52: App name:app id:7 online
2016-06-02 15:17:57: App name:app id:9 disconnected
2016-06-02 15:17:57: App [app] with id [9] and pid [12429], exited with code [0] via signal [SIGINT]
2016-06-02 15:17:57: Starting execution sequence in -cluster mode- for app name:app id:9
2016-06-02 15:17:57: App name:app id:9 online
2016-06-02 15:18:08: App name:app id:7 disconnected
2016-06-02 15:18:08: App [app] with id [7] and pid [68705], exited with code [0] via signal [SIGINT]
2016-06-02 15:18:08: Starting execution sequence in -cluster mode- for app name:app id:7
2016-06-02 15:18:08: App name:app id:7 online
2016-06-02 15:18:12: App name:app id:1 disconnected
2016-06-02 15:18:12: App [app] with id [1] and pid [49526], exited with code [0] via signal [SIGINT]
2016-06-02 15:18:12: Starting execution sequence in -cluster mode- for app name:app id:1
2016-06-02 15:18:12: App name:app id:1 online
2016-06-02 15:18:15: App name:app id:11 disconnected
2016-06-02 15:18:15: App [app] with id [11] and pid [50084], exited with code [0] via signal [SIGINT]
2016-06-02 15:18:15: Starting execution sequence in -cluster mode- for app name:app id:11
2016-06-02 15:18:15: App name:app id:10 disconnected
2016-06-02 15:18:15: App [app] with id [10] and pid [47454], exited with code [0] via signal [SIGINT]
2016-06-02 15:18:15: Starting execution sequence in -cluster mode- for app name:app id:10
2016-06-02 15:18:16: App name:app id:11 online
2016-06-02 15:18:16: App name:app id:10 online
2016-06-02 15:18:43: App name:app id:8 disconnected
2016-06-02 15:18:43: App [app] with id [8] and pid [49537], exited with code [0] via signal [SIGINT]
2016-06-02 15:18:43: Starting execution sequence in -cluster mode- for app name:app id:8
2016-06-02 15:18:43: App name:app id:8 online
2016-06-02 15:19:02: App name:app id:9 disconnected
2016-06-02 15:19:02: App [app] with id [9] and pid [68716], exited with code [0] via signal [SIGINT]
2016-06-02 15:19:02: Starting execution sequence in -cluster mode- for app name:app id:9
2016-06-02 15:19:02: App name:app id:9 online
2016-06-02 18:14:37: App name:app id:11 disconnected
2016-06-02 18:14:37: App [app] with id [11] and pid [68770], exited with code [0] via signal [SIGINT]
2016-06-02 18:14:37: Starting execution sequence in -cluster mode- for app name:app id:11
2016-06-02 18:14:37: App name:app id:11 online
2016-06-02 18:14:49: App name:app id:5 disconnected
2016-06-02 18:14:49: App [app] with id [5] and pid [68291], exited with code [0] via signal [SIGINT]
2016-06-02 18:14:49: Starting execution sequence in -cluster mode- for app name:app id:5
2016-06-02 18:14:49: App name:app id:1 disconnected
2016-06-02 18:14:49: App [app] with id [1] and pid [68759], exited with code [0] via signal [SIGINT]
2016-06-02 18:14:49: Starting execution sequence in -cluster mode- for app name:app id:1
2016-06-02 18:14:49: App name:app id:5 online
2016-06-02 18:14:50: App name:app id:1 online
2016-06-02 23:16:50: App name:app id:0 disconnected
2016-06-02 23:16:50: App [app] with id [0] and pid [65692], exited with code [0] via signal [SIGINT]
2016-06-02 23:16:50: Starting execution sequence in -cluster mode- for app name:app id:0
2016-06-02 23:16:50: App name:app id:0 online
2016-06-02 23:17:06: App name:app id:3 disconnected
2016-06-02 23:17:06: App [app] with id [3] and pid [48515], exited with code [0] via signal [SIGINT]
2016-06-02 23:17:06: Starting execution sequence in -cluster mode- for app name:app id:3
2016-06-02 23:17:06: App name:app id:3 online
2016-06-02 23:17:06: App name:app id:9 disconnected
2016-06-02 23:17:06: App [app] with id [9] and pid [68830], exited with code [0] via signal [SIGINT]
2016-06-02 23:17:06: Starting execution sequence in -cluster mode- for app name:app id:9
2016-06-02 23:17:06: App name:app id:9 online
2016-06-02 23:17:06: App name:app id:12 disconnected
2016-06-02 23:17:06: App [app] with id [12] and pid [68634], exited with code [0] via signal [SIGINT]
为何一直:exited with code [0] via signal [SIGINT]
ps:机器内存和cpu都很充足
~$df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 40G 9.8G 28G 27% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
udev 7.9G 4.0K 7.9G 1% /dev
tmpfs 1.6G 380K 1.6G 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 7.9G 0 7.9G 0% /run/shm
none 100M 0 100M 0% /run/user
~$ free -m
total used free shared buffers cached
Mem: 16035 8177 7857 0 174 3672
-/+ buffers/cache: 4331 11704
Swap: 0 0 0
~$ node -v
v5.1.1
~$ npm -v
3.3.12
~$ pm2 -v
1.0.0
配置文件:
{
"apps": [
{
"name": "app",
"script": "app.js",
"error_file": "../log/error.log",
"out_file": "../log/access.log",
"merge_logs": true,
"cwd": "./",
"instances": 0,
"exec_mode" : "cluster_mode",
"env": {
"NODE_ENV": "production"
}
}
]
}
21 回复
~$df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 40G 9.8G 28G 27% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
udev 7.9G 4.0K 7.9G 1% /dev
tmpfs 1.6G 380K 1.6G 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 7.9G 0 7.9G 0% /run/shm
none 100M 0 100M 0% /run/user
硬盘空间很足呢
没有设置max_memory_restart
内存还很多呢:
~$ free -m
total used free shared buffers cached
Mem: 16035 8177 7857 0 174 3672
-/+ buffers/cache: 4331 11704
Swap: 0 0 0
提点一下:用 systemtap, 参考https://sourceware.org/systemtap/ systemtap 脚本如下,找到发送信号的 PID。
#! /usr/bin/env stap
# sigkill.stp
# Copyright (C) 2007 Red Hat, Inc., Eugene Teo <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# /usr/share/systemtap/tapset/signal.stp:
# [...]
# probe signal.send = _signal.send.*
# {
# sig=$sig
# sig_name = _signal_name($sig)
# sig_pid = task_pid(task)
# pid_name = task_execname(task)
# [...]
probe signal.send {
if (sig_name == "SIGKILL")
printf("%s was sent to %s (pid:%d) by %s uid:%d\n",
sig_name, pid_name, sig_pid, execname(), uid())
}