Package io.lettuce.core.sentinel
Class RedisSentinelReactiveCommandsImpl<K,V>
- java.lang.Object
-
- io.lettuce.core.AbstractRedisReactiveCommands<K,V>
-
- io.lettuce.core.sentinel.RedisSentinelReactiveCommandsImpl<K,V>
-
- Type Parameters:
K
- Key type.V
- Value type.
- All Implemented Interfaces:
BaseRedisReactiveCommands<K,V>
,RedisAclReactiveCommands<K,V>
,RedisFunctionReactiveCommands<K,V>
,RedisGeoReactiveCommands<K,V>
,RedisHashReactiveCommands<K,V>
,RedisHLLReactiveCommands<K,V>
,RedisKeyReactiveCommands<K,V>
,RedisListReactiveCommands<K,V>
,RedisScriptingReactiveCommands<K,V>
,RedisServerReactiveCommands<K,V>
,RedisSetReactiveCommands<K,V>
,RedisSortedSetReactiveCommands<K,V>
,RedisStreamReactiveCommands<K,V>
,RedisStringReactiveCommands<K,V>
,RedisTransactionalReactiveCommands<K,V>
,RedisClusterReactiveCommands<K,V>
,RedisSentinelReactiveCommands<K,V>
public class RedisSentinelReactiveCommandsImpl<K,V> extends AbstractRedisReactiveCommands<K,V> implements RedisSentinelReactiveCommands<K,V>
A reactive and thread-safe API for a Redis Sentinel connection.- Since:
- 3.0
- Author:
- Mark Paluch
-
-
Constructor Summary
Constructors Constructor Description RedisSentinelReactiveCommandsImpl(StatefulConnection<K,V> connection, RedisCodec<K,V> codec)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Mono<K>
clientGetname()
Get the current connection name.Mono<String>
clientInfo()
Get the list of the current client connection.Mono<Long>
clientKill(KillArgs killArgs)
Kill connections of clients which are filtered bykillArgs
.Mono<String>
clientKill(String addr)
Kill the connection of a client identified by ip:port.Mono<String>
clientList()
Get the list of client connections.Mono<String>
clientList(ClientListArgs clientListArgs)
Get the list of client connections which are filtered byclientListArgs
.Mono<String>
clientPause(long timeout)
Stop processing commands from clients for some time.Mono<String>
clientSetinfo(String key, String value)
Assign various info attributes to the current connection.Mono<String>
clientSetname(K name)
Set the current connection name.void
close()
<T> Flux<T>
dispatch(ProtocolKeyword type, CommandOutput<K,V,?> output)
Dispatch a command to the Redis Server.<T> Flux<T>
dispatch(ProtocolKeyword type, CommandOutput<K,V,?> output, CommandArgs<K,V> args)
Dispatch a command to the Redis Server.Mono<String>
failover(K key)
Perform a failover.Mono<SocketAddress>
getMasterAddrByName(K key)
Return the ip and port number of the master with that name.StatefulRedisSentinelConnection<K,V>
getStatefulConnection()
Mono<String>
info()
Get information and statistics about the server.Mono<String>
info(String section)
Get information and statistics about the server.boolean
isOpen()
Mono<Map<K,V>>
master(K key)
Show the state and info of the specified master.Flux<Map<K,V>>
masters()
Enumerates all the monitored masters and their states.Mono<String>
monitor(K key, String ip, int port, int quorum)
This command tells the Sentinel to start monitoring a new master with the specified name, ip, port, and quorum.Mono<String>
ping()
Ping the server.Mono<String>
remove(K key)
remove the specified master.Flux<Map<K,V>>
replicas(K key)
Provides a list of replicas for the master with the specified name.Mono<Long>
reset(K key)
This command will reset all the masters with matching name.Mono<String>
set(K key, String option, V value)
Multiple option / value pairs can be specified (or none at all).Flux<Map<K,V>>
slaves(K key)
Provides a list of replicas for the master with the specified name.-
Methods inherited from class io.lettuce.core.AbstractRedisReactiveCommands
aclCat, aclCat, aclDeluser, aclDryRun, aclDryRun, aclGenpass, aclGenpass, aclGetuser, aclList, aclLoad, aclLog, aclLog, aclLogReset, aclSave, aclSetuser, aclUsers, aclWhoami, append, asking, auth, auth, bgrewriteaof, bgsave, bitcount, bitcount, bitfield, bitopAnd, bitopNot, bitopOr, bitopXor, bitpos, bitpos, bitpos, blmove, blmove, blmpop, blmpop, blpop, blpop, brpop, brpop, brpoplpush, brpoplpush, bzmpop, bzmpop, bzmpop, bzmpop, bzpopmax, bzpopmax, bzpopmin, bzpopmin, clientCaching, clientGetredir, clientId, clientNoEvict, clientTracking, clientUnblock, clusterAddSlots, clusterAddSlotsRange, clusterBumpepoch, clusterCountFailureReports, clusterCountKeysInSlot, clusterDelSlots, clusterDelSlotsRange, clusterFailover, clusterFailover, clusterFlushslots, clusterForget, clusterGetKeysInSlot, clusterInfo, clusterKeyslot, clusterMeet, clusterMyId, clusterNodes, clusterReplicas, clusterReplicate, clusterReset, clusterSaveconfig, clusterSetConfigEpoch, clusterSetSlotImporting, clusterSetSlotMigrating, clusterSetSlotNode, clusterSetSlotStable, clusterShards, clusterSlaves, clusterSlots, command, commandCount, commandInfo, commandInfo, configGet, configGet, configResetstat, configRewrite, configSet, configSet, copy, copy, createDissolvingFlux, createFlux, createMono, createMono, dbsize, debugCrashAndRecover, debugHtstats, debugObject, debugOom, debugReload, debugRestart, debugSdslen, debugSegfault, decr, decrby, del, del, digest, digest, discard, dump, echo, eval, eval, eval, eval, evalReadOnly, evalsha, evalsha, evalshaReadOnly, exec, exists, exists, exists, expire, expire, expire, expire, expireat, expireat, expireat, expireat, expireat, expireat, expiretime, fcall, fcall, fcallReadOnly, fcallReadOnly, flushall, flushall, flushallAsync, flushCommands, flushdb, flushdb, flushdbAsync, functionDump, functionFlush, functionKill, functionList, functionList, functionLoad, functionLoad, functionRestore, functionRestore, geoadd, geoadd, geoadd, geoadd, geoadd, geoadd, geodist, geohash, geopos, georadius, georadius, georadius, georadius_ro, georadius_ro, georadiusbymember, georadiusbymember, georadiusbymember, georadiusbymember_ro, georadiusbymember_ro, geosearch, geosearch, geosearchstore, get, getbit, getConnection, getdel, getex, getrange, getset, hdel, hexists, hget, hgetall, hgetall, hincrby, hincrbyfloat, hkeys, hkeys, hlen, hmget, hmget, hmset, hrandfield, hrandfield, hrandfieldWithvalues, hrandfieldWithvalues, hscan, hscan, hscan, hscan, hscan, hscan, hscan, hscan, hset, hset, hsetnx, hstrlen, hvals, hvals, incr, incrby, incrbyfloat, keys, keys, lastsave, lindex, linsert, llen, lmove, lmpop, lpop, lpop, lpos, lpos, lpos, lpos, lpush, lpushx, lrange, lrange, lrem, lset, ltrim, memoryUsage, mget, mget, mget, mget, mget, migrate, migrate, move, mset, msetnx, multi, objectEncoding, objectFreq, objectIdletime, objectRefcount, persist, pexpire, pexpire, pexpire, pexpire, pexpireat, pexpireat, pexpireat, pexpireat, pexpireat, pexpireat, pexpiretime, pfadd, pfadd, pfcount, pfcount, pfmerge, pfmerge, psetex, pttl, publish, pubsubChannels, pubsubChannels, pubsubNumpat, pubsubNumsub, quit, randomkey, readOnly, readWrite, rename, renamenx, replicaof, replicaofNoOne, reset, restore, restore, role, rpop, rpop, rpoplpush, rpush, rpushx, sadd, save, scan, scan, scan, scan, scan, scan, scan, scan, scard, scriptExists, scriptFlush, scriptFlush, scriptKill, scriptLoad, scriptLoad, sdiff, sdiff, sdiffstore, select, set, set, setAutoFlushCommands, setbit, setex, setGet, setGet, setnx, setrange, setTimeout, shutdown, shutdown, sinter, sinter, sintercard, sintercard, sinterstore, sismember, slaveof, slaveofNoOne, slowlogGet, slowlogGet, slowlogLen, slowlogReset, smembers, smembers, smismember, smove, sort, sort, sort, sort, sortReadOnly, sortReadOnly, sortReadOnly, sortReadOnly, sortStore, spop, spop, srandmember, srandmember, srandmember, srem, sscan, sscan, sscan, sscan, sscan, sscan, sscan, sscan, stralgoLcs, strlen, sunion, sunion, sunionstore, swapdb, time, touch, touch, ttl, type, unlink, unlink, unwatch, waitForReplication, watch, xack, xadd, xadd, xadd, xadd, xautoclaim, xclaim, xclaim, xdel, xgroupCreate, xgroupCreate, xgroupCreateconsumer, xgroupDelconsumer, xgroupDestroy, xgroupSetid, xinfoConsumers, xinfoGroups, xinfoStream, xlen, xpending, xpending, xpending, xpending, xrange, xrange, xread, xread, xreadgroup, xreadgroup, xrevrange, xrevrange, xtrim, xtrim, xtrim, zadd, zadd, zadd, zadd, zadd, zadd, zaddincr, zaddincr, zcard, zcount, zcount, zcount, zdiff, zdiffstore, zdiffWithScores, zincrby, zinter, zinter, zintercard, zintercard, zinterstore, zinterstore, zinterWithScores, zinterWithScores, zlexcount, zlexcount, zmpop, zmpop, zmscore, zpopmax, zpopmax, zpopmin, zpopmin, zrandmember, zrandmember, zrandmemberWithScores, zrandmemberWithScores, zrange, zrange, zrangebylex, zrangebylex, zrangebylex, zrangebylex, zrangebyscore, zrangebyscore, zrangebyscore, zrangebyscore, zrangebyscore, zrangebyscore, zrangebyscore, zrangebyscore, zrangebyscore, zrangebyscore, zrangebyscore, zrangebyscore, zrangebyscoreWithScores, zrangebyscoreWithScores, zrangebyscoreWithScores, zrangebyscoreWithScores, zrangebyscoreWithScores, zrangebyscoreWithScores, zrangebyscoreWithScores, zrangebyscoreWithScores, zrangebyscoreWithScores, zrangebyscoreWithScores, zrangebyscoreWithScores, zrangebyscoreWithScores, zrangestore, zrangestorebylex, zrangestorebyscore, zrangeWithScores, zrangeWithScores, zrank, zrankWithScore, zrem, zremrangebylex, zremrangebylex, zremrangebyrank, zremrangebyscore, zremrangebyscore, zremrangebyscore, zrevrange, zrevrange, zrevrangebylex, zrevrangebylex, zrevrangebyscore, zrevrangebyscore, zrevrangebyscore, zrevrangebyscore, zrevrangebyscore, zrevrangebyscore, zrevrangebyscore, zrevrangebyscore, zrevrangebyscore, zrevrangebyscore, zrevrangebyscore, zrevrangebyscore, zrevrangebyscoreWithScores, zrevrangebyscoreWithScores, zrevrangebyscoreWithScores, zrevrangebyscoreWithScores, zrevrangebyscoreWithScores, zrevrangebyscoreWithScores, zrevrangebyscoreWithScores, zrevrangebyscoreWithScores, zrevrangebyscoreWithScores, zrevrangebyscoreWithScores, zrevrangebyscoreWithScores, zrevrangebyscoreWithScores, zrevrangestore, zrevrangestorebylex, zrevrangestorebyscore, zrevrangeWithScores, zrevrangeWithScores, zrevrank, zrevrankWithScore, zscan, zscan, zscan, zscan, zscan, zscan, zscan, zscan, zscore, zunion, zunion, zunionstore, zunionstore, zunionWithScores, zunionWithScores
-
-
-
-
Constructor Detail
-
RedisSentinelReactiveCommandsImpl
public RedisSentinelReactiveCommandsImpl(StatefulConnection<K,V> connection, RedisCodec<K,V> codec)
-
-
Method Detail
-
getMasterAddrByName
public Mono<SocketAddress> getMasterAddrByName(K key)
Description copied from interface:RedisSentinelReactiveCommands
Return the ip and port number of the master with that name.- Specified by:
getMasterAddrByName
in interfaceRedisSentinelReactiveCommands<K,V>
- Parameters:
key
- the key.- Returns:
- SocketAddress.
-
masters
public Flux<Map<K,V>> masters()
Description copied from interface:RedisSentinelReactiveCommands
Enumerates all the monitored masters and their states.- Specified by:
masters
in interfaceRedisSentinelReactiveCommands<K,V>
- Returns:
- Map<K, V>>.
-
master
public Mono<Map<K,V>> master(K key)
Description copied from interface:RedisSentinelReactiveCommands
Show the state and info of the specified master.- Specified by:
master
in interfaceRedisSentinelReactiveCommands<K,V>
- Parameters:
key
- the key.- Returns:
- Map<K, V>.
-
slaves
public Flux<Map<K,V>> slaves(K key)
Description copied from interface:RedisSentinelReactiveCommands
Provides a list of replicas for the master with the specified name.- Specified by:
slaves
in interfaceRedisSentinelReactiveCommands<K,V>
- Parameters:
key
- the key.- Returns:
- Map<K, V>.
-
replicas
public Flux<Map<K,V>> replicas(K key)
Description copied from interface:RedisSentinelReactiveCommands
Provides a list of replicas for the master with the specified name.- Specified by:
replicas
in interfaceRedisSentinelReactiveCommands<K,V>
- Parameters:
key
- the key.- Returns:
- Map<K, V>.
-
reset
public Mono<Long> reset(K key)
Description copied from interface:RedisSentinelReactiveCommands
This command will reset all the masters with matching name.- Specified by:
reset
in interfaceRedisSentinelReactiveCommands<K,V>
- Parameters:
key
- the key.- Returns:
- Long.
-
failover
public Mono<String> failover(K key)
Description copied from interface:RedisSentinelReactiveCommands
Perform a failover.- Specified by:
failover
in interfaceRedisSentinelReactiveCommands<K,V>
- Parameters:
key
- the master id.- Returns:
- String.
-
monitor
public Mono<String> monitor(K key, String ip, int port, int quorum)
Description copied from interface:RedisSentinelReactiveCommands
This command tells the Sentinel to start monitoring a new master with the specified name, ip, port, and quorum.- Specified by:
monitor
in interfaceRedisSentinelReactiveCommands<K,V>
- Parameters:
key
- the key.ip
- the IP address.port
- the port.quorum
- the quorum count.- Returns:
- String.
-
set
public Mono<String> set(K key, String option, V value)
Description copied from interface:RedisSentinelReactiveCommands
Multiple option / value pairs can be specified (or none at all).- Specified by:
set
in interfaceRedisSentinelReactiveCommands<K,V>
- Parameters:
key
- the key.option
- the option.value
- the value.- Returns:
- String simple-string-reply
OK
ifSET
was executed correctly.
-
remove
public Mono<String> remove(K key)
Description copied from interface:RedisSentinelReactiveCommands
remove the specified master.- Specified by:
remove
in interfaceRedisSentinelReactiveCommands<K,V>
- Parameters:
key
- the key.- Returns:
- String.
-
ping
public Mono<String> ping()
Description copied from interface:BaseRedisReactiveCommands
Ping the server.- Specified by:
ping
in interfaceBaseRedisReactiveCommands<K,V>
- Specified by:
ping
in interfaceRedisSentinelReactiveCommands<K,V>
- Overrides:
ping
in classAbstractRedisReactiveCommands<K,V>
- Returns:
- String simple-string-reply.
-
clientGetname
public Mono<K> clientGetname()
Description copied from interface:RedisServerReactiveCommands
Get the current connection name.- Specified by:
clientGetname
in interfaceRedisSentinelReactiveCommands<K,V>
- Specified by:
clientGetname
in interfaceRedisServerReactiveCommands<K,V>
- Overrides:
clientGetname
in classAbstractRedisReactiveCommands<K,V>
- Returns:
- K bulk-string-reply The connection name, or a null bulk reply if no name is set.
-
clientSetname
public Mono<String> clientSetname(K name)
Description copied from interface:RedisServerReactiveCommands
Set the current connection name.- Specified by:
clientSetname
in interfaceRedisSentinelReactiveCommands<K,V>
- Specified by:
clientSetname
in interfaceRedisServerReactiveCommands<K,V>
- Overrides:
clientSetname
in classAbstractRedisReactiveCommands<K,V>
- Parameters:
name
- the client name.- Returns:
- simple-string-reply
OK
if the connection name was successfully set.
-
clientSetinfo
public Mono<String> clientSetinfo(String key, String value)
Description copied from interface:RedisServerReactiveCommands
Assign various info attributes to the current connection.- Specified by:
clientSetinfo
in interfaceRedisSentinelReactiveCommands<K,V>
- Specified by:
clientSetinfo
in interfaceRedisServerReactiveCommands<K,V>
- Overrides:
clientSetinfo
in classAbstractRedisReactiveCommands<K,V>
- Parameters:
key
- the key.value
- the value.- Returns:
- simple-string-reply
OK
if the connection name was successfully set.
-
clientKill
public Mono<String> clientKill(String addr)
Description copied from interface:RedisServerReactiveCommands
Kill the connection of a client identified by ip:port.- Specified by:
clientKill
in interfaceRedisSentinelReactiveCommands<K,V>
- Specified by:
clientKill
in interfaceRedisServerReactiveCommands<K,V>
- Overrides:
clientKill
in classAbstractRedisReactiveCommands<K,V>
- Parameters:
addr
- ip:port.- Returns:
- String simple-string-reply
OK
if the connection exists and has been closed.
-
clientKill
public Mono<Long> clientKill(KillArgs killArgs)
Description copied from interface:RedisServerReactiveCommands
Kill connections of clients which are filtered bykillArgs
.- Specified by:
clientKill
in interfaceRedisSentinelReactiveCommands<K,V>
- Specified by:
clientKill
in interfaceRedisServerReactiveCommands<K,V>
- Overrides:
clientKill
in classAbstractRedisReactiveCommands<K,V>
- Parameters:
killArgs
- args for the kill operation.- Returns:
- Long integer-reply number of killed connections.
-
clientPause
public Mono<String> clientPause(long timeout)
Description copied from interface:RedisServerReactiveCommands
Stop processing commands from clients for some time.- Specified by:
clientPause
in interfaceRedisSentinelReactiveCommands<K,V>
- Specified by:
clientPause
in interfaceRedisServerReactiveCommands<K,V>
- Overrides:
clientPause
in classAbstractRedisReactiveCommands<K,V>
- Parameters:
timeout
- the timeout value in milliseconds.- Returns:
- String simple-string-reply The command returns OK or an error if the timeout is invalid.
-
clientList
public Mono<String> clientList()
Description copied from interface:RedisServerReactiveCommands
Get the list of client connections.- Specified by:
clientList
in interfaceRedisSentinelReactiveCommands<K,V>
- Specified by:
clientList
in interfaceRedisServerReactiveCommands<K,V>
- Overrides:
clientList
in classAbstractRedisReactiveCommands<K,V>
- Returns:
- String bulk-string-reply a unique string, formatted as follows: One client connection per line (separated by LF), each line is composed of a succession of property=value fields separated by a space character.
-
clientList
public Mono<String> clientList(ClientListArgs clientListArgs)
Description copied from interface:RedisServerReactiveCommands
Get the list of client connections which are filtered byclientListArgs
.- Specified by:
clientList
in interfaceRedisSentinelReactiveCommands<K,V>
- Specified by:
clientList
in interfaceRedisServerReactiveCommands<K,V>
- Overrides:
clientList
in classAbstractRedisReactiveCommands<K,V>
- Returns:
- String bulk-string-reply a unique string, formatted as follows: One client connection per line (separated by LF), each line is composed of a succession of property=value fields separated by a space character.
-
clientInfo
public Mono<String> clientInfo()
Description copied from interface:RedisServerReactiveCommands
Get the list of the current client connection.- Specified by:
clientInfo
in interfaceRedisSentinelReactiveCommands<K,V>
- Specified by:
clientInfo
in interfaceRedisServerReactiveCommands<K,V>
- Overrides:
clientInfo
in classAbstractRedisReactiveCommands<K,V>
- Returns:
- String bulk-string-reply a unique string, formatted as a succession of property=value fields separated by a space character.
-
info
public Mono<String> info()
Description copied from interface:RedisServerReactiveCommands
Get information and statistics about the server.- Specified by:
info
in interfaceRedisSentinelReactiveCommands<K,V>
- Specified by:
info
in interfaceRedisServerReactiveCommands<K,V>
- Overrides:
info
in classAbstractRedisReactiveCommands<K,V>
- Returns:
- String bulk-string-reply as a collection of text lines.
-
info
public Mono<String> info(String section)
Description copied from interface:RedisServerReactiveCommands
Get information and statistics about the server.- Specified by:
info
in interfaceRedisSentinelReactiveCommands<K,V>
- Specified by:
info
in interfaceRedisServerReactiveCommands<K,V>
- Overrides:
info
in classAbstractRedisReactiveCommands<K,V>
- Parameters:
section
- the section type: string.- Returns:
- String bulk-string-reply as a collection of text lines.
-
dispatch
public <T> Flux<T> dispatch(ProtocolKeyword type, CommandOutput<K,V,?> output)
Description copied from interface:BaseRedisReactiveCommands
Dispatch a command to the Redis Server. Please note the command output type must fit to the command response.- Specified by:
dispatch
in interfaceBaseRedisReactiveCommands<K,V>
- Specified by:
dispatch
in interfaceRedisSentinelReactiveCommands<K,V>
- Overrides:
dispatch
in classAbstractRedisReactiveCommands<K,V>
- Type Parameters:
T
- response type.- Parameters:
type
- the command, must not benull
.output
- the command output, must not benull
.- Returns:
- the command response.
-
dispatch
public <T> Flux<T> dispatch(ProtocolKeyword type, CommandOutput<K,V,?> output, CommandArgs<K,V> args)
Description copied from interface:BaseRedisReactiveCommands
Dispatch a command to the Redis Server. Please note the command output type must fit to the command response.- Specified by:
dispatch
in interfaceBaseRedisReactiveCommands<K,V>
- Specified by:
dispatch
in interfaceRedisSentinelReactiveCommands<K,V>
- Overrides:
dispatch
in classAbstractRedisReactiveCommands<K,V>
- Type Parameters:
T
- response type.- Parameters:
type
- the command, must not benull
.output
- the command output, must not benull
.args
- the command arguments, must not benull
.- Returns:
- the command response.
-
close
public void close()
- Overrides:
close
in classAbstractRedisReactiveCommands<K,V>
-
isOpen
public boolean isOpen()
- Specified by:
isOpen
in interfaceBaseRedisReactiveCommands<K,V>
- Specified by:
isOpen
in interfaceRedisSentinelReactiveCommands<K,V>
- Overrides:
isOpen
in classAbstractRedisReactiveCommands<K,V>
- Returns:
true
if the connection is open (connected and not closed).
-
getStatefulConnection
public StatefulRedisSentinelConnection<K,V> getStatefulConnection()
- Specified by:
getStatefulConnection
in interfaceRedisSentinelReactiveCommands<K,V>
- Returns:
- the underlying connection.
-
-