PM2 change cluster processes size at runtime

does anyone know if it is possible to change in NodeJS PM2 the number of cluster processes for an application at runtime?

regards Philipp

specify pm2 settings in json format:

{
 "apps": [{
    "name": "server",
    "script" : "index.js",
    "instances": 2,
    "exec_mode: "cluster",
    "cwd": "/path/to/script"
 }]
}

start the server:

pm2 start application.json

suppose you want to add 2 more instances, just run the same command again:

pm2 start application.json

check the processes list:

pm2 list

to test that all 4 instances are run in cluster mode:

pm2 restart server

it will restart each of the 4 processes.