mirror of
https://gitee.com/dromara/RuoYi-Cloud-Plus.git
synced 2025-09-07 21:09:33 +00:00
update 优化 redisson 配置 去除掉不常用的配置 使用默认配置
This commit is contained in:
@@ -112,14 +112,8 @@ redisson:
|
|||||||
retryAttempts: 3
|
retryAttempts: 3
|
||||||
# 命令重试发送时间间隔,单位:毫秒
|
# 命令重试发送时间间隔,单位:毫秒
|
||||||
retryInterval: 1500
|
retryInterval: 1500
|
||||||
# 发布和订阅连接的最小空闲连接数
|
|
||||||
subscriptionConnectionMinimumIdleSize: 1
|
|
||||||
# 发布和订阅连接池大小
|
# 发布和订阅连接池大小
|
||||||
subscriptionConnectionPoolSize: 50
|
subscriptionConnectionPoolSize: 50
|
||||||
# 单个连接最大订阅数量
|
|
||||||
subscriptionsPerConnection: 5
|
|
||||||
# DNS监测时间间隔,单位:毫秒
|
|
||||||
dnsMonitoringInterval: 5000
|
|
||||||
# redisson 缓存配置
|
# redisson 缓存配置
|
||||||
cacheGroup:
|
cacheGroup:
|
||||||
# 用例: @Cacheable(cacheNames="groupId", key="#XXX") 方可使用缓存组配置
|
# 用例: @Cacheable(cacheNames="groupId", key="#XXX") 方可使用缓存组配置
|
||||||
|
@@ -13,7 +13,6 @@ import org.redisson.spring.cache.RedissonSpringCacheManager;
|
|||||||
import org.redisson.spring.starter.RedissonAutoConfiguration;
|
import org.redisson.spring.starter.RedissonAutoConfiguration;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
|
||||||
import org.springframework.boot.autoconfigure.data.redis.RedisProperties;
|
import org.springframework.boot.autoconfigure.data.redis.RedisProperties;
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
import org.springframework.cache.CacheManager;
|
import org.springframework.cache.CacheManager;
|
||||||
@@ -21,8 +20,8 @@ import org.springframework.cache.annotation.CachingConfigurerSupport;
|
|||||||
import org.springframework.cache.annotation.EnableCaching;
|
import org.springframework.cache.annotation.EnableCaching;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.Primary;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -49,9 +48,9 @@ public class RedisConfiguration extends CachingConfigurerSupport {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private RedissonProperties redissonProperties;
|
private RedissonProperties redissonProperties;
|
||||||
|
|
||||||
|
@Primary
|
||||||
@Bean(destroyMethod = "shutdown")
|
@Bean(destroyMethod = "shutdown")
|
||||||
@ConditionalOnMissingBean(RedissonClient.class)
|
public RedissonClient redisson() {
|
||||||
public RedissonClient redisson() throws IOException {
|
|
||||||
String prefix = REDIS_PROTOCOL_PREFIX;
|
String prefix = REDIS_PROTOCOL_PREFIX;
|
||||||
if (redisProperties.isSsl()) {
|
if (redisProperties.isSsl()) {
|
||||||
prefix = REDISS_PROTOCOL_PREFIX;
|
prefix = REDISS_PROTOCOL_PREFIX;
|
||||||
@@ -73,14 +72,11 @@ public class RedisConfiguration extends CachingConfigurerSupport {
|
|||||||
.setTimeout(singleServerConfig.getTimeout())
|
.setTimeout(singleServerConfig.getTimeout())
|
||||||
.setRetryAttempts(singleServerConfig.getRetryAttempts())
|
.setRetryAttempts(singleServerConfig.getRetryAttempts())
|
||||||
.setRetryInterval(singleServerConfig.getRetryInterval())
|
.setRetryInterval(singleServerConfig.getRetryInterval())
|
||||||
.setSubscriptionsPerConnection(singleServerConfig.getSubscriptionsPerConnection())
|
|
||||||
.setClientName(singleServerConfig.getClientName())
|
.setClientName(singleServerConfig.getClientName())
|
||||||
.setIdleConnectionTimeout(singleServerConfig.getIdleConnectionTimeout())
|
.setIdleConnectionTimeout(singleServerConfig.getIdleConnectionTimeout())
|
||||||
.setSubscriptionConnectionMinimumIdleSize(singleServerConfig.getSubscriptionConnectionMinimumIdleSize())
|
|
||||||
.setSubscriptionConnectionPoolSize(singleServerConfig.getSubscriptionConnectionPoolSize())
|
.setSubscriptionConnectionPoolSize(singleServerConfig.getSubscriptionConnectionPoolSize())
|
||||||
.setConnectionMinimumIdleSize(singleServerConfig.getConnectionMinimumIdleSize())
|
.setConnectionMinimumIdleSize(singleServerConfig.getConnectionMinimumIdleSize())
|
||||||
.setConnectionPoolSize(singleServerConfig.getConnectionPoolSize())
|
.setConnectionPoolSize(singleServerConfig.getConnectionPoolSize());
|
||||||
.setDnsMonitoringInterval(singleServerConfig.getDnsMonitoringInterval());
|
|
||||||
}
|
}
|
||||||
// 集群配置方式 参考下方注释
|
// 集群配置方式 参考下方注释
|
||||||
RedissonProperties.ClusterServersConfig clusterServersConfig = redissonProperties.getClusterServersConfig();
|
RedissonProperties.ClusterServersConfig clusterServersConfig = redissonProperties.getClusterServersConfig();
|
||||||
@@ -98,19 +94,14 @@ public class RedisConfiguration extends CachingConfigurerSupport {
|
|||||||
.setTimeout(clusterServersConfig.getTimeout())
|
.setTimeout(clusterServersConfig.getTimeout())
|
||||||
.setRetryAttempts(clusterServersConfig.getRetryAttempts())
|
.setRetryAttempts(clusterServersConfig.getRetryAttempts())
|
||||||
.setRetryInterval(clusterServersConfig.getRetryInterval())
|
.setRetryInterval(clusterServersConfig.getRetryInterval())
|
||||||
.setSubscriptionsPerConnection(clusterServersConfig.getSubscriptionsPerConnection())
|
|
||||||
.setClientName(clusterServersConfig.getClientName())
|
.setClientName(clusterServersConfig.getClientName())
|
||||||
.setIdleConnectionTimeout(clusterServersConfig.getIdleConnectionTimeout())
|
.setIdleConnectionTimeout(clusterServersConfig.getIdleConnectionTimeout())
|
||||||
.setPingConnectionInterval(clusterServersConfig.getPingConnectionInterval())
|
.setPingConnectionInterval(clusterServersConfig.getPingConnectionInterval())
|
||||||
.setSubscriptionConnectionMinimumIdleSize(clusterServersConfig.getSubscriptionConnectionMinimumIdleSize())
|
|
||||||
.setSubscriptionConnectionPoolSize(clusterServersConfig.getSubscriptionConnectionPoolSize())
|
.setSubscriptionConnectionPoolSize(clusterServersConfig.getSubscriptionConnectionPoolSize())
|
||||||
.setMasterConnectionMinimumIdleSize(clusterServersConfig.getMasterConnectionMinimumIdleSize())
|
.setMasterConnectionMinimumIdleSize(clusterServersConfig.getMasterConnectionMinimumIdleSize())
|
||||||
.setMasterConnectionPoolSize(clusterServersConfig.getMasterConnectionPoolSize())
|
.setMasterConnectionPoolSize(clusterServersConfig.getMasterConnectionPoolSize())
|
||||||
.setSlaveConnectionMinimumIdleSize(clusterServersConfig.getSlaveConnectionMinimumIdleSize())
|
.setSlaveConnectionMinimumIdleSize(clusterServersConfig.getSlaveConnectionMinimumIdleSize())
|
||||||
.setSlaveConnectionPoolSize(clusterServersConfig.getSlaveConnectionPoolSize())
|
.setSlaveConnectionPoolSize(clusterServersConfig.getSlaveConnectionPoolSize())
|
||||||
.setDnsMonitoringInterval(clusterServersConfig.getDnsMonitoringInterval())
|
|
||||||
.setFailedSlaveReconnectionInterval(clusterServersConfig.getFailedSlaveReconnectionInterval())
|
|
||||||
.setScanInterval(clusterServersConfig.getScanInterval())
|
|
||||||
.setReadMode(clusterServersConfig.getReadMode())
|
.setReadMode(clusterServersConfig.getReadMode())
|
||||||
.setSubscriptionMode(clusterServersConfig.getSubscriptionMode())
|
.setSubscriptionMode(clusterServersConfig.getSubscriptionMode())
|
||||||
.setNodeAddresses(nodes);
|
.setNodeAddresses(nodes);
|
||||||
@@ -182,18 +173,8 @@ public class RedisConfiguration extends CachingConfigurerSupport {
|
|||||||
* retryAttempts: 3
|
* retryAttempts: 3
|
||||||
* # 命令重试发送时间间隔,单位:毫秒
|
* # 命令重试发送时间间隔,单位:毫秒
|
||||||
* retryInterval: 1500
|
* retryInterval: 1500
|
||||||
* # 从可用服务器的内部列表中排除 Redis Slave 重新连接尝试的间隔。
|
|
||||||
* failedSlaveReconnectionInterval: 3000
|
|
||||||
* # 发布和订阅连接池最小空闲连接数
|
|
||||||
* subscriptionConnectionMinimumIdleSize: 1
|
|
||||||
* # 发布和订阅连接池大小
|
* # 发布和订阅连接池大小
|
||||||
* subscriptionConnectionPoolSize: 50
|
* subscriptionConnectionPoolSize: 50
|
||||||
* # 单个连接最大订阅数量
|
|
||||||
* subscriptionsPerConnection: 5
|
|
||||||
* # 扫描间隔
|
|
||||||
* scanInterval: 1000
|
|
||||||
* # DNS监测时间间隔,单位:毫秒
|
|
||||||
* dnsMonitoringInterval: 5000
|
|
||||||
* # 读取模式
|
* # 读取模式
|
||||||
* readMode: "SLAVE"
|
* readMode: "SLAVE"
|
||||||
* # 订阅模式
|
* # 订阅模式
|
||||||
|
@@ -87,26 +87,11 @@ public class RedissonProperties {
|
|||||||
*/
|
*/
|
||||||
private int retryInterval;
|
private int retryInterval;
|
||||||
|
|
||||||
/**
|
|
||||||
* 发布和订阅连接的最小空闲连接数
|
|
||||||
*/
|
|
||||||
private int subscriptionConnectionMinimumIdleSize;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发布和订阅连接池大小
|
* 发布和订阅连接池大小
|
||||||
*/
|
*/
|
||||||
private int subscriptionConnectionPoolSize;
|
private int subscriptionConnectionPoolSize;
|
||||||
|
|
||||||
/**
|
|
||||||
* 单个连接最大订阅数量
|
|
||||||
*/
|
|
||||||
private int subscriptionsPerConnection;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* DNS监测时间间隔,单位:毫秒
|
|
||||||
*/
|
|
||||||
private int dnsMonitoringInterval;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@@ -163,36 +148,11 @@ public class RedissonProperties {
|
|||||||
*/
|
*/
|
||||||
private int retryInterval;
|
private int retryInterval;
|
||||||
|
|
||||||
/**
|
|
||||||
* 错误重试次数
|
|
||||||
*/
|
|
||||||
private int failedSlaveReconnectionInterval;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 发布和订阅连接池最小空闲连接数
|
|
||||||
*/
|
|
||||||
private int subscriptionConnectionMinimumIdleSize;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发布和订阅连接池大小
|
* 发布和订阅连接池大小
|
||||||
*/
|
*/
|
||||||
private int subscriptionConnectionPoolSize;
|
private int subscriptionConnectionPoolSize;
|
||||||
|
|
||||||
/**
|
|
||||||
* 单个连接最大订阅数量
|
|
||||||
*/
|
|
||||||
private int subscriptionsPerConnection;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 扫描间隔
|
|
||||||
*/
|
|
||||||
private int scanInterval;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* DNS监测时间间隔,单位:毫秒
|
|
||||||
*/
|
|
||||||
private int dnsMonitoringInterval;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 读取模式
|
* 读取模式
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user