public final class ClusterHandler extends Object implements RedisHandler
Modifier and Type | Method and Description |
---|---|
void |
addSlot(org.springframework.data.redis.connection.RedisClusterNode clusterNode,
int... slotIndex)
添加槽
|
void |
addSlotInRange(org.springframework.data.redis.connection.RedisClusterNode clusterNode,
int beginSlotIndex,
int endSlotIndex)
添加槽
|
Long |
countKeyInSlot(int slotIndex)
在指定槽中键的数量
|
void |
forget(org.springframework.data.redis.connection.RedisClusterNode clusterNode)
移除节点
|
void |
forget(String nodeId)
移除节点
|
org.springframework.data.redis.core.RedisTemplate<String,Object> |
getRedisTemplate()
获取spring redis模板
|
org.springframework.data.redis.connection.ClusterInfo |
info()
集群信息
|
List<String> |
keysInSlot(int slotIndex,
Integer count)
在指定槽中键的列表
|
Integer |
keySlot(String key)
键对应的槽
|
Map<org.springframework.data.redis.connection.RedisClusterNode,Collection<org.springframework.data.redis.connection.RedisClusterNode>> |
masterSlaves()
主从节点字典
|
void |
meet(org.springframework.data.redis.connection.RedisClusterNode clusterNode)
连接集群节点
|
void |
meet(String ip,
String port)
连接集群节点
|
org.springframework.data.redis.connection.RedisClusterNode |
nodeForKey(String key)
根据键获取节点
|
org.springframework.data.redis.connection.RedisClusterNode |
nodeForSlot(int slotIndex)
根据键获取节点
|
Iterable<org.springframework.data.redis.connection.RedisClusterNode> |
nodes()
集群节点
|
void |
removeSlot(org.springframework.data.redis.connection.RedisClusterNode clusterNode,
int... slotIndex)
移除槽
|
void |
removeSlotInRange(org.springframework.data.redis.connection.RedisClusterNode clusterNode,
int beginSlotIndex,
int endSlotIndex)
移除槽
|
void |
replicate(org.springframework.data.redis.connection.RedisClusterNode master,
org.springframework.data.redis.connection.RedisClusterNode replica)
设置从节点
|
void |
setSlot(org.springframework.data.redis.connection.RedisClusterNode node,
int slotIndex,
org.springframework.data.redis.connection.RedisClusterCommands.AddSlots mode)
设置槽
|
Collection<org.springframework.data.redis.connection.RedisClusterNode> |
slaves(String masterId)
从节点集合
|
public org.springframework.data.redis.connection.ClusterInfo info()
public Iterable<org.springframework.data.redis.connection.RedisClusterNode> nodes()
public Collection<org.springframework.data.redis.connection.RedisClusterNode> slaves(String masterId)
masterId
- 主节点idpublic Map<org.springframework.data.redis.connection.RedisClusterNode,Collection<org.springframework.data.redis.connection.RedisClusterNode>> masterSlaves()
public org.springframework.data.redis.connection.RedisClusterNode nodeForKey(String key)
key
- 键public org.springframework.data.redis.connection.RedisClusterNode nodeForSlot(int slotIndex)
slotIndex
- 槽索引public void meet(org.springframework.data.redis.connection.RedisClusterNode clusterNode)
clusterNode
- 集群节点public void meet(String ip, String port)
ip
- 服务器IPport
- 服务器端口public void forget(org.springframework.data.redis.connection.RedisClusterNode clusterNode)
clusterNode
- 节点public void forget(String nodeId)
nodeId
- 节点idpublic void replicate(org.springframework.data.redis.connection.RedisClusterNode master, org.springframework.data.redis.connection.RedisClusterNode replica)
master
- 主节点replica
- 从节点public void addSlot(org.springframework.data.redis.connection.RedisClusterNode clusterNode, int... slotIndex)
clusterNode
- 节点slotIndex
- 槽索引public void addSlotInRange(org.springframework.data.redis.connection.RedisClusterNode clusterNode, int beginSlotIndex, int endSlotIndex)
clusterNode
- 节点beginSlotIndex
- 槽开始索引endSlotIndex
- 槽结束索引public void removeSlot(org.springframework.data.redis.connection.RedisClusterNode clusterNode, int... slotIndex)
clusterNode
- 节点slotIndex
- 槽索引public void removeSlotInRange(org.springframework.data.redis.connection.RedisClusterNode clusterNode, int beginSlotIndex, int endSlotIndex)
clusterNode
- 节点beginSlotIndex
- 槽开始索引endSlotIndex
- 槽结束索引public void setSlot(org.springframework.data.redis.connection.RedisClusterNode node, int slotIndex, org.springframework.data.redis.connection.RedisClusterCommands.AddSlots mode)
node
- 节点slotIndex
- 槽索引mode
- 模式public Integer keySlot(String key)
key
- 键public Long countKeyInSlot(int slotIndex)
slotIndex
- 槽索引public List<String> keysInSlot(int slotIndex, Integer count)
slotIndex
- 槽索引count
- 返回数量Copyright © 2019. All rights reserved.