Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PM2 的 watch file 可以忽略部分目录 #14

Open
zwhu opened this issue Dec 9, 2015 · 0 comments
Open

PM2 的 watch file 可以忽略部分目录 #14

zwhu opened this issue Dec 9, 2015 · 0 comments
Labels

Comments

@zwhu
Copy link
Owner

zwhu commented Dec 9, 2015

最近在服务器上使用 pm2 来管理 node 程序,当然其他程序也可以用 pm2 管理,具体使用方法可以看 这里,(可能需要翻墙)。

pm2 有个 watch file 功能,开启方法 :

$: pm2 start app.js --watch

检查程序中有没有文件被修改,如果被修改的话,重启服务器;我在使用过程中遇到一个很奇怪的bug:每当用户登录的时候,服务器内存就会暴涨,且在服务端设置的 cookie 也会过了很久才被浏览器接收到。

后来经过一番苦逼的排查才发现原来是我在用户登陆的时候会在一个文件中记录用户的登录日志,这个时候 pm2 就会检测到项目目录下有文件变动,然后就是无情地重启服务器... 排查出问题就好解决了, pm2 有个 ignoreWatch 的配置,设置好忽略监测目录。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant