Class CommandsLoadBalancer

All Implemented Interfaces:
LoadBalancer

public class CommandsLoadBalancer extends RoundRobinLoadBalancer implements LoadBalancer
Load Balancer redirects specified commands to the Redis node with specified address.
Author:
Nikita Koksharov
  • Constructor Details

    • CommandsLoadBalancer

      public CommandsLoadBalancer()
  • Method Details

    • getEntry

      public ClientConnectionsEntry getEntry(List<ClientConnectionsEntry> clientsCopy, RedisCommand<?> redisCommand)
      Specified by:
      getEntry in interface LoadBalancer
    • setAddress

      @Deprecated public void setAddress(String address)
      Deprecated.
      Defines Redis node address where the commands are redirected to
      Parameters:
      address - Redis node address
    • setCommands

      @Deprecated public void setCommands(List<String> commands)
      Deprecated.
      Defines command names which are redirected to the Redis node specified by setAddress(String)
      Parameters:
      commands - commands list
    • setCommandsMap

      public void setCommandsMap(Map<String,Set<String>> value)
      Defines command names mapped per host name regular expression.

      YAML definition example:

            loadBalancer: !<org.redisson.connection.balancer.CommandsLoadBalancer>
             commandsMap:
                 "slavehost1.*" : ["get", "hget"]
                 "slavehost2.*" : ["mget", "publish"]
       
      Parameters:
      value - a map where the key is a host name regular expression, and the value is an array of command names that should be executed.