HomeTyk v2.3 Documentation ComponentsRedis Cluster with Elasticache Docker

Redis Cluster with Elasticache Docker

For Redis clustered mode to work with Tyk using Docker and Elasticache, follow these two steps:

Step 1: Make sure cluster mode is enabled

Set the environment variable TYK_GW_STORAGE_ENABLECLUSTER to true.

Step 2: Add all cluster endpoints to the config

Add all the cluster endpoints into Tyk, not just the primary. If Tyk can’t see the whole cluster, then it will not work.

For Elasticache Redis, you can bypass having to list all your nodes, and instead just use the configuration endpoint, this allows read and write operations and the endpoint will determine the correct node to target.

If this does not work, you can still list out the hosts using an environment variable, to do so, set the environment variable

TYK_GW_STORAGE_HOSTS="redis_master1:port,redis_slave1:port,redis_master2:port,redis_slave2:port,redis_master3:port,redis_slave3:port"

It is important that Tyk can connect to all masters and slaves.

It is recommended to ensure that the connection pool is big enough. To do this, set the following environment variables:

TYK_GW_STORAGE_MAXIDLE=6000
TYK_GW_STORAGE_MAXACTIVE=10000

Note: These are suggested settings, please verify them by load testing.

Was this article helpful to you? Yes No