Spring Boot的Redis启动报错ERR This instance has cluster support disabled

异常描述

在云服务器部署了一个redis,启动基本上都是默认参数,然后Spring Boot新建项目配置如下:

1
2
3
4
spring:
redis:
cluster:
nodes: 192.168.7.8:6379

在项目启动的时候,报错:

1
2
3
4
2020-12-20 22:14:17.780 [ok-cloud-cache-service][ WARN ] [12543] [nio-8101-exec-1] [f72eec5ef3575e8e] [f72eec5ef3575e8e] [true] --- [io.lettuce.core.cluster.topology.ClusterTopologyRefresh] [getNodeSpecificViews] [216] : Cannot retrieve partition view from RedisURI [host='192.168.7.8', port=6379], error: java.util.concurrent.ExecutionException: io.lettuce.core.RedisCommandExecutionException: ERR This instance has cluster support disabled
2020-12-20 22:14:17.828 [ok-cloud-cache-service][ WARN ] [12543] [nio-8101-exec-1] [f72eec5ef3575e8e] [f72eec5ef3575e8e] [true] --- [io.lettuce.core.cluster.topology.ClusterTopologyRefresh] [getNodeSpecificViews] [216] : Cannot retrieve partition view from RedisURI [host='192.168.7.8', port=6379], error: java.util.concurrent.ExecutionException: io.lettuce.core.RedisCommandExecutionException: ERR This instance has cluster support disabled
2020-12-20 22:14:17.898 [ok-cloud-cache-service][ ERROR] [12543] [nio-8101-exec-1] [f72eec5ef3575e8e] [f72eec5ef3575e8e] [true] --- [me.yezhou.okcloud.common.config.GlobalWebConfig] [handleException] [78] : Url [/ok-cloud/cache/redis/set] occur exception! interface: CacheRedisController.set, summary info: Could not get a resource from the pool; nested exception is io.lettuce.core.RedisException: Cannot retrieve initial cluster partitions from initial URIs [RedisURI [host='192.168.7.8', port=6379]]
org.springframework.data.redis.connection.PoolException: Could not get a resource from the pool; nested exception is io.lettuce.core.RedisException: Cannot retrieve initial cluster partitions from initial URIs [RedisURI [host='192.168.7.8', port=6379]]

异常分析

从报错信息ERR This instance has cluster support disabled很明显看得出来,是没有启动Redis集群功能,可是项目配置的集群方式,要么修改代码为单机配置,要么修改Redis为集群方式。

解决办法

1、可以修改配置为单机redis配置:

1
2
3
4
spring:
redis:
host: 192.168.7.8
port: 6379

2、搭建Redis集群

Powered by AppBlog.CN     浙ICP备14037229号

Copyright © 2012 - 2021 APP开发技术博客 All Rights Reserved.

访客数 : | 访问量 :