php-bundles/redis-bundle

Avoid treating single server as cluster

tobiassjosten opened this issue · 9 comments

Because the $parameters configuration is required to be an array and because Predis defaults to cluster configuration for array parameters, I can't see a clear way to solve this. I've only got one server and I don't want to use any cluster functionality.

How do I configure this bundle for this?

I'm investigating the problem and I'll give answer for you

If you are going to use an array to specify parameters for a single Redis node then you should use a named array:

$parameters: { host: '127.0.0.1', port: 6379, read_write_timeout: 0 }

Plain indexed arrays, even when only one element is specified, are interpreted as a set of connection parameters for multiple nodes which ends up enabling client-side sharding.

Thanks! But how about if I want to use a full URL? This is what I had:

$parameters: ["%env(REDIS_URL)%"]

So, no solution for that use case then? :)

I thought you already found a solution)
I will study this question in the near future and I will answer

Thanks! I actually had to drop this bundle and wire in Predis myself. Would love to cut that out and go with yours though.

Hello, i have the same issue cant't add multi redis server in the .env file is there a solution ?

Hello,

I'm having the same issue.

When I try to execute this

$this->client->flushall();

I have this error : Cannot use 'FLUSHALL' over clusters of connections.

My configuration look like this

sb_redis:
    clients:
        default:
            $options:    []
            $parameters: ['%env(REDIS_URL)%']

Is there any workaround for this ?

Hi all!

This problem was fixed in version 2.2.
Thank you all for issue!