Redis RESP3 Configuration Guide
Comprehensive configuration reference for HeliosDB's Redis protocol support.
Connection Configuration
Basic Connection
import redis
# Simple connection
client = redis.Redis(
host='localhost',
port=6379,
protocol=3, # RESP3
decode_responses=True
)
Connection Pooling
# Connection pool with multiple connections
pool = redis.ConnectionPool(
host='localhost',
port=6379,
max_connections=50,
protocol=3,
socket_keepalive=True,
socket_keepalive_options={
1: 3, # TCP_KEEPIDLE - idle time
2: 3, # TCP_KEEPINTVL - interval
3: 3 # TCP_KEEPCNT - max probes
}
)
client = redis.Redis(connection_pool=pool)
Connection Parameters
| Parameter |
Type |
Default |
Description |
host |
string |
localhost |
Server hostname |
port |
int |
6379 |
Redis protocol port |
protocol |
int |
3 |
RESP version (2 or 3) |
password |
string |
None |
Authentication password |
username |
string |
default |
ACL username |
db |
int |
0 |
Database number |
decode_responses |
bool |
False |
Auto-decode bytes to str |
socket_timeout |
float |
None |
Socket timeout (seconds) |
socket_connect_timeout |
float |
None |
Connection timeout |
retry_on_timeout |
bool |
False |
Retry on timeout |
Authentication
Password Authentication
# Simple password (AUTH command)
client = redis.Redis(
host='localhost',
port=6379,
password='your_password',
protocol=3
)
ACL Authentication (Redis 6.0+)
# Username + password (ACL)
client = redis.Redis(
host='localhost',
port=6379,
username='analytics_user',
password='secure_password',
protocol=3
)
# ACL operations
client.acl_setuser(
'alice',
'>password123',
permissions=['+@all', '~*']
)
client.acl_getuser('alice')
TLS/SSL Configuration
Basic TLS
import redis
import ssl
# TLS connection
client = redis.Redis(
host='localhost',
port=6380,
protocol=3,
ssl=True,
ssl_certfile='/path/to/client.crt',
ssl_keyfile='/path/to/client.key',
ssl_ca_certs='/path/to/ca.crt',
ssl_check_hostname=True
)
Custom SSL Context
# Custom verification context
ssl_context = ssl.create_default_context()
ssl_context.check_hostname = False
ssl_context.verify_mode = ssl.CERT_NONE
client = redis.Redis(
host='localhost',
port=6380,
protocol=3,
ssl_context=ssl_context
)
TLS Parameters
| Parameter |
Type |
Default |
Description |
ssl |
bool |
False |
Enable TLS |
ssl_certfile |
string |
None |
Client certificate path |
ssl_keyfile |
string |
None |
Client key path |
ssl_ca_certs |
string |
None |
CA certificate path |
ssl_check_hostname |
bool |
False |
Verify hostname |
ssl_cert_reqs |
string |
required |
Certificate requirements |
Connection Pool Settings
Pool Configuration
pool = redis.ConnectionPool(
host='localhost',
port=6379,
max_connections=100,
timeout=30,
retry_on_error=[TimeoutError, ConnectionError],
health_check_interval=30
)
Pool Parameters
| Parameter |
Type |
Default |
Description |
max_connections |
int |
10 |
Maximum pool connections |
timeout |
float |
20 |
Pool wait timeout |
retry_on_error |
list |
[] |
Exception types to retry |
health_check_interval |
int |
0 |
Connection health check interval |
Cluster Configuration
Redis Cluster Mode
from redis.cluster import RedisCluster
# Cluster connection
cluster = RedisCluster(
host='localhost',
port=7000,
decode_responses=True
)
# Multiple startup nodes
cluster = RedisCluster(
startup_nodes=[
{'host': 'node1', 'port': 7000},
{'host': 'node2', 'port': 7001},
{'host': 'node3', 'port': 7002}
],
decode_responses=True
)
Sentinel Configuration
High Availability Setup
from redis.sentinel import Sentinel
# Sentinel connection
sentinel = Sentinel([
('sentinel1', 26379),
('sentinel2', 26379),
('sentinel3', 26379)
], socket_timeout=0.5)
# Get master connection
master = sentinel.master_for(
'mymaster',
socket_timeout=0.5,
password='master_password'
)
# Get replica connection
replica = sentinel.slave_for(
'mymaster',
socket_timeout=0.5,
password='replica_password'
)
Socket Options
import socket
pool = redis.ConnectionPool(
host='localhost',
port=6379,
socket_keepalive=True,
socket_keepalive_options={
socket.TCP_KEEPIDLE: 3, # Start keepalive after 3s idle
socket.TCP_KEEPINTVL: 3, # Probe every 3s
socket.TCP_KEEPCNT: 3 # Max 3 probes
}
)
Timeout Configuration
client = redis.Redis(
host='localhost',
port=6379,
socket_timeout=5.0, # Read/write timeout
socket_connect_timeout=2.0, # Connection timeout
retry_on_timeout=True, # Retry on timeout
retry_on_error=[ConnectionError, TimeoutError]
)
Pipeline Configuration
# Batch operations for performance
pipeline = client.pipeline(transaction=False)
for i in range(1000):
pipeline.set(f'key:{i}', f'value:{i}')
pipeline.execute()
HeliosDB-Specific Settings
Server Configuration
# heliosdb.toml
[redis]
enabled = true
port = 6379
bind = "0.0.0.0"
max_connections = 10000
timeout = 300
protocol_version = 3
[redis.auth]
password = "your_secure_password"
acl_enabled = true
acl_file = "/etc/heliosdb/users.acl"
[redis.tls]
enabled = false
cert_file = "/path/to/server.crt"
key_file = "/path/to/server.key"
ca_file = "/path/to/ca.crt"
Environment Variables
| Variable |
Description |
HELIOSDB_REDIS_PORT |
Redis protocol port |
HELIOSDB_REDIS_PASSWORD |
Authentication password |
HELIOSDB_REDIS_MAX_CONNECTIONS |
Maximum connections |
HELIOSDB_REDIS_TLS_ENABLED |
Enable TLS (true/false) |
Related: README.md | COMPATIBILITY.md | EXAMPLES.md
Last Updated: December 2025