Migrating to Redis cluster using envoy proxy

Prashant Sinha
2 min readMar 17, 2020

--

Migrating from a single instance of Redis to a Redis cluster presents its own set of challenges and Redis filter introduced in envoy proxy can be used to mitigate them.

For the sake of simpler reference, I would refer to single instance of Redis as standalone and Redis cluster as cluster.

Migration strategy:

  • Use envoy proxy with Redis filter can enable mirror writes to both, standalone and cluster.
  • Then, make changes to envoy proxy config to enable write and read only from the cluster once the key with minimum TTL expires in the cluster (i.e. the first key set).

Let’s assume that an application connects to standalone using 10.0.0.1:6379.

Envoy proxy can now be introduced using below config to now connect to standalone.

Application would now connect to standalone via the address of envoy proxy with port being the same.

Migration to cluster with IP 10.0.0.2 to 10.0.0.7, can now be started. Envoy proxy needs to use below configuration which will mirror the writes onto cluster.

Once the key with minimum TTL expires in cluster, envoy proxy can then be updated to use below configuration. This enables envoy proxy to connect to cluster only.

With this setup though, we have introduced a single point of failure. This can be taken care of by having sufficient instances of envoy for fallback.

The advantage of using this approach, is that the application code remains untouched and application connects to the Redis just the way it was doing before.

More over, envoy proxy offers a host of statistics through the admin interface which can be reached via {envoy hostname}:1936/stats. These statistics include health checks, Redis operations e.g. SET, GET, HSET, HGET etc., and failures encountered.

To summarise,

envoy proxy can be used for easier migration from single instance of Redis to Redis cluster. This would not only offer higher availability but also insightful statistics with minimal application code changes.

--

--

Prashant Sinha
Prashant Sinha

Written by Prashant Sinha

A polyglot engineer with focus on high availability and distributed computing.

No responses yet