public class LettuceSentinelConnection extends Object implements RedisSentinelConnection
| Modifier | Constructor and Description |
|---|---|
|
LettuceSentinelConnection(com.lambdaworks.redis.RedisClient redisClient)
Creates a
LettuceSentinelConnection using a supplied RedisClient. |
|
LettuceSentinelConnection(RedisNode sentinel)
Creates a
LettuceSentinelConnection with a dedicated client for a supplied RedisNode. |
protected |
LettuceSentinelConnection(com.lambdaworks.redis.sentinel.api.StatefulRedisSentinelConnection<String,String> connection)
Creates a
LettuceSentinelConnection using a supplied redis connection. |
|
LettuceSentinelConnection(String host,
int port)
|
|
LettuceSentinelConnection(String host,
int port,
com.lambdaworks.redis.resource.ClientResources clientResources)
Creates a
LettuceSentinelConnection with a client for the supplied host and port and reuse
existing ClientResources. |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
failover(NamedNode master)
Force a failover as if the master was not reachable.
|
boolean |
isOpen() |
List<RedisServer> |
masters()
Get a
Collection of monitored masters and their state. |
void |
monitor(RedisServer server)
Tell sentinel to start monitoring a new master with the specified
RedisNode.getName(),
RedisNode.getHost(), RedisNode.getPort(), and RedisServer.getQuorum(). |
void |
remove(NamedNode master)
Removes given master.
|
void |
remove(String masterName) |
List<RedisServer> |
slaves(NamedNode master)
Show list of slaves for given master.
|
List<RedisServer> |
slaves(String masterName) |
public LettuceSentinelConnection(RedisNode sentinel)
LettuceSentinelConnection with a dedicated client for a supplied RedisNode.sentinel - The sentinel to connect to.public LettuceSentinelConnection(String host, int port)
host - must not be null.port - sentinel port.public LettuceSentinelConnection(String host, int port, com.lambdaworks.redis.resource.ClientResources clientResources)
LettuceSentinelConnection with a client for the supplied host and port and reuse
existing ClientResources.host - must not be null.port - sentinel port.clientResources - must not be null.public LettuceSentinelConnection(com.lambdaworks.redis.RedisClient redisClient)
LettuceSentinelConnection using a supplied RedisClient.redisClient - protected LettuceSentinelConnection(com.lambdaworks.redis.sentinel.api.StatefulRedisSentinelConnection<String,String> connection)
LettuceSentinelConnection using a supplied redis connection.connection - native Lettuce connection, must not be nullpublic void failover(NamedNode master)
RedisSentinelCommandsfailover in interface RedisSentinelCommandsmaster - must not be null.public List<RedisServer> masters()
RedisSentinelCommandsCollection of monitored masters and their state.masters in interface RedisSentinelCommandsRedisServers. Never null.public List<RedisServer> slaves(NamedNode master)
RedisSentinelCommandsslaves in interface RedisSentinelCommandsmaster - must not be null.RedisServers. Never null.public List<RedisServer> slaves(String masterName)
masterName - RedisSentinelCommands.slaves(org.springframework.data.redis.connection.NamedNode)public void remove(NamedNode master)
RedisSentinelCommandsRedisSentinelCommands.masters().remove in interface RedisSentinelCommandsmaster - must not be null.public void remove(String masterName)
masterName - RedisSentinelCommands.remove(org.springframework.data.redis.connection.NamedNode)public void monitor(RedisServer server)
RedisSentinelCommandsRedisNode.getName(),
RedisNode.getHost(), RedisNode.getPort(), and RedisServer.getQuorum().monitor in interface RedisSentinelCommandsserver - must not be null.public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic boolean isOpen()
isOpen in interface RedisSentinelConnectionCopyright © 2011-2016–2016 Pivotal Software, Inc.. All rights reserved.