Closed
Description
I have a local redis cluster running (note that an IP is not provided in CLUSTER SLOTS, is this normal?):
redis-cli -h 127.0.0.2 -p 6379 -a fa^ke^key -c
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
127.0.0.2:6379> CLUSTER SLOTS
1) 1) (integer) 0
2) (integer) 16383
3) 1) ""
2) (integer) 6379
3) "55a91fc49daa4477063973c1d039d6c8949c5888"
127.0.0.2:6379> cluster info
cluster_state:ok
cluster_slots_assigned:16384
cluster_slots_ok:16384
cluster_slots_pfail:0
cluster_slots_fail:0
cluster_known_nodes:1
cluster_size:1
cluster_current_epoch:0
cluster_my_epoch:0
cluster_stats_messages_sent:0
cluster_stats_messages_received:0
127.0.0.2:6379> exit
With the following PHP script:
<PRE><?php
$host = '127.0.0.2';
$port = 6379;
$hosts = ["$host:$port"];
$auth = 'fa^ke^key';
$options = []; //['stream' => ['verify_peer_name' => false, 'verify_peer' => false]];
$persist = false;
try {
$redis = new \Redis();
if ($persist) {
$redis->pconnect($host, $port, 5, null, 0, 0, $options);
} else {
$redis->connect($host, $port, 5, null, 0, 0, $options);
}
$redis->auth($auth);
echo "Single redis connection made\n";
for ($i = 0; $i < 3; $i += 1) {
$rand1 = rand(0, 10000000000);
$rand2 = rand(0, 100000000000);
$redis->set($rand1, $rand2);
echo "Set $rand1, $rand2\n";
$rand_return = $redis->get($rand1);
echo "Got $rand_return\n";
}
} catch (Throwable $e) {
print_r($e);
die();
}
echo "\n\n\nCluster:\n";
try {
$obj_cluster = new \RedisCluster(null, $hosts, 1.5, 1.5, $persist, $auth, $options);
echo "connection made\n";
$obj_cluster->set('test', time());
echo 'Found:' . $obj_cluster->get('test');
for ($i = 0; $i < 3; $i += 1) {
$obj_cluster->set(rand(0, 10000000000), rand(0, 100000000000));
}
}
catch (Throwable $e) {
print_r($e->getMessage());
}
I can connect to it directly using Redis->connect(). However RedisCluster() generates an error.
This is the output of the script:
Single redis connection made
Set 465840909, 21045614151
Got 21045614151
Set 1322671438, 80344850474
Got 80344850474
Set 1643062444, 23508231805
Got 23508231805
Cluster:
Couldn't map cluster keyspace using any provided seed
PHP Info:
Redis Support | enabled
Redis Version | 5.3.2RC2
Redis Sentinel Version | 0.1
Available serializers | php, json
Expected behaviour
Connecting to Redis Cluster in local environment using RedisCluster
Actual behaviour
I'm seeing this behaviour on
- OS: Ubuntu 16.04.5 LTS
- Redis: Redis server v=6.0.6 sha=00000000:0 malloc=jemalloc-5.1.0 bits=64 build=d463d609620685c0
- PHP: 7.3
- phpredis:5.3.2RC2
Steps to reproduce, backtrace or example script
I've checked
- [ x ] There is no similar issue from other users
- [ x ] Issue isn't fixed in
develop
branch