Git Product home page Git Product logo

Comments (5)

ultimate-tester avatar ultimate-tester commented on June 16, 2024

You posted a lot of source code snippets but did not actually describe the issue you are having.

from pm2.

robokonk avatar robokonk commented on June 16, 2024

@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.

ultimate-tester avatar ultimate-tester commented on June 16, 2024

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.

robokonk avatar robokonk commented on June 16, 2024

@ultimate-tester

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.

ultimate-tester avatar ultimate-tester commented on June 16, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.