Table of Contents generated with DocToc
Docker compose Redis Clusters with Envoy proxy.
This repo aim to make it quick and simple to get a redis cluster up and running with Envoy as the proxy. The primary use for this cluster is for demo/experimentation/presentation/development running on your location machine.
It this not intended for production use.
This contains 2 Redis clusters, one with cluster mode enabled another with cluster mode disabled and rely on Envoy the partition the keyspace.
The cluster mode enabled cluster is exposed through Envoy on port 6380. Here's the list of nodes in the cluster mode enabled cluster.
IP | Port | Role |
---|---|---|
172.25.0.2 | 7002 | master |
172.25.0.3 | 7003 | master |
172.25.0.4 | 7004 | master |
172.25.0.5 | 7005 | replica |
172.25.0.6 | 7006 | replica |
172.25.0.7 | 7007 | replica |
In cluster mode disabled cluster is exposed through Envoy on port 6381. By default there's only a single node, but it can be scaled using
docker-compose up -d --scale redis-server=3
or
docker-compose scale redis-server=3
docker-compose up --build -d
docker-compose ps
To view the envoy logs.
docker-compose logs envoy
Open http://localhost:9901/ in your browser.
To connect to envoy to the redis cluster 0(cluster mode enabled)
docker-compose exec envoy redis-cli -p 6380
To bypass envoy and connect to one of the nodes directly.
docker-compose exec envoy redis-cli -c -h 172.25.0.2 -p 7002
To connect to envoy to the redis cluster 1(cluster mode disabled)
docker-compose exec envoy redis-cli -p 6381
docker-compose down
We use Pumba for simulating networking errors.
The following example will cause a 1 minute network partition between redis-replica-1 and the rest of the cluster
docker-compose run -rm pumba netem --duration 1m --target 172.25.0.2 --target 172.25.0.3 --target 172.25.0.4 --target 172.25.0.5 --target 172.25.0.7 loss -p 100 docker-envoy-redis-cluster_redis-replica-1_1