Talk pm2

Easy to use than forever, and centos more friendly to Ubuntu, performance monitoring, automatic restart, load balancing for laas scene,

In short, pm2 Node Manager process is applied with a load balancing can be achieved on a cloud server, online deployment nodejs project, the service has been running.

Install npm install pm2 -g

pm2 start app.js

pm2 restart app.js

pm2 delete all

Other commonly used commands

$ Pm2 start app.js # app.js start the application 
 
$ pm2 start app.js -i 4 # cluster mode mode is activated application examples 4 app.js # 4 of the application will automatically load balancing 
 
$ pm2 start app. js --name = "api" # start the application named "API" 
 
$ # PM2 start app.js --watch restart the application automatically when the file changes 
 
$ pm2 start script.sh # bash startup script 
 
$ pm2 list # list PM2 start all applications 
 
$ pm2 monit # display CPU and memory usage of each application is 
 
$ pm2 show [app-name] # displays the application all the information 
 
 
$ pm2 logs # display the log for all applications 
 
$ pm2 logs [app-name] # display the application's log 
 
$ PM2 flush 
 
 
$ PM2 All sTOP # stop all applications 
 
$ pm2 stop 0 # id stop for the specified application 0 
 
$ pm2 restart all # restart all applications
 
$ Pm2 reload all applications in all # restart Cluster the MODE 
 
$ PM2 gracefulReload all # Graceful reload All Apps in Cluster the MODE 
 
$ PM2 the Delete all # shut down and remove all application 
 
$ pm2 delete 0 # delete the specified application the above mentioned id 0 
 
$ PM2 Scale API 10 # the application called api extended to 10 instances of 
 
$ pm2 reset [app-name] # reset the number of restart 
 
$ pm2 startup # create a boot from the start command 
 
$ pm2 save # save the current application list 
 
application $ pm2 resurrect # reload saved list 
 
$ PM2 Update # the Save Processes, the kill PM2 and Restore Processes 
 
$ # PM2 the Generate the Generate the Sample A json the Configuration File 
 
$ PM2 Deploy App.json Prod Setup # Setup "Prod" Remote Server
 
$ pm2 deploy app.json prod          # Update "prod" remote server
 
$ pm2 deploy app.json prod revert 2 # Revert "prod" remote server by 2
 
$ pm2 module:generate [name]    # Generate sample module with name [name]
 
$ pm2 install pm2-logrotate     # Install module (here a log rotation system)
 
$ pm2 uninstall pm2-logrotate   # Uninstall module
 
$ pm2 publish                   # Increment version, git push and npm publish
 
# pm2 --help                    # 更多命令参数请查看帮助

 

Guess you like

Origin www.cnblogs.com/marszhw/p/11279936.html