Interface RedisClusterReactiveCommands<K,V>
-
- Type Parameters:
K
- Key type.V
- Value type.
- All Superinterfaces:
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>
- All Known Subinterfaces:
RedisAdvancedClusterReactiveCommands<K,V>
,RedisClusterPubSubReactiveCommands<K,V>
,RedisPubSubReactiveCommands<K,V>
,RedisReactiveCommands<K,V>
- All Known Implementing Classes:
AbstractRedisReactiveCommands
,RedisAdvancedClusterReactiveCommandsImpl
,RedisClusterPubSubReactiveCommandsImpl
,RedisPubSubReactiveCommandsImpl
,RedisReactiveCommandsImpl
,RedisSentinelReactiveCommandsImpl
public interface RedisClusterReactiveCommands<K,V> extends 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>
A complete reactive and thread-safe cluster Redis API with 400+ Methods.- Since:
- 5.0
- Author:
- Mark Paluch, dengliming
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description Mono<String>
asking()
The asking command is required after a-ASK
redirection.Mono<String>
auth(CharSequence password)
Authenticate to the server.Mono<String>
auth(String username, CharSequence password)
Authenticate to the server with username and password.Mono<String>
clusterAddSlots(int... slots)
Adds slots to the cluster node.Mono<String>
clusterAddSlotsRange(Range<Integer>... ranges)
Takes a list of slot ranges (specified by start and end slots) to assign to the node.Mono<String>
clusterBumpepoch()
Generate a new config epoch, incrementing the current epoch, assign the new epoch to this node, WITHOUT any consensus and persist the configuration on disk before sending packets with the new configuration.Mono<Long>
clusterCountFailureReports(String nodeId)
Returns the number of failure reports for the specified node.Mono<Long>
clusterCountKeysInSlot(int slot)
Returns the number of keys in the specified Redis Cluster hashslot
.Mono<String>
clusterDelSlots(int... slots)
Removes slots from the cluster node.Mono<String>
clusterDelSlotsRange(Range<Integer>... ranges)
Takes a list of slot ranges (specified by start and end slots) to remove to the node.Mono<String>
clusterFailover(boolean force)
Failover a cluster node.Mono<String>
clusterFailover(boolean force, boolean takeOver)
Failover a cluster node.Mono<String>
clusterFlushslots()
Delete all the slots associated with the specified node.Mono<String>
clusterForget(String nodeId)
Disallow connections and remove the cluster node from the cluster.Flux<K>
clusterGetKeysInSlot(int slot, int count)
Retrieve the list of keys within theslot
.Mono<String>
clusterInfo()
Get information and statistics about the cluster viewed by the current node.Mono<Long>
clusterKeyslot(K key)
Returns an integer identifying the hash slot the specified key hashes to.Mono<String>
clusterMeet(String ip, int port)
Meet another cluster node to include the node into the cluster.Mono<String>
clusterMyId()
Obtain the nodeId for the currently connected node.Mono<String>
clusterNodes()
Obtain details about all cluster nodes.Flux<String>
clusterReplicas(String nodeId)
List replicas for a certain node identified by itsnodeId
.Mono<String>
clusterReplicate(String nodeId)
Turn this node into a replica of the node with the idnodeId
.Mono<String>
clusterReset(boolean hard)
Reset a node performing a soft or hard reset: All other nodes are forgotten All the assigned / open slots are released If the node is a replica, it turns into a master Only for hard reset: a new Node ID is generated Only for hard reset: currentEpoch and configEpoch are set to 0 The new configuration is saved and the cluster state updated If the node was a replica, the whole data set is flushed awayMono<String>
clusterSaveconfig()
Forces a node to save the nodes.conf configuration on disk.Mono<String>
clusterSetConfigEpoch(long configEpoch)
This command sets a specific config epoch in a fresh node.Mono<String>
clusterSetSlotImporting(int slot, String nodeId)
Flag a slot as IMPORTING (incoming) from the node specified innodeId
.Mono<String>
clusterSetSlotMigrating(int slot, String nodeId)
Flag a slot as MIGRATING (outgoing) towards the node specified innodeId
.Mono<String>
clusterSetSlotNode(int slot, String nodeId)
Assign a slot to a node.Mono<String>
clusterSetSlotStable(int slot)
Clears migrating / importing state from the slot.Mono<List<Object>>
clusterShards()
Get array of cluster shardsFlux<String>
clusterSlaves(String nodeId)
Deprecated.since 6.1.7, useclusterReplicas(String)
instead.Flux<Object>
clusterSlots()
Get array of cluster slots to node mappings.Mono<String>
readOnly()
Tells a Redis cluster replica node that the client is ok reading possibly stale data and is not interested in running write queries.Mono<String>
readWrite()
Resets readOnly flag.void
setTimeout(Duration timeout)
Deprecated.since 6.2.-
Methods inherited from interface io.lettuce.core.api.reactive.BaseRedisReactiveCommands
dispatch, dispatch, echo, flushCommands, isOpen, ping, publish, pubsubChannels, pubsubChannels, pubsubNumpat, pubsubNumsub, quit, reset, role, setAutoFlushCommands, waitForReplication
-
Methods inherited from interface io.lettuce.core.api.reactive.RedisAclReactiveCommands
aclCat, aclCat, aclDeluser, aclDryRun, aclDryRun, aclGenpass, aclGenpass, aclGetuser, aclList, aclLoad, aclLog, aclLog, aclLogReset, aclSave, aclSetuser, aclUsers, aclWhoami
-
Methods inherited from interface io.lettuce.core.api.reactive.RedisFunctionReactiveCommands
fcall, fcall, fcallReadOnly, fcallReadOnly, functionDump, functionFlush, functionKill, functionList, functionList, functionLoad, functionLoad, functionRestore, functionRestore
-
Methods inherited from interface io.lettuce.core.api.reactive.RedisGeoReactiveCommands
geoadd, geoadd, geoadd, geoadd, geoadd, geoadd, geodist, geohash, geopos, georadius, georadius, georadius, georadiusbymember, georadiusbymember, georadiusbymember, geosearch, geosearch, geosearchstore
-
Methods inherited from interface io.lettuce.core.api.reactive.RedisHashReactiveCommands
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
-
Methods inherited from interface io.lettuce.core.api.reactive.RedisHLLReactiveCommands
pfadd, pfcount, pfmerge
-
Methods inherited from interface io.lettuce.core.api.reactive.RedisKeyReactiveCommands
copy, copy, del, dump, exists, expire, expire, expire, expire, expireat, expireat, expireat, expireat, expireat, expireat, expiretime, keys, keys, migrate, migrate, move, objectEncoding, objectFreq, objectIdletime, objectRefcount, persist, pexpire, pexpire, pexpire, pexpire, pexpireat, pexpireat, pexpireat, pexpireat, pexpireat, pexpireat, pexpiretime, pttl, randomkey, rename, renamenx, restore, restore, scan, scan, scan, scan, scan, scan, scan, scan, sort, sort, sort, sort, sortReadOnly, sortReadOnly, sortReadOnly, sortReadOnly, sortStore, touch, ttl, type, unlink
-
Methods inherited from interface io.lettuce.core.api.reactive.RedisListReactiveCommands
blmove, blmove, blmpop, blmpop, blpop, blpop, brpop, brpop, brpoplpush, brpoplpush, lindex, linsert, llen, lmove, lmpop, lpop, lpop, lpos, lpos, lpos, lpos, lpush, lpushx, lrange, lrange, lrem, lset, ltrim, rpop, rpop, rpoplpush, rpush, rpushx
-
Methods inherited from interface io.lettuce.core.api.reactive.RedisScriptingReactiveCommands
digest, digest, eval, eval, eval, eval, evalReadOnly, evalsha, evalsha, evalshaReadOnly, scriptExists, scriptFlush, scriptFlush, scriptKill, scriptLoad, scriptLoad
-
Methods inherited from interface io.lettuce.core.api.reactive.RedisServerReactiveCommands
bgrewriteaof, bgsave, clientCaching, clientGetname, clientGetredir, clientId, clientInfo, clientKill, clientKill, clientList, clientList, clientNoEvict, clientPause, clientSetinfo, clientSetname, clientTracking, clientUnblock, command, commandCount, commandInfo, commandInfo, configGet, configGet, configResetstat, configRewrite, configSet, configSet, dbsize, debugCrashAndRecover, debugHtstats, debugObject, debugOom, debugReload, debugRestart, debugSdslen, debugSegfault, flushall, flushall, flushallAsync, flushdb, flushdb, flushdbAsync, info, info, lastsave, memoryUsage, replicaof, replicaofNoOne, save, shutdown, shutdown, slaveof, slaveofNoOne, slowlogGet, slowlogGet, slowlogLen, slowlogReset, time
-
Methods inherited from interface io.lettuce.core.api.reactive.RedisSetReactiveCommands
sadd, scard, sdiff, sdiff, sdiffstore, sinter, sinter, sintercard, sintercard, sinterstore, sismember, smembers, smembers, smismember, smove, spop, spop, srandmember, srandmember, srandmember, srem, sscan, sscan, sscan, sscan, sscan, sscan, sscan, sscan, sunion, sunion, sunionstore
-
Methods inherited from interface io.lettuce.core.api.reactive.RedisSortedSetReactiveCommands
bzmpop, bzmpop, bzmpop, bzmpop, bzpopmax, bzpopmax, bzpopmin, bzpopmin, 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
-
Methods inherited from interface io.lettuce.core.api.reactive.RedisStreamReactiveCommands
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
-
Methods inherited from interface io.lettuce.core.api.reactive.RedisStringReactiveCommands
append, bitcount, bitcount, bitfield, bitopAnd, bitopNot, bitopOr, bitopXor, bitpos, bitpos, bitpos, decr, decrby, get, getbit, getdel, getex, getrange, getset, incr, incrby, incrbyfloat, mget, mget, mset, msetnx, psetex, set, set, setbit, setex, setGet, setGet, setnx, setrange, stralgoLcs, strlen
-
-
-
-
Method Detail
-
setTimeout
@Deprecated void setTimeout(Duration timeout)
Deprecated.since 6.2. Use the correspondingStatefulConnection.setTimeout(Duration)
method on the connection interface. To be removed with Lettuce 7.0.Set the default timeout for operations. A zero timeout value indicates to not time out.- Parameters:
timeout
- the timeout value- Since:
- 5.0
-
asking
Mono<String> asking()
The asking command is required after a-ASK
redirection. The client should issueASKING
before to actually send the command to the target instance. See the Redis Cluster specification for more information.- Returns:
- String simple-string-reply
-
auth
Mono<String> auth(CharSequence password)
Authenticate to the server.- Parameters:
password
- the password- Returns:
- String simple-string-reply
-
auth
Mono<String> auth(String username, CharSequence password)
Authenticate to the server with username and password. Requires Redis 6 or newer.- Parameters:
username
- the usernamepassword
- the password- Returns:
- String simple-string-reply
- Since:
- 6.0
-
clusterAddSlots
Mono<String> clusterAddSlots(int... slots)
Adds slots to the cluster node. The current node will become the master for the specified slots.- Parameters:
slots
- one or more slots from 0 to 16384- Returns:
- String simple-string-reply
-
clusterBumpepoch
Mono<String> clusterBumpepoch()
Generate a new config epoch, incrementing the current epoch, assign the new epoch to this node, WITHOUT any consensus and persist the configuration on disk before sending packets with the new configuration.- Returns:
- String simple-string-reply If the new config epoch is generated and assigned either BUMPED (epoch) or STILL (epoch) are returned.
-
clusterCountFailureReports
Mono<Long> clusterCountFailureReports(String nodeId)
Returns the number of failure reports for the specified node. Failure reports are the way Redis Cluster uses in order to promote a PFAIL state, that means a node is not reachable, to a FAIL state, that means that the majority of masters in the cluster agreed within a window of time that the node is not reachable.- Parameters:
nodeId
- the node id- Returns:
- Integer reply: The number of active failure reports for the node.
-
clusterCountKeysInSlot
Mono<Long> clusterCountKeysInSlot(int slot)
Returns the number of keys in the specified Redis Cluster hashslot
.- Parameters:
slot
- the slot- Returns:
- Integer reply: The number of keys in the specified hash slot, or an error if the hash slot is invalid.
-
clusterAddSlotsRange
Mono<String> clusterAddSlotsRange(Range<Integer>... ranges)
Takes a list of slot ranges (specified by start and end slots) to assign to the node.- Parameters:
ranges
- a list of slot ranges (specified by start and end slots)- Returns:
- String simple-string-reply
- Since:
- 6.2
-
clusterDelSlots
Mono<String> clusterDelSlots(int... slots)
Removes slots from the cluster node.- Parameters:
slots
- one or more slots from 0 to 16384- Returns:
- String simple-string-reply
-
clusterDelSlotsRange
Mono<String> clusterDelSlotsRange(Range<Integer>... ranges)
Takes a list of slot ranges (specified by start and end slots) to remove to the node.- Parameters:
ranges
- a list of slot ranges (specified by start and end slots)- Returns:
- String simple-string-reply
- Since:
- 6.2
-
clusterFailover
Mono<String> clusterFailover(boolean force)
Failover a cluster node. Turns the currently connected node into a master and the master into its replica.- Parameters:
force
- do not coordinate with master iftrue
- Returns:
- String simple-string-reply
-
clusterFailover
Mono<String> clusterFailover(boolean force, boolean takeOver)
Failover a cluster node. Turns the currently connected node into a master and the master into its replica.- Parameters:
force
- do not coordinate with master iftrue
takeOver
- do not coordinate with the rest of the cluster iftrue
- Returns:
- String simple-string-reply
- Since:
- 6.2.3
-
clusterFlushslots
Mono<String> clusterFlushslots()
Delete all the slots associated with the specified node. The number of deleted slots is returned.- Returns:
- String simple-string-reply
-
clusterForget
Mono<String> clusterForget(String nodeId)
Disallow connections and remove the cluster node from the cluster.- Parameters:
nodeId
- the node Id- Returns:
- String simple-string-reply
-
clusterGetKeysInSlot
Flux<K> clusterGetKeysInSlot(int slot, int count)
Retrieve the list of keys within theslot
.- Parameters:
slot
- the slotcount
- maximal number of keys- Returns:
- List<K> array-reply list of keys
-
clusterInfo
Mono<String> clusterInfo()
Get information and statistics about the cluster viewed by the current node.- Returns:
- String bulk-string-reply as a collection of text lines.
-
clusterKeyslot
Mono<Long> clusterKeyslot(K key)
Returns an integer identifying the hash slot the specified key hashes to. This command is mainly useful for debugging and testing, since it exposes via an API the underlying Redis implementation of the hashing algorithm. Basically the same asSlotHash.getSlot(byte[])
. If not, call Houston and report that we've got a problem.- Parameters:
key
- the key.- Returns:
- Integer reply: The hash slot number.
-
clusterMeet
Mono<String> clusterMeet(String ip, int port)
Meet another cluster node to include the node into the cluster. The command starts the cluster handshake and returns with OK when the node was added to the cluster.- Parameters:
ip
- IP address of the hostport
- port number.- Returns:
- String simple-string-reply
-
clusterMyId
Mono<String> clusterMyId()
Obtain the nodeId for the currently connected node.- Returns:
- String simple-string-reply
-
clusterNodes
Mono<String> clusterNodes()
Obtain details about all cluster nodes. Can be parsed usingClusterPartitionParser.parse(java.util.List<java.lang.Object>)
- Returns:
- String bulk-string-reply as a collection of text lines
-
clusterReplicate
Mono<String> clusterReplicate(String nodeId)
Turn this node into a replica of the node with the idnodeId
.- Parameters:
nodeId
- master node id- Returns:
- String simple-string-reply
-
clusterReplicas
Flux<String> clusterReplicas(String nodeId)
List replicas for a certain node identified by itsnodeId
. Can be parsed usingClusterPartitionParser.parse(java.util.List<java.lang.Object>)
- Parameters:
nodeId
- node id of the master node- Returns:
- List<String> array-reply list of replicas. The command returns data in the same format as
clusterNodes()
but one line per replica. - Since:
- 6.1.7
-
clusterReset
Mono<String> clusterReset(boolean hard)
Reset a node performing a soft or hard reset:- All other nodes are forgotten
- All the assigned / open slots are released
- If the node is a replica, it turns into a master
- Only for hard reset: a new Node ID is generated
- Only for hard reset: currentEpoch and configEpoch are set to 0
- The new configuration is saved and the cluster state updated
- If the node was a replica, the whole data set is flushed away
- Parameters:
hard
-true
for hard reset. Generates a new nodeId and currentEpoch/configEpoch are set to 0- Returns:
- String simple-string-reply
-
clusterSaveconfig
Mono<String> clusterSaveconfig()
Forces a node to save the nodes.conf configuration on disk.- Returns:
- String simple-string-reply:
OK
or an error if the operation fails.
-
clusterSetConfigEpoch
Mono<String> clusterSetConfigEpoch(long configEpoch)
This command sets a specific config epoch in a fresh node. It only works when:- The nodes table of the node is empty.
- The node current config epoch is zero.
- Parameters:
configEpoch
- the config epoch- Returns:
- String simple-string-reply:
OK
or an error if the operation fails.
-
clusterSetSlotImporting
Mono<String> clusterSetSlotImporting(int slot, String nodeId)
Flag a slot as IMPORTING (incoming) from the node specified innodeId
.- Parameters:
slot
- the slotnodeId
- the id of the node is the master of the slot- Returns:
- String simple-string-reply
-
clusterSetSlotMigrating
Mono<String> clusterSetSlotMigrating(int slot, String nodeId)
Flag a slot as MIGRATING (outgoing) towards the node specified innodeId
. The slot must be handled by the current node in order to be migrated.- Parameters:
slot
- the slotnodeId
- the id of the node is targeted to become the master for the slot- Returns:
- String simple-string-reply
-
clusterSetSlotNode
Mono<String> clusterSetSlotNode(int slot, String nodeId)
Assign a slot to a node. The command migrates the specified slot from the current node to the specified node innodeId
- Parameters:
slot
- the slotnodeId
- the id of the node that will become the master for the slot- Returns:
- String simple-string-reply
-
clusterSetSlotStable
Mono<String> clusterSetSlotStable(int slot)
Clears migrating / importing state from the slot.- Parameters:
slot
- the slot- Returns:
- String simple-string-reply
-
clusterShards
Mono<List<Object>> clusterShards()
Get array of cluster shards- Returns:
- RedisFuture<List<Object>> array-reply nested list of the shards response.
- Since:
- 6.2
-
clusterSlaves
@Deprecated Flux<String> clusterSlaves(String nodeId)
Deprecated.since 6.1.7, useclusterReplicas(String)
instead.List replicas for a certain node identified by itsnodeId
. Can be parsed usingClusterPartitionParser.parse(java.util.List<java.lang.Object>)
- Parameters:
nodeId
- node id of the master node- Returns:
- List<String> array-reply list of replicas. The command returns data in the same format as
clusterNodes()
but one line per replica.
-
clusterSlots
Flux<Object> clusterSlots()
Get array of cluster slots to node mappings.- Returns:
- List<Object> array-reply nested list of slot ranges with IP/Port mappings.
-
readOnly
Mono<String> readOnly()
Tells a Redis cluster replica node that the client is ok reading possibly stale data and is not interested in running write queries.- Specified by:
readOnly
in interfaceBaseRedisReactiveCommands<K,V>
- Returns:
- String simple-string-reply
-
-