Back to articles
Technology Insight

Scaling n8n: Implementing Advanced Queue Mode with Redis Sentinel on a Budget 3-Node Cloud Cluster

May 29, 2026

Introduction to Enterprise-Grade Automation on a Budget

As organizations scale their workflow automation, they inevitably hit the performance ceilings of single-instance deployments. Open-source automation tools like n8n offer incredible flexibility, but a standard setup processes jobs sequentially or within limited local multi-threading constraints. When handling thousands of webhooks, heavy data transformations, or parallel API polling, a single-instance architecture quickly becomes a bottleneck, leading to delayed executions or outright system crashes.

The enterprise solution to this problem is n8n Advanced Queue Mode. By decoupling the main application interface from execution workers using a message broker, n8n can scale horizontally to handle massive workloads. However, relying on a single message broker introduces a single point of failure (SPOF). To achieve true high availability (HA) without paying premium enterprise infrastructure costs, we can leverage Redis Sentinel distributed across a cluster of three budget-friendly Cloud Servers. This guide provides a production-ready blueprint for deploying this resilient, cost-effective architecture.

Understanding the Architecture: n8n Queue Mode & Redis Sentinel

Before diving into the configuration, it is crucial to understand how the components interact in a high-availability environment. Our setup distributes the workload across three separate virtual machines (VMs), maximizing resource utilization and ensuring system survival even if one server goes completely offline.

The Role of n8n Components

  • n8n Main (Webhook/UI) Instance: Acts as the primary control plane. It serves the graphical user interface, handles incoming webhook triggers, and pushes execution jobs into the Redis queue. It does not execute the workflows itself, freeing up CPU cycles to handle web traffic.
  • n8n Workers: Independent instances dedicated solely to pulling jobs from the Redis queue and executing them. Workers can be scaled up or down dynamically based on queue depth.
  • n8n Conductor (Optional/Internal): Coordinates periodic cron triggers and schedules tasks, ensuring they are queued at the correct intervals.

Why Redis Sentinel?

Standard Redis operates on a primary-replica model. If the primary node fails, data ingestion stops, paralyzing your entire automation pipeline. Redis Sentinel solves this by providing automated monitoring, notification, and failover. By deploying three Sentinel nodes (one on each cloud server), they form a quorum. If the primary Redis instance fails, the Sentinels vote to promote a replica to primary automatically, notifying the n8n cluster to redirect their queue connections seamlessly.

Prerequisites and Infrastructure Setup

To follow this guide, you will need three affordable Cloud Servers (e.g., entry-level VPS instances from providers like Hetzner, DigitalOcean, or local budget providers). For optimal performance, ensure they are deployed within the same private network or datacenter region to minimize latency.

Minimum Node Specifications: 2 vCPUs, 4GB RAM, and Ubuntu 24.04 LTS installed. Shared CPU instances are acceptable, but dedicated or high-frequency cores are preferred for the worker nodes.

Network Mapping Allocation

For clarity throughout this tutorial, we will use the following internal IP assignments:

  • Node 1 (Primary Database & n8n Main): 10.0.0.11
  • Node 2 (Redis Replica 1 & n8n Worker 1): 10.0.0.12
  • Node 3 (Redis Replica 2 & n8n Worker 2): 10.0.0.13

You must also provision a shared database—ideally PostgreSQL—configured for high availability or hosted as a managed service, as all n8n instances need access to a single source of truth for workflow states and execution logs.

Step 1: Deploying the Redis Sentinel Cluster

First, we must configure our distributed message queue broker. Install Redis and Redis-Sentinel packages on all three nodes using your package manager:

sudo apt update && sudo apt install redis-server redis-sentinel -y

Configuring Redis Replication

On Node 1 (Primary), edit /etc/redis/redis.conf to bind to the internal IP and set a strong password:

bind 127.0.0.1 10.0.0.11
protected-mode no
requirepass YourStrongRedisPassword
masterauth YourStrongRedisPassword

On Node 2 and Node 3 (Replicas), edit their respective redis.conf files similarly, but instruct them to replicate from Node 1:

bind 127.0.0.1 [LOCAL_NODE_IP]
protected-mode no
requirepass YourStrongRedisPassword
masterauth YourStrongRedisPassword
replicaof 10.0.0.11 6379

Configuring the Sentinel Quorum

Now, modify /etc/redis/sentinel.conf identically across all three nodes. This tells the Sentinels to monitor our primary node and require at least 2 votes (quorum) to trigger a failover:

bind 0.0.0.0
port 26379
protected-mode no
sentinel monitor mymaster 10.0.0.11 6379 2
sentinel auth-pass mymaster YourStrongRedisPassword
sentinel down-after-milliseconds mymaster 5000
sentinel failover-timeout mymaster 60000
sentinel parallel-syncs mymaster 1

Restart the Redis and Sentinel services across all nodes to apply changes, ensuring they boot up on system start:

sudo systemctl restart redis-server redis-sentinel
sudo systemctl enable redis-server redis-sentinel

Step 2: Configuring n8n Advanced Queue Mode

With our highly available Redis infrastructure operational, we can now configure n8n via environment variables. We will use Docker Compose for easy deployment and maintainability across the cluster.

The Shared Base Environment Variables

Every n8n node in our cluster requires specific configuration variables to switch from standard mode to Queue Mode, alongside specifying the Sentinel connection parameters.

EXECUTIONS_MODE=queue
QUEUE_BULLMQ_PREFIX=n8n-queue

# Database Connection
DB_TYPE=postgresdb
DB_POSTGRESDB_HOST=10.0.0.50
DB_POSTGRESDB_PORT=5432
DB_POSTGRESDB_DATABASE=n8n
DB_POSTGRESDB_USER=n8n_user
DB_POSTGRESDB_PASSWORD=YourSecureDBPassword

# Redis Sentinel Integration
QUEUE_BULLMQ_REDIS_TYPE=sentinel
QUEUE_BULLMQ_REDIS_SENTINEL_NAME=mymaster
QUEUE_BULLMQ_REDIS_SENTINELS=[{"host":"10.0.0.11","port":26379},{"host":"10.0.0.12","port":26379},{"host":"10.0.0.13","port":26379}]
QUEUE_BULLMQ_REDIS_PASSWORD=YourStrongRedisPassword

Deploying the Main UI Instance (Node 1)

On Node 1, your docker-compose.yml file will run n8n in standard server mode but configured with the queue variables above. This instance will act as the traffic router and dashboard controller.

version: '3.8'
services:
  n8n-main:
    image: docker.n8n.io/n8nio/n8n:latest
    restart: always
    ports:
      - "5678:5678"
    environment:
      - N8N_HOST=automation.yourdomain.com
      - N8N_PORT=5678
      - N8N_PROTOCOL=https
      # Include all the shared environment variables here

Deploying Worker Instances (Node 2 & Node 3)

On the worker machines, we override the default container command to instruct n8n to start as a background worker rather than a web server. Notice that workers do not expose port 5678, as they do not receive HTTP requests directly.

version: '3.8'
services:
  n8n-worker:
    image: docker.n8n.io/n8nio/n8n:latest
    restart: always
    command: worker
    environment:
      # Include all the shared environment variables here
      - N8N_ENCRYPTION_KEY=YourExactSameMainEncryptionKey

Crucial Note: The N8N_ENCRYPTION_KEY must be identical across all main and worker nodes; otherwise, workers will be unable to decrypt credential payloads fetched from the shared database.

Step 3: Verification and Failover Testing

Once all Docker containers are running (docker compose up -d), verify your infrastructure deployment to ensure system integrity.

Checking the n8n Worker Topology

Log into your n8n main UI instance dashboard. Navigate to Settings > Workers. You should see two active workers listed, actively polling for jobs. Alternatively, check the docker logs on your worker instances to confirm a successful connection:

docker logs [container_id] --tail 50

You should see a message stating: Templates data loaded successfully. n8n worker is now ready.

Simulating a Node Crash

To test the resilience of your setup, simulate a catastrophic hardware failure on Node 1 by shutting down its Redis instance:

sudo systemctl stop redis-server on Node 1

Monitor the Sentinel logs on Node 2 or Node 3 (tail -f /var/log/redis/redis-sentinel.log). You will observe the Sentinels detecting the master timeout, reaching a quorum consensus, and promoting either Node 2 or Node 3 to master. The n8n workers and main instances will momentarily lose connection, detect the change via the Sentinels, and automatically reconnect to the new master without dropping any running executions.

Conclusion and Production Optimization

By implementing n8n Advanced Queue Mode with a 3-node Redis Sentinel configuration, you have established a robust, enterprise-capable workflow engine on budget infrastructure. This topology mitigates single points of failure and allows you to scale worker nodes horizontally as automation demands grow.

To ensure long-term stability, consider implementing these additional production optimizations:

  • Prune Execution Data: n8n writes heavy execution logs to the primary database. Set EXECUTIONS_DATA_PRUNE=true and EXECUTIONS_DATA_MAX_AGE=168 (7 days) to prevent disk space exhaustion.
  • Monitor Queue Depth: Use tools like Prometheus and Grafana or basic cron scripts to monitor BullMQ metrics in Redis. A constantly growing queue indicates that you need to scale up additional worker VPS instances.
  • Tweak Worker Concurrency: By default, each worker runs 10 jobs concurrently. If your workflows involve heavy async API calls, you can safely increase this to 20 or 30 by setting the N8N_WORKERS_CONCURRENCY variable inside your worker configurations.
Scaling n8n: Implementing Advanced Queue Mode with Redis Sentinel on a Budget 3-Node Cloud Cluster | DPTCloud