Springboot Data Redis Properties¶
Redis Properties Overview¶
# Select Redis database index (0-15)
spring.redis.database=0
# Redis connection URL (format: redis://[user:password@]host:port[/database])
spring.redis.url=146.56.223.148:6379
# Redis server host address
spring.redis.host=146.56.223.148
# Redis server port
spring.redis.port=6379
# Redis username (Redis 6+ ACL)
spring.redis.username=default
# Redis access password (quotes required for special characters)
spring.redis.password=#pwd@redis
# Command execution timeout in milliseconds
spring.redis.timeout=2000
# Connection establishment timeout in milliseconds
spring.redis.connect-timeout=5000
# Client name identifier (for server-side monitoring)
spring.redis.client-name=""
# Client implementation type (jedis/lettuce)
spring.redis.client-type=jedis
# Enable SSL encrypted connection
spring.redis.ssl=false
# Custom Configuration
# Validate connection when borrowing from pool
spring.redis.test-on-borrow=true
# Sentinel
# Master node name in Sentinel mode
spring.redis.sentinel.master=mymaster
# Sentinel node addresses (host:port, comma-separated)
spring.redis.sentinel.nodes=127.0.0.1:26379,127.0.0.2:26379,127.0.0.3:26379
# Cluster
# Maximum number of redirects to follow when executing commands.
spring.redis.cluster.max-redirects=3
# Initial cluster node addresses (host:port, comma-separated)
spring.redis.cluster.nodes=127.0.0.1:6379,127.0.0.2:6379,127.0.0.3:6379
# Jedis Pool
# Enable Jedis connection pool
spring.redis.jedis.pool.enabled=true
# Maximum active connections in pool
spring.redis.jedis.pool.max-active=20
# Maximum idle connections in pool
spring.redis.jedis.pool.max-idle=10
# Minimum idle connections in pool
spring.redis.jedis.pool.min-idle=2
# Max wait time to get a connection (ms)
spring.redis.jedis.pool.max-wait=1000ms
# Lettuce
# Lettuce shutdown timeout
spring.redis.lettuce.shutdown-timeout=100ms
# Lettuce Pool (Optional)
# Enable Lettuce connection pool
spring.redis.lettuce.pool.enabled=true
# Maximum active connections in pool
spring.redis.lettuce.pool.max-active=20
# Maximum idle connections in pool
spring.redis.lettuce.pool.max-idle=10
# Minimum idle connections in pool
spring.redis.lettuce.pool.min-idle=2
# Max wait time to get a connection (ms)
spring.redis.lettuce.pool.max-wait=1000ms
# Lettuce cluster topology refresh configuration
# Enable adaptive cluster topology refresh
spring.redis.lettuce.cluster.refresh.adaptive=true
# Periodic cluster topology refresh interval
spring.redis.lettuce.cluster.refresh.period=30s
Key Attributes¶
url¶
format:redis://[user:password@]host:port[/database]
If a url
is used, the host
and port
will be ignored.
username¶
Redis server login username.
Redis 6+ supports ACL and can configure usernames; If ACL is not enabled, it is usually 'default'.
timeout
and connect-timeout
¶
timeout
: Command execution timeout in milliseconds.connect-timeout
: Connection establishment timeout in milliseconds
If connect-timeout
is not configured, then connect-timeout
and timeout
will be consistent.