I'm using phpredis (builded on 25.02.2016 from https://github.com/phpredis/phpredis) with php 5.5.9. The extension is tested succesfully with a single redis instance (version 3.0.7) (remote and local redis instance).
This is the code to connect to a configured redis cluster (no sentinel, only over configs).
$cluster = new \RedisCluster(NULL,
array("192.168.127.203:7000", "192.168.127.203:7001", "192.168.127.203:7002"));
$cluster->setOption(RedisCluster::OPT_SLAVE_FAILOVER, RedisCluster::FAILOVER_ERROR);
var_dump($cluster->_masters());
var_dump($cluster->get('foo1'));
When we execute this code on the same server as the redis instance we successfully get all the masters and the value of foo1. But when we execute the code on another webserver, we get the following masters from the cluster:
array (size=3)
0 =>
array (size=2)
0 => string '127.0.0.1' (length=9)
1 => int 7005
1 =>
array (size=2)
0 => string '127.0.0.1' (length=9)
1 => int 7000
2 =>
array (size=2)
0 => string '127.0.0.1' (length=9)
1 => int 7001
and getting the value will fail with a RedisClusterException with the Message "Can't communicate with any node in the cluster".
I'm not sure if it's a bug in the libary or if i use the lib in a wrong way. the code it the same as in the documentation. i think one problem is that we get the masters with the localhost ip and not the remote ip.
appreciate all your help.