Configure symfony cache to use AWS Redis read replicas

53 views Asked by At

I started up a Redis cluster in AWS, with two nodes: the primary, and a replica. The cluster has two entrypoints: primary entrypoint, and reader entrypoint

In my Symfony app I'm using the primary entrypoint in the .env configuration

REDIS_HOST=xxx-redis.yyy.ng.0001.zone.cache.amazonaws.com
REDIS_PORT=6379

and cache configuration under the framework.cache in the cache.yaml like this:

app: cache.adapter.redis
default_redis_provider: redis://%env(REDIS_HOST)%:%env(int:REDIS_PORT)%

The app is working well and cache is being used, but I noticed that only the primary node is being used, the replica does not register any hit.

I googled a lot for configuration examples on how to add the read only entrypoint to the symfony redis configuration, but found nothing.

So, I hope somebody has had the same issue and figured out the solution. I think that maybe doing a custom cache adapter, or something like that maybe?

0

There are 0 answers