This guide covers configuration of the RALE distributed consensus and key-value store system. RALE uses file-based configuration with support for runtime updates and environment variable overrides.
File Locations (in order of precedence):
- Command-line specified:
--config /path/to/config - User configuration:
~/.config/rale/raled.conf - System configuration:
/etc/rale/raled.conf - Local configuration:
./raled.conf
RALE uses a simple key-value configuration format:
# Comments start with #
key = value
# Multi-line values use continuation
long_value = line1 \
line2 \
line3
# Environment variables are expanded
data_dir = ${RALE_DATA_DIR:/var/lib/rale}
# Node identification
node_id = 1
node_name = rale-node-01
# Network configuration
bind_ip = 0.0.0.0
rale_port = 7400
dstore_port = 7401
# External addresses (for multi-homed systems)
external_ip = 10.0.1.100
advertise_rale_port = 7400
advertise_dstore_port = 7401
Parameters:
node_id: Unique integer identifier (0-9999)node_name: Human-readable node namebind_ip: Local IP address to bind servicesrale_port: Port for RALE consensus protocoldstore_port: Port for distributed store operationsexternal_ip: Public IP for cluster communicationadvertise_*: Ports advertised to other nodes
# Data directories
data_dir = /var/lib/rale/data
log_dir = /var/lib/rale/logs
state_dir = /var/lib/rale/state
# Database settings
db_sync_mode = full
db_cache_size = 64MB
db_checkpoint_interval = 300
# Log rotation
log_max_size = 100MB
log_max_files = 10
log_compression = true
Parameters:
data_dir: Directory for DStore data fileslog_dir: Directory for operation logsstate_dir: Directory for RALE state persistencedb_sync_mode: Database synchronization (full,normal,off)db_cache_size: Database cache sizedb_checkpoint_interval: Checkpoint interval in seconds
# Cluster settings
cluster_name = production-cluster
cluster_size = 3
# Initial cluster members
cluster_members = node1:10.0.1.100:7400,node2:10.0.1.101:7400,node3:10.0.1.102:7400
# Join existing cluster
join_cluster = true
bootstrap_nodes = 10.0.1.100:7400,10.0.1.101:7400
Parameters:
cluster_name: Unique cluster identifiercluster_size: Expected cluster size for quorum calculationscluster_members: Static member list (for initial bootstrap)join_cluster: Whether to join existing clusterbootstrap_nodes: Nodes to contact when joining
# RALE consensus parameters
election_timeout_min = 150
election_timeout_max = 300
heartbeat_interval = 50
max_log_entries_per_request = 100
# Leadership settings
leadership_priority = 1
auto_stepdown = true
stepdown_on_partition = true
Parameters:
election_timeout_min/max: Election timeout range (milliseconds)heartbeat_interval: Leader heartbeat interval (milliseconds)max_log_entries_per_request: Batch size for log replicationleadership_priority: Node priority for leader election (1-10)auto_stepdown: Automatically step down when isolated
# Network tuning
tcp_keepalive = true
tcp_keepalive_idle = 60
tcp_keepalive_interval = 10
tcp_keepalive_probes = 3
# Connection management
max_connections = 100
connection_timeout = 30
reconnect_interval = 5
max_reconnect_attempts = 10
# Buffer sizes
send_buffer_size = 64KB
recv_buffer_size = 64KB
max_message_size = 1MB
Parameters:
tcp_keepalive: Enable TCP keepalivetcp_keepalive_*: Keepalive timing parametersmax_connections: Maximum concurrent connectionsconnection_timeout: Connection timeout in secondsreconnect_interval: Reconnection retry interval
# Network security
enable_tls = false
tls_cert_file = /etc/rale/certs/server.crt
tls_key_file = /etc/rale/certs/server.key
tls_ca_file = /etc/rale/certs/ca.crt
# Authentication
require_auth = false
auth_method = none
shared_secret = ""
Parameters:
enable_tls: Enable TLS encryptiontls_cert_file: Server certificate filetls_key_file: Server private key filetls_ca_file: Certificate authority filerequire_auth: Require client authentication
# Logging configuration
log_level = INFO
log_format = structured
log_output = file
# File logging
log_file = /var/log/rale/raled.log
log_file_rotation = daily
log_file_max_size = 100MB
log_file_max_age = 30d
# Syslog integration
syslog_enabled = false
syslog_facility = daemon
syslog_tag = raled
Log Levels:
ERROR: Error conditions onlyWARNING: Warnings and errorsINFO: Informational messages and aboveDEBUG: All messages including debug
Log Formats:
structured: JSON-formatted logsplain: Human-readable plain textcompact: Compact single-line format
# Per-module log levels
log_level_rale = INFO
log_level_dstore = WARNING
log_level_network = ERROR
log_level_cluster = DEBUG
# Log filtering
log_filter_exclude = heartbeat,ping
log_filter_include = election,leadership
# Memory configuration
max_memory_usage = 1GB
cache_size = 256MB
buffer_pool_size = 128MB
# Garbage collection
gc_interval = 300
gc_threshold = 0.8
auto_compact = true
compact_interval = 3600
Parameters:
max_memory_usage: Maximum memory limitcache_size: General cache sizebuffer_pool_size: Network buffer pool sizegc_interval: Cleanup interval in seconds
# I/O configuration
io_threads = 4
disk_sync_mode = normal
write_batch_size = 1000
read_ahead_size = 64KB
# Performance monitoring
enable_metrics = true
metrics_interval = 60
metrics_retention = 24h
Parameters:
io_threads: Number of I/O worker threadsdisk_sync_mode: Disk synchronization modewrite_batch_size: Write batching sizeenable_metrics: Enable performance metrics collection
# Data locations
export RALE_DATA_DIR=/var/lib/rale
export RALE_CONFIG_DIR=/etc/rale
export RALE_LOG_DIR=/var/log/rale
# Network settings
export RALE_BIND_IP=0.0.0.0
export RALE_PORT=7400
export RALE_DSTORE_PORT=7401
# Runtime options
export RALE_LOG_LEVEL=INFO
export RALE_DEBUG=falseEnvironment variables override configuration file values:
# Override any configuration parameter
export RALE_NODE_ID=1
export RALE_CLUSTER_NAME=my-cluster
export RALE_ELECTION_TIMEOUT_MIN=200
# Boolean values
export RALE_ENABLE_TLS=true
export RALE_AUTO_STEPDOWN=false
# List values (comma-separated)
export RALE_BOOTSTRAP_NODES=10.0.1.100:7400,10.0.1.101:7400File: conf/single-node.conf
# Single node development configuration
node_id = 1
node_name = dev-node
bind_ip = 127.0.0.1
rale_port = 7400
dstore_port = 7401
# Local data storage
data_dir = ./data
log_dir = ./logs
state_dir = ./state
# Development settings
log_level = DEBUG
log_output = console
cluster_size = 1
bootstrap_cluster = true
# Fast timeouts for development
election_timeout_min = 50
election_timeout_max = 100
heartbeat_interval = 20
File: conf/cluster-node1.conf
# Node 1 configuration
node_id = 1
node_name = cluster-node-01
bind_ip = 0.0.0.0
external_ip = 10.0.1.100
rale_port = 7400
dstore_port = 7401
# Cluster membership
cluster_name = production
cluster_size = 3
cluster_members = node1:10.0.1.100:7400,node2:10.0.1.101:7400,node3:10.0.1.102:7400
# Production data storage
data_dir = /var/lib/rale/data
log_dir = /var/log/rale
state_dir = /var/lib/rale/state
# Production logging
log_level = INFO
log_file = /var/log/rale/raled.log
log_file_rotation = daily
# Leadership priority (highest)
leadership_priority = 3
File: conf/cluster-node2.conf
# Node 2 configuration
node_id = 2
node_name = cluster-node-02
bind_ip = 0.0.0.0
external_ip = 10.0.1.101
rale_port = 7400
dstore_port = 7401
# Join existing cluster
cluster_name = production
join_cluster = true
bootstrap_nodes = 10.0.1.100:7400
# Production settings
data_dir = /var/lib/rale/data
log_dir = /var/log/rale
state_dir = /var/lib/rale/state
log_level = INFO
log_file = /var/log/rale/raled.log
# Medium leadership priority
leadership_priority = 2
File: conf/high-performance.conf
# High performance cluster node
node_id = 1
node_name = perf-node-01
# Network optimization
tcp_keepalive = true
max_connections = 1000
send_buffer_size = 256KB
recv_buffer_size = 256KB
max_message_size = 4MB
# Memory optimization
max_memory_usage = 4GB
cache_size = 1GB
buffer_pool_size = 512MB
# I/O optimization
io_threads = 8
disk_sync_mode = normal
write_batch_size = 5000
read_ahead_size = 256KB
# Aggressive timeouts
election_timeout_min = 100
election_timeout_max = 200
heartbeat_interval = 25
max_log_entries_per_request = 500
# Performance monitoring
enable_metrics = true
metrics_interval = 30
log_level = WARNING
# View current configuration
ralectrl --socket /tmp/raled.sock GET --key log_level
# Update configuration
ralectrl --socket /tmp/raled.sock SET --key log_level --value DEBUG
# List all configuration
ralectrl --socket /tmp/raled.sock CONFIG#include <librale.h>
/* Update configuration via API */
int result = librale_config_set("log_level", "DEBUG");
if (result != LIBRALE_SUCCESS) {
fprintf(stderr, "Failed to update configuration\n");
}
/* Get configuration value */
char value[256];
result = librale_config_get("log_level", value, sizeof(value));
if (result == LIBRALE_SUCCESS) {
printf("Current log level: %s\n", value);
}# Validate configuration file
raled --config raled.conf --validate
# Check for syntax errors
raled --config raled.conf --check-configThe system validates configuration parameters at startup:
- Node ID: Must be unique integer (0-9999)
- Ports: Must be valid port numbers (1-65535)
- IP Addresses: Must be valid IPv4/IPv6 addresses
- File Paths: Must be accessible directories
- Memory Sizes: Must be valid size specifications (KB, MB, GB)
- Time Values: Must be positive integers with optional units (s, ms)
ERROR: Invalid node_id '999999' - must be 0-9999
ERROR: Invalid port '70000' - must be 1-65535
ERROR: Invalid IP address '300.0.0.1'
ERROR: Directory '/nonexistent' does not exist
ERROR: Invalid memory size 'XYZ' - use format like '64MB'
# Secure configuration files
chmod 640 /etc/rale/*.conf
chown root:rale /etc/rale/*.conf
# Secure data directories
chmod 750 /var/lib/rale
chown rale:rale /var/lib/rale
# Secure log files
chmod 640 /var/log/rale/*.log
chown rale:rale /var/log/rale# Restrict binding (production)
bind_ip = 10.0.1.100 # Specific interface only
# Enable TLS (recommended for production)
enable_tls = true
tls_cert_file = /etc/rale/certs/server.crt
tls_key_file = /etc/rale/certs/server.key
tls_ca_file = /etc/rale/certs/ca.crt
# Authentication
require_auth = true
shared_secret = "your-secure-shared-secret"
# Open required ports
sudo ufw allow 7400/tcp # RALE consensus
sudo ufw allow 7401/tcp # DStore operations
# Restrict access to specific networks
sudo ufw allow from 10.0.1.0/24 to any port 7400
sudo ufw allow from 10.0.1.0/24 to any port 7401Configuration Not Found:
# Check file permissions
ls -la /etc/rale/raled.conf
# Check search paths
strace raled --config test.conf 2>&1 | grep confInvalid Parameters:
# Run validation
raled --config raled.conf --validate
# Check logs for validation errors
journalctl -u rale | grep ERRORNetwork Binding Issues:
# Check port availability
netstat -tulpn | grep 7400
# Test binding
nc -l 7400 # Should succeed if port is free# Enable debug output
export RALE_DEBUG=true
raled --config raled.conf --foreground
# Trace configuration loading
strace -e trace=openat raled --config raled.conf 2>&1 | grep confFor additional configuration help, see the API reference and troubleshooting guides.