---
title: "Redis RESP3 Configuration Guide"
---

# Redis RESP3 Configuration Guide

:::caution[What the server actually reads]
The `heliosdb-full` Redis listener is enabled with `--enable-redis` (port `--redis-port`,
default 6379, environment `HELIOSDB_REDIS_PORT`) and binds `--bind-addr`. It has no
config-file section, no TLS and no separate Redis password: clients must send
`AUTH <role> <password>` with a role name from the server's role catalog, and the
password is not verified yet. Keep the listener on loopback or a trusted private
network. Settings on this page that are not listed here are not read by the server.
:::

Comprehensive configuration reference for HeliosDB's Redis protocol support.

## Connection Configuration

### Basic Connection

```python
import redis

# Simple connection
client = redis.Redis(
    host='localhost',
    port=6379,
    protocol=3,  # RESP3
    decode_responses=True
)
```

### Connection Pooling

```python
# 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

```python
# Simple password (AUTH command)
client = redis.Redis(
    host='localhost',
    port=6379,
    password='your_password',
    protocol=3
)
```

### ACL Authentication (Redis 6.0+)

```python
# 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

```python
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

```python
# 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

```python
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

```python
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

```python
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

```python
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

```python
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

```python
# 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

```toml
# 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](https://www.heliosdb.com/docs/full/reference/protocols/redis/readme/) | [COMPATIBILITY.md](https://www.heliosdb.com/docs/full/reference/protocols/redis/compatibility/) | [EXAMPLES.md](https://www.heliosdb.com/docs/full/reference/protocols/redis/examples/)

