Advanced
How to set up cluster nodes on n8n
Quick Answer
Setting up n8n cluster nodes requires configuring multiple n8n instances to share workload through Redis as a message broker. You'll need to configure environment variables for clustering, set up Redis connection, and deploy multiple worker nodes.
Prerequisites
- Redis server running
- Multiple server instances with n8n installed
- Docker or npm installation
- Basic understanding of load balancing
1
Configure Redis for clustering
Install and configure Redis server to act as the message broker between n8n nodes. Set up Redis with the following configuration:
Ensure Redis is accessible from all n8n instances and note the connection string for later use.
redis-server --port 6379 --bind 0.0.0.0Ensure Redis is accessible from all n8n instances and note the connection string for later use.
Tip
Use Redis Sentinel or Redis Cluster for high availability in production environments
2
Set up the main n8n instance
Configure the main n8n instance with clustering environment variables. Create a
.env file or set environment variables:N8N_EXECUTIONS_MODE=queue
QUEUE_BULL_REDIS_HOST=your-redis-host
QUEUE_BULL_REDIS_PORT=6379
QUEUE_BULL_REDIS_PASSWORD=your-redis-password
N8N_SKIP_WEBHOOK_DEREGISTRATION_SHUTDOWN=trueTip
The main instance handles the web UI and webhook endpoints while delegating execution to worker nodes
3
Configure worker node instances
Set up worker nodes that will execute workflows. Configure each worker with these environment variables:
Start each worker node with:
N8N_EXECUTIONS_MODE=queue
QUEUE_BULL_REDIS_HOST=your-redis-host
QUEUE_BULL_REDIS_PORT=6379
N8N_EXECUTIONS_PROCESS=main
WEBHOOKS_ENABLED=false
N8N_DISABLE_UI=trueStart each worker node with:
n8n workerTip
Scale worker nodes based on your workflow execution volume and complexity
4
Configure database connection
Ensure all nodes connect to the same database. Set the database connection string on all instances:
DB_TYPE=postgresdb
DB_POSTGRESDB_HOST=your-db-host
DB_POSTGRESDB_PORT=5432
DB_POSTGRESDB_DATABASE=n8n
DB_POSTGRESDB_USER=n8n_user
DB_POSTGRESDB_PASSWORD=your-passwordTip
Use a managed database service for better reliability and automatic backups
5
Set up load balancer
Configure a load balancer (nginx, HAProxy, or cloud load balancer) to distribute traffic to your main n8n instances. Example nginx configuration:
upstream n8n_backend {
server n8n-main-1:5678;
server n8n-main-2:5678;
}
server {
location / {
proxy_pass http://n8n_backend;
proxy_set_header Host $host;
}
}Tip
Enable sticky sessions if using multiple main instances to ensure proper WebSocket connections
6
Start and verify cluster
Start all instances in the correct order: Redis, database, main n8n instance(s), then worker nodes. Verify the cluster is working by checking the Executions page in the n8n UI and monitoring Redis queues:
Create a test workflow and verify it executes on worker nodes.
redis-cli monitorCreate a test workflow and verify it executes on worker nodes.
Tip
Monitor Redis memory usage and configure appropriate maxmemory policies for production use
Troubleshooting
Worker nodes not picking up jobs
Check Redis connectivity and ensure
N8N_EXECUTIONS_MODE=queue is set on all instances. Verify Redis queues using redis-cli and check for firewall issues.Database connection errors across nodes
Ensure all nodes use the same database connection string and the database allows multiple connections. Check
DB_POSTGRESDB_POOL_SIZE settings and connection limits.Webhooks not working in cluster mode
Ensure
WEBHOOKS_ENABLED=false on worker nodes and N8N_SKIP_WEBHOOK_DEREGISTRATION_SHUTDOWN=true on main instances. Configure webhook URLs to point to the load balancer.Memory issues with Redis
Configure Redis
maxmemory and maxmemory-policy settings. Monitor queue sizes and consider using Redis persistence options like AOF or RDB for data durability.Ready to get started with n8n?
Put this tutorial into practice. Visit n8n and follow the steps above.
Visit n8n →