当前位置:网站首页>PM2 simple use and daemon
PM2 simple use and daemon
2022-07-02 06:59:00 【Snow wind in the night sky】
Preface : This tutorial uses centos8 As an example , Other systems can be replaced by themselves .
One 、 install
1. install nodejs
yum install nodejs
2. install pm2
cd /root && npm install pm2 -g
3. Check for successful installation
pm2 list
Two 、 Use
1. A daemon / Script
pm2 start Your program name
2. The guardian thread / process
pm2 start ' Your progress / Threads '
3. Boot from boot
After all the guards are finished, you can run it automatically if you want to turn it on , After all, it's still troublesome to start one by one .
pm2 ps ## Check whether the list you are guarding is correct
4. Stop those who don't want to start up automatically
pm2 stop Your program /' process '
5. Save the services enabled in the current list
pm2 save
6. Add the service that has just been started in the keep list to the startup self startup
sudo pm2 startup
7. How to delete startup ( You cannot delete an item alone )
pm2 unstartup systemd
3、 ... and 、 Troubleshooting
1. Check whether it is administrator mode , If it is not :
su -root
2. Update instruction Library
yum update
3. uninstall
yum remove nodejs -y
Four 、 other
upgrade pm2
pm2 update
5、 ... and 、 Cluster mode ( Limited to Node.js)
pm2 start app.js -i 4 ## Start in cluster mode 4 Application instances , It will load balance each application's network queries
pm2 reload all ## Zero second shutdown and restart
pm2 scale [app-name] 10 ## Scale clustering is applied to 10 A process
## Process monitoring
pm2 list ## List PM2 All processes
pm2 monit ## Displays the memory of each application and cpu usage
pm2 show [app-name] ## Show all the information about the application
## Log management
pm2 logs ## Show logs for all applications
pm2 logs [app-name] ## Show logs for a specific application
pm2 logs --json ## journal JSON format
pm2 flush
pm2 reloadLogs
## Process status management
pm2 start app.js --name="233" ## Start the application and name it “233”
pm2 start app.js -- -a 343 ## Start applying and passing options “-a 343” As a parameter
pm2 start app.js --watch ## Restart the file change application
pm2 start script.sh ## start-up bash Type scripts
pm2 start app.json ## Start at app.json All applications declared in
pm2 reset [app-name] ## Reset all counters
pm2 stop all ## Stop all applications
pm2 stop 456 ## Stop the process id by 456 Applications for
pm2 restart all ## Restart all applications
pm2 gracefulReload all ## Reload all applications normally in cluster mode
pm2 delete all ## Kill and delete all applications
pm2 delete 114 ## Delete process id by 114 Applications for
## start-up / Guide management
pm2 resurrect ## Restore the previously saved process
pm2 unstartup ## Disable and delete the boot system
pm2 update ## Save process , Kill PM2 And resume the process
pm2 generate ## Generate an example json The configuration file
边栏推荐
- 微信小程序基础
- Latex error: the font size command \normalsize is not defined problem solved
- php中在二维数组中根据值返回对应的键值
- Win10: add or delete boot items, and add user-defined boot files to boot items
- Underlying mechanism mvcc
- Latex 报错 LaTeX Error: The font size command \normalsize is not defined问题解决
- sprintf_ How to use s
- CAD二次开发 对象
- In depth study of JVM bottom layer (IV): class file structure
- php中判断版本号是否连续
猜你喜欢
Unexpected inconsistency caused by abnormal power failure; Run fsck manually problem resolved
Date time API details
The default Google browser cannot open the link (clicking the hyperlink does not respond)
Sqli-labs customs clearance (less18-less20)
Latex 编译报错 I found no \bibstyle & \bibdata & \citation command
SQLI-LABS通关(less6-less14)
How to debug wechat built-in browser applications (enterprise number, official account, subscription number)
CTF web practice competition
搭建frp进行内网穿透
Latex 报错 LaTeX Error: The font size command \normalsize is not defined问题解决
随机推荐
Review of reflection topics
Sqli-labs customs clearance (less18-less20)
The win10 network icon disappears, and the network icon turns gray. Open the network and set the flash back to solve the problem
CAD二次开发 对象
Utilisation de la carte et de foreach dans JS
php中的二维数组去重
Underlying mechanism mvcc
JS delete the last bit of the string
sqli-labs通关汇总-page2
Usage of map and foreach in JS
ModuleNotFoundError: No module named ‘jieba. analyse‘; ‘ jieba‘ is not a package
php中树形结构转数组(拉平树结构,保留上下级排序)
SQLI-LABS通关(less15-less17)
How to try catch statements that return promise objects in JS
JS countdown case
js判断对象是否为空
微信小程序基础
2021-07-17C#/CAD二次开发创建圆(5)
Deployment API_ automation_ Problems encountered during test
AWD learning