Unitech / Unitech/pm2

Question: How to start a port that does not get routed in cluster mode?

Open
#5,614 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
43.3k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

What's going wrong?

I want to have a port open on each running process where I can directly talk to this node, without it being load balanced by pm2 cluster mode.

I need this to directly talk to my /metrics endpoint for prometheus.

If I try to start a http server on a random port that is unused by any other process, I get it to work, but I want to have predefined ports, that are not shared with the others than.

My current workaround is, that (because I have less than 10 processes running), I just use 3050 + (process.pid % 9) for the port, and have my prometheus configs set to look at ports 3050-3059.

The issue why I cant use programmatic checks for used ports is, that bc of the load balancing of pm2, all ports show up as free, if you try to use them.

Thanks in advance

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing PM2 cluster-mode networking and the Prometheus metrics requirement described in the issue. No file, test, or entry point is named; done would require a maintainer-confirmed design for predefined per-process ports that bypass load balancing.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
devops, observability-sre
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.