n8n Queue Mode for Production: PostgreSQL, Redis and Workers
Before you start
- 19 min read
- Updated December 2026
Boxes marked Run in terminal are what you type; plain text explains why. Check what you need first

What you get in one minute#
We can move n8n execution work into workers while one main process handles the editor and incoming triggers, using PostgreSQL for records and Redis for the queue.
Logo: the official n8n project (github.com/n8n-io/n8n)
This guide builds a small queue deployment and explains how to keep it recoverable. We share one encryption key across processes, add an external task runner for Code nodes and take a consistent maintenance backup after jobs drain.
For the basic install, see our n8n with Docker in 2026: Self-Host Workflow Automation and AI Agents (Linux, Windows, Mac) guide. That twin already uses PostgreSQL. Our new angle is queue operation, worker isolation and coordinated recovery.
At a glance#
- Result: one main, one execution worker, its task runner, PostgreSQL and Redis.
- Time: allow an hour plus migration rehearsal; our planning estimate.
- Difficulty: intermediate; more services mean more failure points.
- Limit: this single-host layout is not high availability.
| What | Value, checked 6 December 2026 |
|---|---|
| n8n stable | 3.4.4, released 4 December; 3.5.3 is marked prerelease |
| n8n / runner images | n8nio/n8n:3.4.4 / n8nio/runners:3.4.4 |
| Database image | postgres:18.7; supported n8n major, exact tag verified |
| Queue image | redis:8.12.1; official stable release and tag verified |
| Ports | 5678 editor; 5432 database, 6379 Redis and 5679 broker stay internal |
| Resources measured | None; monitor the actual workload before adding workers |
We read the current stable release notes and recent official reports. This does not establish an absence of bugs. PostgreSQL 19 exists, but n8n's current support page lists 17/18 plus compatibility with 16, so we stay on 18.
How it fits together#
The main process queues an execution ID; a worker loads the workflow from PostgreSQL, runs it and stores the result.
Redis carries coordination data; it does not replace the database. Each worker also has an external task-runner sidecar for Code-node tasks. A workflow worker and a task runner are different processes with different jobs.
Before you start#
Use a supported Linux Docker host for the long-running service. Windows/Mac Docker Desktop can rehearse the same topology, provided the machine stays awake.
| System | What we need |
|---|---|
| Linux | Docker Engine, Compose plugin, terminal, openssl and writable data folders |
| Windows | Docker Desktop with WSL2 and PowerShell; prefer project files inside WSL |
| Mac | Docker Desktop, Terminal and a machine that will stay awake |
There are no GPU requirements. Resource use depends on workflow payloads and concurrency. We have not measured a minimum; reserve room for the database, retained executions, Redis, runner memory and backups.
Check docker --version and docker compose version. Check port 5678 with ss -ltn on Linux, Get-NetTCPConnection -LocalPort 5678 on Windows, or lsof -nP -iTCP:5678 on Mac.
- [ ] Existing database, data folder and encryption key backed up.
- [ ] Migration and restore tried on an isolated copy before changing production.
- [ ] Port 5678 free for a fresh deployment; no database/Redis host ports planned.
- [ ] Secrets generated locally and stored outside this machine too.
- [ ] For public HTTPS only: domain, DNS and ports 80/443 available.
All paths, names and domains here are dummy examples. Tested by DIY Lab Hub: not yet. Linux, Windows and Mac commands and expected outcomes are documentation-based.
LLM Guide: let your AI assistant set it up#
We can give an assistant a bounded queue-deployment procedure.
Copy the block below into ChatGPT, Claude, Gemini or a local model. It first asks about your setup, then follows only the path that fits you.
Help me set up n8n queue mode with PostgreSQL, Redis, a worker and an external runner.
Follow https://diylabhub.com/n8n-queue-production/ (checked 6 December 2026).
Work one step at a time. Explain every command. Wait for OK before deleting data, stopping services, changing a router or opening ports.
STEP 0 - FIND OUT MY SETUP
1. Linux distribution, Windows/WSL2 or Mac? Check docker --version and docker compose version.
2. New or existing install? Which version, database, data folder, encryption key backup and Compose project?
3. Is port 5678 available? What RAM, free disk and workload need planning? No GPU required.
4. Any Code nodes, custom nodes, binary files or long-running jobs?
5. Local only, public-domain HTTPS or home-only HTTPS? Existing Traefik, Caddy, nginx/Nginx Proxy Manager or none?
6. Is a maintenance window available to stop ingress and drain jobs?
THEN FOLLOW THE MATCHING PATH
- Existing install: rehearse migration using the guide. Preserve the original key and database. SQLite needs entity export/import, not only DB_TYPE. Follow the twin for major-version upgrades and legacy native installs.
- New Linux/Mac: create ~/docker_volumes/n8n-queue/{data/main,data/worker,data/postgres,data/redis,config,logs,backups}. Linux chown data/main and data/worker to 1000:1000. Mac skips chown.
- Windows: use New-Item and $HOME\docker_volumes\n8n-queue; WSL filesystem is preferable.
- Generate five distinct local secrets (openssl rand -hex 32 each, or Windows .NET RandomNumberGenerator): POSTGRES_PASSWORD, N8N_DB_PASSWORD, REDIS_PASSWORD, RUNNERS_AUTH_TOKEN and a new N8N_ENCRYPTION_KEY only for an empty install. Save them in .env, never chat. Also set N8N_HOST=localhost, N8N_PROTOCOL=http, N8N_WEBHOOK_URL=http://localhost:5678/. Protect .env with chmod 600 or Windows owner-only permissions.
- Save the files below. The initialization script runs only for an empty PostgreSQL cluster; use LF endings.
- Traefik: only main joins [default,proxy], with no host ports. Use the guide's Host rule, traefik.enable=true, traefik.docker.network=proxy, entrypoints=https, tls=true, tls.certresolver=le and service port 5678.
- Caddy: follow the guide's Caddyfile. Native upstream localhost:5678; Docker upstream main:5678, image caddy:2.11.9. Public HTTPS needs DNS and 80/443. Home-only uses tls internal and trusts the public root on each Linux/Windows/Mac client.
- HTTPS: set N8N_HOST, N8N_PROTOCOL=https, N8N_WEBHOOK_URL to the real HTTPS URL and N8N_PROXY_HOPS=1 for one proxy. Keep secure cookies enabled.
- nginx/Nginx Proxy Manager: use its official configuration guidance with those URL settings. Never send browser traffic to a worker.
- Scale by adding a worker/runner pair with separate worker data and matching broker URI. Never scale main or just the worker alone.
- Backups: stop ingress and drain before the guide's script. Restore into an isolated network with fresh Redis; unpublish workflows before allowing external access.
docker-compose.yml:
x-n8n-env: &n8n-env
DB_TYPE: postgresdb
DB_POSTGRESDB_HOST: postgres
DB_POSTGRESDB_PORT: "5432"
DB_POSTGRESDB_DATABASE: n8n
DB_POSTGRESDB_USER: n8n
DB_POSTGRESDB_PASSWORD: ${N8N_DB_PASSWORD}
N8N_ENCRYPTION_KEY: ${N8N_ENCRYPTION_KEY}
EXECUTIONS_MODE: queue
QUEUE_BULL_REDIS_HOST: redis
QUEUE_BULL_REDIS_PORT: "6379"
QUEUE_BULL_REDIS_PASSWORD: ${REDIS_PASSWORD}
N8N_HOST: ${N8N_HOST}
N8N_PROTOCOL: ${N8N_PROTOCOL}
N8N_WEBHOOK_URL: ${N8N_WEBHOOK_URL}
N8N_GRACEFUL_SHUTDOWN_TIMEOUT: "120"
N8N_RUNNERS_MODE: external
N8N_RUNNERS_AUTH_TOKEN: ${RUNNERS_AUTH_TOKEN}
services:
postgres:
image: postgres:18.7
restart: unless-stopped
environment:
POSTGRES_USER: postgres
N8N_DB_PASSWORD: ${N8N_DB_PASSWORD}
POSTGRES_DB: n8n
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- ./data/postgres:/var/lib/postgresql
- ./config/init-db.sh:/docker-entrypoint-initdb.d/init-db.sh:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d n8n"]
interval: 5s
timeout: 5s
retries: 20
redis:
image: redis:8.12.1
restart: unless-stopped
command: ["redis-server", "--appendonly", "yes", "--appendfsync", "everysec", "--maxmemory-policy", "noeviction", "--requirepass", "${REDIS_PASSWORD}"]
environment:
REDISCLI_AUTH: ${REDIS_PASSWORD}
volumes:
- ./data/redis:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 20
main:
image: n8nio/n8n:3.4.4
restart: unless-stopped
stop_grace_period: 180s
ports: ["127.0.0.1:5678:5678"]
environment: *n8n-env
volumes:
- ./data/main:/home/node/.n8n
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
worker:
image: n8nio/n8n:3.4.4
restart: unless-stopped
stop_grace_period: 180s
command: ["worker", "--concurrency=5"]
environment:
<<: *n8n-env
N8N_RUNNERS_BROKER_LISTEN_ADDRESS: "0.0.0.0"
QUEUE_HEALTH_CHECK_ACTIVE: "true"
volumes:
- ./data/worker:/home/node/.n8n
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
runners:
image: n8nio/runners:3.4.4
restart: unless-stopped
read_only: true
tmpfs: ["/tmp"]
environment:
N8N_RUNNERS_TASK_BROKER_URI: http://worker:5679
N8N_RUNNERS_AUTH_TOKEN: ${RUNNERS_AUTH_TOKEN}
depends_on:
- worker
config/init-db.sh:
#!/bin/sh
set -eu
psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" --set=app_password="$N8N_DB_PASSWORD" --set=ON_ERROR_STOP=1 <<'SQL'
CREATE ROLE n8n LOGIN PASSWORD :'app_password';
GRANT CONNECT ON DATABASE n8n TO n8n;
GRANT USAGE, CREATE ON SCHEMA public TO n8n;
SQL
START AND CHECK IT WORKED
Validate: docker compose config --quiet.
Start: docker compose up -d postgres redis; docker compose up -d main. Read main's startup/migration logs before docker compose up -d worker runners.
Check docker compose ps and docker compose logs --tail 100 main worker runners.
Use curl --fail http://localhost:5678/healthz/readiness (Windows curl.exe).
Create a dummy published Webhook-to-Edit-Fields workflow, call its production URL and confirm completion on a worker. Test harmless Code-node data for the runner. Manual runs also use workers on n8n 3.0.
With HTTPS, check curl -I https://n8n.example.com/healthz and browser login.
RULES FOR YOU
Use these pinned versions and settings only. No :latest, guessed flags, OFFLOAD_MANUAL_EXECUTIONS_TO_WORKERS or deprecated queue timeout. On errors show them and read https://docs.n8n.io/deploy/host-n8n/configure-n8n/scaling/enable-queue-mode.
Keep PostgreSQL, Redis, broker/worker ports, secrets and backups private. Never update with docker compose down -v. Example domains and paths are placeholders. Never ask me to paste passwords, tokens or keys into chat.
Tested by DIY Lab Hub: not yet.
Step 1: Prepare folders and secrets#
For an existing deployment, first read the migration section below. Do not replace its encryption key.
Linux#
mkdir -p ~/docker_volumes/n8n-queue/{data/main,data/worker,data/postgres,data/redis,config,logs,backups}
cd ~/docker_volumes/n8n-queue
sudo chown -R 1000:1000 data/main data/worker
openssl rand -hex 32
Run the random generator separately for five secrets: PostgreSQL administrator password, application database password, Redis password, runner token and, only for a new install, encryption key.
Windows (PowerShell)#
$project = "$HOME\docker_volumes\n8n-queue"
New-Item -ItemType Directory -Force "$project\data\main","$project\data\worker","$project\data\postgres","$project\data\redis","$project\config","$project\logs","$project\backups" | Out-Null
Set-Location $project
$bytes = New-Object byte[] 32
[Security.Cryptography.RandomNumberGenerator]::Create().GetBytes($bytes)
-join ($bytes | ForEach-Object { '{0:x2}' -f $_ })
Repeat the generator for separate secrets. For Linux-style permissions use the Linux commands inside WSL and keep files in that distribution's home folder.
Mac (Terminal)#
Same commands as Linux, without chown; Docker Desktop handles the bind mount.
Create .env locally using the generated values in place of these placeholders:
POSTGRES_PASSWORD=<generated-database-admin-password> N8N_DB_PASSWORD=<generated-application-database-password> REDIS_PASSWORD=<generated-redis-password> N8N_ENCRYPTION_KEY=<original-or-new-encryption-key> RUNNERS_AUTH_TOKEN=<generated-runner-token> N8N_HOST=localhost N8N_PROTOCOL=http N8N_WEBHOOK_URL=http://localhost:5678/
Protect it with chmod 600 .env on Linux/Mac; on Windows restrict the file's Security permissions. Store the encryption key in a separate protected backup. Check it worked: folders exist and five distinct secret values are saved locally. N8N_DB_PASSWORD and RUNNERS_AUTH_TOKEN are our Compose substitution names; the YAML maps them to the documented service settings. Never print the merged Compose configuration into a support post.
Tip: The encryption key is part of the data. A perfect PostgreSQL backup cannot decrypt credentials without the matching key.
Step 2: Save the queue configuration#
Save this as docker-compose.yml. The shared environment anchor avoids accidentally configuring the main and worker differently.
x-n8n-env: &n8n-env
DB_TYPE: postgresdb
DB_POSTGRESDB_HOST: postgres
DB_POSTGRESDB_PORT: "5432"
DB_POSTGRESDB_DATABASE: n8n
DB_POSTGRESDB_USER: n8n
DB_POSTGRESDB_PASSWORD: ${N8N_DB_PASSWORD}
N8N_ENCRYPTION_KEY: ${N8N_ENCRYPTION_KEY}
EXECUTIONS_MODE: queue
QUEUE_BULL_REDIS_HOST: redis
QUEUE_BULL_REDIS_PORT: "6379"
QUEUE_BULL_REDIS_PASSWORD: ${REDIS_PASSWORD}
N8N_HOST: ${N8N_HOST}
N8N_PROTOCOL: ${N8N_PROTOCOL}
N8N_WEBHOOK_URL: ${N8N_WEBHOOK_URL}
N8N_GRACEFUL_SHUTDOWN_TIMEOUT: "120"
N8N_RUNNERS_MODE: external
N8N_RUNNERS_AUTH_TOKEN: ${RUNNERS_AUTH_TOKEN}
services:
postgres:
image: postgres:18.7
restart: unless-stopped
environment:
POSTGRES_USER: postgres
N8N_DB_PASSWORD: ${N8N_DB_PASSWORD}
POSTGRES_DB: n8n
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- ./data/postgres:/var/lib/postgresql
- ./config/init-db.sh:/docker-entrypoint-initdb.d/init-db.sh:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d n8n"]
interval: 5s
timeout: 5s
retries: 20
redis:
image: redis:8.12.1
restart: unless-stopped
command: ["redis-server", "--appendonly", "yes", "--appendfsync", "everysec", "--maxmemory-policy", "noeviction", "--requirepass", "${REDIS_PASSWORD}"]
environment:
REDISCLI_AUTH: ${REDIS_PASSWORD}
volumes:
- ./data/redis:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 20
main:
image: n8nio/n8n:3.4.4
restart: unless-stopped
stop_grace_period: 180s
ports: ["127.0.0.1:5678:5678"]
environment: *n8n-env
volumes:
- ./data/main:/home/node/.n8n
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
worker:
image: n8nio/n8n:3.4.4
restart: unless-stopped
stop_grace_period: 180s
command: ["worker", "--concurrency=5"]
environment:
<<: *n8n-env
N8N_RUNNERS_BROKER_LISTEN_ADDRESS: "0.0.0.0"
QUEUE_HEALTH_CHECK_ACTIVE: "true"
volumes:
- ./data/worker:/home/node/.n8n
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
runners:
image: n8nio/runners:3.4.4
restart: unless-stopped
read_only: true
tmpfs: ["/tmp"]
environment:
N8N_RUNNERS_TASK_BROKER_URI: http://worker:5679
N8N_RUNNERS_AUTH_TOKEN: ${RUNNERS_AUTH_TOKEN}
depends_on:
- worker
Linux#
Save the file with an editor and run docker compose config --quiet.
Windows (PowerShell)#
Use notepad docker-compose.yml; save the exact extension, then run docker compose config --quiet.
Mac (Terminal)#
Same validation command as Linux.
Check it worked: validation exits successfully without printing secrets. PostgreSQL 18's official image uses a versioned data directory under /var/lib/postgresql; we mount the parent. Do not point this at an old major-version cluster.
PostgreSQL uses its bootstrap administrator only for setup and backup. The app connects as a separate non-superuser. Before the first database start, save this as config/init-db.sh with Linux LF line endings:
#!/bin/sh set -eu psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" --set=app_password="$N8N_DB_PASSWORD" --set=ON_ERROR_STOP=1 <<'SQL' CREATE ROLE n8n LOGIN PASSWORD :'app_password'; GRANT CONNECT ON DATABASE n8n TO n8n; GRANT USAGE, CREATE ON SCHEMA public TO n8n; SQL
The official image runs initialization scripts only for an empty cluster. Changing .env later does not change an existing database password or create this role. On an existing deployment, preserve and review its current roles instead of rerunning initialization.
Redis persistence reduces queue loss, but is not a guarantee that every external action runs exactly once. AOF everysec can lose recent writes in a crash. Workflows that send payments, messages or provisioning requests need destination-side duplicate protection.
Step 3: Start and prove execution#
Start database services first, then let the main process finish migrations before starting workers.
Linux#
docker compose up -d postgres redis docker compose up -d main docker compose logs --tail 100 main
Once the main log shows successful startup, continue:
docker compose up -d worker runners docker compose ps curl --fail http://localhost:5678/healthz/readiness
Windows (PowerShell)#
Use the same Compose sequence and curl.exe --fail http://localhost:5678/healthz/readiness.
Mac (Terminal)#
Same commands as Linux.
Check it worked: PostgreSQL and Redis are healthy, main/worker/runner stay running and the readiness endpoint succeeds. A healthy main does not prove a worker is doing jobs.
Create the owner account locally. Build a dummy Webhook → Edit Fields workflow, publish it and send a request to the production webhook URL shown by the editor. Check its completed execution and the worker log. Then try a harmless Code node returning dummy data to confirm the external runner connects.
In n8n 3.0+, manual executions in queue mode also run on workers. OFFLOAD_MANUAL_EXECUTIONS_TO_WORKERS has been removed. Test both manual and published paths.
Tip: A workflow that succeeds before queue conversion can expose missing worker credentials or dependencies afterwards. Recheck every required custom node and external dependency.
Move an existing installation safely#
Do not combine a database migration, a major n8n update and queue conversion in one untested change. First reach the selected n8n release using the twin's upgrade guidance and the official breaking-change lists.
For an existing PostgreSQL deployment, keep its database and original encryption key. Stop incoming work, drain executions and stop the current n8n before adding the worker configuration. Back up before changing any mount. This guide's fresh-folder paths must be adapted to the existing deployment.
For SQLite, setting DB_TYPE=postgresdb alone does not transfer anything. n8n provides export:entities and import:entities for database migration. On an isolated copy of the stopped old instance, export with n8n export:entities --outputDir=/migration --includeExecutionHistoryDataTables=true, bind-mounting a protected migration folder. Import into an empty PostgreSQL database using the same n8n version and encryption key with n8n import:entities --inputDir=/migration. Do not use --truncateTables against a live database.
Review users, credentials, execution history and stored files after the import. A workflow-only export is useful for portability but is not a full-instance migration.
Add workers without changing the main role#
Start with one worker at concurrency five, an explicit initial choice consistent with the queue documentation. Measure it before increasing the total.
For a second worker, duplicate the worker service as worker2, give it ./data/worker2 and duplicate the runner as runners2. Change that runner's broker URI to http://worker2:5679 and its dependency to worker2. Preserve all shared database, Redis and encryption settings. Prepare permissions for the new data directory first.
Do not run --scale worker=2 on this file alone: each worker needs its own runner sidecar. Do not scale the main service to add execution capacity. Multi-main operation and its licensing are a separate design.
We leave binary storage at the current queue-mode default, the database. Local filesystem storage across workers requires the same shared storage path on every relevant process. Two unrelated local folders with the same name are not shared storage.
Put it behind HTTPS with Traefik#
Only the main process serves browser traffic here. Public domains require DNS and ports 80/443; local-only readers can skip public exposure.
With Traefik#
Use an existing Traefik with entrypoint https and resolver le. Inspect proxy; if absent run docker network create proxy. Remove main's host port, put only main on [default, proxy] and add:
labels:
- traefik.enable=true
- traefik.docker.network=proxy
- traefik.http.routers.n8n-queue.rule=Host(`n8n.example.com`)
- traefik.http.routers.n8n-queue.entrypoints=https
- traefik.http.routers.n8n-queue.tls=true
- traefik.http.routers.n8n-queue.tls.certresolver=le
- traefik.http.services.n8n-queue.loadbalancer.server.port=5678
networks:
proxy:
external: true
Update .env: N8N_HOST=n8n.example.com, N8N_PROTOCOL=https, N8N_WEBHOOK_URL=https://n8n.example.com/. Add N8N_PROXY_HOPS: "1" to the shared environment for this one-proxy layout. Keep secure cookies enabled. The current docs support N8N_WEBHOOK_URL from 2.30.0; older instructions may use WEBHOOK_URL.
Without Traefik: Caddy#
Native Caddy on the same host uses:
n8n.example.com {
reverse_proxy localhost:5678
}
For Docker Caddy, save config/Caddyfile with reverse_proxy main:5678 and add:
caddy:
image: caddy:2.11.9
restart: unless-stopped
ports: ["80:80", "443:443"]
volumes:
- ./config/Caddyfile:/etc/caddy/Caddyfile:ro
- ./data/caddy:/data
- ./data/caddy-config:/config
Remove main's host port for this route. Apply the same public URL and proxy-hop settings. Use official native installation if preferred: Linux packages and sudo systemctl reload caddy; Windows official binary and caddy run --config Caddyfile; Mac brew install caddy and the same command.
For home-only HTTPS use n8n.home.arpa, local DNS and tls internal. Trust the public Caddy root from data/caddy/pki/authorities/local/root.crt: Linux installs it under /usr/local/share/ca-certificates/ then runs sudo update-ca-certificates; Windows uses administrator certutil -addstore -f ROOT root.crt; Mac uses System keychain and Always Trust. Keep the CA private key private. Outside webhook providers cannot generally reach a home-only name.
Security and testing#
Keep database, Redis, broker and worker health ports unpublished. The runner gets a broker token, not database credentials or the encryption key. Give it no host filesystem or Docker socket mount. Its root filesystem is read-only with temporary storage at /tmp, following the runner-hardening guidance.
Run docker compose ps, docker compose logs --tail 100 main worker runners and docker inspect "$(docker compose ps -q worker)" (PowerShell: docker inspect (docker compose ps -q worker)). Inspect output can reveal secrets; redact it before sharing.
Check curl -I https://n8n.example.com/healthz with certificate verification, then test browser login and a published dummy webhook. Worker readiness is available internally at /healthz/readiness when QUEUE_HEALTH_CHECK_ACTIVE=true; do not publish it just to make monitoring easier.
n8n 3.0 deprecates internal task runners and changes Code-node timeout defaults to 60 seconds. Keep external runners matched to n8n and review the official runner-hardening guidance before allowing untrusted workflow authors.
Common mistakes#
| Mistake | Why it happens | Do this instead |
|---|---|---|
| Setting queue mode without workers | Main still serves the editor | Start and test an execution worker |
| Different encryption keys | Each process generates its own first-run key | Set the same original key everywhere |
| Pointing PostgreSQL at SQLite files | Changing an env variable looks like migration | Export/import entities into a new database |
| Scaling workers without runner sidecars | Workflow workers and task runners sound similar | Add a matched worker/runner pair |
| Using local file storage on separate machines | Equal paths look shared | Use database mode or real shared storage |
| An AI adds the old manual-offload variable | It uses pre-3.0 instructions | Remove it; manual executions already use workers |
| Restarting old workers after a DB migration | Image rollback seems sufficient | Restore a matching database or finish the coordinated update |
Troubleshooting#
| Problem | Solution |
|---|---|
| Editor works, executions wait | Check docker compose logs --tail 100 worker and Redis health |
| Credentials fail only on a worker | Restore the original shared encryption key; do not regenerate it |
| Redis refuses connections | Check its service, password and internal DNS name |
| Code nodes wait or time out | Check runner logs, broker URI, token and matching image tag |
| Database appears empty | Inspect the actual mount and PGDATA layout before writing anything |
| Webhooks advertise localhost | Set the public URL and recreate main with proxy-hop settings |
| Old nodes stop after a major upgrade | Run the documented migration review before upgrading |
database files are incompatible with server#
This PostgreSQL error fragment means the data directory and server major are incompatible. Use a dump/restore or supported PostgreSQL upgrade procedure. Do not delete the cluster to silence it.
Known bugs#
The official backup docs still warn about issue #37814: separate credential imports can fail when their directory also contains workflow exports. The linked issue is closed as of this check; the docs still advise separate directories. Our full PostgreSQL recovery uses a database dump instead. Recent node-specific reports do not establish a general failure of this topology.
Tip: Do not retry a failed external write until we know whether the destination already accepted it. Queue recovery is not a guarantee against duplicate side effects.
Updates and backups#
First stop incoming work and the main process; leave workers running until queued and running jobs finish. Check executions in the UI before closing it and use logs/monitoring during the drain. Long-lived waiting workflows require a deliberate maintenance decision. Do not treat Redis DBSIZE as a queue-length check.
After the drain, this Linux/Mac config/backup.sh takes a database dump and files together:
#!/usr/bin/env bash set -euo pipefail cd "$HOME/docker_volumes/n8n-queue" stamp=$(date +%Y%m%d-%H%M%S) mkdir -p backups docker compose stop -t 180 main worker runners trap 'docker compose start main worker runners' EXIT docker compose exec -T postgres pg_dump -U postgres -d n8n -Fc -f /tmp/n8n.dump docker compose cp postgres:/tmp/n8n.dump "backups/n8n-$stamp.dump" tar -czf "backups/n8n-files-$stamp.tgz" data/main data/worker config .env docker-compose.yml
Copy the dump and matching archive off the host, encrypted. If using Caddy, back up its persistent state separately while stopped, especially the home-only certificate authority; losing that root means updating every client's trust. Add any custom-node or external-storage paths we actually use. A raw copy of PostgreSQL's running data folder is not this backup.
Windows follows the same sequence: create a timestamp with Get-Date -Format yyyyMMdd-HHmmss, use pg_dump -Fc -f /tmp/n8n.dump inside PostgreSQL and docker compose cp to copy it out, then tar -czf the files. Check $LASTEXITCODE after each command and restart services in a finally block. This avoids sending binary dump bytes through a PowerShell text pipeline.
Schedule a 03:00 maintenance window with Linux/Mac cron or Windows Task Scheduler. The script assumes ingress is stopped and the queue drained; scheduling only the archive script is insufficient. For unattended backups, implement and verify the drain checks first.
Rehearse restore on an isolated machine or internal Docker network, using an empty directory, a different Compose project and loopback port 5680. Restore files and the original key, start PostgreSQL, copy in the chosen dump and run pg_restore -U postgres -d n8n --exit-on-error /tmp/n8n.dump against the empty database. Start fresh Redis rather than replaying an old production queue. Before starting main, run n8n unpublish:workflow --all through a one-off main container with dependencies available. Keep egress blocked until workflows and credentials have been reviewed. Start main, worker and runner, then test only dummy operations.
For updates, drain, back up and stop all n8n processes. Change both n8n image lines and the runner tag to the same selected version. Run docker compose pull, start main alone for migrations, then docker compose up -d worker runners. Recheck a manual execution, published webhook and Code node. Restore the pre-update database and images together if rollback is required. PostgreSQL major upgrades are a separate dump/restore operation.
Performance and resources#
We have no measured RAM, CPU or throughput figures. Observe docker stats, execution duration, queue wait and database storage before increasing concurrency. Two workers at five slots can offer ten concurrent workflow slots, but neither the database nor an external API is guaranteed to sustain that load.
A single Redis, PostgreSQL and host remain failure points. Adding workers can improve capacity; it does not make these shared services redundant.
FAQ#
Do we need PostgreSQL for a queue deployment? Use a supported PostgreSQL version. Distributed queue mode over SQLite is unsupported.
Is Redis our workflow backup? No. PostgreSQL stores workflows, credentials and execution records; retain the key and files too.
Does an execution worker replace a task runner? No. The worker runs workflows; its external runner handles Code-node tasks.
Can manual tests stay on main? Not with n8n 3.0 queue mode. Manual executions also run on workers.
Does this guarantee each action runs once? No. Design external writes to detect repeated requests and review recovery before replaying jobs.
Sources#
Official sources read on 6 December 2026:
- n8n 3.4.4 release and Redis 8.12.1 release, checked using
gh api. - Queue mode, queue variables, database support.
- External task runners, runner variables, runner hardening.
- n8n 3.0 breaking changes, server CLI and full backup and restore.
- PostgreSQL official image, pg_dump and pg_restore, CREATE ROLE and psql variables.
- Redis persistence.
- Docker Hub exact tags: n8n, runners, PostgreSQL, Redis.
- Traefik Docker provider, Caddy reverse proxy, Caddy automatic HTTPS.
Checked against the official docs on 2026-12-06. Tested by DIY Lab Hub: not yet.