joaojeronimo / node_redis_cluster

A thin wrapper over node_redis to make it work with Redis Cluster
53 stars 17 forks source link

LUA eval not recognizing key slot #18

Closed knguyen2525 closed 9 years ago

knguyen2525 commented 9 years ago

I am using the poor man cluster client to run a basic lua script: "return redis.call('GET', 'foo')" but the client is not able to recognize where the key "foo" is stored.

Is there a way to do this besides parsing CLUSTER SLOTS to find the keyslot for foo manually?

h0x91b commented 9 years ago

LUA will not work at cluster mode... You can access only to local keys, there is no communication layer in LUA.

joaojeronimo commented 9 years ago

The lua context is not aware of the cluster, it does not know which node in the cluster is responsible for the "foo" key or any other. In a redis cluster you shouldn't use Lua to access/change objects in the database.

Even if you parsed cluster slots to find the keyslot for foo manually, from the lua context I think you cannot connect to the correct node. Outside of that context you can, but outside of that context you can use this driver to put the key in the correct place too ;)