How to Duplicate Reseller Service Plans in Plesk
This guide will walk you through the process of cloning the reseller service plans in…
In this article, you will learn what PM2 is and how it can be used to manage and monitor Node.js applications in a production environment. It covers installation, key features, and essential commands to help you keep your apps running smoothly.
PM2 (Process Manager 2) is a production process manager for Node.js applications. It helps developers manage, monitor, and keep applications running continuously without manual intervention. PM2 automatically restarts apps if they crash, supports load balancing across CPU cores, and provides tools for performance monitoring and log management.
Features
Installation
npm install -g pm2
pm2 --version
Basic Commands
Using Cluster Mode
Cluster mode allows PM2 to run multiple instances of an application across CPU cores.
Example:
pm2 start app.js -i max
The -i max flag automatically launches one instance per available CPU core.
Auto-Start on Boot
To make PM2-managed applications start automatically after a reboot, use:
pm2 startup
pm2 save
pm2 startup generates a startup script, and pm2 save saves the current list of running applications.
Monitoring and Logs
You can view and monitor applications directly from the command line:
pm2 logs
pm2 monit
For advanced monitoring, PM2 can be connected to PM2 Plus, which provides a web-based dashboard.
This way, we can conclude that PM2 is a powerful and easy-to-use process manager for Node.js applications. It helps ensure uptime, simplifies scaling with cluster mode, and provides useful monitoring tools for production environments.
Explore more hosting insights, tips and industry updates.
This guide will walk you through the process of cloning the reseller service plans in…
There are many pre-installed programs on the WHM and cPanel server, and there is the…
Domain Name: Domain name represents the unique name of your website in the World Wide…