Redis cluster ips issue

34 views
Skip to first unread message

Daniel Alonso Heras

unread,
Nov 23, 2015, 9:22:51 AM11/23/15
to Redis DB
Hi there!!

I'm doing serveral tests with redis cluster in Amazon. When creating the redis cluster I have created the cluster in the following way:

redis-trib.rb  create --replicas 1 X.X.X.X:7000 X.X.X.X:7001 X.X.X.X:7002 X.X.X.X:7003 X.X.X.X:7004 X.X.X.X:7005

Where X.X.X.X --> is the public ip of the server (yes, it is a securirty issue but take into account that is only for testing).

At the beggining I tried to do so with 127.0.0.1, but when using phpredis client it gets cluster nodes info to connect and it was returning 127.0.0.1, so the client tried always to connect locally.

With the aforementioned config I expect phpredis client to be able to connect normally, but at the end I discovered that it doesn't because "cluster nodes / slots" behaves different in each server:

Server 7000 output:

1) 1) (integer) 0
   2) (integer) 5460
   3) 1) "10.0.0.X"
      2) (integer) 7000
   4) 1) "X.X.X.X"
      2) (integer) 7003
2) 1) (integer) 5461
   2) (integer) 10922
   3) 1) "X.X.X.X"
      2) (integer) 7001
   4) 1) "X.X.X.X"
      2) (integer) 7004
3) 1) (integer) 10923
   2) (integer) 16383
   3) 1) "X.X.X.X"
      2) (integer) 7002
   4) 1) "X.X.X.X"
      2) (integer) 7005


Server 7003 output:

1) 1) (integer) 5461
   2) (integer) 10922
   3) 1) "X.X.X.X"
      2) (integer) 7001
   4) 1) "X.X.X.X"
      2) (integer) 7004
2) 1) (integer) 10923
   2) (integer) 16383
   3) 1) "X.X.X.X"
      2) (integer) 7002
   4) 1) "X.X.X.X"
      2) (integer) 7005
3) 1) (integer) 0
   2) (integer) 5460
   3) 1) "X.X.X.X"
      2) (integer) 7000
   4) 1) "10.0.0.X"
      2) (integer) 7003

So phpredis client always will have a private ip mapping making it unusable.....

Daniel Alonso Heras

unread,
Nov 23, 2015, 12:03:09 PM11/23/15
to Redis DB
Reply all
Reply to author
Forward
0 new messages