vipshop / hiredis-vip

Support redis cluster. Maintained and used at vipshop.
BSD 3-Clause "New" or "Revised" License
322 stars 173 forks source link

PING not allowed #33

Open GregoBalu opened 7 years ago

GregoBalu commented 7 years ago

Hi!

As I see for now, the library does not support issuing "PING" commands at a cluster node as an error occurs client side: "No keys in command(must have keys for redis cluster mode)".

While I see the intention of client-side-hashing on keys, the "PING" command is useful to check the connection of the redis client OR the availability of the redis cluster (server).

I could of course issue a "PING" on every node contained in the redisClusterContext->table, but then again I think there are too much restrictions in general in this lib (Several redis commands are not supported as they are not defined in the client lib).

Thanks in advance for the reply!

Balázs

tangzhikun commented 2 years ago

I got the same problem, did you get other solutions to check the connection of redis client or the availability of the redis cluster?

GregoBalu commented 2 years ago

In the end I've used a random (non-existent) key to query. Not perfect but this way it's still something and the code can be the same, regardless of cluster/singleton redis server.