public class RedisSentinelConfiguration extends Object
RedisConnection
via RedisConnectionFactory
using connecting
to Redis Sentinel(s). Useful when setting up a high availability Redis
environment.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.
|
NamedNode |
getMaster()
Get the Sentinel master node.
|
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 |
setMaster(NamedNode master)
Set the master.
|
void |
setMaster(String name)
Set the master node via its name.
|
void |
setSentinels(Iterable<RedisNode> sentinels)
Set Sentinels to connect to.
|
public 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()
Collections.unmodifiableSet(Set)
of Sentinels.Set
of sentinels. Never null.public void addSentinel(RedisNode sentinel)
sentinel
- must not be null.public void setMaster(String name)
name
- must not be null.public void setMaster(NamedNode master)
master
- must not be null.public NamedNode getMaster()
public RedisSentinelConfiguration master(String master)
master
- setMaster(String)
public RedisSentinelConfiguration master(NamedNode master)
master
- setMaster(NamedNode)
public RedisSentinelConfiguration sentinel(RedisNode sentinel)
sentinel
- addSentinel(RedisNode)
public RedisSentinelConfiguration sentinel(String host, Integer port)
host
- port
- sentinel(RedisNode)
Copyright © 2011–2019 Pivotal Software, Inc.. All rights reserved.