pm2 scale选项有什么用?

What is the use of pm2 scale option?

实际上我无法理解 pm2 scale [app-name] 10 的用法,但我知道 pm2 start app.js -i 4 用于在集群模式下启动应用程序实例。

还有一个问题,如果我将簇数设置为 -1 意味着

会发生什么

pm2 start app.js -i -1

PM2 能够创建新进程或删除当前 运行 个进程,具体取决于您为 scale 选项 pm2 scale N 提供的数字,来自文档:N is a consistent number which the cluster will scale up or down.

pm2 scale app +3 - 添加 3 个新进程到当前进程 运行.

pm2 scale app 3 - 将实例数设置为 3。感谢@Jolly 的更正。

关于pm2 start app.js -i -1中的-1,意思是PM2会创建新的进程数,等于(Number of Cores)-1