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:


🎯 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

  1. 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:latest
    
  2. Enable 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:


πŸ“Š 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:


πŸ“š Additional Resources


πŸŽ‰ 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! πŸš€