Skip to content

HeliosProxy Configuration Reference

HeliosProxy Configuration Reference

Complete reference for all HeliosProxy configuration options.


Configuration File Format

HeliosProxy uses TOML format for configuration files.

Terminal window
heliosdb-proxy --config /path/to/config.toml

Top-Level Options

OptionTypeDefaultDescription
listen_addressstring"0.0.0.0:5432"Address for client connections
admin_addressstring"0.0.0.0:9090"Address for admin API
tr_enabledbooltrueEnable transaction replay
tr_modestring"session"Transaction replay mode
write_timeout_secsu6430Write timeout during failover

Transaction Replay Modes (tr_mode)

ModeDescription
noneNo transaction replay
sessionRe-establish session only
selectRe-execute SELECT queries
transactionFull transaction replay

Pool Mode Configuration ([pool_mode])

Controls connection pooling behavior.

[pool_mode]
mode = "transaction"
max_pool_size = 100
min_idle = 10
idle_timeout_secs = 600
max_lifetime_secs = 3600
acquire_timeout_secs = 5
reset_query = "DISCARD ALL"
prepared_statement_mode = "track"
OptionTypeDefaultDescription
modestring"session"Pooling mode: session, transaction, statement
max_pool_sizeu32100Maximum connections per node
min_idleu3210Minimum idle connections
idle_timeout_secsu64600Idle connection timeout
max_lifetime_secsu643600Maximum connection lifetime
acquire_timeout_secsu645Connection acquire timeout
reset_querystring"DISCARD ALL"Query to reset connection state
prepared_statement_modestring"disable"Prepared statement handling

Pooling Modes

ModeConnection ReturnsBest For
sessionOn client disconnectLegacy apps, prepared statements
transactionAfter COMMIT/ROLLBACKWeb apps, microservices
statementAfter each statementSimple queries, high concurrency

Prepared Statement Modes

ModeBehavior
disableNo prepared statement support (safest)
trackTrack and recreate on new connections
namedUse protocol-level named statements

Connection Pool Configuration ([pool])

Basic connection pool settings.

[pool]
min_connections = 2
max_connections = 100
idle_timeout_secs = 300
max_lifetime_secs = 1800
acquire_timeout_secs = 30
test_on_acquire = true
OptionTypeDefaultDescription
min_connectionsusize2Minimum connections per node
max_connectionsusize100Maximum connections per node
idle_timeout_secsu64300Idle connection timeout
max_lifetime_secsu641800Maximum connection lifetime
acquire_timeout_secsu6430Connection acquire timeout
test_on_acquirebooltrueTest connection before use

Load Balancer Configuration ([load_balancer])

Controls query routing to backend nodes.

[load_balancer]
read_strategy = "round_robin"
read_write_split = true
latency_threshold_ms = 100
OptionTypeDefaultDescription
read_strategystring"round_robin"Read query routing strategy
read_write_splitbooltrueEnable read/write splitting
latency_threshold_msu64100Latency threshold for unhealthy

Routing Strategies (read_strategy)

StrategyDescription
round_robinRotate through nodes equally
weighted_round_robinRotate based on node weights
least_connectionsRoute to least loaded node
latency_basedRoute to lowest latency node
randomRandom node selection

Health Check Configuration ([health])

Backend health monitoring.

[health]
check_interval_secs = 5
check_timeout_secs = 3
failure_threshold = 3
success_threshold = 2
check_query = "SELECT 1"
OptionTypeDefaultDescription
check_interval_secsu645Health check interval
check_timeout_secsu643Health check timeout
failure_thresholdu323Failures before unhealthy
success_thresholdu322Successes before healthy
check_querystring"SELECT 1"Health check query

Node Configuration ([[nodes]])

Backend node definitions. Use [[nodes]] for each node.

[[nodes]]
host = "primary.example.com"
port = 5432
http_port = 8080
role = "primary"
weight = 100
enabled = true
name = "primary-1"
[[nodes]]
host = "standby-1.example.com"
port = 5432
role = "standby"
weight = 50
[[nodes]]
host = "replica-1.example.com"
port = 5432
role = "replica"
weight = 25
OptionTypeDefaultDescription
hoststringrequiredNode hostname or IP
portu16requiredPostgreSQL port
http_portu168080HTTP admin port
rolestringrequiredNode role
weightu32100Load balancing weight
enabledbooltrueNode is active
namestringoptionalHuman-readable name

Node Roles

RoleDescription
primaryRead/write node (required)
standbySynchronous standby
replicaRead-only replica

TLS Configuration ([tls])

Optional TLS settings for client connections.

[tls]
enabled = true
cert_path = "/path/to/cert.pem"
key_path = "/path/to/key.pem"
ca_path = "/path/to/ca.pem"
require_client_cert = false
OptionTypeDefaultDescription
enabledboolfalseEnable TLS
cert_pathstringrequiredServer certificate path
key_pathstringrequiredServer key path
ca_pathstringoptionalCA certificate for client auth
require_client_certboolfalseRequire client certificates

Complete Example

# HeliosProxy Configuration
# Full example with all options
listen_address = "0.0.0.0:5433"
admin_address = "0.0.0.0:9090"
tr_enabled = true
tr_mode = "session"
write_timeout_secs = 30
# Connection pooling mode
[pool_mode]
mode = "transaction"
max_pool_size = 100
min_idle = 10
idle_timeout_secs = 600
max_lifetime_secs = 3600
acquire_timeout_secs = 5
reset_query = "DISCARD ALL"
prepared_statement_mode = "track"
# Basic pool settings
[pool]
min_connections = 5
max_connections = 100
idle_timeout_secs = 300
max_lifetime_secs = 1800
acquire_timeout_secs = 30
test_on_acquire = true
# Load balancing
[load_balancer]
read_strategy = "least_connections"
read_write_split = true
latency_threshold_ms = 50
# Health checks
[health]
check_interval_secs = 5
check_timeout_secs = 3
failure_threshold = 3
success_threshold = 2
check_query = "SELECT 1"
# Primary node
[[nodes]]
host = "db-primary.internal"
port = 5432
http_port = 8080
role = "primary"
weight = 100
enabled = true
name = "primary"
# Standby node (sync replication)
[[nodes]]
host = "db-standby-1.internal"
port = 5432
http_port = 8080
role = "standby"
weight = 100
enabled = true
name = "standby-1"
# Read replica
[[nodes]]
host = "db-replica-1.internal"
port = 5432
http_port = 8080
role = "replica"
weight = 50
enabled = true
name = "replica-1"
# TLS (optional)
[tls]
enabled = false
# cert_path = "/etc/heliosproxy/server.crt"
# key_path = "/etc/heliosproxy/server.key"

Environment Variable Overrides

Configuration values can be overridden with environment variables:

Terminal window
HELIOS_PROXY_LISTEN_ADDRESS=0.0.0.0:5433
HELIOS_PROXY_ADMIN_ADDRESS=0.0.0.0:9090
HELIOS_PROXY_POOL_MODE=transaction
HELIOS_PROXY_MAX_POOL_SIZE=200

Configuration Validation

The proxy validates configuration on startup:

  1. At least one node must be configured
  2. A primary node must exist
  3. max_connections must be >= min_connections
  4. All required fields must be present

Invalid configurations will prevent startup with a descriptive error message.


Admin API Endpoints

The admin API provides runtime information and management.

EndpointMethodDescription
/healthGETProxy health status
/pool/statsGETConnection pool statistics
/nodesGETBackend node status
/nodes/{name}/enablePOSTEnable a node
/nodes/{name}/disablePOSTDisable a node
/configGETCurrent configuration
/metricsGETPrometheus metrics

Pool Stats Response

{
"mode": "transaction",
"total_connections": 50,
"active_leases": 12,
"idle_connections": 38,
"waiting_requests": 0,
"connections_created": 1234,
"connections_closed": 1184
}

Node Status Response

{
"nodes": [
{
"name": "primary",
"host": "db-primary.internal",
"port": 5432,
"role": "primary",
"healthy": true,
"active_connections": 15,
"latency_ms": 0.5
}
]
}

See Also