当前位置:网站首页>How to use PM2 management application? Come in and see

How to use PM2 management application? Come in and see

2022-04-23 20:31:00 Different 213

pm2 Management applications

pm2 Is a process management tool , You can use it to manage your node process , And look at node State of process , Of course, it also supports performance monitoring , Process daemons , Load balancing and other functions

How to use pm2 ?

1. Global installation is required first pm2
npm install pm2 -g
2. Then enter the project root directory
 pm2 start .\app.js --name web_vueshop
  • --name web_vueshop : optional , web_vueshop It's a custom name

In this way, the service is started successfully .

The example figure shows :

image-20210221210942475

  • id Value is unique , Identify this item . You can choose to use a custom name or id value .
3. Introduce some commonly used commands
  • View all running projects :

    pm2 ls
    
  • Restart project :

    pm2 restart Custom name 
    

    You can also select the corresponding id value , As shown below :

    pm2 restart 0
    

    Here id 0 Corresponding to the item in the above figure

  • Stop the project :

    pm2 stop  Custom name /id value 
    
  • Delete the project :

    pm2 delete  Custom name /id value 
    

版权声明
本文为[Different 213]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210550450695.html