question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed to refresh slots cache

See original GitHub issue

Having issues when running clusters. Ports are opened on the server. Cannot find what the error message wants.

REDIS CONNECT error Error: Failed to refresh slots cache.

The redis server is started with

./create-cluster start
./create-cluster create
>>> Creating cluster
>>> Performing hash slots allocation on 6 nodes...
Using 3 masters:
127.0.0.1:30001
127.0.0.1:30002
127.0.0.1:30003
Adding replica 127.0.0.1:30004 to 127.0.0.1:30001
Adding replica 127.0.0.1:30005 to 127.0.0.1:30002
Adding replica 127.0.0.1:30006 to 127.0.0.1:30003
M: b52b834a64cd5a5b21143ab04c812280e51c027b 127.0.0.1:30001
   slots:0-5460 (5461 slots) master
M: d78d47d58d18432ce24c23a808e5e5910abf9ed2 127.0.0.1:30002
   slots:5461-10922 (5462 slots) master
M: d95b9eaac2fcef61e9f8a4b7569c6ce4833224fc 127.0.0.1:30003
   slots:10923-16383 (5461 slots) master
S: 9ba310a137f57539b8a5d011cfe7db4e9a7089a9 127.0.0.1:30004
   replicates b52b834a64cd5a5b21143ab04c812280e51c027b
S: bebafd0ff37774a5e40dbf959401042e7e39beb9 127.0.0.1:30005
   replicates d78d47d58d18432ce24c23a808e5e5910abf9ed2
S: 1bade260c211b59b967fa6d85124deadbfbfafe7 127.0.0.1:30006
   replicates d95b9eaac2fcef61e9f8a4b7569c6ce4833224fc
Can I set the above configuration? (type 'yes' to accept): yes
>>> Nodes configuration updated
>>> Assign a different config epoch to each node
>>> Sending CLUSTER MEET messages to join the cluster
Waiting for the cluster to join..
>>> Performing Cluster Check (using node 127.0.0.1:30001)
M: b52b834a64cd5a5b21143ab04c812280e51c027b 127.0.0.1:30001
   slots:0-5460 (5461 slots) master
M: d78d47d58d18432ce24c23a808e5e5910abf9ed2 127.0.0.1:30002
   slots:5461-10922 (5462 slots) master
M: d95b9eaac2fcef61e9f8a4b7569c6ce4833224fc 127.0.0.1:30003
   slots:10923-16383 (5461 slots) master
M: 9ba310a137f57539b8a5d011cfe7db4e9a7089a9 127.0.0.1:30004
   slots: (0 slots) master
   replicates b52b834a64cd5a5b21143ab04c812280e51c027b
M: bebafd0ff37774a5e40dbf959401042e7e39beb9 127.0.0.1:30005
   slots: (0 slots) master
   replicates d78d47d58d18432ce24c23a808e5e5910abf9ed2
M: 1bade260c211b59b967fa6d85124deadbfbfafe7 127.0.0.1:30006
   slots: (0 slots) master
   replicates d95b9eaac2fcef61e9f8a4b7569c6ce4833224fc
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.

This is the code used.

var rClusters = [[{
        port: 30001,
        host: 'xxx.us-west-2.compute.amazonaws.com'
    }, {
        port: 30002,
        host: 'xxx.us-west-2.compute.amazonaws.com'
    }, {
        port: 30003,
        host: 'xxx.us-west-2.compute.amazonaws.com'
    }]],
    Redis = require('ioredis'),
    db = new Redis.Cluster(rClusters),
    pub = new Redis.Cluster(rClusters),
    sub = new Redis.Cluster(rClusters),
    sockets = [];
sub.subscribe(conf.redisNamespace+ 'chatmessage'); // someone said something
sub.subscribe(conf.redisNamespace+ 'chatmessage-confirm'); // someone said something confirm back
sub.subscribe(conf.redisNamespace+ 'presence-friends'); // loop friend id, if publish exist broadcast online state
sub.subscribe(conf.redisNamespace+ 'user-clear'); // clear user from memory
sub.subscribe(conf.redisNamespace+ 'process-start'); // gather process info
sub.subscribe(conf.redisNamespace+ 'process-end'); // has some data
db.on('connect',function(){
    console.log("REDIS CONNECT");
});
db.on('error',function(err){
    console.log("REDIS CONNECT error "+ err);
});

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
luincommented, Dec 22, 2015

ioredis emits Failed to refresh slots cache when none of the nodes can be connected to. You may listen to the node error event for the detail information or just check the lastNodeError property of the err:

db.on('error',function(err){
    console.log("REDIS CONNECT error "+ err);
    console.log('node error', err.lastNodeError);
});
0reactions
fbackercommented, Dec 23, 2015

Looks like it goes from the host I wanted to 127.0.0.1 in the end? I’ve installed redis locally so now it works but might want to check into using redis cluster with another hostname.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed to refresh slots cache #711 - luin/ioredis - GitHub
Hi, We are running ioredis 4.0.0 against an AWS ElastiCache replication group with cluster mode on (2 nodes, 1 shard) and using the...
Read more >
ioredis - ClusterAllFailedError: Failed to refresh slots cache
I'm dealing with a ClusterAllFailedError: Failed to refresh slots cache. issue from ioredis and Elasticache. This is my clustering config
Read more >
luin/ioredis - Gitter
Anyone using ioredis with elasticache cluster mode? I'm trying a failover scenario and my node process crashes (unhandled rejection) with: Error: Connection is ......
Read more >
clusterallfailederror: failed to refresh slots cache.
unhandled error event: clusterallfailederror: failed to refresh slots cache._【Registered Agent Discount】:bally online casino games ...
Read more >
redis cluster[使用redis 集群过程中查到的资料] - CNode技术社区
Failed to refresh slots cache https://github.com/luin/ioredis/issues/220. 如果本地没有配置集群, 不要使用new ioredis.Cluster()方法去创建redisClient, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found