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 voidclusterAddSlots(int... slots)Adds slots to this Redis nodeRFuture<Void>clusterAddSlotsAsync(int... slots)Adds slots to this Redis nodelongclusterCountFailureReports(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 idlongclusterCountKeysInSlot(int slot)Counts keys in defined slotRFuture<Long>clusterCountKeysInSlotAsync(int slot)Counts keys in defined slotvoidclusterDeleteSlots(int... slots)Removes slots from this Redis nodeRFuture<Void>clusterDeleteSlotsAsync(int... slots)Removes slots from this Redis nodevoidclusterFlushSlots()Removes all slots from this Redis nodeRFuture<Void>clusterFlushSlotsAsync()Removes all slots from this Redis nodevoidclusterForget(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 countStringclusterId()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 nodevoidclusterMeet(String address)Joins Redis node by the defined address to ClusterRFuture<Void>clusterMeetAsync(String address)Joins Redis node by the defined address to ClustervoidclusterReplicate(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.voidclusterSetSlot(int slot, SetSlotCommand command)Sets slot to this Redis node according to defined commandvoidclusterSetSlot(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 nodesbooleanequals(Object obj)InetSocketAddressgetAddr()Get Redis node addressRedisClientgetClient()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 statisticsinthashCode()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.booleanping()Ping Redis node.booleanping(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.voidsetConfig(String parameter, String value)Set value of Redis configuration parameter.RFuture<Void>setConfigAsync(String parameter, String value)Set value of Redis configuration parameter.Timetime()Returns current Redis server time in secondsRFuture<Time>timeAsync()Returns current Redis server time in secondsStringtoString()
-
-
-
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:RedisNodeGet Redis node address
-
pingAsync
public RFuture<Boolean> pingAsync()
Description copied from interface:RedisNodeAsyncPing Redis node. Default timeout is 1000 milliseconds- Specified by:
pingAsyncin interfaceRedisNodeAsync- Returns:
trueif "PONG" reply received,falseotherwise
-
pingAsync
public RFuture<Boolean> pingAsync(long timeout, TimeUnit timeUnit)
Description copied from interface:RedisNodeAsyncPing Redis node with specified timeout.- Specified by:
pingAsyncin interfaceRedisNodeAsync- Parameters:
timeout- - ping timeouttimeUnit- - timeout unit- Returns:
trueif "PONG" reply received,falseotherwise
-
ping
public boolean ping()
Description copied from interface:RedisNodePing Redis node. Default timeout is 1000 milliseconds
-
ping
public boolean ping(long timeout, TimeUnit timeUnit)Description copied from interface:RedisNodePing Redis node with specified timeout.
-
timeAsync
public RFuture<Time> timeAsync()
Description copied from interface:RedisNodeAsyncReturns current Redis server time in seconds- Specified by:
timeAsyncin interfaceRedisNodeAsync- Returns:
- time in seconds
-
time
public Time time()
Description copied from interface:RedisNodeReturns current Redis server time in seconds
-
clusterInfoAsync
public RFuture<Map<String,String>> clusterInfoAsync()
Description copied from interface:RedisClusterNodeAsyncReturns cluster information reported by this Redis node- Specified by:
clusterInfoAsyncin interfaceRedisClusterNodeAsync- Returns:
- cluster information
-
clusterInfo
public Map<String,String> clusterInfo()
Description copied from interface:RedisClusterNodeReturns cluster information reported by this Redis node- Specified by:
clusterInfoin interfaceRedisClusterNode- Returns:
- cluster information
-
clusterId
public String clusterId()
Description copied from interface:RedisClusterNodeReturns id of this Redis node- Specified by:
clusterIdin interfaceRedisClusterNode- Returns:
- Redis node Id
-
clusterAddSlots
public void clusterAddSlots(int... slots)
Description copied from interface:RedisClusterNodeAdds slots to this Redis node- Specified by:
clusterAddSlotsin interfaceRedisClusterNode- Parameters:
slots- slots to add
-
clusterReplicate
public void clusterReplicate(String nodeId)
Description copied from interface:RedisClusterNodeReconfigures this Redis node as replica of Redis node by defined id.- Specified by:
clusterReplicatein interfaceRedisClusterNode- Parameters:
nodeId- Redis node Id
-
clusterForget
public void clusterForget(String nodeId)
Description copied from interface:RedisClusterNodeRemoves Redis node by defined id from Cluster- Specified by:
clusterForgetin interfaceRedisClusterNode
-
clusterDeleteSlots
public void clusterDeleteSlots(int... slots)
Description copied from interface:RedisClusterNodeRemoves slots from this Redis node- Specified by:
clusterDeleteSlotsin interfaceRedisClusterNode- Parameters:
slots- slots to remove
-
clusterCountKeysInSlot
public long clusterCountKeysInSlot(int slot)
Description copied from interface:RedisClusterNodeCounts keys in defined slot- Specified by:
clusterCountKeysInSlotin interfaceRedisClusterNode- Parameters:
slot- slot- Returns:
- keys amount
-
clusterGetKeysInSlot
public List<String> clusterGetKeysInSlot(int slot, int count)
Description copied from interface:RedisClusterNodeReturns keys in defines slot limited by count- Specified by:
clusterGetKeysInSlotin interfaceRedisClusterNode- Parameters:
slot- slotcount- limits keys amount- Returns:
- keys
-
clusterSetSlot
public void clusterSetSlot(int slot, SetSlotCommand command)Description copied from interface:RedisClusterNodeSets slot to this Redis node according to defined command- Specified by:
clusterSetSlotin interfaceRedisClusterNode- Parameters:
slot- slotcommand- slot command
-
clusterSetSlot
public void clusterSetSlot(int slot, SetSlotCommand command, String nodeId)Description copied from interface:RedisClusterNodeSets slot to this Redis node according to defined command- Specified by:
clusterSetSlotin interfaceRedisClusterNode- Parameters:
slot- slotcommand- slot commandnodeId- Redis node id
-
clusterMeet
public void clusterMeet(String address)
Description copied from interface:RedisClusterNodeJoins Redis node by the defined address to ClusterAddress example:
redis://127.0.0.1:9233- Specified by:
clusterMeetin interfaceRedisClusterNode- Parameters:
address- Redis node address
-
clusterCountFailureReports
public long clusterCountFailureReports(String nodeId)
Description copied from interface:RedisClusterNodeReturns number of failure reports for Redis node by defined id- Specified by:
clusterCountFailureReportsin interfaceRedisClusterNode- Parameters:
nodeId- Redis node id- Returns:
- amount of failure reports
-
clusterFlushSlots
public void clusterFlushSlots()
Description copied from interface:RedisClusterNodeRemoves all slots from this Redis node- Specified by:
clusterFlushSlotsin interfaceRedisClusterNode
-
clusterSlots
public Map<ClusterSlotRange,Set<String>> clusterSlots()
Description copied from interface:RedisClusterNodeReturn Redis Cluster slots mapped to Redis nodes- Specified by:
clusterSlotsin interfaceRedisClusterNode- Returns:
- slots mapping
-
info
public Map<String,String> info(RedisNode.InfoSection section)
Description copied from interface:RedisNodeReturns information about Redis node.
-
getMemoryStatistics
public Map<String,String> getMemoryStatistics()
Description copied from interface:RedisNodeReturns Redis memory statistics- Specified by:
getMemoryStatisticsin interfaceRedisNode- Returns:
- statistics info map
-
getMemoryStatisticsAsync
public RFuture<Map<String,String>> getMemoryStatisticsAsync()
Description copied from interface:RedisNodeAsyncReturns Redis memory statistics- Specified by:
getMemoryStatisticsAsyncin interfaceRedisNodeAsync- Returns:
- statistics info map
-
clusterIdAsync
public RFuture<String> clusterIdAsync()
Description copied from interface:RedisClusterNodeAsyncReturns id of this Redis node- Specified by:
clusterIdAsyncin interfaceRedisClusterNodeAsync- Returns:
- Redis node Id
-
clusterAddSlotsAsync
public RFuture<Void> clusterAddSlotsAsync(int... slots)
Description copied from interface:RedisClusterNodeAsyncAdds slots to this Redis node- Specified by:
clusterAddSlotsAsyncin interfaceRedisClusterNodeAsync- Parameters:
slots- slots to add- Returns:
- void
-
clusterReplicateAsync
public RFuture<Void> clusterReplicateAsync(String nodeId)
Description copied from interface:RedisClusterNodeAsyncReconfigures this Redis node as replica of Redis node by defined id.- Specified by:
clusterReplicateAsyncin interfaceRedisClusterNodeAsync- Parameters:
nodeId- Redis node Id- Returns:
- void
-
clusterForgetAsync
public RFuture<Void> clusterForgetAsync(String nodeId)
Description copied from interface:RedisClusterNodeAsyncRemoves Redis node by defined id from Cluster- Specified by:
clusterForgetAsyncin interfaceRedisClusterNodeAsync- Returns:
- void
-
clusterDeleteSlotsAsync
public RFuture<Void> clusterDeleteSlotsAsync(int... slots)
Description copied from interface:RedisClusterNodeAsyncRemoves slots from this Redis node- Specified by:
clusterDeleteSlotsAsyncin interfaceRedisClusterNodeAsync- Parameters:
slots- slots to remove- Returns:
- void
-
clusterCountKeysInSlotAsync
public RFuture<Long> clusterCountKeysInSlotAsync(int slot)
Description copied from interface:RedisClusterNodeAsyncCounts keys in defined slot- Specified by:
clusterCountKeysInSlotAsyncin interfaceRedisClusterNodeAsync- Parameters:
slot- slot- Returns:
- keys amount
-
clusterGetKeysInSlotAsync
public RFuture<List<String>> clusterGetKeysInSlotAsync(int slot, int count)
Description copied from interface:RedisClusterNodeAsyncReturns keys in defines slot limited by count- Specified by:
clusterGetKeysInSlotAsyncin interfaceRedisClusterNodeAsync- Parameters:
slot- slotcount- limits keys amount- Returns:
- keys
-
clusterSetSlotAsync
public RFuture<Void> clusterSetSlotAsync(int slot, SetSlotCommand command)
Description copied from interface:RedisClusterNodeAsyncSets slot to this Redis node according to defined command- Specified by:
clusterSetSlotAsyncin interfaceRedisClusterNodeAsync- Parameters:
slot- slotcommand- slot command- Returns:
- void
-
clusterSetSlotAsync
public RFuture<Void> clusterSetSlotAsync(int slot, SetSlotCommand command, String nodeId)
Description copied from interface:RedisClusterNodeAsyncSets slot to this Redis node according to defined command- Specified by:
clusterSetSlotAsyncin interfaceRedisClusterNodeAsync- Parameters:
slot- slotcommand- slot commandnodeId- Redis node id- Returns:
- void
-
clusterMeetAsync
public RFuture<Void> clusterMeetAsync(String address)
Description copied from interface:RedisClusterNodeAsyncJoins Redis node by the defined address to ClusterAddress example:
redis://127.0.0.1:9233- Specified by:
clusterMeetAsyncin interfaceRedisClusterNodeAsync- Parameters:
address- Redis node address- Returns:
- void
-
clusterCountFailureReportsAsync
public RFuture<Long> clusterCountFailureReportsAsync(String nodeId)
Description copied from interface:RedisClusterNodeAsyncReturns number of failure reports for Redis node by defined id- Specified by:
clusterCountFailureReportsAsyncin interfaceRedisClusterNodeAsync- Parameters:
nodeId- Redis node id- Returns:
- amount of failure reports
-
clusterFlushSlotsAsync
public RFuture<Void> clusterFlushSlotsAsync()
Description copied from interface:RedisClusterNodeAsyncRemoves all slots from this Redis node- Specified by:
clusterFlushSlotsAsyncin interfaceRedisClusterNodeAsync- Returns:
- void
-
clusterSlotsAsync
public RFuture<Map<ClusterSlotRange,Set<String>>> clusterSlotsAsync()
Description copied from interface:RedisClusterNodeAsyncReturn Redis Cluster slots mapped to Redis nodes- Specified by:
clusterSlotsAsyncin interfaceRedisClusterNodeAsync- Returns:
- slots mapping
-
infoAsync
public RFuture<Map<String,String>> infoAsync(RedisNode.InfoSection section)
Description copied from interface:RedisNodeAsyncReturns information about Redis node.- Specified by:
infoAsyncin interfaceRedisNodeAsync- Parameters:
section- - section of information- Returns:
- information map
-
getConfig
public Map<String,String> getConfig(String parameter)
Description copied from interface:RedisNodeGet value of Redis configuration parameter.
-
setConfig
public void setConfig(String parameter, String value)
Description copied from interface:RedisNodeSet value of Redis configuration parameter.
-
getConfigAsync
public RFuture<Map<String,String>> getConfigAsync(String parameter)
Description copied from interface:RedisNodeAsyncGet value of Redis configuration parameter.- Specified by:
getConfigAsyncin interfaceRedisNodeAsync- Parameters:
parameter- - name of parameter- Returns:
- value of parameter
-
setConfigAsync
public RFuture<Void> setConfigAsync(String parameter, String value)
Description copied from interface:RedisNodeAsyncSet value of Redis configuration parameter.- Specified by:
setConfigAsyncin interfaceRedisNodeAsync- Parameters:
parameter- - name of parametervalue- - value of parameter- Returns:
- void
-
-