REDIS TROUBLESHOOTING
Comprehensive guidelines for AI-assisted development within the Editor platform
π§ Redis Connection Troubleshooting Guide
Comprehensive guide for resolving Redis connection issues in Singularity app
π Understanding Redis "Connection Refused" Errors
Based on Redis troubleshooting documentation and comprehensive Redis connection guides, Redis connection refused errors typically indicate:
- Redis server is not running
- Network connectivity issues
- Firewall blocking connections
- Incorrect configuration settings
- Resource limitations (memory/file descriptors)
π― Current Redis Status in Singularity
β Expected Behavior (By Design)
In your Singularity app, Redis is intentionally disabled for local development:
// Configuration in redis-integration.service.ts
const REDIS_CONFIG: RedisConfig = {
restApiUrl: 'http://localhost:8079', // Redis REST API proxy
enabled: false // Disabled for local development by default
};
π Expected Console Messages
βΈοΈ Redis is disabled for local development - skipping connection test
POST http://localhost:8079/info net::ERR_CONNECTION_REFUSED
β Real Redis connection failed
These are NOT errors - they're expected messages indicating Redis is properly disabled for local development.
π οΈ Redis Connection Troubleshooting Steps
Step 1: Verify Redis Server Status
Check if Redis is running:
# Check Redis status
redis-server --status
# Start Redis (Ubuntu/Debian)
sudo systemctl start redis-server
# Start Redis (macOS with Homebrew)
brew services start redis
# Start Redis manually
redis-server
Step 2: Test Connection Locally
# Test basic connection
redis-cli ping
# Test specific host/port
redis-cli -h localhost -p 6379 ping
# Expected response: PONG
Step 3: Check Network Connectivity
From Redis Enterprise troubleshooting guide:
# Test network connectivity
ping <redis-server-ip>
# Check DNS resolution
dig <redis-endpoint>
# Test port accessibility
telnet <redis-host> 6379
Step 4: Verify Configuration
Check redis.conf settings:
# Key settings to verify
bind 127.0.0.1 # IP binding
port 6379 # Port number
protected-mode yes # Security mode
Step 5: Check Firewall Rules
# Check iptables (Linux)
iptables -L
# Check ufw status (Ubuntu)
ufw status
# Check firewall (CentOS/RHEL)
firewall-cmd --list-all
π§ Enabling Redis for Singularity Development
Option 1: Local Redis Server
Install Redis locally:
# macOS brew install redis brew services start redis # Ubuntu/Debian sudo apt update sudo apt install redis-server sudo systemctl start redis-server # Windows (using WSL or Docker) docker run -d -p 6379:6379 redis:latestEnable Redis in Singularity:
// Update redis-integration.service.ts const REDIS_CONFIG: RedisConfig = { restApiUrl: 'http://localhost:6379', // Direct Redis connection enabled: true // Enable for local development };
Option 2: Redis REST API Proxy
Set up a REST API proxy for Redis:
# Using redis-rest-api (npm package)
npm install -g redis-rest-api
redis-rest-api --port 8079 --redis-host localhost --redis-port 6379
Option 3: Cloud Redis (Production)
For production use:
- Redis Cloud: Managed Redis service
- AWS ElastiCache: Amazon's Redis service
- Google Cloud Memorystore: Google's Redis service
- Azure Cache for Redis: Microsoft's Redis service
π Common Redis Issues & Solutions
| Issue | Symptom | Solution |
|---|---|---|
| Connection Refused | ERR_CONNECTION_REFUSED |
Start Redis server, check firewall |
| Permission Denied | EACCES or auth errors |
Check Redis AUTH configuration |
| Timeout | Connection hangs | Check network connectivity, increase timeout |
| Memory Issues | OOM errors |
Configure maxmemory, check available RAM |
| Port Conflicts | Address already in use | Change port or stop conflicting service |
π Production Redis Setup
High Availability Configuration
# Redis Cluster setup (3 master nodes)
redis-server --port 7000 --cluster-enabled yes --cluster-config-file nodes-7000.conf
redis-server --port 7001 --cluster-enabled yes --cluster-config-file nodes-7001.conf
redis-server --port 7002 --cluster-enabled yes --cluster-config-file nodes-7002.conf
# Create cluster
redis-cli --cluster create 127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002 --cluster-replicas 0
Security Best Practices
# redis.conf security settings
requirepass your-strong-password
protected-mode yes
bind 127.0.0.1
port 6379
π Debugging Tools
Redis CLI Commands
# Get server info
redis-cli INFO
# Monitor commands in real-time
redis-cli MONITOR
# Check slow queries
redis-cli SLOWLOG GET 10
# Test latency
redis-cli --latency -h <host> -p <port>
Performance Monitoring
# Check memory usage
redis-cli INFO memory
# Check connected clients
redis-cli INFO clients
# Check command statistics
redis-cli INFO commandstats
π― For Singularity Development
Current Recommendation: Keep Redis Disabled
For local Singularity development, keep Redis disabled because:
β
IndexedDB provides all needed functionality
β
No external dependencies required
β
Faster development iteration
β
Offline development capabilities
β
No Redis server maintenance needed
When to Enable Redis
Enable Redis when you need:
- Production caching layer
- Session management across servers
- Real-time analytics
- Pub/Sub messaging
- Distributed locking
π Additional Resources
- Redis Official Documentation
- Redis Enterprise Troubleshooting
- Redis Connection Guide
- Redis Best Practices
π Summary
β
Redis "connection refused" in Singularity is expected behavior
β
Local-first development doesn't require Redis
β
Comprehensive troubleshooting steps provided for production use
β
Clear roadmap for enabling Redis when needed
Your current setup prioritizes local development speed and simplicity - Redis can be added later when scaling to production! π