Comments (5)
You posted a lot of source code snippets but did not actually describe the issue you are having.
from pm2.
@ultimate-tester
I am having a problem running it in cluster mode. While the mode is working, I do not have any error logs, only information indicating that there is an error with the instance running in cluster mode.
from pm2.
Is that message appearing when you do pm2 logs
? Or else, where do you see it?
Could it be that this happens because your script is completing/terminating? It doesn't seem to have any functionality that needs to be clustered.
from pm2.
root@docker-desktop /s/a/v1# pm2 flush && pm2 start ecosystem.config.cjs
[PM2] Flushing /root/.pm2/pm2.log
[PM2] Logs flushed
[PM2][WARN] Applications index not running, starting...
[PM2] App [index] launched (8 instances)
┌────┬──────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │
├────┼──────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0 │ index │ default │ N/A │ cluster │ 6167 │ 0s │ 1 │ online │ 0% │ 46.9mb │ root │ enabled │
│ 1 │ index │ default │ N/A │ cluster │ 6178 │ 0s │ 1 │ online │ 0% │ 49.6mb │ root │ enabled │
│ 2 │ index │ default │ N/A │ cluster │ 6196 │ 0s │ 1 │ online │ 0% │ 0b │ root │ enabled │
│ 3 │ index │ default │ N/A │ cluster │ 6132 │ 0 │ 1 │ stopped │ 0% │ 0b │ root │ enabled │
│ 4 │ index │ default │ N/A │ cluster │ 6143 │ 0s │ 0 │ online │ 0% │ 0b │ root │ enabled │
│ 5 │ index │ default │ N/A │ cluster │ 6150 │ 0s │ 0 │ online │ 0% │ 51.9mb │ root │ enabled │
│ 6 │ index │ default │ N/A │ cluster │ 6161 │ 0s │ 0 │ online │ 0% │ 48.9mb │ root │ enabled │
│ 7 │ index │ default │ N/A │ cluster │ 6190 │ 0s │ 0 │ online │ 0% │ 45.6mb │ root │ enabled │
└────┴──────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
root@docker-desktop /s/a/v1# pm2 list
┌────┬──────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │
├────┼──────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0 │ index │ default │ N/A │ cluster │ 0 │ 0 │ 15 │ errored │ 0% │ 0b │ root │ enabled │
│ 1 │ index │ default │ N/A │ cluster │ 0 │ 0 │ 15 │ errored │ 0% │ 0b │ root │ enabled │
│ 2 │ index │ default │ N/A │ cluster │ 0 │ 0 │ 15 │ errored │ 0% │ 0b │ root │ enabled │
│ 3 │ index │ default │ N/A │ cluster │ 0 │ 0 │ 15 │ errored │ 0% │ 0b │ root │ enabled │
│ 4 │ index │ default │ N/A │ cluster │ 0 │ 0 │ 15 │ errored │ 0% │ 0b │ root │ enabled │
│ 5 │ index │ default │ N/A │ cluster │ 0 │ 0 │ 15 │ errored │ 0% │ 0b │ root │ enabled │
│ 6 │ index │ default │ N/A │ cluster │ 0 │ 0 │ 15 │ errored │ 0% │ 0b │ root │ enabled │
│ 7 │ index │ default │ N/A │ cluster │ 0 │ 0 │ 15 │ errored │ 0% │ 0b │ root │ enabled │
└────┴──────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
root@docker-desktop /s/a/v1# pm2 logs
[TAILING] Tailing last 15 lines for [all] processes (change the value with --lines option)
/root/.pm2/pm2.log last 15 lines:
PM2 | 2024-03-21T18:18:56: PM2 log: App name:index id:4 disconnected
PM2 | 2024-03-21T18:18:56: PM2 log: App [index:4] exited with code [0] via signal [SIGINT]
PM2 | 2024-03-21T18:18:56: PM2 log: Script /usr/bin/bash had too many unstable restarts (16). Stopped. "errored"
PM2 | 2024-03-21T18:18:56: PM2 log: App name:index id:3 disconnected
PM2 | 2024-03-21T18:18:56: PM2 log: App [index:3] exited with code [0] via signal [SIGINT]
PM2 | 2024-03-21T18:18:56: PM2 log: Script /usr/bin/bash had too many unstable restarts (16). Stopped. "errored"
PM2 | 2024-03-21T18:18:56: PM2 log: App name:index id:6 disconnected
PM2 | 2024-03-21T18:18:56: PM2 log: App [index:6] exited with code [0] via signal [SIGINT]
PM2 | 2024-03-21T18:18:56: PM2 log: Script /usr/bin/bash had too many unstable restarts (16). Stopped. "errored"
PM2 | 2024-03-21T18:18:56: PM2 log: App name:index id:5 disconnected
PM2 | 2024-03-21T18:18:56: PM2 log: App [index:5] exited with code [0] via signal [SIGINT]
PM2 | 2024-03-21T18:18:56: PM2 log: Script /usr/bin/bash had too many unstable restarts (16). Stopped. "errored"
PM2 | 2024-03-21T18:18:56: PM2 log: App name:index id:7 disconnected
PM2 | 2024-03-21T18:18:56: PM2 log: App [index:7] exited with code [0] via signal [SIGINT]
PM2 | 2024-03-21T18:18:56: PM2 log: Script /usr/bin/bash had too many unstable restarts (16). Stopped. "errored"
/root/.pm2/logs/index-out-0.log last 15 lines:
/root/.pm2/logs/index-error-0.log last 15 lines:
/root/.pm2/logs/index-out-1.log last 15 lines:
/root/.pm2/logs/index-error-1.log last 15 lines:
/root/.pm2/logs/index-out-2.log last 15 lines:
/root/.pm2/logs/index-error-2.log last 15 lines:
/root/.pm2/logs/index-out-3.log last 15 lines:
/root/.pm2/logs/index-error-3.log last 15 lines:
/root/.pm2/logs/index-out-4.log last 15 lines:
/root/.pm2/logs/index-error-4.log last 15 lines:
/root/.pm2/logs/index-out-5.log last 15 lines:
/root/.pm2/logs/index-error-5.log last 15 lines:
/root/.pm2/logs/index-out-6.log last 15 lines:
/root/.pm2/logs/index-error-6.log last 15 lines:
/root/.pm2/logs/index-out-7.log last 15 lines:
/root/.pm2/logs/index-error-7.log last 15 lines:
^C⏎
root@docker-desktop /s/a/v1 [SIGINT]# pm2 logs --err
[TAILING] Tailing last 15 lines for [all] processes (change the value with --lines option)
/root/.pm2/logs/index-error-0.log last 15 lines:
/root/.pm2/logs/index-error-1.log last 15 lines:
/root/.pm2/logs/index-error-2.log last 15 lines:
/root/.pm2/logs/index-error-3.log last 15 lines:
/root/.pm2/logs/index-error-4.log last 15 lines:
/root/.pm2/logs/index-error-5.log last 15 lines:
/root/.pm2/logs/index-error-6.log last 15 lines:
/root/.pm2/logs/index-error-7.log last 15 lines:
Or another way, do you have any JS script that works with cluster mode? Can you share the repository with me, including the package.json file?
from pm2.
Code 0 is a normal successful program end, which I'd expect from the code you provided.
The cluster mode is meant to automatically share a listening port between all nodes in the cluster. For example if you setup an express server and want to load balance between multiple nodes. So perhaps the sample code of express might be a good test. Another example would be if you have built a (queue) worker. In any case scripts that keep running because they are listening on a port or waiting for an event to happen.
from pm2.
Related Issues (20)
- EPIPE
- CONDENSED_MODE too wide
- Why logs are being created by root?
- How to run pm2 over https ?? HOT 1
- Can't start app when using autostart = false HOT 5
- TypeError: _env[key].slice is not a function when running `pm2 info`
- Cron tasks do not run at system startup until you manually trigger them
- High & Medium Vulnerabilities in two PM2 dependencies
- Services running using pm2 couldnt restart on server reboot
- Feature request: Allow setting `max_restarts` to `false` to disable checking of max restarts
- PM2 fails to start bat files in Windows because of Node.JS security updates HOT 1
- Not able to link pm2.io
- Why pm2 logs are being saved with root as owner? HOT 1
- PM2 + Node.js + Ubuntu: Garbage collection does not work as expected
- [Bug]: How do I disable @pm2/io when I use pm2, I hope it doesn't autoload HOT 1
- PM2 API connection error in Next.js 14: 'Module not found: Can't resolve term.js
- npm audit fails for pm2 5.4.0 HOT 1
- lost mem message by 'pm2 ls' command after use 'pm2 reset all' command
- `pm2 startup` does not take environment variable `PM2_HOME` into account
- PM2 shows lots of servers offline
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pm2.