当前位置:网站首页>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
边栏推荐
- Fe - use of weex development weex UI components and configuration use
- Automation - when Jenkins pipline executes the nodejs command, it prompts node: command not found
- uniapp引入本地字体
- JS countdown case
- php中生成随机的6位邀请码
- 2021-07-19C#CAD二次开发创建多线段
- php中计算树状结构数据中的合计
- Utilisation de la carte et de foreach dans JS
- php中通过集合collect的方法来实现把某个值插入到数组中指定的位置
- 搭建frp进行内网穿透
猜你喜欢
Latex 报错 LaTeX Error: The font size command \normalsize is not defined问题解决
In depth study of JVM bottom layer (IV): class file structure
flex九宫格布局
Queue (linear structure)
Unexpected inconsistency caused by abnormal power failure; Run fsck manually problem resolved
Sqli labs customs clearance summary-page4
微信小程序基础
CTF three count
Blog directory of zzq -- updated on 20210601
AWD learning
随机推荐
In depth study of JVM bottom layer (II): hotspot virtual machine object
The table component specifies the concatenation parallel method
Sublime text configuring PHP compilation environment
In depth study of JVM bottom layer (3): garbage collector and memory allocation strategy
AWD learning
Cve-2015-1635 (ms15-034) Remote Code Execution Vulnerability recurrence
UEditor . Net version arbitrary file upload vulnerability recurrence
js数组的常用的原型方法
20201002 vs 2019 qt5.14 developed program packaging
Underlying mechanism mvcc
js的防抖和节流
Laravel8中的find_in_set、upsert的使用方法
Code execution sequence with and without resolve in promise
JS to determine whether there is a value in the object in the array
Virtualenv and pipenv installation
Sqli labs customs clearance summary-page4
DeprecationWarning: . ix is deprecated. Please use. loc for label based indexing or. iloc for positi
CVE-2015-1635(MS15-034 )远程代码执行漏洞复现
SQLI-LABS通关(less15-less17)
Eggjs -typeorm treeenity practice