今天我开始在 MacBook Pro 中使用 M1 pro(具有 8 个性能核心和 2 个高效核心)的 spring boot 项目,显示错误:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisson' defined in class path resource [misc/redisson/RedissonConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.redisson.api.Redisson]: Factory method 'redisson' threw exception; nested exception is org.redisson.client.RedisConnectionException: Unable to init enough connections amount! Only 10 of 24 were initialized. Redis server: cruise-redis-master.reddwarf-cache.svc.cer.local/10.108.202.100:6379
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658) ~[spring-beans-5.3.19.jar:5.3.19]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:486) ~[spring-beans-5.3.19.jar:5.3.19]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352) ~[spring-beans-5.3.19.jar:5.3.19]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195) ~[spring-beans-5.3.19.jar:5.3.19]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.3.19.jar:5.3.19]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.19.jar:5.3.19]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.19.jar:5.3.19]
远程 redis 是一个带有 2 个 slaves 的 redis 主服务器。我的 redission 配置如下所示:
package misc.redisson;
import org.redisson.Redisson;
import org.redisson.api.Redisson;
import org.redisson.config.Config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @author dolphin
* @version 1.0
* @date: 2020/9/5 9:50
*/
@Configuration
public class RedissonConfig {
@Value(value = "${spring.redis.host}")
private String redisHost;
@Value(value = "${spring.redis.port:6379}")
private Integer redisPort;
@Value(value = "${spring.redis.timeout:2000}")
private Integer redisTimeOut;
@Value(value = "${spring.redis.password}")
private String redisPwd;
@Bean(name = "redisson")
public Redisson redisson() {
Config config = new Config();
config.useSingleServer()
.setAddress("redis://" + redisHost + ":" + redisPort)
.setPassword(redisPwd)
.setTimeout(redisTimeOut)
.setDatabase(1);
Redisson redisson = Redisson.create(config);
return redisson;
}
}
和 redis 服务器(云中的 2Core 和 8GB 内存)max 客户端配置:
connected_clients
120
cer_connections
0
maxclients
10000
远程服务器是单个 kubernetes 节点,并通过 telepresence 连接本地机器和远程服务器。为什么会发生这种情况?我该怎么做才能解决这个问题?
本站系公益性非盈利分享网址,本文来自用户投稿,不代表码文网立场,如若转载,请注明出处
评论列表(26条)