public class RedisClusterConfiguration extends Object
RedisConnection via RedisConnectionFactory using connecting
to Redis Cluster. Useful when setting up a high availability Redis
environment.| Constructor and Description |
|---|
RedisClusterConfiguration()
Creates new
RedisClusterConfiguration. |
RedisClusterConfiguration(Collection<String> clusterNodes)
Creates
RedisClusterConfiguration for given hostPort combinations. |
RedisClusterConfiguration(PropertySource<?> propertySource)
Creates
RedisClusterConfiguration looking up values in given PropertySource. |
| Modifier and Type | Method and Description |
|---|---|
void |
addClusterNode(RedisNode node)
Add a cluster node to configuration.
|
RedisClusterConfiguration |
clusterNode(RedisNode node) |
RedisClusterConfiguration |
clusterNode(String host,
Integer port) |
Set<RedisNode> |
getClusterNodes()
Returns an
Collections.unmodifiableSet(Set) of cluster nodes. |
Integer |
getMaxRedirects() |
void |
setClusterNodes(Iterable<RedisNode> nodes)
Set cluster nodes to connect to.
|
void |
setMaxRedirects(int maxRedirects) |
public RedisClusterConfiguration()
RedisClusterConfiguration.public RedisClusterConfiguration(Collection<String> clusterNodes)
RedisClusterConfiguration for given hostPort combinations.
clusterHostAndPorts[0] = 127.0.0.1:23679 clusterHostAndPorts[1] = 127.0.0.1:23680 ...
cluster - must not be
null.public RedisClusterConfiguration(PropertySource<?> propertySource)
RedisClusterConfiguration looking up values in given PropertySource.
spring.redis.cluster.nodes=127.0.0.1:23679,127.0.0.1:23680,127.0.0.1:23681
spring.redis.cluster.timeout=5
spring.redis.cluster.max-redirects=3
spring.redis.cluster.password=foobar
propertySource - must not be null.public void setClusterNodes(Iterable<RedisNode> nodes)
nodes - must not be null.public Set<RedisNode> getClusterNodes()
Collections.unmodifiableSet(Set) of cluster nodes.Set of nodes. Never null.public void addClusterNode(RedisNode node)
node - must not be null.public RedisClusterConfiguration clusterNode(RedisNode node)
public Integer getMaxRedirects()
public void setMaxRedirects(int maxRedirects)
maxRedirects - public RedisClusterConfiguration clusterNode(String host, Integer port)
host - port - Copyright © 2011-2016–2016 Pivotal Software, Inc.. All rights reserved.