K
- Key type.V
- Value type.public interface RedisClusterCommands<K,V> extends BaseRedisCommands<K,V>, RedisGeoCommands<K,V>, RedisHashCommands<K,V>, RedisHLLCommands<K,V>, RedisKeyCommands<K,V>, RedisListCommands<K,V>, RedisScriptingCommands<K,V>, RedisServerCommands<K,V>, RedisSetCommands<K,V>, RedisSortedSetCommands<K,V>, RedisStreamCommands<K,V>, RedisStringCommands<K,V>, RedisTransactionalCommands<K,V>, RedisClusterConnection<K,V>
Modifier and Type | Method and Description |
---|---|
String |
asking()
The asking command is required after a
-ASK redirection. |
String |
auth(String password)
Authenticate to the server.
|
void |
close()
Close the connection.
|
String |
clusterAddSlots(int... slots)
Adds slots to the cluster node.
|
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.
|
Long |
clusterCountFailureReports(String nodeId)
Returns the number of failure reports for the specified node.
|
Long |
clusterCountKeysInSlot(int slot)
Returns the number of keys in the specified Redis Cluster hash
slot . |
String |
clusterDelSlots(int... slots)
Removes slots from the cluster node.
|
String |
clusterFailover(boolean force)
Failover a cluster node.
|
String |
clusterFlushslots()
Delete all the slots associated with the specified node.
|
String |
clusterForget(String nodeId)
Blacklist and remove the cluster node from the cluster.
|
List<K> |
clusterGetKeysInSlot(int slot,
int count)
Retrieve the list of keys within the
slot . |
String |
clusterInfo()
Get information and statistics about the cluster viewed by the current node.
|
Long |
clusterKeyslot(K key)
Returns an integer identifying the hash slot the specified key hashes to.
|
String |
clusterMeet(String ip,
int port)
Meet another cluster node to include the node into the cluster.
|
String |
clusterMyId()
Obtain the nodeId for the currently connected node.
|
String |
clusterNodes()
Obtain details about all cluster nodes.
|
String |
clusterReplicate(String nodeId)
Turn this node into a slave of the node with the id
nodeId . |
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 slave, 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 slave, the whole data set is flushed away
|
String |
clusterSaveconfig()
Forces a node to save the nodes.conf configuration on disk.
|
String |
clusterSetConfigEpoch(long configEpoch)
This command sets a specific config epoch in a fresh node.
|
String |
clusterSetSlotImporting(int slot,
String nodeId)
Flag a slot as IMPORTING (incoming) from the node specified in
nodeId . |
String |
clusterSetSlotMigrating(int slot,
String nodeId)
Flag a slot as MIGRATING (outgoing) towards the node specified in
nodeId . |
String |
clusterSetSlotNode(int slot,
String nodeId)
Assign a slot to a node.
|
String |
clusterSetSlotStable(int slot)
Clears migrating / importing state from the slot.
|
List<String> |
clusterSlaves(String nodeId)
List slaves for a certain node identified by its
nodeId . |
List<Object> |
clusterSlots()
Get array of cluster slots to node mappings.
|
String |
readOnly()
Tells a Redis cluster slave node that the client is ok reading possibly stale data and is not interested in running write
queries.
|
String |
readWrite()
Resets readOnly flag.
|
void |
setTimeout(long timeout,
TimeUnit unit)
Set the default timeout for operations.
|
dispatch, dispatch, echo, isOpen, ping, publish, pubsubChannels, pubsubChannels, pubsubNumpat, pubsubNumsub, quit, reset, role, waitForReplication
geoadd, geoadd, geodist, geohash, geopos, georadius, georadius, georadius, georadiusbymember, georadiusbymember, georadiusbymember
hdel, hexists, hget, hgetall, hgetall, hincrby, hincrbyfloat, hkeys, hkeys, hlen, hmget, hmget, hmset, hscan, hscan, hscan, hscan, hscan, hscan, hscan, hscan, hset, hsetnx, hstrlen, hvals, hvals
pfadd, pfcount, pfmerge
del, dump, exists, expire, expireat, expireat, keys, keys, migrate, migrate, move, objectEncoding, objectIdletime, objectRefcount, persist, pexpire, pexpireat, pexpireat, pttl, randomkey, rename, renamenx, restore, restore, scan, scan, scan, scan, scan, scan, scan, scan, sort, sort, sort, sort, sortStore, touch, ttl, type, unlink
blpop, brpop, brpoplpush, lindex, linsert, llen, lpop, lpush, lpushx, lpushx, lrange, lrange, lrem, lset, ltrim, rpop, rpoplpush, rpush, rpushx, rpushx
digest, eval, eval, evalsha, evalsha, scriptExists, scriptFlush, scriptKill, scriptLoad
sadd, scard, sdiff, sdiff, sdiffstore, sinter, sinter, sinterstore, sismember, smembers, smembers, smove, spop, spop, srandmember, srandmember, srandmember, srem, sscan, sscan, sscan, sscan, sscan, sscan, sscan, sscan, sunion, sunion, sunionstore
bzpopmax, bzpopmin, zadd, zadd, zadd, zadd, zadd, zadd, zaddincr, zaddincr, zcard, zcount, zcount, zcount, zincrby, zinterstore, zinterstore, zlexcount, zlexcount, zpopmax, zpopmax, zpopmin, zpopmin, 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, zrangeWithScores, zrangeWithScores, zrank, 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, zrevrangeWithScores, zrevrangeWithScores, zrevrank, zscan, zscan, zscan, zscan, zscan, zscan, zscan, zscan, zscore, zunionstore, zunionstore
xack, xadd, xadd, xadd, xadd, xclaim, xclaim, xdel, xgroupCreate, xgroupDelconsumer, xgroupDestroy, xgroupSetid, xlen, xpending, xpending, xpending, xrange, xrange, xread, xread, xreadgroup, xreadgroup, xrevrange, xrevrange, xtrim, xtrim
append, bitcount, bitcount, bitfield, bitopAnd, bitopNot, bitopOr, bitopXor, bitpos, bitpos, bitpos, decr, decrby, get, getbit, getrange, getset, incr, incrby, incrbyfloat, mget, mget, mset, msetnx, psetex, set, set, setbit, setex, setnx, setrange, strlen
discard, exec, multi, unwatch, watch
hdel, hexists, hget, hgetall, hgetall, hincrby, hincrbyfloat, hkeys, hkeys, hlen, hmget, hmget, hmset, hscan, hscan, hscan, hscan, hscan, hscan, hscan, hscan, hset, hsetnx, hstrlen, hvals, hvals
del, dump, exists, exists, expire, expireat, expireat, keys, keys, migrate, migrate, move, objectEncoding, objectIdletime, objectRefcount, persist, pexpire, pexpireat, pexpireat, pttl, randomkey, rename, renamenx, restore, scan, scan, scan, scan, scan, scan, scan, scan, sort, sort, sort, sort, sortStore, touch, ttl, type, unlink
append, bitcount, bitcount, bitfield, bitopAnd, bitopNot, bitopOr, bitopXor, bitpos, bitpos, decr, decrby, get, getbit, getrange, getset, incr, incrby, incrbyfloat, mget, mget, mset, msetnx, psetex, set, set, setbit, setex, setnx, setrange, strlen
blpop, brpop, brpoplpush, lindex, linsert, llen, lpop, lpush, lpushx, lpushx, lrange, lrange, lrem, lset, ltrim, rpop, rpoplpush, rpush, rpushx, rpushx
sadd, scard, sdiff, sdiff, sdiffstore, sinter, sinter, sinterstore, sismember, smembers, smembers, smove, spop, spop, srandmember, srandmember, srandmember, srem, sscan, sscan, sscan, sscan, sscan, sscan, sscan, sscan, sunion, sunion, sunionstore
zadd, zadd, zadd, zadd, zaddincr, zaddincr, zcard, zcount, zcount, zincrby, zinterstore, zinterstore, zlexcount, zrange, zrange, zrangebylex, zrangebylex, zrangebyscore, zrangebyscore, zrangebyscore, zrangebyscore, zrangebyscore, zrangebyscore, zrangebyscore, zrangebyscore, zrangebyscoreWithScores, zrangebyscoreWithScores, zrangebyscoreWithScores, zrangebyscoreWithScores, zrangebyscoreWithScores, zrangebyscoreWithScores, zrangebyscoreWithScores, zrangebyscoreWithScores, zrangeWithScores, zrangeWithScores, zrank, zrem, zremrangebylex, zremrangebyrank, zremrangebyscore, zremrangebyscore, zrevrange, zrevrange, zrevrangebyscore, zrevrangebyscore, zrevrangebyscore, zrevrangebyscore, zrevrangebyscore, zrevrangebyscore, zrevrangebyscore, zrevrangebyscore, zrevrangebyscoreWithScores, zrevrangebyscoreWithScores, zrevrangebyscoreWithScores, zrevrangebyscoreWithScores, zrevrangebyscoreWithScores, zrevrangebyscoreWithScores, zrevrangebyscoreWithScores, zrevrangebyscoreWithScores, zrevrangeWithScores, zrevrangeWithScores, zrevrank, zscan, zscan, zscan, zscan, zscan, zscan, zscan, zscan, zscore, zunionstore, zunionstore
eval, eval, evalsha, evalsha, scriptExists, scriptFlush, scriptKill, scriptLoad
clientUnblock, debugCrashAndRecover, debugReload, debugRestart, debugSdslen
pfadd, pfcount, pfmerge
geoadd, geoadd, geodist, geohash, geopos, georadius, georadius, georadius, georadiusbymember, georadiusbymember, georadiusbymember
digest, discard, dispatch, dispatch, echo, exec, isOpen, multi, ping, publish, pubsubChannels, pubsubChannels, pubsubNumpat, pubsubNumsub, quit, role, unwatch, waitForReplication, watch
void setTimeout(long timeout, TimeUnit unit)
setTimeout
in interface RedisClusterConnection<K,V>
timeout
- the timeout valueunit
- the unit of the timeout valueString auth(String password)
auth
in interface RedisClusterConnection<K,V>
password
- the passwordString clusterBumpepoch()
String clusterMeet(String ip, int port)
clusterMeet
in interface RedisClusterConnection<K,V>
ip
- IP address of the hostport
- port number.String clusterForget(String nodeId)
clusterForget
in interface RedisClusterConnection<K,V>
nodeId
- the node IdString clusterAddSlots(int... slots)
clusterAddSlots
in interface RedisClusterConnection<K,V>
slots
- one or more slots from 0 to 16384String clusterDelSlots(int... slots)
clusterDelSlots
in interface RedisClusterConnection<K,V>
slots
- one or more slots from 0 to 16384String clusterSetSlotNode(int slot, String nodeId)
nodeId
clusterSetSlotNode
in interface RedisClusterConnection<K,V>
slot
- the slotnodeId
- the id of the node that will become the master for the slotString clusterSetSlotStable(int slot)
clusterSetSlotStable
in interface RedisClusterConnection<K,V>
slot
- the slotString clusterSetSlotMigrating(int slot, String nodeId)
nodeId
. The slot must be handled by
the current node in order to be migrated.clusterSetSlotMigrating
in interface RedisClusterConnection<K,V>
slot
- the slotnodeId
- the id of the node is targeted to become the master for the slotString clusterSetSlotImporting(int slot, String nodeId)
nodeId
.clusterSetSlotImporting
in interface RedisClusterConnection<K,V>
slot
- the slotnodeId
- the id of the node is the master of the slotString clusterInfo()
clusterInfo
in interface RedisClusterConnection<K,V>
String clusterMyId()
clusterMyId
in interface RedisClusterConnection<K,V>
String clusterNodes()
ClusterPartitionParser.parse(java.lang.String)
clusterNodes
in interface RedisClusterConnection<K,V>
List<String> clusterSlaves(String nodeId)
nodeId
. Can be parsed using
ClusterPartitionParser.parse(java.lang.String)
clusterSlaves
in interface RedisClusterConnection<K,V>
nodeId
- node id of the master nodeclusterNodes()
but one line per slave.List<K> clusterGetKeysInSlot(int slot, int count)
slot
.clusterGetKeysInSlot
in interface RedisClusterConnection<K,V>
slot
- the slotcount
- maximal number of keysLong clusterCountKeysInSlot(int slot)
slot
.clusterCountKeysInSlot
in interface RedisClusterConnection<K,V>
slot
- the slotLong clusterCountFailureReports(String nodeId)
clusterCountFailureReports
in interface RedisClusterConnection<K,V>
nodeId
- the node idLong clusterKeyslot(K key)
SlotHash.getSlot(byte[])
. If not, call Houston and report that we've got a problem.clusterKeyslot
in interface RedisClusterConnection<K,V>
key
- the key.String clusterSaveconfig()
clusterSaveconfig
in interface RedisClusterConnection<K,V>
OK
or an error if the operation fails.String clusterSetConfigEpoch(long configEpoch)
clusterSetConfigEpoch
in interface RedisClusterConnection<K,V>
configEpoch
- the config epochOK
or an error if the operation fails.List<Object> clusterSlots()
clusterSlots
in interface RedisClusterConnection<K,V>
String asking()
-ASK
redirection. The client should issue ASKING
before to
actually send the command to the target instance. See the Redis Cluster specification for more information.asking
in interface RedisClusterConnection<K,V>
String clusterReplicate(String nodeId)
nodeId
.clusterReplicate
in interface RedisClusterConnection<K,V>
nodeId
- master node idString clusterFailover(boolean force)
clusterFailover
in interface RedisClusterConnection<K,V>
force
- do not coordinate with master if trueString clusterReset(boolean hard)
clusterReset
in interface RedisClusterConnection<K,V>
hard
- true for hard reset. Generates a new nodeId and currentEpoch/configEpoch are set to 0String clusterFlushslots()
clusterFlushslots
in interface RedisClusterConnection<K,V>
String readOnly()
readOnly
in interface BaseRedisCommands<K,V>
readOnly
in interface BaseRedisConnection<K,V>
readOnly
in interface RedisClusterConnection<K,V>
String readWrite()
readWrite
in interface BaseRedisCommands<K,V>
readWrite
in interface BaseRedisConnection<K,V>
readWrite
in interface RedisClusterConnection<K,V>
void close()
close
in interface AutoCloseable
close
in interface BaseRedisCommands<K,V>
close
in interface BaseRedisConnection<K,V>
close
in interface Closeable
Copyright © 2018 lettuce.io. All rights reserved.