Interface ClusterOperations<K,V>
@NullUnmarked
public interface ClusterOperations<K,V>
Redis operations for cluster specific operations. A
RedisClusterNode can be obtained from
a connection or it can be constructed using either
host and RedisNode.getPort() or the node Id.- Since:
- 1.7
- Author:
- Christoph Strobl, Mark Paluch, Dennis Neufeld
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddSlots(@NonNull RedisClusterNode node, int... slots) Add slots to given node;voidaddSlots(@NonNull RedisClusterNode node, @NonNull RedisClusterNode.SlotRange range) Add slots inRedisClusterNode.SlotRangeto given node.voidbgReWriteAof(@NonNull RedisClusterNode node) Start an Append Only File rewrite process on given node.voidbgSave(@NonNull RedisClusterNode node) Start background saving of db on given node.voidflushDb(@NonNull RedisClusterNode node) Flush db on node.voidflushDb(@NonNull RedisClusterNode node, @NonNull RedisServerCommands.FlushOption option) Flush db on node using the specifiedRedisServerCommands.FlushOption.voidforget(@NonNull RedisClusterNode node) Remove the node from the cluster.Collection<@NonNull RedisClusterNode> getReplicas(@NonNull RedisClusterNode node) keys(@NonNull RedisClusterNode node, @NonNull K pattern) Retrieve all keys located at given node matching the given pattern.voidmeet(@NonNull RedisClusterNode node) Add the node to cluster.ping(@NonNull RedisClusterNode node) Ping the given node;randomKey(@NonNull RedisClusterNode node) Get a random key from the range served by the given node.voidreshard(@NonNull RedisClusterNode source, int slot, @NonNull RedisClusterNode target) Move slot assignment from one source to target node and copy keys associated with the slot.voidsave(@NonNull RedisClusterNode node) Synchronous save current db snapshot on server.voidshutdown(@NonNull RedisClusterNode node) Shutdown given node.
-
Method Details
-
keys
Retrieve all keys located at given node matching the given pattern.IMPORTANT: The KEYS command is non-interruptible and scans the entire keyspace which may cause performance issues.
- Parameters:
node- must not be null.pattern-- Returns:
- never null.
- See Also:
-
ping
Ping the given node;- Parameters:
node- must not be null.- Returns:
- See Also:
-
randomKey
Get a random key from the range served by the given node.- Parameters:
node- must not be null.- Returns:
- See Also:
-
addSlots
Add slots to given node;- Parameters:
node- must not be null.slots- must not be null.
-
addSlots
Add slots inRedisClusterNode.SlotRangeto given node.- Parameters:
node- must not be null.range- must not be null.
-
bgReWriteAof
Start an Append Only File rewrite process on given node.- Parameters:
node- must not be null.- See Also:
-
bgSave
Start background saving of db on given node.- Parameters:
node- must not be null.- See Also:
-
meet
Add the node to cluster.- Parameters:
node- must not be null.
-
forget
Remove the node from the cluster.- Parameters:
node- must not be null.
-
flushDb
Flush db on node.- Parameters:
node- must not be null.- See Also:
-
flushDb
Flush db on node using the specifiedRedisServerCommands.FlushOption.- Parameters:
node- must not be null.option- must not be null.- Since:
- 2.7
- See Also:
-
getReplicas
- Parameters:
node- must not be null.- Returns:
-
save
Synchronous save current db snapshot on server.- Parameters:
node- must not be null.- See Also:
-
shutdown
Shutdown given node.- Parameters:
node- must not be null.- See Also:
-
reshard
Move slot assignment from one source to target node and copy keys associated with the slot.- Parameters:
source- must not be null.slot-target- must not be null.
-