PM2 parameter configuration

https://github.com/jawil/blog/issues/7

 

Configuration items:

name the name of the application process;
script startup script path;
cwd application startup path, on the difference between script and cwd of example: running /data/release/node/index.js in / home / polo / directory, where the script is / data / release / node / index.js, cwd is / home / polo /;
the parameters passed to the script args;
interpreter specified script interpreter;
interpreter_args parameters passed to the interpreter;
instances number of instances of an application launch, only the cluster mode is active by default fork;
exec_mode application launch mode, support fork and cluster mode;
Watch monitor restart, enabled by default, the folder or sub-folder changes apply automatically restart;
ignore_watch ignored monitor folders, support for regular expressions;
max_memory_restart maximum memory limit, beyond automatically restart;
the env environment variable, object type, such as { "NODE_ENV": "Production", "ID": "42 is"};
log_date_format specified log date format, such as YYYY-MM-DD HH: mm: SS;
error_file. recording standard error stream, $ HOME / .pm2 / logs / XXXerr.log), the code error can be found in the file;
the out_file note Recording the standard output stream, $ HOME / .pm2 / logs / XXXout.log), a number of standard applications such as printing output, will cause pm2日志过大;
min_uptime application running less than time is considered abnormal start;
max_restarts maximum number of reboots, run time that is less than min_uptime number of restarts;
autorestart is the default is true, to automatically restart the event of abnormal;
cron_restart crontab time format to restart the application, currently only supports cluster mode;
Force default false, if true, could start a script repeat. pm2 is not recommended;
restart_delay case of abnormal restart, restart delay time;

 

Stable operation recommendations

Reasonable set min_uptime, min_uptime long continuous minimum run an application when a normal start, beyond this time were judged to be abnormal actuation;
set abnormal restart delay restart_delay, for anomalies cause the application to stop, restart delay setting error can not be prevented Application the case of continuously measuring restart problems lead to excessive number of restarts and the like;
provided abnormal reboots, reboot exception if constantly applied, and exceeds a certain limited number of times, in this case described environment for a long time in an uncontrollable state, the server is abnormal. At this point you can stop trying, error warning notification

Guess you like

Origin www.cnblogs.com/liuzhenwei/p/12006906.html