Skip to content

Redis RESP3 Configuration Guide

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

ParameterTypeDefaultDescription
hoststringlocalhostServer hostname
portint6379Redis protocol port
protocolint3RESP version (2 or 3)
passwordstringNoneAuthentication password
usernamestringdefaultACL username
dbint0Database number
decode_responsesboolFalseAuto-decode bytes to str
socket_timeoutfloatNoneSocket timeout (seconds)
socket_connect_timeoutfloatNoneConnection timeout
retry_on_timeoutboolFalseRetry 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

ParameterTypeDefaultDescription
sslboolFalseEnable TLS
ssl_certfilestringNoneClient certificate path
ssl_keyfilestringNoneClient key path
ssl_ca_certsstringNoneCA certificate path
ssl_check_hostnameboolFalseVerify hostname
ssl_cert_reqsstringrequiredCertificate 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

ParameterTypeDefaultDescription
max_connectionsint10Maximum pool connections
timeoutfloat20Pool wait timeout
retry_on_errorlist[]Exception types to retry
health_check_intervalint0Connection 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'
)

Performance Tuning

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

VariableDescription
HELIOSDB_REDIS_PORTRedis protocol port
HELIOSDB_REDIS_PASSWORDAuthentication password
HELIOSDB_REDIS_MAX_CONNECTIONSMaximum connections
HELIOSDB_REDIS_TLS_ENABLEDEnable TLS (true/false)

Related: README.md | COMPATIBILITY.md | EXAMPLES.md

Last Updated: December 2025