본문 바로가기
기타2/Nodejs

pm2

by 죠부니 2018. 8. 7.
반응형

PM2

http://pm2.keymetrics.io/

https://www.npmjs.com/package/pm2


일반전인 웹 애플리케이션을 배포할때는 WAS를 이용한다.


하지만 node의 경우 자체 웹서버의 기능이 존재하여 WAS나 웹서버를 이용할 필요가 없다.


node의경우 그냥


node index 의 명령어를 이용하면 애플리케이션이 시작된다.


해당 형태로 시작하게되면 커맨드창을 지속적으로 켜두거나 서버가 뻗어버렸을경우 답이없다.


PM2에 나와있는 설명

Overview

Why use PM2 ? At the end of this overview, you will better understand the benefits of using PM2 as a process manager.

Forever Alivelink

Once started, your app is forever alive, auto-restarting across crashes and machine restarts.


대안으로는 여러가지 있지만

StrongLoop Process Manager

http://strong-pm.io/

forever

https://github.com/foreverjs/forever


나는 PM2를 선택했다.


https://pm2.io/doc/en/runtime/overview/


설치

npm install -g pm2

뭐 간단한건 설명서를 보도록 하고


자주쓰는 명령어

리스트

pm2 ls


시작

앱을 시작하면서 이름과 --watch옵션 추가

pm2 start app.js --name "앱이름" --watch


중지

pm2 stop app

재시작

pm2 restart app

삭제

pm2 delete app


상세정보

pm2 show


로그확인

pm2 logs


로그삭제

pm2 flush


모니터형태로 확인

pm2 monit

반응형

'기타2 > Nodejs' 카테고리의 다른 글

multer  (1) 2018.08.09
Express에서 정적 파일 제공  (0) 2018.08.09
cors  (0) 2018.08.09
mysql2  (0) 2018.08.08
https://jestjs.io/  (0) 2018.08.02