Redis is an open-source, in-memory data structure store used as a database, cache, message broker, and streaming engine. It’s known for exceptional performance and versatility.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/dokploy/dokploy/llms.txt
Use this file to discover all available pages before exploring further.
Creating a Redis Database
Navigate to Databases
In your Dokploy dashboard, select your environment and click Add Database > Redis.
Configure Basic Settings
Provide the required information:
- Name: Display name for your Redis instance
- App Name: Internal DNS name (e.g.,
redis-cache) - Description: Optional notes about usage
- Docker Image: Redis version (default:
redis:8)
Set Password
Configure Redis authentication:
Redis uses a single password for authentication. All clients must provide this password.
Connection Information
- Internal Connection
- External Connection
- Application Clients
Applications in the same environment connect via internal DNS:Connection String Examples:
Configuration
Environment Variables
Customize Redis behavior:Resource Allocation
Redis resource recommendations:| Use Case | Memory Reservation | Memory Limit | CPU Reservation | CPU Limit |
|---|---|---|---|---|
| Session Store | 128MB | 256MB | 0.1 | 0.25 |
| Cache (Small) | 256MB | 512MB | 0.25 | 0.5 |
| Cache (Medium) | 512MB | 1GB | 0.5 | 1.0 |
| Cache (Large) | 1GB | 2GB | 1.0 | 2.0 |
| Message Queue | 512MB | 2GB | 0.5 | 1.0 |
Redis stores all data in memory. Set memory limits appropriately based on your dataset size.
Docker Image Versions
Redis version options:Database Operations
Lifecycle Management
- Start/Stop
- Reload
- Rebuild
Control Redis availability:Start:
- Status:
done - Accepts connections
- Loads persisted data
- Status:
idle - Saves data to disk
- Closes all connections
- No resource usage
Volume Management
Redis stores persistent data in a Docker volume:- RDB snapshots (
dump.rdb) - AOF files (
appendonly.aof) - Configuration backups
Redis persistence is optional. Configure RDB and/or AOF based on your durability requirements.
Persistence Options
RDB (Redis Database)
Point-in-time snapshots:- Compact single file
- Fast restart
- Good for backups
- Data loss between snapshots
- Fork may use 2x memory
AOF (Append Only File)
Logs every write operation:- Minimal data loss
- Append-only (safer)
- Auto-rewrite when large
- Larger file size
- Slower restart
- Small performance impact
Recommendation
For production, use both:Advanced Configuration
Custom Startup Options
Command:Health Check Configuration
Restart Policy
Common Use Cases
- Session Store
- Application Cache
- Message Queue
- Rate Limiting
Store user sessions:No persistence needed - sessions can be recreated.
Memory Policies
Configure eviction when memory limit is reached:| Policy | Description | Use Case |
|---|---|---|
noeviction | Return errors when memory full | Message queues |
allkeys-lru | Evict least recently used keys | General cache |
allkeys-lfu | Evict least frequently used keys | Frequency-based cache |
volatile-lru | Evict LRU keys with expiration | Mixed workload |
volatile-ttl | Evict keys with shortest TTL | Time-sensitive data |
allkeys-random | Evict random keys | Uniform importance |
Monitoring and Logs
View Redis logs:- Open your Redis service
- Navigate to Logs tab
- Monitor operations and errors
Redis CLI Commands
Useful commands for administration:Troubleshooting
Cannot connect
Cannot connect
Connection troubleshooting:
- Verify host: Use app name internally
- Check port: 6379 internal, custom external
- Test password: Ensure correct password
- Database status: Must be
done
Out of memory
Out of memory
Redis hitting memory limits:
-
Check current usage:
-
Solutions:
- Increase memory limit
- Enable eviction:
- Set expiration on keys:
- Clear unused data:
Slow performance
Slow performance
Performance optimization:
-
Check slow log:
- Avoid KEYS command: Use SCAN instead
-
Optimize data structures:
- Use hashes for objects
- Use sets for unique items
- Use sorted sets for rankings
- Enable pipelining in your client
- Increase memory if heavily evicting
Data loss after restart
Data loss after restart
Persistence not configured:
-
Enable RDB snapshots:
-
Enable AOF:
-
Manual save:
- Verify persistence files exist in volume
Best Practices
Security
- Strong password: Use complex passwords
- Rename dangerous commands:
- Limit external access: Only expose when necessary
- Use firewall rules: Restrict IP access
Performance
- Set expiration: Use TTL on temporary data
- Choose right data structures: Optimize for your use case
- Use pipelining: Batch commands together
- Monitor memory: Track usage and evictions
- Avoid blocking commands: Use SCAN not KEYS
Reliability
- Configure persistence: Based on durability needs
- Monitor logs: Check for warnings
- Set memory limits: Prevent OOM
- Regular backups: Copy RDB/AOF files
- Test recovery: Practice restore procedures
Redis Commander
Use Redis Commander for web-based management:http://localhost:8081
Next Steps
Database Backups
Redis doesn’t use standard backups - configure persistence instead
PostgreSQL
Deploy a PostgreSQL database