当前位置:网站首页>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
边栏推荐
猜你喜欢

如何调试微信内置浏览器应用(企业号、公众号、订阅号)

The use of regular expressions in JS

Latex 报错 LaTeX Error: The font size command \normalsize is not defined问题解决

AWD learning

Latex warning: citation "*****" on page y undefined on input line*

Redis -- cache breakdown, penetration, avalanche

CTF three count

Usage of map and foreach in JS

Latex在VSCODE中编译中文,使用中文路径问题解决

UEditor .Net版本任意文件上传漏洞复现
随机推荐
In depth study of JVM bottom layer (II): hotspot virtual machine object
2020-9-23 use of QT timer qtimer class.
Recursion (maze problem, Queen 8 problem)
SQLI-LABS通關(less6-less14)
Deployment API_ automation_ Problems encountered during test
DeprecationWarning: . ix is deprecated. Please use. loc for label based indexing or. iloc for positi
Pytest (3) parameterize
js中map和forEach的用法
SQLI-LABS通关(less1)
sqli-labs通關匯總-page2
浏览器滚动加载更多实现
Fe - weex uses a simple encapsulated data loading plug-in as the global loading method
CVE-2015-1635(MS15-034 )远程代码执行漏洞复现
20201002 vs 2019 qt5.14 developed program packaging
Win10:添加或者删除开机启动项,在开机启动项中添加在用户自定义的启动文件
How to try catch statements that return promise objects in JS
VSCODE 安装LATEX环境,参数配置,常见问题解决
The use of regular expressions in JS
In depth study of JVM bottom layer (3): garbage collector and memory allocation strategy
PHP Session原理简析