cabol / nebulex_redis_adapter

Nebulex adapter for Redis

Home Page:https://hexdocs.pm/nebulex_redis_adapter/NebulexRedisAdapter.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve configuration for Redis Cluster mode

cabol opened this issue · comments

The current config for Redis Cluster uses the :master_nodes and :conn_opts options, but it is quite confusing how they work. The goal is to simplify it by using only :conn_opts.

The :conn_opts option

For Redis Cluster mode,:conn_opts will define the Redis client options but for the configuration endpoint. This is where the client should connect to send the "CLUSTER SHARDS" (Redis >= 7) or "CLUSTER SLOTS" (Redis < 7) command to get the cluster information and set it up on the client side.

The :override_master_host option

Defines whether the given master host should be overridden with the configuration endpoint or not. Defaults to false. By default, the adapter uses the host returned by the "CLUSTER SHARDS" (Redis >= 7) or "CLUSTER SLOTS" (Redis < 7) command. One may consider set it to true for tests when using Docker for example, or when Redis nodes are behind a load balancer that Redis doesn't know the endpoint of. See Redis docs for more information.