用pm2 在Centos7下部署node工程(express框架),2天后可以访问(5.9),但连接数据库无法响应,pm2日志如下
发布于 3 年前 作者 bykege 6224 次浏览 来自 问答

pm2日志如下,日志的错误信息并没有写时间,还有从错误日志看,请问有可能是什么问题导致的

[root@centos7 root]# pm2 logs [PM2] Tailing last 20 lines for [all] processes

PM2: 2016-04-29 17:56:38: Script /root/node/configmanage/bin/www had too many unstable restarts (16). Stopped. "errored" PM2: 2016-04-29 18:04:00: Stopping app:www id:0 PM2: 2016-04-29 18:04:50: Starting execution sequence in -fork mode- for app name:www id:0 PM2: 2016-04-29 18:04:50: App name:www id:0 online PM2: 2016-05-05 16:26:01: [PM2][WORKER] Started with refreshing interval: 30000 PM2: 2016-05-05 16:26:01: [[[[ PM2/God daemon launched ]]]] PM2: 2016-05-05 16:26:01: BUS system [READY] on port /root/.pm2/pub.sock PM2: 2016-05-05 16:26:01: RPC interface [READY] on port /root/.pm2/rpc.sock PM2: 2016-05-05 16:26:01: Starting execution sequence in -fork mode- for app name:www id:0 PM2: 2016-05-05 16:26:01: App name:www id:0 online PM2: 2016-05-06 12:51:07: Stopping app:www id:0 PM2: 2016-05-06 12:51:07: App [www] with id [0] and pid [4910], exited with code [0] via signal [SIGINT] PM2: 2016-05-06 12:51:08: Starting execution sequence in -fork mode- for app name:www id:0 PM2: 2016-05-06 12:51:08: App name:www id:0 online PM2: 2016-05-06 12:58:14: Starting execution sequence in -fork mode- for app name:pm2-http-interface id:1 PM2: 2016-05-06 12:58:14: App name:pm2-http-interface id:1 online PM2: 2016-05-09 11:26:48: Stopping app:www id:0 PM2: 2016-05-09 11:26:48: App [www] with id [0] and pid [2619], exited with code [0] via signal [SIGINT] PM2: 2016-05-09 11:26:48: Starting execution sequence in -fork mode- for app name:www id:0 PM2: 2016-05-09 11:26:48: App name:www id:0 online

www-0 (err): TypeError: Cannot read property ‘query’ of undefined www-0 (err): at /root/node/configmanage/models/user.js:40:15 www-0 (err): at Pool.<anonymous> (/root/node/configmanage/node_modules/mysql/lib/Pool.js:47:16) www-0 (err): at Handshake.Sequence.end (/root/node/configmanage/node_modules/mysql/lib/protocol/sequences/Sequence.js:96:24) www-0 (err): at Protocol.handleNetworkError (/root/node/configmanage/node_modules/mysql/lib/protocol/Protocol.js:335:14) www-0 (err): at PoolConnection.Connection._handleNetworkError (/root/node/configmanage/node_modules/mysql/lib/Connection.js:340:18) www-0 (err): at emitOne (events.js:77:13) www-0 (err): at Socket.emit (events.js:169:7) www-0 (err): at emitErrorNT (net.js:1253:8) www-0 (err): at nextTickCallbackWith2Args (node.js:442:9) www-0 (err): at process._tickDomainCallback (node.js:397:17) www-0 (err): Fri, 29 Apr 2016 10:04:51 GMT express-session deprecated undefined resave option; provide resave option at app.js:39:9 www-0 (err): Fri, 29 Apr 2016 10:04:51 GMT express-session deprecated undefined saveUninitialized option; provide saveUninitialized option at app.js:39:9 www-0 (err): (node) Buffer.write(string, encoding, offset, length) is deprecated. Use write(string[, offset[, length]][, encoding]) instead. www-0 (err): Thu, 05 May 2016 08:26:02 GMT express-session deprecated undefined resave option; provide resave option at app.js:39:9 www-0 (err): Thu, 05 May 2016 08:26:02 GMT express-session deprecated undefined saveUninitialized option; provide saveUninitialized option at app.js:39:9 www-0 (err): Fri, 06 May 2016 04:51:08 GMT express-session deprecated undefined resave option; provide resave option at app.js:39:9 www-0 (err): Fri, 06 May 2016 04:51:08 GMT express-session deprecated undefined saveUninitialized option; provide saveUninitialized option at app.js:39:9 www-0 (err): Mon, 09 May 2016 03:26:48 GMT express-session deprecated undefined resave option; provide resave option at app.js:39:9 www-0 (err): Mon, 09 May 2016 03:26:48 GMT express-session deprecated undefined saveUninitialized option; provide saveUninitialized option at app.js:39:9

www-0 (out): GET /javascripts/basic.js 304 2ms www-0 (out): GET /image/buttons/cosco.png 304 0ms www-0 (out): GET /image/buttons/ding.png 304 2ms www-0 (out): GET /image/buttons/mini.png 304 2ms www-0 (out): GET /image/buttons/close.png 304 2ms www-0 (out): GET /image/fleet.png 304 2ms www-0 (out): GET /image/srms.png 304 1ms www-0 (out): GET /image/terminal.png 304 0ms www-0 (out): GET /image/system.png 304 1ms www-0 (out): GET /image/market.png 304 1ms www-0 (out): invoked[getUsrList] www-0 (out): GET /manageUser 304 45ms www-0 (out): GET /stylesheets/style.css 304 6ms www-0 (out): GET /javascripts/jquery-1.10.2.min.js 304 6ms www-0 (out): GET /image/buttons/dot.png 304 2ms www-0 (out): GET /image/buttons/add1.jpg 304 1ms www-0 (out): GET /image/buttons/del1.jpg 304 1ms www-0 (out): GET /image/buttons/change1.jpg 304 1ms www-0 (out): GET /image/buttons/select1.jpg 304 1ms www-0 (out): GET /image/buttons/change2.jpg 304 0ms

[PM2] Streaming realtime logs for [all] processes

www-0 GET / 200 10ms - 5.3kb www-0 GET /stylesheets/style.css 304 2ms www-0 GET /javascripts/jquery-1.10.2.min.js 304 1ms www-0 GET /image/cosco_logo.png 304 0ms www-0 GET /image/cosco.png 304 1ms

3 回复

mysql有个连接超时时间 默认超过8小时不访问就会关闭连接 所以要定时select一下

@kentkwan 哦哦 感谢你

回到顶部