TODO:Node.js PM2 How to use

Source: Internet
Author: User

TODO:Node.js PM2 How to use

The PM2 is a process manager for a node app with load-balancing capabilities.

PM2 is perfect when you want to take advantage of all of your standalone code on all the CPUs on the server and ensure that the process is always alive, with 0 seconds of overloading.

1. Installing PM2 using NPM install Pm2-g

2. Using PM2 to manage the node process, execute the following command to start the node service:

PM2 Start Process.json

Error log output, less ~/.pm2/logs/video-error.log,node error:cannot find module ' Express ':

3. Setting Node_path Environment variables

Export path= $PATH:/data/node/node-v6.9.1-linux-x64/bin

Export node_path= "/data/node/node-v6.9.1-linux-x64/lib/node_modules"

4. Install the dependent warranty

NPM install-d

5. Start the node service, PM2 start Process.json

6. Test if the service port is turned on, telnet 127.0.0.1 9994

7. Stop PM2 Management app,pm2 stop Video,status to stopped stop successful

8. Start PM2 managed app,pm2 start video,status for online then start successfully

9. More PM2 use method, you can use Pm2–help to view the detailed usage method

$ PM2 List

$ PM2 Stop

$ PM2 Restart

$ PM2 Delete

Wxgzh:ludong86

TODO:Node.js PM2 How to use

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.