Skip to content

Redis Configuration

The redis section configures the Redis connection used for the job queue.

redis:
addr: "localhost:6379"
password: ""
db: 0

Redis server address in host:port format.

PropertyValue
Typestring
Defaultlocalhost:6379
EnvironmentCS_REDIS_ADDR

Examples:

# Local development
addr: "localhost:6379"
# Docker Compose
addr: "redis:6379"
# Custom port
addr: "redis.example.com:6380"

Redis password for authentication (if required).

PropertyValue
Typestring
Default"" (no password)
EnvironmentCS_REDIS_PASSWORD

Redis database number to use.

PropertyValue
Typeinteger
Default0
EnvironmentCS_REDIS_DB
Terminal window
CS_REDIS_ADDR="localhost:6379"
CS_REDIS_PASSWORD="secret"
CS_REDIS_DB="0"

Code Search requires Redis 6.0 or later.

For most deployments, Redis default memory settings are sufficient. For large deployments:

Terminal window
# redis.conf
maxmemory 256mb
maxmemory-policy noeviction

Important: Use noeviction policy to prevent job data loss.

Code Search uses Redis for:

  1. Job Queue - Background jobs for indexing, syncing, and replace operations
  2. Job Results - Storing job completion status and errors
  3. Job Progress - Tracking progress of running jobs
Key PatternPurpose
codesearch:jobs:queueJob queue
codesearch:job:*Individual job data
failed to connect to Redis: connection refused
  • Verify Redis is running: redis-cli ping
  • Check host and port are correct
  • Ensure Redis is bound to the correct interface
NOAUTH Authentication required

Set the password in config:

redis:
addr: "redis:6379"
password: "your-password"

Or via environment variable:

Terminal window
CS_REDIS_PASSWORD="your-password"