Class JedisSentinelConnection
java.lang.Object
org.springframework.data.redis.connection.jedis.JedisSentinelConnection
- All Implemented Interfaces:
Closeable
,AutoCloseable
,RedisSentinelCommands
,RedisSentinelConnection
- Since:
- 1.4
- Author:
- Christoph Strobl
-
Constructor Summary
ConstructorDescriptionJedisSentinelConnection
(String host, int port) JedisSentinelConnection
(RedisNode sentinel) JedisSentinelConnection
(redis.clients.jedis.Jedis jedis) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
protected void
doInit
(redis.clients.jedis.Jedis jedis) Do what ever is required to establish the connection to redis.void
Force a failover as if the master was not reachable.boolean
isOpen()
masters()
Get aCollection
of monitored masters and their state.void
monitor
(RedisServer server) Tell sentinel to start monitoring a new master with the specifiedRedisNode.getName()
,RedisNode.getHost()
,RedisNode.getPort()
, andRedisServer.getQuorum()
.void
void
Removes given master.Show list of replicas for given master.
-
Constructor Details
-
JedisSentinelConnection
-
JedisSentinelConnection
-
JedisSentinelConnection
public JedisSentinelConnection(redis.clients.jedis.Jedis jedis)
-
-
Method Details
-
failover
Description copied from interface:RedisSentinelCommands
Force a failover as if the master was not reachable.- Specified by:
failover
in interfaceRedisSentinelCommands
- Parameters:
master
- must not be null.
-
masters
Description copied from interface:RedisSentinelCommands
Get aCollection
of monitored masters and their state.- Specified by:
masters
in interfaceRedisSentinelCommands
- Returns:
- Collection of
RedisServer
s. Never null.
-
replicas
Description copied from interface:RedisSentinelCommands
Show list of replicas for given master.- Specified by:
replicas
in interfaceRedisSentinelCommands
- Parameters:
master
- must not be null.- Returns:
- Collection of
RedisServer
s. Never null.
-
replicas
- Parameters:
masterName
-- Returns:
- See Also:
-
remove
Description copied from interface:RedisSentinelCommands
Removes given master. The server will no longer be monitored and will no longer be returned byRedisSentinelCommands.masters()
.- Specified by:
remove
in interfaceRedisSentinelCommands
- Parameters:
master
- must not be null.
-
remove
- Parameters:
masterName
-- See Also:
-
monitor
Description copied from interface:RedisSentinelCommands
Tell sentinel to start monitoring a new master with the specifiedRedisNode.getName()
,RedisNode.getHost()
,RedisNode.getPort()
, andRedisServer.getQuorum()
.- Specified by:
monitor
in interfaceRedisSentinelCommands
- Parameters:
server
- must not be null.
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
doInit
protected void doInit(redis.clients.jedis.Jedis jedis) Do what ever is required to establish the connection to redis.- Parameters:
jedis
-
-
isOpen
public boolean isOpen()- Specified by:
isOpen
in interfaceRedisSentinelConnection
- Returns:
- true if connected to server
-