Bes-js / pm2-guide

PM2 Lecture, Operation Logic and Command Guide

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool



You can follow the steps below to download PM2: Install Node.js: PM2 runs on Node.js, so you need to install the latest version of Node.js first. Install PM2 package: You can use npm (Node.js Package Manager) to install PM2 package. npm is automatically installed when you install Node.js. To install the PM2 package, run the command:

npm install pm2 -g

This command will install PM2 package globally. Verify that PM2 is installed: To install PM2 correctly, use the following command:

pm2 --version

This command will check if PM2 is installed and show the version of PM2. Installing PM2 will make it easier for you to manage, restart and update your Node.js applications.



PM2 is an application manager. PM2 is used to monitor, manage and deploy Node.js applications. Some of the functions PM2 provides are:
  • Starts and stops your application.
  • It monitors the running status of your application, restarts or stops it in case of any problems.
  • It runs your application in several processes so you can get more CPU usage.
  • It processes and manages the logs of your application.
  • It provides an easy way to publish your app.

PM2 can be configured via console commands or using a configuration file. Also, PM2 provides APIs to perform many actions on your application.

PM2 allows you to make your Node.js applications more efficient and configure them according to your needs. PM2 can also be used to run multiple applications on a shared server.



  • pm2 start

Start your application using the pm2 start command. For example, you can start your app.js file using the pm2 start app.js command. PM2 will start monitoring your application and will automatically restart in case of any problems.

PM2 can be configured according to specified criteria to automatically restart your application; use the command pm2 start [app-name] --watch to do this.

  • pm2 list

You can view all running applications using the pm2 list command.

  • pm2 stop

Use the pm2 stop [app-name / ID / all] command to stop your app. Instead of [app-name / ID] you should use the name of your app.

  • pm2 restart

Use the pm2 restart [app-name / ID / all] command to restart your app.

  • pm2 logs

Use the pm2 logs [app-name / ID] command to view your app's logs. Use your app name instead of [app-name / ID].

  • pm2 show

Use the pm2 show [app-name] command to view the status of your app. Use your app name instead of [app-name / ID].

  • pm2 flush

Use the pm2 flush command to clear/delete your PM2 log history.

  • pm2 kill

You can use the pm2 kill command to stop/shut down the PM2 system.

  • pm2 save

You can use the pm2 save command to make a working backup of the PM2 applications you have started/run.

  • pm2 resurrect

You can restart your PM2 applications that you have backed up with pm2 save by using pm2 resurrect command in case of machine shutdown.



PM2 Related Help, Support, Questions etc. You can get help from our server.

Discord Banner

About

PM2 Lecture, Operation Logic and Command Guide


Languages

Language:Batchfile 100.0%