public class LettuceSentinelConnection extends Object implements RedisSentinelConnection
Modifier | Constructor and Description |
---|---|
|
LettuceSentinelConnection(LettuceConnectionProvider connectionProvider)
Creates a
LettuceSentinelConnection using a LettuceConnectionProvider . |
|
LettuceSentinelConnection(io.lettuce.core.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(io.lettuce.core.sentinel.api.StatefulRedisSentinelConnection<String,String> connection)
Creates a
LettuceSentinelConnection using a supplied redis connection. |
|
LettuceSentinelConnection(String host,
int port)
|
|
LettuceSentinelConnection(String host,
int port,
io.lettuce.core.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, io.lettuce.core.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(io.lettuce.core.RedisClient redisClient)
LettuceSentinelConnection
using a supplied RedisClient
.redisClient
- must not be null.protected LettuceSentinelConnection(io.lettuce.core.sentinel.api.StatefulRedisSentinelConnection<String,String> connection)
LettuceSentinelConnection
using a supplied redis connection.connection
- native Lettuce connection, must not be nullpublic LettuceSentinelConnection(LettuceConnectionProvider connectionProvider)
LettuceSentinelConnection
using a LettuceConnectionProvider
.connectionProvider
- must not be null.public void failover(NamedNode master)
RedisSentinelCommands
failover
in interface RedisSentinelCommands
master
- must not be null.public List<RedisServer> masters()
RedisSentinelCommands
Collection
of monitored masters and their state.masters
in interface RedisSentinelCommands
RedisServer
s. Never null.public List<RedisServer> slaves(NamedNode master)
RedisSentinelCommands
slaves
in interface RedisSentinelCommands
master
- must not be null.RedisServer
s. Never null.public List<RedisServer> slaves(String masterName)
masterName
- RedisSentinelCommands.slaves(org.springframework.data.redis.connection.NamedNode)
public void remove(NamedNode master)
RedisSentinelCommands
RedisSentinelCommands.masters()
.remove
in interface RedisSentinelCommands
master
- must not be null.public void remove(String masterName)
masterName
- RedisSentinelCommands.remove(org.springframework.data.redis.connection.NamedNode)
public void monitor(RedisServer server)
RedisSentinelCommands
RedisNode.getName()
,
RedisNode.getHost()
, RedisNode.getPort()
, and RedisServer.getQuorum()
.monitor
in interface RedisSentinelCommands
server
- must not be null.public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public boolean isOpen()
isOpen
in interface RedisSentinelConnection
Copyright © 2011–2019 Pivotal Software, Inc.. All rights reserved.