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
ConstructorDescriptionRedisNode
(RedisClient client, CommandAsyncExecutor commandExecutor, NodeType type) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Runs an Append Only File rewrite process.Runs an Append Only File rewrite process.void
bgSave()
Runs the Redis database saving process in background.Runs the Redis database saving process in background.void
clusterAddSlots
(int... slots) Adds slots to this Redis nodeclusterAddSlotsAsync
(int... slots) Adds slots to this Redis nodelong
clusterCountFailureReports
(String nodeId) Returns number of failure reports for Redis node by defined idReturns number of failure reports for Redis node by defined idlong
clusterCountKeysInSlot
(int slot) Counts keys in defined slotclusterCountKeysInSlotAsync
(int slot) Counts keys in defined slotvoid
clusterDeleteSlots
(int... slots) Removes slots from this Redis nodeclusterDeleteSlotsAsync
(int... slots) Removes slots from this Redis nodevoid
Removes all slots from this Redis nodeRemoves all slots from this Redis nodevoid
clusterForget
(String nodeId) Removes Redis node by defined id from ClusterclusterForgetAsync
(String nodeId) Removes Redis node by defined id from ClusterclusterGetKeysInSlot
(int slot, int count) Returns keys in defines slot limited by countclusterGetKeysInSlotAsync
(int slot, int count) Returns keys in defines slot limited by countReturns id of this Redis nodeReturns id of this Redis nodeReturns cluster information reported by this Redis nodeReturns cluster information reported by this Redis nodevoid
clusterMeet
(String address) Joins Redis node by the defined address to ClusterclusterMeetAsync
(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.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 commandclusterSetSlotAsync
(int slot, SetSlotCommand command) Sets slot to this Redis node according to defined commandclusterSetSlotAsync
(int slot, SetSlotCommand command, String nodeId) Sets slot to this Redis node according to defined commandReturn Redis Cluster slots mapped to Redis nodesReturn Redis Cluster slots mapped to Redis nodesboolean
getAddr()
Get Redis node addressGet value of Redis configuration parameter.getConfigAsync
(String parameter) Get value of Redis configuration parameter.Returns time of the last successful Redis database save operation.Returns time of the last successful Redis database save operation.Returns Redis memory statisticsReturns Redis memory statisticsint
hashCode()
info
(RedisNode.InfoSection section) Returns information about Redis node.infoAsync
(RedisNode.InfoSection section) Returns information about Redis node.boolean
ping()
Ping Redis node.boolean
Ping Redis node with specified timeout.Ping Redis node.Ping Redis node with specified timeout.void
save()
Save the Redis database.Save the Redis database.void
Save the Redis database in background.Save the Redis database in background.void
Set value of Redis configuration parameter.setConfigAsync
(String parameter, String value) Set value of Redis configuration parameter.long
size()
Returns keys amount stored in this Redis node.Returns keys amount stored in this Redis node.time()
Returns current Redis server time in secondsReturns current Redis server time in secondstoString()
-
Constructor Details
-
RedisNode
-
-
Method Details
-
getClient
-
getAddr
Description copied from interface:RedisNode
Get Redis node address -
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
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
Description copied from interface:RedisNode
Ping Redis node with specified timeout. -
hashCode
public int hashCode() -
equals
-
timeAsync
Description copied from interface:RedisNodeAsync
Returns current Redis server time in seconds- Specified by:
timeAsync
in interfaceRedisNodeAsync
- Returns:
- time in seconds
-
time
Description copied from interface:RedisNode
Returns current Redis server time in seconds -
toString
-
clusterInfoAsync
Description copied from interface:RedisClusterNodeAsync
Returns cluster information reported by this Redis node- Specified by:
clusterInfoAsync
in interfaceRedisClusterNodeAsync
- Returns:
- cluster information
-
clusterInfo
Description copied from interface:RedisClusterNode
Returns cluster information reported by this Redis node- Specified by:
clusterInfo
in interfaceRedisClusterNode
- Returns:
- cluster information
-
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
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
Description copied from interface:RedisClusterNode
Removes Redis node by defined id from Cluster- Specified by:
clusterForget
in interfaceRedisClusterNode
- Parameters:
nodeId
-
-
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
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
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
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
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
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
Description copied from interface:RedisClusterNode
Return Redis Cluster slots mapped to Redis nodes- Specified by:
clusterSlots
in interfaceRedisClusterNode
- Returns:
- slots mapping
-
info
Description copied from interface:RedisNode
Returns information about Redis node. -
getMemoryStatistics
Description copied from interface:RedisNode
Returns Redis memory statistics- Specified by:
getMemoryStatistics
in interfaceRedisNode
- Returns:
- statistics info map
-
getMemoryStatisticsAsync
Description copied from interface:RedisNodeAsync
Returns Redis memory statistics- Specified by:
getMemoryStatisticsAsync
in interfaceRedisNodeAsync
- Returns:
- statistics info map
-
clusterIdAsync
Description copied from interface:RedisClusterNodeAsync
Returns id of this Redis node- Specified by:
clusterIdAsync
in interfaceRedisClusterNodeAsync
- Returns:
- Redis node Id
-
clusterAddSlotsAsync
Description copied from interface:RedisClusterNodeAsync
Adds slots to this Redis node- Specified by:
clusterAddSlotsAsync
in interfaceRedisClusterNodeAsync
- Parameters:
slots
- slots to add- Returns:
- void
-
clusterReplicateAsync
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
Description copied from interface:RedisClusterNodeAsync
Removes Redis node by defined id from Cluster- Specified by:
clusterForgetAsync
in interfaceRedisClusterNodeAsync
- Parameters:
nodeId
-- Returns:
- void
-
clusterDeleteSlotsAsync
Description copied from interface:RedisClusterNodeAsync
Removes slots from this Redis node- Specified by:
clusterDeleteSlotsAsync
in interfaceRedisClusterNodeAsync
- Parameters:
slots
- slots to remove- Returns:
- void
-
clusterCountKeysInSlotAsync
Description copied from interface:RedisClusterNodeAsync
Counts keys in defined slot- Specified by:
clusterCountKeysInSlotAsync
in interfaceRedisClusterNodeAsync
- Parameters:
slot
- slot- Returns:
- keys amount
-
clusterGetKeysInSlotAsync
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
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
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
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
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
Description copied from interface:RedisClusterNodeAsync
Removes all slots from this Redis node- Specified by:
clusterFlushSlotsAsync
in interfaceRedisClusterNodeAsync
- Returns:
- void
-
clusterSlotsAsync
Description copied from interface:RedisClusterNodeAsync
Return Redis Cluster slots mapped to Redis nodes- Specified by:
clusterSlotsAsync
in interfaceRedisClusterNodeAsync
- Returns:
- slots mapping
-
infoAsync
Description copied from interface:RedisNodeAsync
Returns information about Redis node.- Specified by:
infoAsync
in interfaceRedisNodeAsync
- Parameters:
section
- - section of information- Returns:
- information map
-
getConfig
Description copied from interface:RedisNode
Get value of Redis configuration parameter. -
setConfig
Description copied from interface:RedisNode
Set value of Redis configuration parameter. -
getConfigAsync
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
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
-
bgSave
public void bgSave()Description copied from interface:RedisNode
Runs the Redis database saving process in background. -
scheduleBgSave
public void scheduleBgSave()Description copied from interface:RedisNode
Save the Redis database in background. If AOF rewrite process is in progress then the background save is scheduled to run upon its completion.- Specified by:
scheduleBgSave
in interfaceRedisNode
-
save
public void save()Description copied from interface:RedisNode
Save the Redis database. -
getLastSaveTime
Description copied from interface:RedisNode
Returns time of the last successful Redis database save operation.- Specified by:
getLastSaveTime
in interfaceRedisNode
- Returns:
- time
-
bgSaveAsync
Description copied from interface:RedisNodeAsync
Runs the Redis database saving process in background.- Specified by:
bgSaveAsync
in interfaceRedisNodeAsync
-
scheduleBgSaveAsync
Description copied from interface:RedisNodeAsync
Save the Redis database in background. If AOF rewrite process is in progress then the background save is scheduled to run upon its completion.- Specified by:
scheduleBgSaveAsync
in interfaceRedisNodeAsync
-
saveAsync
Description copied from interface:RedisNodeAsync
Save the Redis database.- Specified by:
saveAsync
in interfaceRedisNodeAsync
-
getLastSaveTimeAsync
Description copied from interface:RedisNodeAsync
Returns time of the last successful Redis database save operation.- Specified by:
getLastSaveTimeAsync
in interfaceRedisNodeAsync
- Returns:
- time
-
bgRewriteAOF
public void bgRewriteAOF()Description copied from interface:RedisNode
Runs an Append Only File rewrite process. Starts only if there is no a background process doing persistence.If fails no data gets lost
- Specified by:
bgRewriteAOF
in interfaceRedisNode
-
bgRewriteAOFAsync
Description copied from interface:RedisNodeAsync
Runs an Append Only File rewrite process. Starts only if there is no a background process doing persistence.If fails no data gets lost
- Specified by:
bgRewriteAOFAsync
in interfaceRedisNodeAsync
-
size
public long size()Description copied from interface:RedisNode
Returns keys amount stored in this Redis node. -
sizeAsync
Description copied from interface:RedisNodeAsync
Returns keys amount stored in this Redis node.- Specified by:
sizeAsync
in interfaceRedisNodeAsync
- Returns:
- keys amount
-