Does an n8n Worker instance need to expose a port?

Hi,

I’m running an n8n Worker instance, and I see this message in the logs:

n8n worker server listening on port 5678

Do I need to open this port for the Worker to function properly?
I’m asking because if I run multiple instances, I’d need to assign a different port for each one.

Thanks in advance!

Hi,

Are you running in a docker environment? How did you deploy?

Regards,
J.

yes, I am using a docker deploy in swarm mode, with 2 replicas

deploy:
  mode: replicated
  replicas: 2
  restart_policy:
    condition: on-failure

A worker never needs its ports to be opened.
Only webhook processors and the main instance need access to the container via a port.

However I am not sure what you are exactly doing. As that log message does not make sense.
So more information on your setup might be helpful.

yes, so as long as each container gets it’s own IP address it should work as expected. If you want to combine the same service for the same IP address you run into problems.

so did you run into a problem? I guess not?

Depends what you are trying to do… if you enable metrics on the workers, it does…

Good call, that might need that. Metrics on workers is a fairly recent addition I think. (if it has been added yet)

yes, I configured the workers this morning, and it looks like they are working well, but I saw that line on the log that made me wonder if I need to open a port for each instance…

yep, I only started the workers with “n8n worker”, and the env variable EXECUTIONS_MODE=queue. Everything seems to be working, but starting n8n in worker mode, it has that line in the log. But as said here, it could be the env
QUEUE_HEALTH_CHECK_ACTIVE=true

No it’s normal, main or worker they are all listening on 5789. The queue health env parameter has nothing to do with that.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.