pm2

nodejs PM2 cluster mode for load balancing

时光怂恿深爱的人放手 提交于 2019-12-22 09:25:18
问题 When using pm2 cluster there's a pretty severe warning saying you shouldn't use it in production, nor for load balancing, use nginx instead. Unfortunately that's exactly how I planned to use PM2. Is it really not intended to be used for that purpose or is it just not completely ready yet? 回答1: The nodejs cluster (0.10) has a lot of issues and is not safe to use in production! You may want to give a try with 0.11, there were some improvements. This feature has not anything to do with pm2, it's

突然发现的nodejs运行管理工具PM2

你离开我真会死。 提交于 2019-12-22 01:20:43
公司的程序nodejs查看内存很奇怪内存不被释放 感觉是哪里写了闭包,但是找起来很麻烦,因为内存上涨的很慢,感觉运行一个月以内应该ok pm2可以在程序挂掉的时候自动重启,那么程序用pm2管理让他自动重启呗 https://www.jianshu.com/p/994936baa38d 链接,安装方法和使用指南 来源: CSDN 作者: SpecYue 链接: https://blog.csdn.net/qq_34788903/article/details/103643127

Run play scala application with pm2

旧城冷巷雨未停 提交于 2019-12-21 20:05:40
问题 We have been deploying Play/Scala application on our UNIX server by just running the executable, something like java_opts="-Xms128M -Xmx512M" ./bin/myProject -Dconfig.file=/path/to/my/confFile.conf -Dhttp.port=9022 & and it works fine. However, for my NodeJS applications I use pm2 and I really appreciate its ease of use as well as monitoring options and hence would like to use it for the other apps too. This thread claims it is possible to run JARs. Any idea on how to adapt the conf (see

How do you use pm2 startup with a non-root user?

不想你离开。 提交于 2019-12-21 17:46:12
问题 According to the documentation here: http://pm2.keymetrics.io/docs/usage/startup/#startup-systems-support You can use the command pm2 startup ubuntu -u nodeapps to resurrect all saved pm2 jobs on server startup. I ran this command as the nodeapps user. Then I was given a sudo su command to run. I logged out of nodeapps, used sudo su to log into the system as root, and ran the command: sudo su -c "env PATH=$PATH:/usr/bin pm2 startup ubuntu -u nodapps --hp /home/nodeapps" The processes did not

custom logging under pm2

孤人 提交于 2019-12-21 07:56:35
问题 I have some useful logging in my node app that I write to console.log node server.js >> /var/log/nodeserver.log 2>&1 However, when trying the same under pm2 : pm2 start server.js >> /var/log/pm2server.log 2>&1 the log file only shows the pm2 startup information Is application logging at all possible with pm2 ? On their page they discuss logging, and show an image with text like "log message from echo.js" , but I see nothing about getting custom information into the pm2 log. 回答1: When running

What is the difference between pm2 restart and pm2 reload

时间秒杀一切 提交于 2019-12-21 06:47:23
问题 I have a nodejs app running on server. When should I use pm2 restart ,and when should pm2 reload be used? Referred to the pm2 documention here,but couldn't figure out the difference in use case of the two. 回答1: The difference is documented here: As opposed to restart , which kills and restarts the process, reload achieves a 0-second-downtime reload. The latter means (found here): With reload, pm2 restarts all processes one by one, always keeping at least one process running. It also states

Can the pm2 node module restarts the app after crash automatically

无人久伴 提交于 2019-12-21 03:13:10
问题 I have a node app ready which is workable, but has known and unknown bugs which crashes the node app. In such cases it would be nice if pm2 can restart the node app. Is this feature already available in pm2 ? 回答1: Yes, it does this by default and there is even a watch option to restart on changes. 回答2: Also, check new excellent option --exp-backoff-restart-delay=100 (msec, not sec!) pm2 will restart crashed app after 100 msec, then step-by-step increase restart-delay to 15 secunds 回答3: This

How to automatically reload Node.js project when using pm2

徘徊边缘 提交于 2019-12-20 11:57:46
问题 I am currently programming Node.js with Express.js, and every time I change a line of code in the file router or app, I need to type the command: pm2 reload id_project. How do I make pm2 auto-reload the project when a file is changed? 回答1: By default, node doesn’t automatically refresh our server every time we change files. I don't know about specific pm2 solution, but you can do that with nodemon. Just install with: npm install -g nodemon and use with: nodemon server.js . Personally, it

Start Node JS application when server reboots with pm2

北城余情 提交于 2019-12-20 02:35:22
问题 I am trying to use the module pm2 to start my node js app everytime the server boots. I have used the command pm2 startup ubuntu but each time I restart the server, my application is not running and I have to start it manually again. Any ideas what is causing this issue? 回答1: Make sure you do save your processes: pm2 start app.js pm2 startup ubuntu pm2 save Once you have started the apps and want to keep them on server reboot do: pm2 save Source: https://github.com/Unitech/PM2/blob/master

Ubuntu 14.04 - pm2 startup not starting after reboot

匆匆过客 提交于 2019-12-18 16:59:41
问题 I am using pm2 to start a node.js process, and I would like this process to be started automatically when the system (Ubuntu 14.04 on Intel Atom processor) is booted. I have followed the instructions on the pm2 web site but without success. My dump.pm2 appears to be correct, but the pm2 daemon is never started. I have tried both the ubuntu and linux options to pm2 startup , as well as autodetect, both with and without a specified user. Files (links) S20pm2-init.sh have been created in /etc/rc