Redis配置说明
概览
redis:
type: standalone #:可选值: cluster,sentinel,standalone
config :
type: manual #配置类型,可选的有:manual(手动),rest(rest api配置)
host: 192.168.2.5
port: 6379
password:
maxIdle: 500
maxTotal: 500
maxWaitMillis: -1
手工搭建redis
standalone式配置
如果采用手动配置标准式redis,则核心配置为:
redis:
type: standalone
config:
type: manual
host: 192.168.2.5
port: 6379
password: yourpwd
maxIdle: 500
maxTotal: 500
maxWaitMillis: -1
集群配置
redis:
type: cluster
config:
type: manual
cluster:
nodes: ip1:6379,ip2:6379 #集群节点
password: yourpwd
maxIdle: 500
maxTotal: 500
maxWaitMillis: -1
注:基于swarm式的可伸缩式集群,上述ip只需要配置为所有swarm node的ip即可
哨兵配置
redis:
type: sentinel
config:
type: manual
host: 192.168.2.5
sentinel:
master: mymaster #哨兵master名称
nodes: ip2:6379,ip2:6379 #哨兵节点
port: 6379
password: yourpwd
maxIdle: 500
maxTotal: 500
maxWaitMillis: -1
sohu tv的cache cloud方式 搭建redis
如果采用sohu tv的cache cloud 来管理redis,核心配置 :
redis:
type: standalone
config:
type: rest
restUrl: http://ip:8585 #cache cloud的rest api地址
restAppid: 1000 #cache cloud中的appid
restClientVersion: 1.0-SNAPSHOT #不用变
连接池配置
配置项 | 说明 | 示例 |
---|---|---|
redis.maxIdle | 最大空闲数 | 100 |
redis.maxTotal | 最大连接数 | 100 |
redis.maxWaitMillis | 获取连接时的最大等待毫秒数,-1为不超时 | 1000 |