Redisson 配置文件的3种写法
redisson
Redisson - Easy Redis Java client with features of In-Memory Data Grid. Sync/Async/RxJava/Reactive API. Over 50 Redis based Java objects and services: Set, Multimap, SortedSet, Map, List, Queue, Deque, Semaphore, Lock, AtomicLong, Map Reduce, Bloom filter, Spring Cache, Tomcat, Scheduler, JCache API, Hibernate, RPC, local cache ...
项目地址:https://gitcode.com/gh_mirrors/re/redisson
免费下载资源
·
application.properties
# 应用名称
spring.application.name=demo-schedule
##Redisson配置
spring.redisson.enable=true
#spring.redisson.singleServerConfig
spring.redisson.singleServerConfig.address=redis://10.1.1.1:6789
#没有密码时不要出现,否则会报错
#spring.redisson.singleServerConfig.password=
spring.redisson.singleServerConfig.database=1
spring.redisson.singleServerConfig.threads=0
spring.redisson.singleServerConfig.nettyThreads=0
spring.redisson.singleServerConfig.codec=!<org.redisson.codec.FstCodec> {}
spring.redisson.singleServerConfig.transportMode="NIO"
application.yml
优点:可以用环境变量进行注入
application.yml
spring:
application:
# 应用名称
name: demo-schedule
##Redisson配置 spring.redisson.singleServerConfig
redis:
redisson:
config: |
singleServerConfig:
address: "redis://10.252.51.13:31379"
database: 1
password:
# 配置看门狗的默认超时时间为30s,这里改为 10s
lockWatchdogTimeout: 10000
application.yml+redisson.yml
application.yml
spring:
application:
# 应用名称
name: demo-schedule
##Redisson配置 spring.redisson.singleServerConfig
redis:
redisson:
# 参考 https://zhuanlan.zhihu.com/p/380530036
file: classpath:redisson.yml
redisson.yml
# 单节点配置
singleServerConfig:
# 连接空闲超时,单位:毫秒
idleConnectionTimeout: 10000
# 连接超时,单位:毫秒
connectTimeout: 10000
# 命令等待超时,单位:毫秒
timeout: 3000
# 命令失败重试次数,如果尝试达到 retryAttempts(命令失败重试次数) 仍然不能将命令发送至某个指定的节点时,将抛出错误。
# 如果尝试在此限制之内发送成功,则开始启用 timeout(命令等待超时) 计时。
retryAttempts: 3
# 命令重试发送时间间隔,单位:毫秒
retryInterval: 1500
# 密码,没有设置密码时,需要注释掉,否则会报错
# password: redis.shbeta
# 单个连接最大订阅数量
subscriptionsPerConnection: 5
# 客户端名称
clientName: "axin"
# 节点地址
address: "redis://10.1.1.1:6789"
# 发布和订阅连接的最小空闲连接数
subscriptionConnectionMinimumIdleSize: 1
# 发布和订阅连接池大小
subscriptionConnectionPoolSize: 50
# 最小空闲连接数
connectionMinimumIdleSize: 32
# 连接池大小
connectionPoolSize: 64
# 数据库编号
database: 1
# DNS监测时间间隔,单位:毫秒
dnsMonitoringInterval: 5000
# 线程池数量,默认值: 当前处理核数量 * 2
threads: 0
# Netty线程池数量,默认值: 当前处理核数量 * 2
nettyThreads: 0
# 编码
codec: !<org.redisson.codec.JsonJacksonCodec> {}
# 传输模式
transportMode : "NIO"
# 配置看门狗的默认超时时间为30s,这里改为 10s
lockWatchdogTimeout: 10000
GitHub 加速计划 / re / redisson
23.06 K
5.31 K
下载
Redisson - Easy Redis Java client with features of In-Memory Data Grid. Sync/Async/RxJava/Reactive API. Over 50 Redis based Java objects and services: Set, Multimap, SortedSet, Map, List, Queue, Deque, Semaphore, Lock, AtomicLong, Map Reduce, Bloom filter, Spring Cache, Tomcat, Scheduler, JCache API, Hibernate, RPC, local cache ...
最近提交(Master分支:2 个月前 )
15bd94ed - 3 个月前
d220f2a8 - 3 个月前
更多推荐
已为社区贡献1条内容
所有评论(0)