public class RedisSentinelConfiguration extends Object implements RedisConfiguration, RedisConfiguration.SentinelConfiguration
RedisConnection via RedisConnectionFactory using connecting
to Redis Sentinel(s). Useful when setting up a high availability Redis
environment.RedisConfiguration.ClusterConfiguration, RedisConfiguration.DomainSocketConfiguration, RedisConfiguration.SentinelConfiguration, RedisConfiguration.StaticMasterReplicaConfiguration, RedisConfiguration.WithDatabaseIndex, RedisConfiguration.WithDomainSocket, RedisConfiguration.WithHostAndPort, RedisConfiguration.WithPassword| Constructor and Description |
|---|
RedisSentinelConfiguration()
Creates new
RedisSentinelConfiguration. |
RedisSentinelConfiguration(PropertySource<?> propertySource)
Creates
RedisSentinelConfiguration looking up values in given PropertySource. |
RedisSentinelConfiguration(String master,
Set<String> sentinelHostAndPorts)
Creates
RedisSentinelConfiguration for given hostPort combinations. |
| Modifier and Type | Method and Description |
|---|---|
void |
addSentinel(RedisNode sentinel)
Add sentinel.
|
int |
getDatabase()
Get the database index to use.
|
NamedNode |
getMaster()
Get the Sentinel master node.
|
RedisPassword |
getPassword()
Get the RedisPassword to use when connecting.
|
RedisPassword |
getSentinelPassword()
Returns the
RedisPassword to use when connecting to a Redis Sentinel. |
Set<RedisNode> |
getSentinels()
Returns an
Collections.unmodifiableSet(Set) of Sentinels. |
RedisSentinelConfiguration |
master(NamedNode master) |
RedisSentinelConfiguration |
master(String master) |
RedisSentinelConfiguration |
sentinel(RedisNode sentinel) |
RedisSentinelConfiguration |
sentinel(String host,
Integer port) |
void |
setDatabase(int index)
Set the database index to use.
|
void |
setMaster(NamedNode master)
Set the master node.
|
void |
setPassword(RedisPassword password)
Create and set a
RedisPassword for given String. |
void |
setSentinelPassword(RedisPassword sentinelPassword)
Set a
RedisPassword to be used when authenticating with Redis Sentinel. |
void |
setSentinels(Iterable<RedisNode> sentinels)
Set Sentinels to connect to.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetDatabaseOrElse, getDatabaseOrElse, getHostOrElse, getPasswordOrElse, getPasswordOrElse, getPortOrElse, isClusterConfiguration, isDatabaseIndexAware, isDomainSocketConfiguration, isHostAndPortAware, isPasswordAware, isSentinelConfiguration, isStaticMasterReplicaConfigurationgetDataNodePassword, setMaster, setSentinelPassword, setSentinelPasswordsetPassword, setPasswordpublic RedisSentinelConfiguration()
RedisSentinelConfiguration.public RedisSentinelConfiguration(String master, Set<String> sentinelHostAndPorts)
RedisSentinelConfiguration for given hostPort combinations.
sentinelHostAndPorts[0] = 127.0.0.1:23679 sentinelHostAndPorts[1] = 127.0.0.1:23680 ...
sentinelHostAndPorts - must not be null.public RedisSentinelConfiguration(PropertySource<?> propertySource)
RedisSentinelConfiguration looking up values in given PropertySource.
spring.redis.sentinel.master=myMaster
spring.redis.sentinel.nodes=127.0.0.1:23679,127.0.0.1:23680,127.0.0.1:23681
propertySource - must not be null.public void setSentinels(Iterable<RedisNode> sentinels)
sentinels - must not be null.public Set<RedisNode> getSentinels()
RedisConfiguration.SentinelConfigurationCollections.unmodifiableSet(Set) of Sentinels.getSentinels in interface RedisConfiguration.SentinelConfigurationSet of sentinels. Never null.public void addSentinel(RedisNode sentinel)
sentinel - must not be null.public void setMaster(NamedNode master)
RedisConfiguration.SentinelConfigurationsetMaster in interface RedisConfiguration.SentinelConfigurationmaster - must not be null.public NamedNode getMaster()
RedisConfiguration.SentinelConfigurationgetMaster in interface RedisConfiguration.SentinelConfigurationpublic RedisSentinelConfiguration master(String master)
master - The master node name.RedisConfiguration.SentinelConfiguration.setMaster(String)public RedisSentinelConfiguration master(NamedNode master)
master - the master nodesetMaster(NamedNode)public RedisSentinelConfiguration sentinel(RedisNode sentinel)
sentinel - the node to add as sentinel.addSentinel(RedisNode)public RedisSentinelConfiguration sentinel(String host, Integer port)
host - redis sentinel node host name or ip.port - redis sentinel port.sentinel(RedisNode)public int getDatabase()
RedisConfiguration.WithDatabaseIndexgetDatabase in interface RedisConfiguration.WithDatabaseIndexzero by default.public void setDatabase(int index)
RedisConfiguration.WithDatabaseIndexsetDatabase in interface RedisConfiguration.WithDatabaseIndexpublic RedisPassword getPassword()
RedisConfiguration.WithPasswordgetPassword in interface RedisConfiguration.WithPasswordRedisPassword.none() if none set.public void setPassword(RedisPassword password)
RedisConfiguration.WithPasswordRedisPassword for given String.setPassword in interface RedisConfiguration.WithPasswordpassword - must not be null use RedisPassword.none() instead.public void setSentinelPassword(RedisPassword sentinelPassword)
RedisConfiguration.SentinelConfigurationRedisPassword to be used when authenticating with Redis Sentinel.setSentinelPassword in interface RedisConfiguration.SentinelConfigurationsentinelPassword - must not be null use RedisPassword.none() instead.public RedisPassword getSentinelPassword()
RedisConfiguration.SentinelConfigurationRedisPassword to use when connecting to a Redis Sentinel. RedisConfiguration.SentinelConfiguration.setSentinelPassword(RedisPassword) or RedisPassword.none() if no password has
been set.getSentinelPassword in interface RedisConfiguration.SentinelConfigurationRedisPassword for authenticating with Redis Sentinel.Copyright © 2011–2020 Pivotal Software, Inc.. All rights reserved.