草庐IT

spring-boot - 使用 spring boot 连接被拒绝的 redis master slave

我在端口3824(主)和3825(从)上设置了一个主从。但是,当我关闭master时,读取操作给出了连接被拒绝的异常。下面是我的配置。我怎么能保证即使我杀了master,我仍然在从slave读取。我哪里错了。@BeanpublicRedisConnectionFactoryredisFactory(){LettuceClientConfigurationconfig=LettuceClientConfiguration.builder().readFrom(ReadFrom.SLAVE_PREFERRED).buld();RedisStandaloneConfigurationserv

spring - 在 Spring Boot 中理解 Redis

我有一个SpringBoot应用程序,我需要在应用程序初始化时从表中获取数据。我有一个包含以下代码的存储库:@RepositorypublicinterfaceBookepositoryextendsJpaRepository{ProveedorfindByName(Stringname);@Cacheable("books")ListfindAll();}然后从我的服务:@ServicepublicclassServiceBooks{publicvoidfindAll(){booksRepo.findAll();}publicvoidfindByName(Stringname){bo

spring-boot - 在 Docker 容器中运行的 SpringBoot 应用无法连接到同一台机器上托管的 Redis

我在同一台物理机上安装了Redis和Docker。我正在尝试运行一个Docker容器,其中包含一个需要连接到Redis的SpringBoot应用程序。应用程序启动失败,出现以下错误:2019-08-2812:25:16.858ERROR6---[main]o.s.boot.SpringApplication:Applicationrunfailedorg.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'enableRedisKeyspaceNotificationsInitial

java - spring boot redis starter 获取错误字符串超出最大允许大小 (512MB)

我试图将redis与springboot集成,并且我正在使用springbootredisstater依赖项。我按照springboot官方指南进行配置:#redisspring.redis.database=1spring.redis.host=127.0.0.1spring.redis.password=spring.redis.port=6379spring.redis.pool.max-idle=8spring.redis.pool.min-idle=0spring.redis.pool.max-active=8spring.redis.pool.max-wait=-1redi

并行的Spring Boot多个缓存管理器

我有一个SpringBootWeb应用程序,并将springsession与redis存储一起使用。Web请求有时需要缓存它们的响应(以避免不必要的数据库访问),我计划使用Caffeine。然而,Redis似乎接管了(只要我包含gradle依赖项)作为缓存实现,因为我为Caffeine设置的所有TTL都被忽略了。是否可以/推荐在SpringBoot应用程序中使用超过1个缓存提供程序?我可以尝试将Redis用于所有缓存,只是担心它会影响SpringBoot附带的session实现(我没有配置任何东西,只是使用了@EnableRedisHttpSession)。我很感激任何关于这方面的建议

java - 无法在 Spring Boot 中使用 Redis 确定数据库类型 NONE 的嵌入式数据库驱动程序类

我使用SpringBoot和Redis。我添加了pom.xml:org.springframework.bootspring-boot-starter-redisorg.springframework.dataspring-data-redisorg.springframework.bootspring-boot-starter-data-jpa并创建了包含Beans的RedisConfig类JedisConnectionFactoryjedisConnectionFactory和RedisTemplateredisTemplate().当我运行应用程序时,出现错误:*********

spring-boot - 连接redis和lettuce客户端时出现内存泄漏错误

我正在使用lettuce连接到redis:spring-boot-starter-redis:2.0.6.RELEASE,当我启动应用程序时出现此错误:[ERROR][main][ResourceLeakDetector][error]-LEAK:HashedWheelTimer.release()wasnotcalledbeforeit'sgarbage-collected.Seehttp://netty.io/wiki/reference-counted-objects.htmlformoreinformation.Recentaccessrecords:Createdat:io.

java - 内存中存储和处理大型数据列表 Spring Boot 2 java

我有一个应用程序可以处理大型内存数据列表。目前我使用如下单例数据缓存结构:publicclassDataCache{privatefinalMap>>arraysMap=newHashMap();privatefinalMap>integerMap=newHashMap();privatefinalMap>stringMap=newHashMap();privatefinalMap>arraysMap=newHashMap();/***Mapforbooleanlocksusedtotemporalydisable*editionwhilethedatachanges.*/privat

spring-boot - redissonClient.poll() 只返回String类型值的前8个字符

目前正在使用reddison,创建一个redissonClient并尝试从redis服务器轮询数据。如果我通过redis-cli检查,我可以在redis数据库中看到数据,但是当我在我的java应用程序中查看字符串值时,它始终是字符串的前8个字符,仅此而已。不确定为什么它不能给我全部值(value)。我也尝试过使用.peek()方法,但我看到了相同的症状,即我只得到返回字符串的8个字符。这是代码的主要部分,我可以根据需要提供更多详细信息:@Service@Slf4jpublicclassRedisConsumer{RedisConfigredisConfig;//RQueueredisQ

java - Spring Boot 中的 Redis,保留 redis 模板

我有一个项目的问题。我正在使用spring和redis创建一个非常原始的聊天程序。我将redis连接作为SpringBean:privateHashOperationshashOps;@AutowiredpublicUserRepositoryImpl(RedisTemplateredisTemplate){this.redisTemplate=redisTemplate;}@PostConstructprivatevoidinit(){hashOps=redisTemplate.opsForHash();}到这里一切似乎都正常,散列被声明为模板。但是现在我打电话publicboole