Package org.redisson.redisnode
Class RedisNode
- java.lang.Object
-
- org.redisson.redisnode.RedisNode
-
- All Implemented Interfaces:
RedisClusterMaster
,RedisClusterMasterAsync
,RedisClusterNode
,RedisClusterNodeAsync
,RedisClusterSlave
,RedisClusterSlaveAsync
,RedisMaster
,RedisMasterAsync
,RedisNode
,RedisNodeAsync
,RedisSlave
,RedisSlaveAsync
public class RedisNode extends Object implements RedisClusterMaster, RedisClusterSlave, RedisMaster, RedisSlave, RedisClusterMasterAsync, RedisClusterSlaveAsync, RedisMasterAsync, RedisSlaveAsync
- Author:
- Nikita Koksharov
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.redisson.api.redisnode.RedisNode
RedisNode.InfoSection
-
-
Constructor Summary
Constructors Constructor Description RedisNode(RedisClient client, CommandAsyncExecutor commandExecutor, NodeType type)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clusterAddSlots(int... slots)
Adds slots to this Redis nodeRFuture<Void>
clusterAddSlotsAsync(int... slots)
Adds slots to this Redis nodelong
clusterCountFailureReports(String nodeId)
Returns number of failure reports for Redis node by defined idRFuture<Long>
clusterCountFailureReportsAsync(String nodeId)
Returns number of failure reports for Redis node by defined idlong
clusterCountKeysInSlot(int slot)
Counts keys in defined slotRFuture<Long>
clusterCountKeysInSlotAsync(int slot)
Counts keys in defined slotvoid
clusterDeleteSlots(int... slots)
Removes slots from this Redis nodeRFuture<Void>
clusterDeleteSlotsAsync(int... slots)
Removes slots from this Redis nodevoid
clusterFlushSlots()
Removes all slots from this Redis nodeRFuture<Void>
clusterFlushSlotsAsync()
Removes all slots from this Redis nodevoid
clusterForget(String nodeId)
Removes Redis node by defined id from ClusterRFuture<Void>
clusterForgetAsync(String nodeId)
Removes Redis node by defined id from ClusterList<String>
clusterGetKeysInSlot(int slot, int count)
Returns keys in defines slot limited by countRFuture<List<String>>
clusterGetKeysInSlotAsync(int slot, int count)
Returns keys in defines slot limited by countString
clusterId()
Returns id of this Redis nodeRFuture<String>
clusterIdAsync()
Returns id of this Redis nodeMap<String,String>
clusterInfo()
Returns cluster information reported by this Redis nodeRFuture<Map<String,String>>
clusterInfoAsync()
Returns cluster information reported by this Redis nodevoid
clusterMeet(String address)
Joins Redis node by the defined address to ClusterRFuture<Void>
clusterMeetAsync(String address)
Joins Redis node by the defined address to Clustervoid
clusterReplicate(String nodeId)
Reconfigures this Redis node as replica of Redis node by defined id.RFuture<Void>
clusterReplicateAsync(String nodeId)
Reconfigures this Redis node as replica of Redis node by defined id.void
clusterSetSlot(int slot, SetSlotCommand command)
Sets slot to this Redis node according to defined commandvoid
clusterSetSlot(int slot, SetSlotCommand command, String nodeId)
Sets slot to this Redis node according to defined commandRFuture<Void>
clusterSetSlotAsync(int slot, SetSlotCommand command)
Sets slot to this Redis node according to defined commandRFuture<Void>
clusterSetSlotAsync(int slot, SetSlotCommand command, String nodeId)
Sets slot to this Redis node according to defined commandMap<ClusterSlotRange,Set<String>>
clusterSlots()
Return Redis Cluster slots mapped to Redis nodesRFuture<Map<ClusterSlotRange,Set<String>>>
clusterSlotsAsync()
Return Redis Cluster slots mapped to Redis nodesboolean
equals(Object obj)
InetSocketAddress
getAddr()
Get Redis node addressRedisClient
getClient()
Map<String,String>
getConfig(String parameter)
Get value of Redis configuration parameter.RFuture<Map<String,String>>
getConfigAsync(String parameter)
Get value of Redis configuration parameter.Map<String,String>
getMemoryStatistics()
Returns Redis memory statisticsRFuture<Map<String,String>>
getMemoryStatisticsAsync()
Returns Redis memory statisticsint
hashCode()
Map<String,String>
info(RedisNode.InfoSection section)
Returns information about Redis node.RFuture<Map<String,String>>
infoAsync(RedisNode.InfoSection section)
Returns information about Redis node.boolean
ping()
Ping Redis node.boolean
ping(long timeout, TimeUnit timeUnit)
Ping Redis node with specified timeout.RFuture<Boolean>
pingAsync()
Ping Redis node.RFuture<Boolean>
pingAsync(long timeout, TimeUnit timeUnit)
Ping Redis node with specified timeout.void
setConfig(String parameter, String value)
Set value of Redis configuration parameter.RFuture<Void>
setConfigAsync(String parameter, String value)
Set value of Redis configuration parameter.Time
time()
Returns current Redis server time in secondsRFuture<Time>
timeAsync()
Returns current Redis server time in secondsString
toString()
-
-
-
Constructor Detail
-
RedisNode
public RedisNode(RedisClient client, CommandAsyncExecutor commandExecutor, NodeType type)
-
-
Method Detail
-
getClient
public RedisClient getClient()
-
getAddr
public InetSocketAddress getAddr()
Description copied from interface:RedisNode
Get Redis node address
-
pingAsync
public RFuture<Boolean> pingAsync()
Description copied from interface:RedisNodeAsync
Ping Redis node. Default timeout is 1000 milliseconds- Specified by:
pingAsync
in interfaceRedisNodeAsync
- Returns:
true
if "PONG" reply received,false
otherwise
-
pingAsync
public RFuture<Boolean> pingAsync(long timeout, TimeUnit timeUnit)
Description copied from interface:RedisNodeAsync
Ping Redis node with specified timeout.- Specified by:
pingAsync
in interfaceRedisNodeAsync
- Parameters:
timeout
- - ping timeouttimeUnit
- - timeout unit- Returns:
true
if "PONG" reply received,false
otherwise
-
ping
public boolean ping()
Description copied from interface:RedisNode
Ping Redis node. Default timeout is 1000 milliseconds
-
ping
public boolean ping(long timeout, TimeUnit timeUnit)
Description copied from interface:RedisNode
Ping Redis node with specified timeout.
-
timeAsync
public RFuture<Time> timeAsync()
Description copied from interface:RedisNodeAsync
Returns current Redis server time in seconds- Specified by:
timeAsync
in interfaceRedisNodeAsync
- Returns:
- time in seconds
-
time
public Time time()
Description copied from interface:RedisNode
Returns current Redis server time in seconds
-
clusterInfoAsync
public RFuture<Map<String,String>> clusterInfoAsync()
Description copied from interface:RedisClusterNodeAsync
Returns cluster information reported by this Redis node- Specified by:
clusterInfoAsync
in interfaceRedisClusterNodeAsync
- Returns:
- cluster information
-
clusterInfo
public Map<String,String> clusterInfo()
Description copied from interface:RedisClusterNode
Returns cluster information reported by this Redis node- Specified by:
clusterInfo
in interfaceRedisClusterNode
- Returns:
- cluster information
-
clusterId
public String clusterId()
Description copied from interface:RedisClusterNode
Returns id of this Redis node- Specified by:
clusterId
in interfaceRedisClusterNode
- Returns:
- Redis node Id
-
clusterAddSlots
public void clusterAddSlots(int... slots)
Description copied from interface:RedisClusterNode
Adds slots to this Redis node- Specified by:
clusterAddSlots
in interfaceRedisClusterNode
- Parameters:
slots
- slots to add
-
clusterReplicate
public void clusterReplicate(String nodeId)
Description copied from interface:RedisClusterNode
Reconfigures this Redis node as replica of Redis node by defined id.- Specified by:
clusterReplicate
in interfaceRedisClusterNode
- Parameters:
nodeId
- Redis node Id
-
clusterForget
public void clusterForget(String nodeId)
Description copied from interface:RedisClusterNode
Removes Redis node by defined id from Cluster- Specified by:
clusterForget
in interfaceRedisClusterNode
-
clusterDeleteSlots
public void clusterDeleteSlots(int... slots)
Description copied from interface:RedisClusterNode
Removes slots from this Redis node- Specified by:
clusterDeleteSlots
in interfaceRedisClusterNode
- Parameters:
slots
- slots to remove
-
clusterCountKeysInSlot
public long clusterCountKeysInSlot(int slot)
Description copied from interface:RedisClusterNode
Counts keys in defined slot- Specified by:
clusterCountKeysInSlot
in interfaceRedisClusterNode
- Parameters:
slot
- slot- Returns:
- keys amount
-
clusterGetKeysInSlot
public List<String> clusterGetKeysInSlot(int slot, int count)
Description copied from interface:RedisClusterNode
Returns keys in defines slot limited by count- Specified by:
clusterGetKeysInSlot
in interfaceRedisClusterNode
- Parameters:
slot
- slotcount
- limits keys amount- Returns:
- keys
-
clusterSetSlot
public void clusterSetSlot(int slot, SetSlotCommand command)
Description copied from interface:RedisClusterNode
Sets slot to this Redis node according to defined command- Specified by:
clusterSetSlot
in interfaceRedisClusterNode
- Parameters:
slot
- slotcommand
- slot command
-
clusterSetSlot
public void clusterSetSlot(int slot, SetSlotCommand command, String nodeId)
Description copied from interface:RedisClusterNode
Sets slot to this Redis node according to defined command- Specified by:
clusterSetSlot
in interfaceRedisClusterNode
- Parameters:
slot
- slotcommand
- slot commandnodeId
- Redis node id
-
clusterMeet
public void clusterMeet(String address)
Description copied from interface:RedisClusterNode
Joins Redis node by the defined address to ClusterAddress example:
redis://127.0.0.1:9233
- Specified by:
clusterMeet
in interfaceRedisClusterNode
- Parameters:
address
- Redis node address
-
clusterCountFailureReports
public long clusterCountFailureReports(String nodeId)
Description copied from interface:RedisClusterNode
Returns number of failure reports for Redis node by defined id- Specified by:
clusterCountFailureReports
in interfaceRedisClusterNode
- Parameters:
nodeId
- Redis node id- Returns:
- amount of failure reports
-
clusterFlushSlots
public void clusterFlushSlots()
Description copied from interface:RedisClusterNode
Removes all slots from this Redis node- Specified by:
clusterFlushSlots
in interfaceRedisClusterNode
-
clusterSlots
public Map<ClusterSlotRange,Set<String>> clusterSlots()
Description copied from interface:RedisClusterNode
Return Redis Cluster slots mapped to Redis nodes- Specified by:
clusterSlots
in interfaceRedisClusterNode
- Returns:
- slots mapping
-
info
public Map<String,String> info(RedisNode.InfoSection section)
Description copied from interface:RedisNode
Returns information about Redis node.
-
getMemoryStatistics
public Map<String,String> getMemoryStatistics()
Description copied from interface:RedisNode
Returns Redis memory statistics- Specified by:
getMemoryStatistics
in interfaceRedisNode
- Returns:
- statistics info map
-
getMemoryStatisticsAsync
public RFuture<Map<String,String>> getMemoryStatisticsAsync()
Description copied from interface:RedisNodeAsync
Returns Redis memory statistics- Specified by:
getMemoryStatisticsAsync
in interfaceRedisNodeAsync
- Returns:
- statistics info map
-
clusterIdAsync
public RFuture<String> clusterIdAsync()
Description copied from interface:RedisClusterNodeAsync
Returns id of this Redis node- Specified by:
clusterIdAsync
in interfaceRedisClusterNodeAsync
- Returns:
- Redis node Id
-
clusterAddSlotsAsync
public RFuture<Void> clusterAddSlotsAsync(int... slots)
Description copied from interface:RedisClusterNodeAsync
Adds slots to this Redis node- Specified by:
clusterAddSlotsAsync
in interfaceRedisClusterNodeAsync
- Parameters:
slots
- slots to add- Returns:
- void
-
clusterReplicateAsync
public RFuture<Void> clusterReplicateAsync(String nodeId)
Description copied from interface:RedisClusterNodeAsync
Reconfigures this Redis node as replica of Redis node by defined id.- Specified by:
clusterReplicateAsync
in interfaceRedisClusterNodeAsync
- Parameters:
nodeId
- Redis node Id- Returns:
- void
-
clusterForgetAsync
public RFuture<Void> clusterForgetAsync(String nodeId)
Description copied from interface:RedisClusterNodeAsync
Removes Redis node by defined id from Cluster- Specified by:
clusterForgetAsync
in interfaceRedisClusterNodeAsync
- Returns:
- void
-
clusterDeleteSlotsAsync
public RFuture<Void> clusterDeleteSlotsAsync(int... slots)
Description copied from interface:RedisClusterNodeAsync
Removes slots from this Redis node- Specified by:
clusterDeleteSlotsAsync
in interfaceRedisClusterNodeAsync
- Parameters:
slots
- slots to remove- Returns:
- void
-
clusterCountKeysInSlotAsync
public RFuture<Long> clusterCountKeysInSlotAsync(int slot)
Description copied from interface:RedisClusterNodeAsync
Counts keys in defined slot- Specified by:
clusterCountKeysInSlotAsync
in interfaceRedisClusterNodeAsync
- Parameters:
slot
- slot- Returns:
- keys amount
-
clusterGetKeysInSlotAsync
public RFuture<List<String>> clusterGetKeysInSlotAsync(int slot, int count)
Description copied from interface:RedisClusterNodeAsync
Returns keys in defines slot limited by count- Specified by:
clusterGetKeysInSlotAsync
in interfaceRedisClusterNodeAsync
- Parameters:
slot
- slotcount
- limits keys amount- Returns:
- keys
-
clusterSetSlotAsync
public RFuture<Void> clusterSetSlotAsync(int slot, SetSlotCommand command)
Description copied from interface:RedisClusterNodeAsync
Sets slot to this Redis node according to defined command- Specified by:
clusterSetSlotAsync
in interfaceRedisClusterNodeAsync
- Parameters:
slot
- slotcommand
- slot command- Returns:
- void
-
clusterSetSlotAsync
public RFuture<Void> clusterSetSlotAsync(int slot, SetSlotCommand command, String nodeId)
Description copied from interface:RedisClusterNodeAsync
Sets slot to this Redis node according to defined command- Specified by:
clusterSetSlotAsync
in interfaceRedisClusterNodeAsync
- Parameters:
slot
- slotcommand
- slot commandnodeId
- Redis node id- Returns:
- void
-
clusterMeetAsync
public RFuture<Void> clusterMeetAsync(String address)
Description copied from interface:RedisClusterNodeAsync
Joins Redis node by the defined address to ClusterAddress example:
redis://127.0.0.1:9233
- Specified by:
clusterMeetAsync
in interfaceRedisClusterNodeAsync
- Parameters:
address
- Redis node address- Returns:
- void
-
clusterCountFailureReportsAsync
public RFuture<Long> clusterCountFailureReportsAsync(String nodeId)
Description copied from interface:RedisClusterNodeAsync
Returns number of failure reports for Redis node by defined id- Specified by:
clusterCountFailureReportsAsync
in interfaceRedisClusterNodeAsync
- Parameters:
nodeId
- Redis node id- Returns:
- amount of failure reports
-
clusterFlushSlotsAsync
public RFuture<Void> clusterFlushSlotsAsync()
Description copied from interface:RedisClusterNodeAsync
Removes all slots from this Redis node- Specified by:
clusterFlushSlotsAsync
in interfaceRedisClusterNodeAsync
- Returns:
- void
-
clusterSlotsAsync
public RFuture<Map<ClusterSlotRange,Set<String>>> clusterSlotsAsync()
Description copied from interface:RedisClusterNodeAsync
Return Redis Cluster slots mapped to Redis nodes- Specified by:
clusterSlotsAsync
in interfaceRedisClusterNodeAsync
- Returns:
- slots mapping
-
infoAsync
public RFuture<Map<String,String>> infoAsync(RedisNode.InfoSection section)
Description copied from interface:RedisNodeAsync
Returns information about Redis node.- Specified by:
infoAsync
in interfaceRedisNodeAsync
- Parameters:
section
- - section of information- Returns:
- information map
-
getConfig
public Map<String,String> getConfig(String parameter)
Description copied from interface:RedisNode
Get value of Redis configuration parameter.
-
setConfig
public void setConfig(String parameter, String value)
Description copied from interface:RedisNode
Set value of Redis configuration parameter.
-
getConfigAsync
public RFuture<Map<String,String>> getConfigAsync(String parameter)
Description copied from interface:RedisNodeAsync
Get value of Redis configuration parameter.- Specified by:
getConfigAsync
in interfaceRedisNodeAsync
- Parameters:
parameter
- - name of parameter- Returns:
- value of parameter
-
setConfigAsync
public RFuture<Void> setConfigAsync(String parameter, String value)
Description copied from interface:RedisNodeAsync
Set value of Redis configuration parameter.- Specified by:
setConfigAsync
in interfaceRedisNodeAsync
- Parameters:
parameter
- - name of parametervalue
- - value of parameter- Returns:
- void
-
-