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

Doesn't seem to support Redis cluster mode #99

Open
iamalnewkirk opened this issue Aug 15, 2020 · 4 comments
Open

Doesn't seem to support Redis cluster mode #99

iamalnewkirk opened this issue Aug 15, 2020 · 4 comments

Comments

@iamalnewkirk
Copy link

Accessing a key located on a different shard doesn't follow the redirect and instead throws an error.

@shogo82148
Copy link
Owner

Right. Redis-Fast doesn't support Redis cluster mode currently.
Did you try https://metacpan.org/pod/Redis::Cluster ?

@iamalnewkirk
Copy link
Author

It hasn't been updated since 2015 but I tried it anyway and it failed:

Could not connect to Redis server at 66.228.88.236:6381:9fefdfd5f9dd2d982914ff2fb866072dd4bee401:
  at /root/zing/local/lib/perl5/Redis/Cluster.pm line 669.
  Redis::Cluster::_get_node(Redis::Cluster=HASH(0x564d23e81238), "66.228.88.236:6381:9fefdfd5f9dd2d982914ff2fb866072dd4bee401") called
    at /root/zing/local/lib/perl5/Redis/Cluster.pm line 592
  Redis::Cluster::_get_master_by_slot(Redis::Cluster=HASH(0x564d23e81238), 12503) called
    at /root/zing/local/lib/perl5/Redis/Cluster.pm line 298

@iamalnewkirk
Copy link
Author

I got it to work. FYI, to fix this you need to edit this line:

https://metacpan.org/source/SMSONLINE/Redis-Cluster-0.14/lib/Redis/Cluster.pm#L665

and change:

$node = join(':', @$node) if ref($node);

to this:

$node = join(':', @$node) if ref($node);
$node = join(':', (split /:/, $node)[0,1]);

@Yenya
Copy link
Contributor

Yenya commented Feb 27, 2023

FWIW, Redis::Cluster::Fast is probably the way to go for accessing Redis cluster from Perl.

For Redis::Cluster, more places than the above one need to be patched for newer Redis protocol. See this issue for a more complete patch:
https://rt.cpan.org/Ticket/Display.html?id=119851

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