forever 로그 무한 증가 해결방안

전산|2020. 9. 1. 15:31
728x90
반응형

 

forever는 node.js앱의 인스턴스를 관리해주는 툴입니다.

node.js로 만든 앱이 예기치 않게 종료가 되었을때 다시 실행해주고, 로그도 남겨주는 역할을 하고요.

서버상의 로그가 지속적으로 늘어나면서 결국엔 98%까지 올라가서 원인을 찾다가 forever 로그를 확인했고요.

아래 오류 메세지가 출력되었습니다.

 

결론

- node.js 앱을 시작하는데, 기존 앱의 서비스가 살아있는 경우 입니다.

1. 해당 앱의 종료 명령어로 서비스를 종료 하고, 다시시작하는 방법

2. node.js 앱을 찾아서 강제 죽이는 방법 ( $kill -9 PID)

 

추가적으로 아래 명령어로 로그 위치 파악

[id@web ~]$ forever list

info: Forever processes running

data: uid command script forever pid id logfile uptime

data: [0] qur7 /usr/local/bin/node bin/run.js 12453 12459 /home/xxxx/.forever/qur7.log27:17:3:24.453

 

위에 내용을 길게 작성은 하였지만..서비스 재시작하니 대부분 해결 되는거 같습니다.

 

 

오류메세지

 

events.js:136

throw er; // Unhandled 'error' event

^

 

Error: listen EADDRINUSE :::9080

at Object._errnoException (util.js:999:13)

at _exceptionWithHostPort (util.js:1020:20)

at Server.setupListenHandle [as _listen2] (net.js:1379:14)

at listenInCluster (net.js:1420:12)

at Server.listen (net.js:1508:7)

at Application.listen (/home/xxxx/xxxx/node_modules/koa/lib/application.js:64:19)

at Object.<anonymous> (/home/xxxx/xxxx/bin/server.js:11:8)

at Module._compile (module.js:660:30)

at loader (/home/xxxx/xxxx/node_modules/babel-register/lib/node.js:144:5)

at Object.require.extensions.(anonymous function) [as .js] (/home/xxxx/xxxx/node_modules/babel-register/lib/node.js:154:7)

at Module.load (module.js:573:32)

at tryModuleLoad (module.js:513:12)

at Function.Module._load (module.js:505:3)

at Module.require (module.js:604:17)

at require (internal/module.js:11:18)

at Object.<anonymous> (/home/xxxx/xxxx/bin/run.js:2:1)

error: Forever detected script exited with code: 1

error: Script restart attempt 1689613

Tue, 28 Jul 2020 00:48:16 GMT app:config Creating default configuration.

Tue, 28 Jul 2020 00:48:16 GMT app:config Package "node-uuid" was not found as an npm dependency in package.json; it won't be included in the webpack vendor bundle.

Consider removing it from vendor_dependencies in ~/config/index.js

Tue, 28 Jul 2020 00:48:16 GMT app:config Looking for environment overrides for NODE_ENV "production".

Tue, 28 Jul 2020 00:48:16 GMT app:config Found overrides, applying to default configuration.

 

 

 

npm : https://www.npmjs.com/package/forever

이미지 썸네일 삭제

forever

A simple CLI tool for ensuring that a given node script runs continuously (i.e. forever)

www.npmjs.com

끝..

 

 

728x90
반응형

댓글()