Redis配置说明
概览
单机配置
#redis 配置
spring:
redis:
host: ip
port: 6379
password: 123456
database: 14 #redis数据库
timeout: 20000 #读取资源超时时间(毫秒)
connect-timeout: 10000 #连接超时时间(毫秒)
哨兵配置
#redis 哨兵配置
spring:
redis:
password: 123456 #redis主节点密码
sentinel: #哨兵模式
master: mymaster #哨兵节点名称
nodes: ip:host,ip:host,ip:host
password: #哨兵节点的密码
database: 14 #redis数据库
timeout: 20000 #读取资源超时时间(毫秒)
connect-timeout: 10000 #连接超时时间(毫秒)
集群配置
spring:
redis:
password: 123456 #redis点密码
database: 14 #redis数据库
timeout: 20000 #读取资源超时时间(毫秒)
connect-timeout: 10000 #连接超时时间(毫秒)
cluster:
nodes:
- ip:host
- ip:host
- ip:host
- ip:host
- ip:host
- ip:host
refresh:
dynamic-refresh-sources: true #是否开启动态刷新
adaptive: true #是否开启自适应刷新
period: 100ms #刷新周期
连接池配置
spring:
redis:
lettuce: #连接池配置
pool:
enabled: true #是否启用连接池
max-active: 1000 #连接池最大连接数(使用负值表示没有限制)
max-idle: 10 #连接池中的最大空闲连接
min-idle: 5 # 连接池中的最小空闲连接
max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制)