Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Redis Cluster Support #9

Open
andrew-dixon opened this issue Oct 19, 2020 · 8 comments
Open

Add Redis Cluster Support #9

andrew-dixon opened this issue Oct 19, 2020 · 8 comments

Comments

@andrew-dixon
Copy link

andrew-dixon commented Oct 19, 2020

We have set up and configured a Redis cluster that is working, however, the Lucee Redis extension does not appear to support the "MOVED" response and is instead returning null. As a simple example, using the redis-cli:

[root]# redis-cli -h localhost -p 6379 -c set foo bar
OK
[root]# redis-cli -h localhost -p 6379 get foo
"bar"
[root]# redis-cli -h localhost -p 6382 get foo
(error) MOVED 12182 localhost:6379

If we then add the -c option (cluster mode) we get:

[root]# redis-cli -h localhost -p 6382 -c get foo
"bar"

As expected as the -c option Enable cluster mode (follow -ASK and -MOVED redirections)., however, with Lucee, if I configure two Redis caches, using the above host and ports and do:

<cfscript>
        cacheput('foo', 'bar', createTimespan(0,0,0,30), createTimespan(0,0,0,30), 'test-redis');
        dump(cacheget('foo', false, 'test-redis'));
        dump(cacheget('foo', false, 'test-redis-2'));
</cfscript>

The response I get is:

string	bar
Empty:null

So, clearly, the Lucee Redis extension is not following the "MOVED" response from the cluster and retrieving the key value from the location given.

@andrew-dixon
Copy link
Author

Actually, I think there is probably more that needs doing for "real" cluster support. From reading over the spec (https://redis.io/topics/cluster-spec) I think it would need to be able to support the definition of multiple servers in the cache definitions as well as dealing with messaging about cluster node changes, e.g. promotions, demotions, etc... Will change the title of ticket.

@andrew-dixon andrew-dixon changed the title Redis Cluster "MOVED" response not supported Add Redis Cluster Support Oct 19, 2020
@tbenton
Copy link

tbenton commented Nov 25, 2020

@andrew-dixon We use a sentinel configuration and it seems to work for us. However, it appears 2.9.0.10-RC is the last release that has Redis sentinel support. I am not sure if you looked at that version to see if it will support your needs.

The biggest trick is the host list needs to be separated by Chr(10) not by commas.

@andrew-dixon
Copy link
Author

@tbenton My understanding is that Sentinel and Cluster are two different things. In this case the Redis Cluster is being used already, it is just Lucee isn't following the responses to get the result from the cluster as it needs to.

@tbenton
Copy link

tbenton commented Nov 25, 2020

@andrew-dixon Sentinel and Cluster are two different things. I know in sentinel that driver takes care of where to get the data. I assume the Redis driver would have to figure out which node to get data from.

Sorry I have not done much with Cluser

@andrew-dixon
Copy link
Author

@tbenton When you query a cluster node, if the data is on a different node it responses with a message telling you which node it is on, e.g.

(error) MOVED 12182 localhost:6379

It is then up to the client to remake the request to that node. At present, Lucee errors.

@tbenton
Copy link

tbenton commented Nov 25, 2020

@andrew-dixon Which version of the extension are you using?

@andrew-dixon
Copy link
Author

@tbenton I tried up to the latest beta version that was available at the time of raising the ticket.

@jlamoree
Copy link

Is there no hope for Redis cluster support in the Lucee Redis Cache Extension? Are Lucee users instructed to buy the Ortus Solutions Redis Cache extension instead?

The project readme indicates that this is based on Jedis, but I think it may have been inspired by Jedis, rather than dependent on Jedis. I assume that is the impediment to supporting Redis clusters -- it would be all new work to implement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants