8000 [Cache] Redis adapter is not working at all with sentinel and phpredis extension · Issue #46600 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
[Cache] Redis adapter is not working at all with sentinel and phpredis extension #46600
Closed
@edefimov

Description

@edefimov

Symfony version(s) affected

>=5.3

Description

According to official documentation on redis adapter it is possible to use redis sentinel as DSN for cache component:

RedisAdapter::createConnection(
    'redis:?host[redis1:26379]&host[redis2:26379]&host[redis3:26379]&redis_sentinel=mymaster'
);

However doing so leads to the following problems:

  • defining several hosts along with redis_sentinel param in dsn creates instance of RedisArray instead of RedisSentinel inside the createConnection method of RedisTrait
  • actual redis master is evaluated only once during connection initialization. For long-running applications it is the same as using direct connection to redis without sentinel

How to reproduce

Setup at least 2 redis sentinels and master-slave servers. Try to configure dsn to use sentinel.

Possible Solution

To mitigate the problems sentinel proxy class can be implemented in the same way as existing Redis*Proxy classes. The class should evaluate redis master at runtime and handle "Writing against read only replica" error.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0