---
title: "Deploy Redis HA"
description: "3-node Redis 8 with Sentinel failover and HAProxy router"
category: "Storage"
url: https://railway.com/deploy/deploy-redis-ha-on-railway
---

# Deploy Redis HA

3-node Redis 8 with Sentinel failover and HAProxy router

**[Deploy Redis HA on Railway](https://railway.com/template/deploy-redis-ha-on-railway)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/deploy-redis-ha-on-railway/manifest.json

- **Creator:** onepush
- **Category:** Storage

## Template content

### Redis

- **Image:** ghcr.io/onepush-dev/redis-ha-router:8.10.3@sha256:a86aacda65af654a1109bf9b154e8cb124ec6e8f273aedb62088103d4a36ff7f
- **Health check:** /health

### redis-1

- **Image:** ghcr.io/onepush-dev/redis-ha-node:8.10.3@sha256:672f6310650c226fdae0acdeff10f4e82dfce7d38096e35a8ec61069588f271e

### redis-3

- **Image:** ghcr.io/onepush-dev/redis-ha-node:8.10.3@sha256:672f6310650c226fdae0acdeff10f4e82dfce7d38096e35a8ec61069588f271e

### redis-2

- **Image:** ghcr.io/onepush-dev/redis-ha-node:8.10.3@sha256:672f6310650c226fdae0acdeff10f4e82dfce7d38096e35a8ec61069588f271e

## Documentation

# Deploy and Host self hosted Redis HA (Open-Source Highly Available Redis) on Railway

This template deploys three Redis 8.10.3 nodes, each with a colocated Sentinel, plus an HAProxy router that gives your apps one stable connection string.

## About Hosting Redis HA open-source software on Railway (self hosted Redis Sentinel template)

This template runs three Redis 8.10.3 nodes, each with a colocated Sentinel on port 26379, plus an HAProxy router that serves read/write on 6379 and read-only on 6380.

## Why Deploy Redis HA, the managed Redis alternative on Railway (Railway Free Trial)

Managed Redis like ElastiCache is convenient, but you pay for every node and give up control over Sentinel settings, persistence, and read routing.

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 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 self hosting

Here is how this three-node Sentinel stack on Railway compares with running it yourself.

| Provider | What You Get with Railway | What You Get with the Other Provider |
| --- | --- | --- |
| DigitalOcean | Three Redis 8.10.3 nodes with Sentinel and the HAProxy router, deployed with zero inputs. | Droplets, but you install Redis, set Sentinel quorum, and write the HAProxy config yourself. |
| AWS | The HA topology with JSON, Search, TimeSeries, and Bloom loaded, plus a read-only port on 6380. | Full control over networking, but Sentinel and failover tuning are your job. |
| Hetzner | Private networking and router health endpoints on 8080, with nothing to wire by hand. | Low-cost servers, but you own patching, upgrades, and every failover test. |

If you enjoy operating Sentinel by hand, a VPS gives you the most knobs, but the template gets a working failover setup running much faster.

## Common Use Cases for hosted Redis HA

- **App cache with failover:** Keep your hot read cache on Redis HA so a primary crash promotes a replica in seconds. Writes pause briefly during the switch, so keep retry logic in your app.
- **Session store:** Store login sessions on REDIS_URL so users stay signed in through a failover. Sessions are small and rewritten often, which suits Redis.
- **Job queues:** Point Sidekiq, BullMQ, or similar workers at the router so queue state lives on a replicated primary. AOF is on by default, so a worker restart mid-job loses less.
- **RedisJSON documents:** Store structured documents with JSON.SET and JSON.GET, since the JSON module loads on every node. This avoids running a separate document database.
- **Read replicas via RO port 6380:** Send heavy read traffic to REDIS_READONLY_URL on port 6380 and keep writes on 6379. Replicas lag the primary slightly, so don't read back a value you just wrote and expect it there yet.

## Dependencies for Redis HA Docker hosted on Railway

This template needs nothing from you at deploy time. You don't write any Sentinel config, and the deploy form has zero required inputs.

### Deployment Dependencies for Managed Redis HA Service (Sentinel Cluster)

The cluster is four services: redis-1, redis-2, and redis-3 run Redis plus Sentinel, and the Redis router sits in front of them.

### Implementation Details for Redis HA (Using onepush-dev redis-ha-node and redis-ha-router images)

The node service runs ghcr.io/onepush-dev/redis-ha-node:8.10.3, pinned by digest and built from redis:8.10.3-trixie with JSON, Search, TimeSeries, and Bloom modules loaded.

## How does Redis HA compare against other Redis hosting options

### Redis HA vs single Railway Redis (Single Node Railway Redis Alternative)

- **Failover:** One node is a single point of failure. Redis HA runs three nodes with Sentinel, and a replica takes over in a few seconds if the primary dies.
- **Write path:** Your app keeps one connection string, and the HAProxy router keeps pointing at the current primary when it moves.
- **Where single Redis wins:** It is simpler and uses fewer resources, so it fits dev, staging, or caches where a brief outage is fine.

### Redis HA vs Railway's older redis-ha (8.4) (Redis 8.4 HA Template Alternative)

- **Redis version and modules:** Redis HA ships Redis 8.10.3 with JSON, Search, TimeSeries, and Bloom loaded.
- **Read scaling:** A read-only router port (6380) sends reads to replicas. The older template exposes only one write port.
- **Restart behavior:** A restarted primary rejoins as a replica and never comes back as a second primary.

### Redis HA vs AWS ElastiCache (Managed AWS Redis Alternative)

- **Operations:** ElastiCache handles patching, backups, and multi-AZ failover for you, which is hard to beat if you already live on AWS.
- **Cost and control:** Redis HA runs in your Railway project, so you choose the memory limit and eviction policy and skip AWS node pricing.
- **Where ElastiCache wins:** IAM auth, VPC peering, and a managed SLA matter if your stack is already on AWS.

### Redis HA vs Redis Cloud (Managed Redis Cloud Alternative)

- **Managed features:** Redis Cloud offers managed clustering and vendor support. Redis HA gives you Sentinel failover on infrastructure you already run.
- **Module access:** Redis HA includes JSON, Search, TimeSeries, and Bloom in the image, so you can test them without a separate plan.
- **Where Redis Cloud wins:** Sharding data across many nodes and a vendor to call at 3 a.m. Redis HA is primary and replicas, not a sharded cluster.

## How to use Redis HA (the OSS highly available Redis)?

1. Deploy the template with no inputs. The cluster password is generated for you and every service picks it up.

2. Wait about 5 minutes for the second deploy cycle. When all four services show Online, confirm that `GET /health` on port 8080 returns 200 with "Service ready".

3. Check `/status` on the same port. You want `primary_up=1` and `replicas_up=2`.

4. Connect your app to `REDIS_URL` on the Redis router service. It uses port 6379 and always routes to the current primary, so failover stays invisible to the client.

```bash
redis-cli -u "$REDIS_URL" SET greeting "hello"
redis-cli -u "$REDIS_URL" GET greeting
```

5. For read-heavy traffic, use `REDIS_READONLY_URL` on port 6380, which sends you to the replicas. Replicas can lag slightly, so keep strictly consistent reads on `REDIS_URL`.

6. For Sentinel-aware clients, use `REDIS_SENTINEL_HOSTS` with the master name in `REDIS_MASTER_NAME`, which defaults to `mymaster`.

## How to self host Redis HA on other VPS Services (Redis Sentinel self hosting guide)

Running this stack yourself means three Redis 8.10.3 containers with Sentinel beside each one, plus an HAProxy router in front.

### Clone the Repository

Pull the source from the upstream repo and move into the directory.

```bash
git clone https://github.com/onepush-dev/redis-ha.git
cd redis-ha
```

### Install Dependencies

You need Docker Engine and the Compose plugin. Nothing else is required on the host, because the images already bundle Redis, Sentinel, and HAProxy.

```bash
docker --version
docker compose version
```

### Configure Environment Variables

Create a `.env` file and set a strong shared password.

```bash
REDIS_PASSWORD=change-me-to-a-long-random-string
REDIS_NODES=your-domain-1,your-domain-2,your-domain-3
REDIS_APPENDONLY=yes
```

### Start the Redis HA Application

Bring the stack up on each host and confirm the router reports a primary.

```bash
docker compose up -d
curl http://your-domain:8080/status
```

Railway handles the private networking, volumes, and restart behavior for you, which you otherwise have to wire up yourself.

## Official Pricing of Redis HA (Redis pricing)

Redis HA is free and open source, so there is no license fee to pay. Your cost is the Railway usage for the three Redis nodes, the router, and their volumes, billed under your Railway plan.

## Redis HA cloud vs self hosted comparison (Pricing, features, costs, and more)

Self hosting Redis HA means you pay for compute and storage directly and own the failover behavior. Here is how the two paths compare on cost and what you need to provision.

### Monthly cost of self hosting Redis HA on Railway

Railway bills by resource usage, so your monthly cost depends on the memory and CPU the three Redis nodes and the router consume, plus volume storage for AOF and RDB files on each node's /data volume.

### System Requirements for Hosting Redis HA on a VPS

On a VPS, plan for three separate machines or containers, since quorum of 2 out of 3 Sentinels only means something across three independent failure domains.

## Frequently Asked Questions (FAQs)

### Where do I check whether the cluster is healthy?

The router answers on HTTP port 8080. `GET /health` returns 200 with "Service ready" once the cluster can take traffic, and `GET /status` shows `primary_up=1` and `replicas_up=2`.

### Which port should my app use for writes and reads?

Use port 6379 (`REDIS_URL`) for reads and writes, since the router always routes it to the current primary.

### Which modules come with it?

RedisJSON, RediSearch, RedisTimeSeries, and RedisBloom load on every node alongside Redis 8.10.3. You don't install or enable them separately.

### What happens when the primary goes down?

Sentinel needs two of three nodes to agree the primary is gone, then promotes a replica. A restarted old primary rejoins as a replica.

### Is persistence enabled?

Yes. AOF is on by default (`REDIS_APPENDONLY=yes`), with RDB snapshots running alongside it on the `/data` volumes.

### When is three nodes overkill?

If your Redis is just a cache you can rebuild from a database, or you're running a dev environment, a single Redis service is simpler and cheaper.


## Similar templates

- [RustFS | (Just Updated) S3 Object Store, Public URL and Keys Set](https://railway.com/deploy/rustfs-or-just-updated-s3-object-store-p) — S3-compatible object store, keys and public URL preset, volume kept
- [TimescaleDB](https://railway.com/deploy/timescaledb-railway-template) — A PostgreSQL-based time-series database for analytics on Railway.
- [Garage S3 Storage](https://railway.com/deploy/garage-s3-storage) — Ultra-light S3 server: fast, open-source, plug-and-play.

Open this page in a browser: https://railway.com/deploy/deploy-redis-ha-on-railway
