Notice: 函数 WP_Scripts::localize 的调用方法不正确$l10n 参数必须是一个数组。若要将任意数据传递给脚本,请改用 wp_add_inline_script() 函数。 请查阅调试 WordPress来获取更多信息。 (这个消息是在 5.7.0 版本添加的。) in /data/www/appblog/wp-includes/functions.php on line 6131

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

异常描述

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

spring:
  redis:
    cluster:
      nodes: 192.168.7.8:6379

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

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配置:

spring:
  redis:
    host: 192.168.7.8
    port: 6379

2、搭建Redis集群

上一篇 Redis队列的实现
下一篇 Redis 6 集群安装