
Deploy Redis HA Celery
Sentinel-backed Redis as a Celery broker and result backend
Just deployed
Just deployed
/data
Just deployed
/data
Just deployed
/data
Deploy and Host self hosted Redis HA Celery (Highly Available Celery Broker Setup) on Railway
This template deploys a three-node Redis 8.10 cluster with colocated Sentinel and an HAProxy router, so your Celery broker and result backend survive a primary failure.
About Hosting Redis HA Celery open-source software on Railway (self hosted Celery broker and result backend on Redis Sentinel HA template)
This template runs three Redis 8.10.3 nodes (redis-1, redis-2, redis-3), each with a colocated Sentinel on master name mymaster with a quorum of 2 of 3.
Why Deploy Redis HA Celery, the Redis Cloud alternative on Railway (Railway Free Trial)
Redis Cloud is the easier path for a Celery broker, while Redis HA Celery trades some setup time for control over the Sentinel topology and AOF settings inside your own Railway project.
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying Redis HA Celery on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
Railway vs Other Hosting Providers and VPS for Redis HA Celery self hosting
Sentinel failover is mostly a question of how much of it you want to run yourself. This table compares the Railway template with three common alternatives.
| Provider | What You Get with Railway | What You Get with the Other Provider |
|---|---|---|
| DigitalOcean | Three Redis 8.10.3 nodes with Sentinel and a router from one template. | Droplets you wire together yourself, including the Sentinel config and router. |
| AWS | A 2 of 3 Sentinel quorum and a router that always reaches the primary. | EC2 or ElastiCache building blocks with more network control and more setup. |
| Hetzner | Failover already tested, with writes back after about 4.4 seconds. | Low-cost bare servers where you run the monitoring and failover tests yourself. |
Choose the host that matches how much of the Sentinel layer you want to operate.
Common Use Cases for hosted Redis HA Celery
- Surviving a primary redeploy: Redeploying the primary promotes a replica in about 3 seconds, and writes resumed after roughly 4.4 seconds with no acknowledged writes lost. Sentinel-aware Celery clients reconnect on their own.
- ETA and countdown tasks: A task scheduled an hour out sits unacknowledged the whole time. Set
visibility_timeoutabove your longest delay, or the broker redelivers it again and again. - Sharing one broker: Several Celery apps on one cluster need a common visibility timeout, and the shortest value wins. Set it in every app's config so they stay in step.
- Moving off a single Redis box: Switch the broker URL to
sentinel://, addmaster_nameand thesentinel_kwargspassword, and the same code now survives a primary failure. - Simple apps on the router: Apps without Sentinel-aware code can use a
redis://URL on the router at port 6379. The router always reaches the current primary.
Dependencies for Redis HA Celery Docker hosted on Railway
This template runs three Redis 8.10.3 nodes, each with a colocated Sentinel, behind an HAProxy router, so your Celery workers can keep their broker while the primary is replaced.
Deployment Dependencies for Managed Redis HA Celery Service (Database)
The template creates redis-1, redis-2 and redis-3 (volume /data on each) plus the Redis router. redis-1 generates a 32-character REDIS_PASSWORD that the peers and the router reference, and the router exposes REDIS_URL on 6379, REDIS_READONLY_URL on 6380, and REDIS_SENTINEL_HOSTS for Sentinel-aware clients.
Implementation Details for Redis HA Celery (Using Redis HA official docker image)
The node image is ghcr.io/onepush-dev/redis-ha-node:8.10.3 and the router image is ghcr.io/onepush-dev/redis-ha-router:8.10.3 (HAProxy 3.4.7).
How does Redis HA Celery compare against other ways to run Celery with a highly available Redis broker
Redis HA Celery is a self-hosted Sentinel setup, so it trades managed convenience for control over the broker. The four options below are the ones most Python teams weigh.
Redis HA Celery vs Redis Cloud (Redis Cloud Alternative)
- Control: You own the three nodes and the router, so you set the eviction policy, AOF, and visibility timeout yourself.
- Failover: Sentinel handles promotion in our test, with about 4.4 s of write pause and no acknowledged writes lost.
- Where Redis Cloud wins: Redis Ltd runs the patching, backups, and support, which matters if nobody on your team wants that job.
Redis HA Celery vs Amazon ElastiCache (AWS ElastiCache Alternative)
- Portability: The template runs on Railway or any VPS, so you are not tied to an AWS VPC to reach your broker.
- Client code: Celery connects with a sentinel:// URL and master_name, which you configure yourself.
- Where ElastiCache wins: It is deeply integrated with AWS networking, IAM, and monitoring, which makes it the easier call inside an AWS shop.
Redis HA Celery vs RabbitMQ (RabbitMQ Alternative for Celery)
- Model: RabbitMQ is a purpose-built AMQP broker, while Redis gives you a broker plus a result backend in one service.
- Redelivery: Redis uses a visibility timeout that you must size against your longest ETA task, which RabbitMQ handles differently.
- Where RabbitMQ wins: Its routing and acknowledgement semantics are richer, so it suits complex workflows better than a Redis list.
Redis HA Celery vs Upstash (Upstash Alternative for Celery)
- Hosting: Upstash is serverless and pay-per-use, which suits spiky workloads; this template runs as always-on nodes.
- Setup: Celery's docs describe Upstash as a serverless option, while you run Sentinel and the router here.
- Where Upstash wins: You skip running any nodes at all, which is hard to beat for small or bursty projects.
How to use Redis HA Celery (the OSS in-memory data store)?
- Deploy the Redis HA template so redis-1, redis-2, redis-3 and the router are running, with master name mymaster.
- Set REDIS_PASSWORD and REDIS_MAXMEMORY_POLICY=noeviction, reading the password from the environment.
- Set REDIS_SENTINEL_HOSTS and REDIS_MASTER_NAME for Sentinel-aware workers.
- Point Celery at the sentinel:// URL and set the transport options below.
- Set visibility_timeout to 3600 (or your value) everywhere it applies.
- For simple apps, use redis://:password@hostname:6379/db_number instead.
import os
from celery import Celery
password = os.environ["REDIS_PASSWORD"]
sentinels = os.environ["REDIS_SENTINEL_HOSTS"].split(",")
broker_url = ";".join(f"sentinel://:{password}@{h}" for h in sentinels)
app = Celery("tasks", broker=broker_url, backend=broker_url)
opts = {"master_name": "mymaster", "visibility_timeout": 3600}
app.conf.broker_transport_options = {**opts, "sentinel_kwargs": {"password": password}}
app.conf.result_backend_transport_options = dict(opts)
app.conf.visibility_timeout = 3600
How to self host Redis HA Celery on other VPS Services (Redis HA self hosting guide)
Running this on your own VPS means you manage the three Redis nodes, their Sentinels, and the router.
Clone the Repository
Clone the template repository on each VPS and check out the 8.10.3 image tags so every node runs the same build.
git clone https://github.com/onepush-dev/redis-ha.git
cd redis-ha
Install Dependencies
Install Docker and Docker Compose on each host.
Configure Environment Variables
Create a .env file on each node with the same REDIS_PASSWORD and REDIS_NODES list, using your-domain hostnames.
REDIS_PASSWORD=change-me-to-a-32-char-secret
REDIS_NODES=node-1.your-domain,node-2.your-domain,node-3.your-domain
REDIS_MASTER_NAME=mymaster
REDIS_MAXMEMORY_POLICY=noeviction
REDIS_APPENDONLY=yes
Start the Redis HA Celery Application
Start the first node so it bootstraps as primary, then start the other two so they join as replicas. Check the router's /health on port 8080.
Official Pricing of Redis HA Celery (Redis HA pricing)
Redis HA Celery is free and open source, so there is no license fee to pay. You pay only for the infrastructure it runs on.
Redis HA Celery cloud vs self hosted comparison (Pricing, features, costs, and more)
Running Redis HA Celery yourself on Railway means you pay for three Redis nodes and a router, and you own the failover behaviour.
Monthly cost of self hosting Redis HA Celery on Railway
Expect about $20-50 per month for three Redis nodes plus the router at light use, and the bill climbs as memory grows.
System Requirements for Hosting Redis HA Celery on a VPS
If you move off Railway, plan for three separate machines so Sentinel quorum of 2 of 3 can survive losing one node.
Frequently Asked Questions (FAQs)
Why does Celery need master_name for Sentinel?
Sentinel does not hand out a fixed primary address, so Celery needs the logical master name to ask for it.
What do I do about InconsistencyError on _kombu.binding.celery?
Redis evicted the Celery binding key under memory pressure. Use allkeys-lru only for a pure cache.
How long do writes pause during a primary failover?
In our fresh test, a replica was promoted in about 3 seconds and writes resumed after about 4.4 seconds, with 0 acknowledged writes lost.
What does a too-short visibility timeout cause?
Unacknowledged tasks are redelivered and run again once the timeout passes.
Do I use the sentinel URL or the router URL?
Use the sentinel:// URL if your workers have Sentinel-aware client code.
How do I keep the password out of my config?
Read REDIS_PASSWORD from the environment and pass it as sentinel_kwargs {'password': os.environ['REDIS_PASSWORD']}.
Template Content
