We are currently using PhpRedis
extension and our code is written using the class Redis
from the PhpRedis
. But now we are migrating to a redis cluster.
Is it possible to use the Class Redis to connect to redis cluster? or do we need to re-write our code and use the Class RedisArray?
We ll need to have consistent hashing too. We have added keys like this {user}:1
so we can do consistent hashing later.
main problem is taking all the code written using the class Redis
and changing it to RedisArray
.
I am new to redis so please provide some advice
Thanks
This is a email reply from one of the author of PHPredis Nicolas. I thank him for taking the time for replying to me.
Hi,
I just want to start by clarifying that the RedisArray class does not provide a client library for Redis Cluster. It uses consistent hashing to distribute data to a set of independent Redis nodes, and provides a common interface so that developers can avoid having to write the distribution layer themselves.
Phpredis does not currently support Redis Cluster.
Addressing your questions:
To learn more about the RedisArray class, please refer to the documentation on GitHub.
They have added support for Redis cluster now https://github.com/phpredis/phpredis/blob/feature/redis_cluster/cluster.markdown#readme