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

New Redis Cluster management strategy

cabol opened this issue · comments

New Redis Cluster management strategy

Currently, the Redis Cluster setup is very naive, when the cache is started, it tries to get the cluster configuration from Redis and then configure the supervision tree based on it. The problem is it is static once the cache starts, and it doesn't handle cluster changes or "MOVED" errors. The idea is to provide a smarter cluster management strategy able to handle cluster changes as well as "MOVED" errors dynamically.

Strategy highlights

  • A dynamic supervision tree for handling the connection pools to the different master nodes.
  • A configuration manager process in charge of configuring the hash slot map whenever there is a change in the cluster to a "MOVED" error.
  • When the configuration manager runs, it should block all commands execution until the hash slot map is ready to use.
  • Whenever there is a "MOVED" error, the configuration manager is called to re-configure the cluster and once it is done, the failed command is executed again.
  • Remove the :master_nodes option which is quite confusing and use only :conn_opts instead. The idea here is to configure only the configuration endpoint via the :conn_opts; 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.