Configuration
Overview
Redix is highly configurable through convars in the server.cfg file. All Redix convars begin with the redix: prefix.
Essential Convars
These are the minimum settings required to run Redix.
Prop
Type
Examples
set redix:host "127.0.0.1"
set redix:port "6379"
set redix:password "MySecurePassword123"
set redix:db "0"
set redix:locale "en"Security
In production, always use a strong password for Redis, especially if exposed on a network.
Advanced Connection Convars
These settings control Redis connection behavior.
Prop
Type
Examples
set redix:username "redix_user"
set redix:family "4"
set redix:connectTimeout "10000"
set redix:keepAlive "30000"
set redix:lazyConnect "false"
set redix:retryEnabled "true"
set redix:maxRetries "3"Redis 6.0 introduced Access Control Lists that allow creating users with specific permissions. If using Redis 5 or earlier, leave username empty.
A lower keepAlive value keeps the connection more active but generates more traffic. Useful if you have issues with connections closing.
Logging Convars
Control what gets logged to the server console.
Prop
Type
Examples
set redix:logging "true"
set redix:logErrors "true"
set redix:logConnections "false"Disabling logErrors is not recommended in production as it makes debugging problems difficult.
Testing Convars
Useful for development and debugging.
Prop
Type
Examples
set redix:testOnStartup "false"
set redix:testOnStartup "true"Enabling tests on startup is useful during development to verify that all operations work correctly. In production, it is better to leave it disabled to speed up startup.
Predefined Configurations
Here are some common configurations for different scenarios.
Local Development Configuration
Ideal for testing Redix on your local machine.
# Simple local connection
set redix:host "127.0.0.1"
set redix:port "6379"
set redix:db "0"
set redix:locale "en"
# Testing and debugging
set redix:testOnStartup "true"
set redix:logging "true"
set redix:logErrors "true"
set redix:logConnections "true"
ensure redixBasic Production Configuration
For a production server with local Redix.
# Secure connection
set redix:host "127.0.0.1"
set redix:port "6379"
set redix:password "SecureComplexPassword123!"
set redix:db "0"
# Essential logging
set redix:locale "en"
set redix:logging "true"
set redix:logErrors "true"
set redix:logConnections "false"
# No automatic tests
set redix:testOnStartup "false"
ensure redixRemote Redis Configuration
For connection to Redis on a separate server.
# Remote connection
set redix:host "192.168.1.100"
set redix:port "6379"
set redix:password "SecurePassword"
set redix:db "0"
# Longer timeouts for network
set redix:connectTimeout "15000"
set redix:keepAlive "60000"
# Aggressive retry
set redix:retryEnabled "true"
set redix:maxRetries "5"
# Logging
set redix:locale "en"
set redix:logging "true"
set redix:logErrors "true"
set redix:logConnections "true"
ensure redixHigh Availability Configuration
For critical servers requiring maximum reliability.
# Connection
set redix:host "redis-cluster.example.com"
set redix:port "6379"
set redix:password "SuperSecurePassword456!"
set redix:username "redix_production"
set redix:db "0"
# Robust connection
set redix:connectTimeout "20000"
set redix:keepAlive "30000"
set redix:retryEnabled "true"
set redix:maxRetries "10"
# Complete logging
set redix:locale "en"
set redix:logging "true"
set redix:logErrors "true"
set redix:logConnections "true"
ensure redixMulti-Database Configuration
If you want to separate data by type.
# FiveM Server 1 - Main database
set redix:host "127.0.0.1"
set redix:port "6379"
set redix:db "0"
set redix:locale "en"
ensure redixTo use different databases, create separate instances or change database programmatically:
-- Use database 0 for character data
Redix.Save('char:123', data)
-- Temporarily switch to database 1 for cache
-- Requires direct access to Redis instance
local RedisInstance = Redix.GetInstance()
RedisInstance:select(1)Best Practices
1. Security
# Correct - Strong password
set redix:password "K9$mP2@vN8qL5#wR"
# Wrong - Weak or missing password
set redix:password "password123"
set redix:password ""2. Timeouts
# Correct - Appropriate timeout for local network
set redix:connectTimeout "10000"
# Warning - Timeout too short
set redix:connectTimeout "1000"3. Logging in Production
# Correct - Essential logs in production
set redix:logging "true"
set redix:logErrors "true"
set redix:logConnections "false"
set redix:testOnStartup "false"
# Wrong - Too verbose in production
set redix:logging "true"
set redix:logConnections "true"
set redix:testOnStartup "true"4. Retry Strategy
# Correct - Limited retry
set redix:retryEnabled "true"
set redix:maxRetries "5"
# Warning - Infinite retry
set redix:maxRetries "0"Environment Variables
If you prefer using environment variables instead of convars:
# In docker-compose.yml or startup script
REDIX_HOST=127.0.0.1
REDIX_PORT=6379
REDIX_PASSWORD=SecurePassword
REDIX_DB=0Then in server.cfg:
set redix:host "${REDIX_HOST}"
set redix:port "${REDIX_PORT}"
set redix:password "${REDIX_PASSWORD}"
set redix:db "${REDIX_DB}"Verify Configuration
After modifying the configuration, follow these steps to verify it:
Restart the Server
Restart your FiveM or RedM server to apply the configuration changes.
Check the Logs
Monitor the server console for Redix connection messages. You should see the Redix banner and a successful connection message.
Run a Manual Test
Test the connection with a simple command:
-- In server console or test resource
exports.redix:TestConnection()If everything works, you should see:
[Redix] Test completed successfully
[Redix] All operations work correctlyTroubleshooting
Redix Does Not Connect
Verify in order:
- Are
redix:hostandredix:portcorrect? - Is Redis running?
- Is the password correct?
- Is the firewall blocking the port?
Frequent Timeouts
# Increase timeouts
set redix:connectTimeout "20000"
set redix:maxRetries "10"Too Many Logs
# Reduce verbosity
set redix:logConnections "false"
set redix:testOnStartup "false"With the correct configuration, Redix will be optimized for your specific needs!