如何解决RedisStaticMasterReplicaConfiguration不支持发布/订阅,因为缺少在各个服务器之间传播的发布/订阅消息
我想将select
id,max(case when rn = 1 then value end) value1,max(case when rn = 2 then value end) value2,max(case when rn = 3 then value end) value3
from (
select id,value,row_number() over(partition by id order by value) rn
from mytable
) t
group by id
应用于我的spring-session-data-redis
项目。
但打印了日志spring boot
例外消息为Connection failure occurred. Restarting subscription task after 5000 ms
我的redis配置是
Pub/Sub connections not supported with Master/Replica configurations
在public LettuceConnectionFactory lettuceConnectionFactory() {
RedisStaticMasterReplicaConfiguration configuration = new RedisStaticMasterReplicaConfiguration(
MASTER_HOST,MASTER_PORT);
configuration.addNode(SLAVE_HOST,SLAVE_PORT);
LettuceClientConfiguration clientConfig =
LettuceClientConfiguration.builder().readFrom(ReadFrom.REPLICA_PREFERRED).build();
return new LettuceConnectionFactory(configuration,clientConfig);
}
环境中开发。
我的redis环境是写到主数据库,从副本中读取
因此,我们根据以下文档应用了aws
。
对于通过INFO报告非公共地址的环境 命令(例如,使用AWS时),请使用 RedisStaticMasterReplicaConfiguration代替 RedisStandaloneConfiguration。
但是,根据下面的文档,它不支持RedisStaticMasterReplicaConfiguration
。
请注意,RedisStaticMasterReplicaConfiguration不会 由于缺少发布之间的发布/订阅消息传播,因此支持发布/订阅 单个服务器。
有什么好主意吗?
奇怪的是
打印日志Pub/Sub
但是,它运行良好。(在Connection failure occurred. Restarting subscription task after 5000 ms
中保存并选择会话)
其他信息:
以此尝试连接redis
。
Pub/Sub
org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。