项目里面使用了egg-socket.io,package.json里面的启动命令如下:
EGG_SERVER_ENV=prod egg-scripts start --sticky --port=10006 --daemon
redis服务出现网络异常时,egg会尝试重连几次,但最后连接不上后,egg服务就退出了。 出现异常时的错误日志:
2019-05-29 01:19:51,044 ERROR 30602 nodejs.AbortError: Ready check failed: Redis connection lost and command aborted. It might have been processed. (uncaughtException throw 27 times on pid:30602) at RedisClient.flush_and_error (/datadisk/socket-egg-server/node_modules/redis/index.js:362:23) at RedisClient.connection_gone (/datadisk/socket-egg-server/node_modules/redis/index.js:664:14) at Socket. (/datadisk/socket-egg-server/node_modules/redis/index.js:289:14) at Object.onceWrapper (events.js:315:30) at emitOne (events.js:116:13) at Socket.emit (events.js:211:7) at TCP._handle.close [as _onclose] (net.js:557:12) code: "UNCERTAIN_STATE" command: "INFO" pid: 30602 hostname: VM_4_89_centos
2019-05-29 01:20:09,699 ERROR 30602 nodejs.ECONNRESETError: read ECONNRESET at _errnoException (util.js:992:11) at TCP.onread (net.js:618:25) code: "ECONNRESET" errno: "ECONNRESET" syscall: "read" name: "ECONNRESETError" pid: 30602 hostname: VM_4_89_centos
2019-05-29 01:20:14,318 ERROR 30594 nodejs.ECONNRESETError: read ECONNRESET at _errnoException (util.js:992:11) at TCP.onread (net.js:618:25) code: "ECONNRESET" errno: "ECONNRESET" syscall: "read" name: "ECONNRESETError" pid: 30594