7.9 KiB
Redis Setup for Windows
⚠️ IMPORTANT: Redis Version Requirements
BullMQ requires Redis version 5.0.0 or higher.
❌ DO NOT USE: Microsoft Archive Redis (https://github.com/microsoftarchive/redis/releases)
- This is outdated and only provides Redis 3.x
- Version 3.0.504 is NOT compatible with BullMQ
- You will get errors:
Redis version needs to be greater or equal than 5.0.0
✅ USE ONE OF THESE METHODS INSTEAD:
Method 1: Using Memurai (Recommended for Windows) ⭐
Memurai is a Redis-compatible server built specifically for Windows with full Redis 6.x+ compatibility.
Why Memurai?
- ✅ Native Windows support - Runs as a Windows service
- ✅ Redis 6.x+ compatible - Full feature support
- ✅ Easy installation - Just install and run
- ✅ Free for development - Free tier available
- ✅ Production-ready - Used in enterprise environments
Installation Steps:
-
Download Memurai:
- Visit: https://www.memurai.com/get-memurai
- Download the Developer Edition (free)
-
Install:
- Run the installer (
Memurai-*.exe) - Choose default options
- Memurai will install as a Windows service and start automatically
- Run the installer (
-
Verify Installation:
# Check if service is running Get-Service Memurai # Should show: Running # Test connection memurai-cli ping # Should return: PONG # Check version (should be 6.x or 7.x) memurai-cli --version -
Configuration:
- Default port: 6379
- Connection string:
redis://localhost:6379 - Service runs automatically on Windows startup
- No additional configuration needed for development
Method 2: Using Docker Desktop (Alternative) 🐳
If you have Docker Desktop installed, this is the easiest method to get Redis 7.x.
Installation Steps:
-
Install Docker Desktop (if not already installed):
- Download from: https://www.docker.com/products/docker-desktop
- Install and start Docker Desktop
-
Start Redis Container:
# Run Redis 7.x in a container docker run -d --name redis-tat -p 6379:6379 redis:7-alpine # Or if you want it to restart automatically: docker run -d --name redis-tat -p 6379:6379 --restart unless-stopped redis:7-alpine -
Verify:
# Check if container is running docker ps | Select-String redis # Check Redis version docker exec redis-tat redis-server --version # Should show: Redis server v=7.x.x # Test connection docker exec redis-tat redis-cli ping # Should return: PONG -
Stop/Start Redis:
# Stop Redis docker stop redis-tat # Start Redis docker start redis-tat # Remove container (if needed) docker rm -f redis-tat
Method 3: Using WSL2 (Windows Subsystem for Linux)
-
Enable WSL2:
wsl --install -
Install Redis in WSL:
sudo apt update sudo apt install redis-server sudo service redis-server start -
Verify:
redis-cli ping # Should return: PONG
Quick Test
After starting Redis, test the connection:
# If you have redis-cli or memurai-cli
redis-cli ping
# Or use telnet
Test-NetConnection -ComputerName localhost -Port 6379
Troubleshooting
❌ Error: "Redis version needs to be greater or equal than 5.0.0 Current: 3.0.504"
Problem: You're using Microsoft Archive Redis (version 3.x) which is too old for BullMQ.
Solution:
-
Stop the old Redis:
# Find and stop the old Redis process Get-Process redis-server -ErrorAction SilentlyStop | Stop-Process -Force -
Uninstall/Remove old Redis (if installed as service):
# Check if running as service Get-Service | Where-Object {$_.Name -like "*redis*"} -
Install one of the recommended methods:
- Option A: Install Memurai (Recommended) - See Method 1 above
- Option B: Use Docker - See Method 2 above
- Option C: Use WSL2 - See Method 3 above
-
Verify new Redis version:
# For Memurai memurai-cli --version # Should show: 6.x or 7.x # For Docker docker exec redis-tat redis-server --version # Should show: Redis server v=7.x.x -
Restart your backend server:
# The TAT worker will now detect the correct Redis version npm run dev
Port Already in Use
# Check what's using port 6379
netstat -ano | findstr :6379
# Kill the process if needed (replace <PID> with actual process ID)
taskkill /PID <PID> /F
# Or if using old Redis, stop it:
Get-Process redis-server -ErrorAction SilentlyStop | Stop-Process -Force
Service Not Starting (Memurai)
# Start Memurai service
net start Memurai
# Check service status
Get-Service Memurai
# Check logs
Get-EventLog -LogName Application -Source Memurai -Newest 10
# Restart service
Restart-Service Memurai
Docker Container Not Starting
# Check Docker is running
docker ps
# Check Redis container logs
docker logs redis-tat
# Restart container
docker restart redis-tat
# Remove and recreate if needed
docker rm -f redis-tat
docker run -d --name redis-tat -p 6379:6379 redis:7-alpine
Cannot Connect to Redis
# Test connection
Test-NetConnection -ComputerName localhost -Port 6379
# For Memurai
memurai-cli ping
# For Docker
docker exec redis-tat redis-cli ping
Configuration
Environment Variable
Add to your .env file:
REDIS_URL=redis://localhost:6379
Default Settings
- Port:
6379 - Host:
localhost - Connection String:
redis://localhost:6379 - No authentication required for local development
- Default configuration works out of the box
Verification After Setup
After installing Redis, verify it's working:
# 1. Check Redis version (must be 5.0+)
# For Memurai:
memurai-cli --version
# For Docker:
docker exec redis-tat redis-server --version
# 2. Test connection
# For Memurai:
memurai-cli ping
# Expected: PONG
# For Docker:
docker exec redis-tat redis-cli ping
# Expected: PONG
# 3. Check if backend can connect
# Start your backend server and check logs:
npm run dev
# Look for:
# [TAT Queue] Connected to Redis
# [TAT Worker] Connected to Redis at redis://127.0.0.1:6379
# [TAT Worker] Redis version: 7.x.x (or 6.x.x)
# [TAT Worker] Worker is ready and listening for jobs
Quick Fix: Migrating from Old Redis
If you already installed Microsoft Archive Redis (3.x), follow these steps:
-
Stop old Redis:
# Close the PowerShell window running redis-server.exe # Or kill the process: Get-Process redis-server -ErrorAction SilentlyStop | Stop-Process -Force -
Choose a new method (recommended: Memurai or Docker)
-
Install and verify (see methods above)
-
Update .env (if needed):
REDIS_URL=redis://localhost:6379 -
Restart backend:
npm run dev
Production Considerations
- ✅ Use Redis authentication in production
- ✅ Configure persistence (RDB/AOF)
- ✅ Set up monitoring and alerts
- ✅ Consider Redis Cluster for high availability
- ✅ Use managed Redis service (Redis Cloud, AWS ElastiCache, etc.)
Summary: Recommended Setup for Windows
| Method | Ease of Setup | Performance | Recommended For |
|---|---|---|---|
| Memurai ⭐ | ⭐⭐⭐⭐⭐ Very Easy | ⭐⭐⭐⭐⭐ Excellent | Most Users |
| Docker | ⭐⭐⭐⭐ Easy | ⭐⭐⭐⭐⭐ Excellent | Docker Users |
| WSL2 | ⭐⭐⭐ Moderate | ⭐⭐⭐⭐⭐ Excellent | Linux Users |
| ❌ Microsoft Archive Redis | ❌ Don't Use | ❌ Too Old | None - Outdated |
⭐ Recommended: Memurai for easiest Windows-native setup, or Docker if you already use Docker Desktop.