有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java Redis sentinel使用spring boot设置

我有一个主设备和两个从设备上的redis,每台服务器上都有一个sentinel进程在端口26379上运行

我想知道如何将sentinel配置为master,以便在应用程序中添加以下内容。属性文件

spring.redis.sentinel.master=
spring.redis.sentinel.nodes=

我有redis server 2.8.19和spring boot 1.3.4,spring data redis 1.6.4 JAR


共 (1) 个答案

  1. # 1 楼答案

    根据Add support for Redis Sentinel Configuration GitHub request

    Spring Data Redis 1.4.0 will introduce redis Sentinel support. Sentinels can be configured using RedisSentinelConfiguration. When applied to RedisConnectionFactory the sentinel configuration will be used to determine current master node an perform failover in case a new master is elected.

    Added new config properties to RedisProperties:

    spring.redis.sentinel.master=mymaster #name of redis server
    spring.redis.sentinel.nodes=127.0.0.1:26379,127.0.0.1:26380 #deliminated list of sentinels.
    

    我希望这能帮助你